diff --git a/Control/AthenaConfiguration/python/AllConfigFlags.py b/Control/AthenaConfiguration/python/AllConfigFlags.py index ce01d3b1c53c0904b4d4e2a7b8c14315614afdb3..99e1eb37643d12fb7fdabf8365c814a76773eca2 100644 --- a/Control/AthenaConfiguration/python/AllConfigFlags.py +++ b/Control/AthenaConfiguration/python/AllConfigFlags.py @@ -57,6 +57,12 @@ def _createCfgFlags(): return createDetectorConfigFlags() acf.addFlagsCategory( "Detector", __detector ) +#Simulation Flags: + def __simulation(): + from G4AtlasApps.SimConfigFlags import createSimConfigFlags + return createSimConfigFlags() + acf.addFlagsCategory( "Sim", __simulation ) + #Geo Model Flags: acf.addFlag('GeoModel.Layout', 'atlas') # replaces global.GeoLayout acf.addFlag("GeoModel.AtlasVersion", lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("Geometry","ATLAS-R2-2016-01-00-01")) # diff --git a/Control/AthenaConfiguration/python/DetectorConfigFlags.py b/Control/AthenaConfiguration/python/DetectorConfigFlags.py index d19cd7879ddad7a40993daad1dd4dc0b4c445578..81f33cdd8e5465e97d8edb2e588cfd02eff2adfd 100644 --- a/Control/AthenaConfiguration/python/DetectorConfigFlags.py +++ b/Control/AthenaConfiguration/python/DetectorConfigFlags.py @@ -128,5 +128,4 @@ def createDetectorConfigFlags(): prevFlags.Detector.OverlaysTGC or prevFlags.Detector.OverlayMM)) dcf.addFlag('Detector.Overlay', lambda prevFlags : (prevFlags.Detector.OverlayID or prevFlags.Detector.OverlayCalo or prevFlags.Detector.OverlayMuon)) - - return dcf + return dcf \ No newline at end of file diff --git a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt index fa0f10628622dfe4e1d4e249003fb5826b8bf9f6..c41896159d15da0baf5cec5ced950871d66525a0 100644 --- a/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt +++ b/InnerDetector/InDetG4/BCM_G4_SD/CMakeLists.txt @@ -28,6 +28,12 @@ atlas_add_component( BCM_G4_SD INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils AthenaKernel StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth ) + +atlas_add_test( BCM_G4_SDToolConfig_test + SCRIPT test/BCM_G4_SDToolConfig_test.py + PROPERTIES TIMEOUT 300 ) + + # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..b87f06bfe1b73bc54097ae43e6ae50d753daa096 --- /dev/null +++ b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDToolConfig.py @@ -0,0 +1,23 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg + +from BCM_G4_SD.BCM_G4_SDConf import BCMSensorSDTool + +def BCMSensorSDCfg(ConfigFlags, name="BCMSensorSD", **kwargs): + + result = ComponentAccumulator() + bare_collection_name = "BCMHits" + mergeable_collection_suffix = "_G4" + merger_input_property = "BCMHits" + acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, + mergeable_collection_suffix, + merger_input_property) + kwargs.setdefault("LogicalVolumeNames", ["Pixel::bcmDiamondLog"]) + kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) + + result.merge(acc) + return result, BCMSensorSDTool(name, **kwargs) + + diff --git a/InnerDetector/InDetG4/BCM_G4_SD/test/BCM_G4_SDToolConfig_test.py b/InnerDetector/InDetG4/BCM_G4_SD/test/BCM_G4_SDToolConfig_test.py new file mode 100755 index 0000000000000000000000000000000000000000..33490d42cf3cc62918bc8d013290eb798d30440a --- /dev/null +++ b/InnerDetector/InDetG4/BCM_G4_SD/test/BCM_G4_SDToolConfig_test.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +"""Run tests on BCM_G4_SD configuration + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +if __name__ == '__main__': + + + # Set up logging and config behaviour + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = 1 + + + #import config flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + ConfigFlags.Sim.ISF.Run = True + + #Provide input + from AthenaConfiguration.TestDefaults import defaultTestFiles + inputDir = defaultTestFiles.d + ConfigFlags.Input.Files = defaultTestFiles.EVNT + + # Finalize + ConfigFlags.lock() + + + ## Initialize a new component accumulator + cfg = ComponentAccumulator() + + from BCM_G4_SD.BCM_G4_SDToolConfig import BCMSensorSDCfg + + + acc, tool = BCMSensorSDCfg(ConfigFlags) + acc.addPublicTool(tool) + cfg.merge(acc) + + + + cfg.printConfig(withDetails=True, summariseProps = True) + ConfigFlags.dump() + + f=open("test.pkl","w") + cfg.store(f) + f.close() + + + + print cfg._publicTools + print "-----------------finished----------------------" \ No newline at end of file diff --git a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt index 8df58d25e75339554fe67355134b64d94523e4d1..c895489f88aa35c9f819abf22aa6664ca912cdff 100644 --- a/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt +++ b/InnerDetector/InDetG4/BLM_G4_SD/CMakeLists.txt @@ -27,6 +27,14 @@ atlas_add_component( BLM_G4_SD INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth ) + + +atlas_add_test( BLM_G4_SDToolConfig_test + SCRIPT test/BLM_G4_SDToolConfig_test.py + PROPERTIES TIMEOUT 300 ) + + + # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py b/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..b1c0159e5e398a66849f681703d902b7849c9c11 --- /dev/null +++ b/InnerDetector/InDetG4/BLM_G4_SD/python/BLM_G4_SDToolConfig.py @@ -0,0 +1,22 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg + +from BLM_G4_SD.BLM_G4_SDConf import BLMSensorSDTool + + +def BLMSensorSDCfg(ConfigFlags, name="BLMSensorSD", **kwargs): + + result = ComponentAccumulator() + bare_collection_name = "BLMHits" + mergeable_collection_suffix = "_G4" + merger_input_property = "BLMHits" + acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, + mergeable_collection_suffix, + merger_input_property) + kwargs.setdefault("LogicalVolumeNames", ["Pixel::blmDiamondLog"]) + kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) + + result.merge(acc) + return result, BLMSensorSDTool(name, **kwargs) diff --git a/InnerDetector/InDetG4/BLM_G4_SD/test/BLM_G4_SDToolConfig_test.py b/InnerDetector/InDetG4/BLM_G4_SD/test/BLM_G4_SDToolConfig_test.py new file mode 100755 index 0000000000000000000000000000000000000000..13ae451e3e0ec2c61a584c61948f079fc99e0b7f --- /dev/null +++ b/InnerDetector/InDetG4/BLM_G4_SD/test/BLM_G4_SDToolConfig_test.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +"""Run tests on BLM_G4_SD configuration + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +if __name__ == '__main__': + + + # Set up logging and config behaviour + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = 1 + + + #import config flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + ConfigFlags.Sim.ISF.Run = True + + #Provide input + from AthenaConfiguration.TestDefaults import defaultTestFiles + inputDir = defaultTestFiles.d + ConfigFlags.Input.Files = defaultTestFiles.EVNT + + # Finalize + ConfigFlags.lock() + + + ## Initialize a new component accumulator + cfg = ComponentAccumulator() + + from BLM_G4_SD.BLM_G4_SDToolConfig import BLMSensorSDCfg + + + acc, tool = BLMSensorSDCfg(ConfigFlags) + acc.addPublicTool(tool) + cfg.merge(acc) + + + + + cfg.printConfig(withDetails=True, summariseProps = True) + ConfigFlags.dump() + + f=open("test.pkl","w") + cfg.store(f) + f.close() + + + + print cfg._publicTools + print "-----------------finished----------------------" \ No newline at end of file diff --git a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt index 81dacbc1ab811c66d5e18362667a7a451e29a406..8cb80cf188da3c0a78309500e8b34a46a6e93d5e 100644 --- a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt +++ b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt @@ -27,6 +27,11 @@ atlas_add_component( PixelG4_SD INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth ) + +atlas_add_test( PixelG4_SDToolConfig_test + SCRIPT test/PixelG4_SDToolConfig_test.py + PROPERTIES TIMEOUT 300 ) + # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py b/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..5aece606e3324370d3fe00f0c34db6a735ae1717 --- /dev/null +++ b/InnerDetector/InDetG4/PixelG4_SD/python/PixelG4_SDToolConfig.py @@ -0,0 +1,35 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg + +from PixelG4_SD.PixelG4_SDConf import PixelSensorSDTool + + +def PixelSensorSDCfg(ConfigFlags, name="PixelSensorSD", **kwargs): + + result = ComponentAccumulator() + bare_collection_name = "PixelHits" + mergeable_collection_suffix = "_G4" + merger_input_property = "PixelHits" + acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, + mergeable_collection_suffix, + merger_input_property) + kwargs.setdefault("LogicalVolumeNames", ["Pixel::siBLayLog","Pixel::siLog","Pixel::dbmDiamondLog"]) + #kwargs.setdefault("LogicalVolumeNames", ["Pixel::siBLayLog","Pixel::siLog"]) + kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) + + result.merge(acc) + return result, PixelSensorSDTool(name, **kwargs) + +def PixelSensor_CTBCfg(name="PixelSensor_CTB", **kwargs): + kwargs.setdefault("LogicalVolumeNames", ["Pixel::siBLayLog","Pixel::siLog"]) + kwargs.setdefault("OutputCollectionNames", ["PixelHits"]) + return PixelSensorSDTool(name, **kwargs) + +def DBMSensorSDCfg(name="DBMSensorSD", **kwargs): + kwargs.setdefault("LogicalVolumeNames", ["Pixel::dbmDiamondLog"]) + kwargs.setdefault("OutputCollectionNames", ["DBMHits"]) + return PixelSensorSDTool(name, **kwargs) + + diff --git a/InnerDetector/InDetG4/PixelG4_SD/test/PixelG4_SDToolConfig_test.py b/InnerDetector/InDetG4/PixelG4_SD/test/PixelG4_SDToolConfig_test.py new file mode 100755 index 0000000000000000000000000000000000000000..c0d812e3171e8415e1d2a66bd62282ffb5677893 --- /dev/null +++ b/InnerDetector/InDetG4/PixelG4_SD/test/PixelG4_SDToolConfig_test.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +"""Run tests on PixelG4_SD configuration + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +if __name__ == '__main__': + + + # Set up logging and config behaviour + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = 1 + + + #import config flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + ConfigFlags.Sim.ISF.Run = True + + + #Provide input + from AthenaConfiguration.TestDefaults import defaultTestFiles + inputDir = defaultTestFiles.d + ConfigFlags.Input.Files = defaultTestFiles.EVNT + + # Finalize + ConfigFlags.lock() + + + ## Initialize a new component accumulator + cfg = ComponentAccumulator() + + from PixelG4_SD.PixelG4_SDToolConfig import PixelSensorSDCfg + from PixelG4_SD.PixelG4_SDToolConfig import PixelSensor_CTBCfg + from PixelG4_SD.PixelG4_SDToolConfig import DBMSensorSDCfg + + + + acc, tool = PixelSensorSDCfg(ConfigFlags) + acc.addPublicTool(tool) + cfg.merge(acc) + + tool2 = PixelSensor_CTBCfg() + cfg.addPublicTool(tool2) + + tool3 = DBMSensorSDCfg() + cfg.addPublicTool(tool3) + + + + cfg.printConfig(withDetails=True, summariseProps = True) + ConfigFlags.dump() + + f=open("test.pkl","w") + cfg.store(f) + f.close() + + + + print cfg._publicTools + print "-----------------finished----------------------" \ No newline at end of file diff --git a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt index f4eaccd3ea95aff625f84a168eecd1ca417f8adc..76cb0696468132590e472bea41068dfa1309efd1 100644 --- a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt +++ b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt @@ -27,6 +27,10 @@ atlas_add_component( SCT_G4_SD INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils StoreGateLib SGtests GaudiKernel InDetSimEvent G4AtlasToolsLib MCTruth ) +atlas_add_test( SCT_G4_SDToolConfig_test + SCRIPT test/SCT_G4_SDToolConfig_test.py + PROPERTIES TIMEOUT 300 ) + # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py b/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..b2a6c43a1590729b0b022805cafc70ef35abb5dd --- /dev/null +++ b/InnerDetector/InDetG4/SCT_G4_SD/python/SCT_G4_SDToolConfig.py @@ -0,0 +1,43 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg + +from SCT_G4_SD.SCT_G4_SDConf import SctSensorSDTool +from SCT_G4_SD.SCT_G4_SDConf import SctSensor_CTBTool + + +def SctSensorSDCfg(ConfigFlags, name="SctSensorSD", **kwargs): + + result = ComponentAccumulator() + bare_collection_name = "SCT_Hits" + mergeable_collection_suffix = "_G4" + merger_input_property = "SCTHits" + + acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, mergeable_collection_suffix, merger_input_property) + kwargs.setdefault("LogicalVolumeNames", ["SCT::BRLSensor","SCT::ECSensor0","SCT::ECSensor1", + "SCT::ECSensor2","SCT::ECSensor3"]) + kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) + + result.merge(acc) + return result, SctSensorSDTool(name, **kwargs) + + +def SLHC_SctSensorSDCfg(ConfigFlags, name="SLHC_SctSensorSD", **kwargs): + + kwargs.setdefault("LogicalVolumeNames", ["SCT::BRLSensor","SCT::BRLSensorSS","SCT::BRLSensorMS", + "SCT::ECSensor0","SCT::ECSensor1","SCT::ECSensor2", + "SCT::ECSensor3","SCT::ECSensor4","SCT::ECSensor5"]) + return SctSensorSDCfg(ConfigFlags, name, **kwargs) + + +def SLHC_SctSensorSD_GmxCfg(ConfigFlags, name="SLHC_SctSensorSD_Gmx", **kwargs): + kwargs.setdefault("GmxSensor", True ) + return SLHC_SctSensorSDCfg(ConfigFlags, name, **kwargs) + + +def SctSensor_CTBCfg(name="SctSensor_CTB", **kwargs): + kwargs.setdefault("LogicalVolumeNames", ["SCT::ECSensor0"]) + kwargs.setdefault("OutputCollectionNames", ["SCT_Hits"]) + return SctSensor_CTBTool(name, **kwargs) + diff --git a/InnerDetector/InDetG4/SCT_G4_SD/test/SCT_G4_SDToolConfig_test.py b/InnerDetector/InDetG4/SCT_G4_SD/test/SCT_G4_SDToolConfig_test.py new file mode 100755 index 0000000000000000000000000000000000000000..a1fad97bb9f2fdfbd9cac2009bdb270f993a9b1f --- /dev/null +++ b/InnerDetector/InDetG4/SCT_G4_SD/test/SCT_G4_SDToolConfig_test.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +"""Run tests on SCT_G4_SD configuration + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +if __name__ == '__main__': + + + # Set up logging and config behaviour + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = 1 + + + #import config flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + ConfigFlags.Sim.ISF.Run = True + + #Provide input + from AthenaConfiguration.TestDefaults import defaultTestFiles + inputDir = defaultTestFiles.d + ConfigFlags.Input.Files = defaultTestFiles.EVNT + + # Finalize + ConfigFlags.lock() + + + ## Initialize a new component accumulator + cfg = ComponentAccumulator() + + from SCT_G4_SD.SCT_G4_SDToolConfig import SLHC_SctSensorSD_GmxCfg + from SCT_G4_SD.SCT_G4_SDToolConfig import SLHC_SctSensorSDCfg + from SCT_G4_SD.SCT_G4_SDToolConfig import SctSensorSDCfg + from SCT_G4_SD.SCT_G4_SDToolConfig import SctSensor_CTBCfg + + acc1, tool1 = SLHC_SctSensorSD_GmxCfg(ConfigFlags) + acc1.addPublicTool(tool1) + cfg.merge(acc1) + + acc2, tool2 = SLHC_SctSensorSDCfg(ConfigFlags) + acc2.addPublicTool(tool2) + cfg.merge(acc2) + + acc, tool = SctSensorSDCfg(ConfigFlags) + acc.addPublicTool(tool) + cfg.merge(acc) + + tool3 = SctSensor_CTBCfg() + cfg.addPublicTool(tool3) + + + + cfg.printConfig(withDetails=True, summariseProps = True) + ConfigFlags.dump() + + f=open("test.pkl","w") + cfg.store(f) + f.close() + + + + print cfg._publicTools + print "-----------------finished----------------------" \ No newline at end of file diff --git a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt index b8bf5e7e4ac1de1446a29318b92ebcf595484067..53ba848c633791377d71c93e23228f2dfdfa6dcf 100644 --- a/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt +++ b/InnerDetector/InDetG4/TRT_G4_SD/CMakeLists.txt @@ -29,6 +29,12 @@ atlas_add_component( TRT_G4_SD INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel CxxUtils StoreGateLib SGtests GaudiKernel TRT_G4Utilities InDetSimEvent G4AtlasToolsLib MCTruth ) + +atlas_add_test( TRT_G4_SDToolConfig_test + SCRIPT test/TRT_G4_SDToolConfig_test.py + PROPERTIES TIMEOUT 300 ) + + # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py b/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..2f785a15c4abee859bbe761439f12a774ac0bddb --- /dev/null +++ b/InnerDetector/InDetG4/TRT_G4_SD/python/TRT_G4_SDToolConfig.py @@ -0,0 +1,33 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from ISF_Algorithms.collection_merger_helpersNew import CollectionMergerCfg + +from TRT_G4_SD.TRT_G4_SDConf import TRTSensitiveDetectorTool + +def TRTSensitiveDetectorCfg(ConfigFlags, name="TRTSensitiveDetector", **kwargs): + + result = ComponentAccumulator() + bare_collection_name = "TRTUncompressedHits" + mergeable_collection_suffix = "_G4" + merger_input_property = "TRTUncompressedHits" + acc, hits_collection_name = CollectionMergerCfg(ConfigFlags, bare_collection_name, + mergeable_collection_suffix, + merger_input_property) + result.merge(acc) + + logicalVolumeNames = ["TRT::Gas","TRT::GasMA"] + if ( ConfigFlags.GeoModel.Run in ["RUN2", "RUN3"] ) : + ## RUN2 configuration + logicalVolumeNames += ["TRT::Gas_Ar","TRT::GasMA_Ar", + "TRT::Gas_Kr","TRT::GasMA_Kr"] + kwargs.setdefault("LogicalVolumeNames", logicalVolumeNames) + + kwargs.setdefault("OutputCollectionNames", [hits_collection_name]) + return result, TRTSensitiveDetectorTool(name, **kwargs) + + +def TRTSensitiveDetector_CTBCfg(name="TRTSensitiveDetector_CTB", **kwargs): + kwargs.setdefault("LogicalVolumeNames", ["TRT::GasMA"]) + kwargs.setdefault("OutputCollectionNames", ["TRTUncompressedHits"]) + return TRTSensitiveDetectorTool(name, **kwargs) diff --git a/InnerDetector/InDetG4/TRT_G4_SD/test/TRT_G4_SDToolConfig_test.py b/InnerDetector/InDetG4/TRT_G4_SD/test/TRT_G4_SDToolConfig_test.py new file mode 100755 index 0000000000000000000000000000000000000000..7069e6dac0110d3b2d8fc5dfb3a13c1b03c218a1 --- /dev/null +++ b/InnerDetector/InDetG4/TRT_G4_SD/test/TRT_G4_SDToolConfig_test.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +"""Run tests on TRT_G4_SD configuration + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + + +if __name__ == '__main__': + + + # Set up logging and config behaviour + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = 1 + + + #import config flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + ConfigFlags.Sim.ISF.Run = True + + #Provide input + from AthenaConfiguration.TestDefaults import defaultTestFiles + inputDir = defaultTestFiles.d + ConfigFlags.Input.Files = defaultTestFiles.EVNT + + # Finalize + ConfigFlags.lock() + + + ## Initialize a new component accumulator + cfg = ComponentAccumulator() + + from TRT_G4_SD.TRT_G4_SDToolConfig import TRTSensitiveDetectorCfg + from TRT_G4_SD.TRT_G4_SDToolConfig import TRTSensitiveDetector_CTBCfg + + + + acc, tool = TRTSensitiveDetectorCfg(ConfigFlags) + acc.addPublicTool(tool) + cfg.merge(acc) + + + tool = TRTSensitiveDetector_CTBCfg() + cfg.addPublicTool(tool) + + + cfg.printConfig(withDetails=True, summariseProps = True) + ConfigFlags.dump() + + f=open("test.pkl","w") + cfg.store(f) + f.close() + + + + print cfg._publicTools + print "-----------------finished----------------------" \ No newline at end of file diff --git a/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py new file mode 100644 index 0000000000000000000000000000000000000000..c0dfdfa04e29758d7fa684c47963462364ef301d --- /dev/null +++ b/Simulation/G4Atlas/G4AtlasApps/python/SimConfigFlags.py @@ -0,0 +1,12 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.AthConfigFlags import AthConfigFlags + +def createSimConfigFlags(): + scf=AthConfigFlags() + + + scf.addFlag("Sim.ISF.Run",False) + scf.addFlag("Sim.ISF.HITSMergingRequired", True) + + return scf diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py b/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py new file mode 100644 index 0000000000000000000000000000000000000000..69ca5459e5ea242516b52035cc78db3a11c251d6 --- /dev/null +++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/python/collection_merger_helpersNew.py @@ -0,0 +1,39 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + +def CollectionMergerCfg(ConfigFlags, bare_collection_name, + mergeable_collection_suffix, + merger_input_property): + """Generates and returns a collection name that is also registered to + the ISF CollectionMerger algorithm. + + :param bare_collection_name: name of the collection if no merging + is taking place. + :param mergeable_collection_suffix: suffix to the collection in + case merging is taking place. + :param merger_input_property: name of the Input* property in the + CollectionMerger algorithm to add the mergeable collection to.""" + + result = ComponentAccumulator() + if ConfigFlags.Sim.ISF.Run and ConfigFlags.Sim.ISF.HITSMergingRequired: + mergeable_collection = '{bare}{suffix}'.format( + bare=bare_collection_name, + suffix=mergeable_collection_suffix) + + + from AthenaCommon.CfgGetter import getAlgorithm + algo = getAlgorithm('ISF_CollectionMerger') + result.addEventAlgo(algo) + + input_attribute_name = 'Input{merger_input_property}'.format( + merger_input_property=merger_input_property) + + merger_input_collections = getattr(algo,input_attribute_name) #empty list always? + merger_input_collections.append(mergeable_collection) + + else: + mergeable_collection = bare_collection_name + print result + print "#################################" + return result, mergeable_collection \ No newline at end of file