From c603544a4aa622ccc1de3a615875a6bc17e47c60 Mon Sep 17 00:00:00 2001 From: Juraj Smiesko <34742917+kjvbrt@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:23:49 +0200 Subject: [PATCH 1/3] Avoid list comprehension (#45) --- .../options/fcc_ee_caloBenchmarkCalibration.py | 3 ++- .../tests/options/reproduceSegfault.py | 14 +++++++------- RecFCCeeCalorimeter/tests/options/runCaloSim.py | 13 +++++++------ ...ullCaloSystem_ReconstructionSW_noiseFromFile.py | 14 ++++++++------ 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py b/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py index 787a9bbd..7e5af388 100644 --- a/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py +++ b/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py @@ -24,7 +24,8 @@ DETECTORS = [ 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', ] -GEOSERVICE.detectors = [os.path.join(DETECTORPATH, d) for d in DETECTORS] +for det in DETECTORS: + GEOSERVICE.detectors = [os.path.join(DETECTORPATH, det)] GEOSERVICE.OutputLevel = INFO ApplicationMgr().ExtSvc += [GEOSERVICE] diff --git a/RecFCCeeCalorimeter/tests/options/reproduceSegfault.py b/RecFCCeeCalorimeter/tests/options/reproduceSegfault.py index 977dae52..7cf93d3c 100644 --- a/RecFCCeeCalorimeter/tests/options/reproduceSegfault.py +++ b/RecFCCeeCalorimeter/tests/options/reproduceSegfault.py @@ -60,13 +60,13 @@ from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc") # if FCC_DETECTORS is empty, this should use relative path to working directory -path_to_detector = os.environ.get("FCCDETECTORS", "") -print(path_to_detector) -detectors_to_use=[ - 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', - ] -# prefix all xmls with path_to_detector -geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] +path_to_detectors = os.environ.get("FCCDETECTORS", "") +detectors = [ + 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', +] +# prefix all xmls with path_to_detectors +for det in detectors: + geoservice.detectors += [os.path.join(path_to_detectors, det)] geoservice.OutputLevel = INFO # Geant4 service diff --git a/RecFCCeeCalorimeter/tests/options/runCaloSim.py b/RecFCCeeCalorimeter/tests/options/runCaloSim.py index b07048bb..c04f36e0 100644 --- a/RecFCCeeCalorimeter/tests/options/runCaloSim.py +++ b/RecFCCeeCalorimeter/tests/options/runCaloSim.py @@ -46,12 +46,13 @@ from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc") # if FCC_DETECTORS is empty, this should use relative path to working directory -path_to_detector = os.environ.get("FCCDETECTORS", "") -detectors_to_use=[ - 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', - ] -# prefix all xmls with path_to_detector -geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] +path_to_detectors = os.environ.get("FCCDETECTORS", "") +detectors = [ + 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', +] +# prefix all xmls with path_to_detectors +for det in detectors: + geoservice.detectors += [os.path.join(path_to_detectors, det)] geoservice.OutputLevel = INFO ApplicationMgr().ExtSvc += [geoservice] diff --git a/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py b/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py index 00421b24..0da32fdf 100644 --- a/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py +++ b/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py @@ -1,3 +1,4 @@ +import os # Setup # Names of cells collections ecalBarrelCellsName = "ECalBarrelCells" @@ -22,12 +23,13 @@ from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc") # if FCC_DETECTORS is empty, this should use relative path to working directory -path_to_detector = os.environ.get("FCCDETECTORS", "") -detectors_to_use=[ - 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml' - ] -# prefix all xmls with path_to_detector -geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use] +path_to_detectors = os.environ.get("FCCDETECTORS", "") +detectors = [ + 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml' +] +# prefix all xmls with path_to_detectors +for det in detectors: + geoservice.detectors = [os.path.join(path_to_detectors, det)] geoservice.OutputLevel = WARNING From b52cd6d5698c3c14fcc345e98d32da9b997f95ad Mon Sep 17 00:00:00 2001 From: Juraj Smiesko <34742917+kjvbrt@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:24:33 +0200 Subject: [PATCH 2/3] Setting test environment for all active tests (#44) --- RecCalorimeter/CMakeLists.txt | 3 --- RecFCCeeCalorimeter/CMakeLists.txt | 11 ++++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/RecCalorimeter/CMakeLists.txt b/RecCalorimeter/CMakeLists.txt index 97628118..934fcd96 100644 --- a/RecCalorimeter/CMakeLists.txt +++ b/RecCalorimeter/CMakeLists.txt @@ -28,9 +28,6 @@ install(TARGETS k4RecCalorimeterPlugins include(CTest) -add_test(NAME TemporaryTest - COMMAND k4run -h) - #install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/tests/options DESTINATION ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/Reconstruction/RecCalorimeter) # #gaudi_add_test(genJetClustering diff --git a/RecFCCeeCalorimeter/CMakeLists.txt b/RecFCCeeCalorimeter/CMakeLists.txt index d26877f3..fd7560a5 100644 --- a/RecFCCeeCalorimeter/CMakeLists.txt +++ b/RecFCCeeCalorimeter/CMakeLists.txt @@ -28,16 +28,21 @@ install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/tests DESTINATION ${CMAKE_INSTALL_DA add_test(NAME FCCeeLAr_reproduceSegfault COMMAND k4run RecFCCeeCalorimeter/tests/options/reproduceSegfault.py - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +) +set_test_env(FCCeeLAr_reproduceSegfault) add_test(NAME FCCeeLAr_simulateForReco COMMAND k4run RecFCCeeCalorimeter/tests/options/runCaloSim.py - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +) +set_test_env(FCCeeLAr_simulateForReco) add_test(NAME FCCeeLAr_slidingWindowClustering COMMAND k4run RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - ) +) +set_test_env(FCCeeLAr_slidingWindowClustering) set_tests_properties(FCCeeLAr_slidingWindowClustering PROPERTIES DEPENDS "FCCeeLAr_simulateForReco") add_test(NAME FCCeeLAr_benchmarkCalibration From d6d214ded9a656798fc3ed8f42238820e6bb28c9 Mon Sep 17 00:00:00 2001 From: Juraj Smiesko <34742917+kjvbrt@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:52:46 +0200 Subject: [PATCH 3/3] fix creation of the list of detectors (#47) --- .../tests/options/fcc_ee_caloBenchmarkCalibration.py | 2 +- .../options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py b/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py index 7e5af388..b842c201 100644 --- a/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py +++ b/RecFCCeeCalorimeter/tests/options/fcc_ee_caloBenchmarkCalibration.py @@ -25,7 +25,7 @@ 'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml', ] for det in DETECTORS: - GEOSERVICE.detectors = [os.path.join(DETECTORPATH, det)] + GEOSERVICE.detectors += [os.path.join(DETECTORPATH, det)] GEOSERVICE.OutputLevel = INFO ApplicationMgr().ExtSvc += [GEOSERVICE] diff --git a/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py b/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py index 0da32fdf..df448cd9 100644 --- a/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py +++ b/RecFCCeeCalorimeter/tests/options/runFullCaloSystem_ReconstructionSW_noiseFromFile.py @@ -29,7 +29,7 @@ ] # prefix all xmls with path_to_detectors for det in detectors: - geoservice.detectors = [os.path.join(path_to_detectors, det)] + geoservice.detectors += [os.path.join(path_to_detectors, det)] geoservice.OutputLevel = WARNING