From 979488e0eaead82314ccbd1d3519e9a1663d41c7 Mon Sep 17 00:00:00 2001 From: P-A Loizeau <p.-a.loizeau@gsi.de> Date: Fri, 30 Sep 2022 11:43:16 +0200 Subject: [PATCH] [mCBM] Add macro to create the setup geo root files based on RunId - For now making call to mcbm_transport.C from a different folder (hardcoded path) + running 1 event - Call should be replaced on the long term with an INIT only method (no need to run a simulation to get a geometry) --- macro/run/.gitignore | 1 + macro/run/CMakeLists.txt | 34 +++++++++++++++---------------- macro/run/create_mcbm_geo_setup.C | 31 ++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 macro/run/create_mcbm_geo_setup.C diff --git a/macro/run/.gitignore b/macro/run/.gitignore index 6979d2cf3b..fe1932d646 100644 --- a/macro/run/.gitignore +++ b/macro/run/.gitignore @@ -2,3 +2,4 @@ all_*.par data/*.root data/qa/*.root CbmRecoUnpack.perf.root +gphysi.dat diff --git a/macro/run/CMakeLists.txt b/macro/run/CMakeLists.txt index e30e0ec842..6b4d6b13d2 100644 --- a/macro/run/CMakeLists.txt +++ b/macro/run/CMakeLists.txt @@ -302,11 +302,11 @@ If(DEFINED ENV{RAW_DATA_PATH} ) Message( STATUS "Raw data path provided => Performing mCBM 2021 tests using tsa files in ${RAW_DATA_PATH}" ) ## Generate scripts + GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/create_mcbm_geo_setup.C ) # Geofile creation GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_unpack_tsa.C ) # Unpackers GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2021/check_timing_any.C ) # Check Timing mCBM 2021 GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2022/mcbm_event.C ) # Event building mCBM 2022 GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/beamtime/mcbm2022/mcbm_event_reco_L1.C ) # Reco + Event building + L1 mCBM 2022 - GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/mcbm/mcbm_transport.C) ## Run only if raw data files present: 2021 # =====> Set the timeouts depending on test model (profiling = slow) @@ -368,17 +368,6 @@ If(DEFINED ENV{RAW_DATA_PATH} ) endif() - ### Transport run to create geo file - Set(setup mcbm_beam_2022_05_23_nickel) - Set(testname mcbm_geo_${setup}) - Set(fixture_geo_run fixture_done_${testname}) - Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/mcbm/mcbm_transport.sh 1 \"${setup}\" \"${CBMROOT_BINARY_DIR}/macro/run/data/${setup}\" \"\" kTRUE) - Set_Tests_Properties(${testname} PROPERTIES - TIMEOUT "600" - PASS_REGULAR_EXPRESSION "Test Passed;All ok" - FIXTURES_REQUIRED run_cleanup - FIXTURES_SETUP ${fixture_geo_run} - ) # ==================================================================== ForEach(RUN 2391 2488 ) @@ -386,6 +375,17 @@ If(DEFINED ENV{RAW_DATA_PATH} ) If(EXISTS ${RAW_DATA_PATH}/${RUN}_first20Ts.tsa) Message( STATUS "Raw data file found, tests will be performed for mCBM run ${RUN}" ) + ### Transport run to create geo file + Set(testname mcbm_geo_${RUN}) + Set(fixture_geo_${RUN} fixture_done_${testname}) + Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/run/create_mcbm_geo_setup.sh ${RUN}) + Set_Tests_Properties(${testname} PROPERTIES + TIMEOUT "200" + PASS_REGULAR_EXPRESSION "Test Passed;All ok" + FIXTURES_REQUIRED run_cleanup + FIXTURES_SETUP ${fixture_geo_${RUN}} + ) + ## Define tests + dependencies ### Raw data analysis tests: unpacking Set(testname mcbm_unpack_${RUN}) @@ -415,15 +415,15 @@ If(DEFINED ENV{RAW_DATA_PATH} ) Set(testname mcbm_reco_2022_${RUN}) Set(fixture_reco_${RUN} fixture_done_${testname}) Add_Test(${testname} ${CBMROOT_BINARY_DIR}/macro/beamtime/mcbm2022/mcbm_event_reco_L1.sh ${RUN} ${RECO_EVNTS_NB} - \"${CBMROOT_BINARY_DIR}/macro/run/data/\" \"${CBMROOT_BINARY_DIR}/macro/run/data/\" - -1 kFALSE kTRUE kTRUE kTRUE kTRUE kFALSE kTRUE kTRUE kFALSE kTRUE kTRUE kFALSE kFALSE - \"${CBMROOT_BINARY_DIR}/macro/run/data/${RUN}_first20Ts.digi.root\" - ) + \"${CBMROOT_BINARY_DIR}/macro/run/data/\" \"${CBMROOT_BINARY_DIR}/macro/run/data/\" + -1 kFALSE kTRUE kTRUE kTRUE kTRUE kFALSE kTRUE kTRUE kFALSE kTRUE kTRUE kFALSE kFALSE + \"${CBMROOT_BINARY_DIR}/macro/run/data/${RUN}_first20Ts.digi.root\" + ) Set_Tests_Properties(${testname} PROPERTIES TIMEOUT ${RAW_DATA_RECO_TO} FAIL_REGULAR_EXPRESSION "segmentation violation" PASS_REGULAR_EXPRESSION "Macro finished successfully" - FIXTURES_REQUIRED "${fixture_geo_run};${fixture_event_${RUN}}" + FIXTURES_REQUIRED "${fixture_geo_${RUN}};${fixture_event_${RUN}}" FIXTURES_SETUP ${fixture_reco_${RUN}} RESOURCE_LOCK mcbmRecoAllCoresBug ) diff --git a/macro/run/create_mcbm_geo_setup.C b/macro/run/create_mcbm_geo_setup.C new file mode 100644 index 0000000000..1b5a95c1c1 --- /dev/null +++ b/macro/run/create_mcbm_geo_setup.C @@ -0,0 +1,31 @@ +/* Copyright (C) 2022 Facility for Antiproton and Ion Research in Europe, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Pierre-Alain Loizeau [committer] */ + +void create_mcbm_geo_setup(uint64_t ulRunId) +{ + /// Do automatic mapping + std::string sSetupName = ""; + cbm::mcbm::ToForceLibLoad dummy; /// Needed to trigger loading of the library as no fct dict in ROOT6 and CLING + try { + sSetupName = cbm::mcbm::GetSetupFromRunId(ulRunId); + } + catch (const std::invalid_argument& e) { + std::cout << "Error in mapping from runID to setup name: " << e.what() << std::endl; + return; + } + std::string sPath = "data/" + sSetupName; + if (gSystem->AccessPathName(Form("%s.geo.root", sPath.data()))) { + std::string sSrcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory + std::string sTransportMacro = sSrcDir + "/macro/mcbm/mcbm_transport.C"; + gROOT->LoadMacro(sTransportMacro.data()); + + std::string sTransportCall = "mcbm_transport( 1, \"" + sSetupName + "\", \"" + sPath + "\")"; + gInterpreter->ProcessLine(sTransportCall.data()); + } + else { + std::cout << "Geofile already existing for this run at: " << Form("%s.geo.root", sPath.data()) << std::endl; + std::cout << " Test passed" << std::endl; + std::cout << " All ok " << std::endl; + } +} -- GitLab