diff --git a/Control/CalypsoExample/Generation/scripts/faserMDC_foresee.py b/Control/CalypsoExample/Generation/scripts/faserMDC_foresee.py index b276a6fb4ccff55e15ba9cf2b8b233aba3d60508..16af6c88d22b91a01a29b2974a134669fd1df21b 100755 --- a/Control/CalypsoExample/Generation/scripts/faserMDC_foresee.py +++ b/Control/CalypsoExample/Generation/scripts/faserMDC_foresee.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ Produce particle gun samples -Derived from G4FaserAlgConfigNew +Derived from G4FaserAlgConfig Usage: faserMDC_particlegun.py --conf=<config_file> @@ -176,7 +176,7 @@ if __name__ == '__main__': # # Add the G4FaserAlg # - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg cfg.merge(G4FaserAlgCfg(configFlags)) # # Dump config diff --git a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py index 4da91d1dc363a28b38b27f0566d23828fcf66762..32157bceda769b00ab670f532ee5938f64405206 100755 --- a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py +++ b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ Produce particle gun samples -Derived from G4FaserAlgConfigNew +Derived from G4FaserAlgConfig Usage: faserMDC_particlegun.py --conf=<config_file> @@ -187,7 +187,7 @@ if __name__ == '__main__': # # Add the G4FaserAlg # - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg cfg.merge(G4FaserAlgCfg(configFlags)) # # Dump config diff --git a/Control/CalypsoExample/Generation/scripts/faser_particlegun.py b/Control/CalypsoExample/Generation/scripts/faser_particlegun.py index 7cf0fdc33b5274129f309fff1d62a805aabce96b..1600d40609430b0571a8cdb8a3141f78aeecb49e 100755 --- a/Control/CalypsoExample/Generation/scripts/faser_particlegun.py +++ b/Control/CalypsoExample/Generation/scripts/faser_particlegun.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ Produce particle gun samples -Derived from G4FaserAlgConfigNew +Derived from G4FaserAlgConfig Usage: faser_particlegun.py --conf=<config_file> @@ -265,7 +265,7 @@ if __name__ == '__main__': # # Add the G4FaserAlg # - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg cfg.merge(G4FaserAlgCfg(configFlags)) #Event Filtering? diff --git a/Control/CalypsoExample/Simulation/scripts/faserMDC_simulate.py b/Control/CalypsoExample/Simulation/scripts/faserMDC_simulate.py index 9fb68f723e59b0a027b7fca0368662f77c92fcb0..7f3cec391f27d2326ecf425515a2e22a1151b430 100755 --- a/Control/CalypsoExample/Simulation/scripts/faserMDC_simulate.py +++ b/Control/CalypsoExample/Simulation/scripts/faserMDC_simulate.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ Produce simulated hits from input 4-vectors -Derived from G4FaserAlgConfigNew +Derived from G4FaserAlgConfig Usage: faserMDC_simulate.py filepath outfile @@ -226,7 +226,7 @@ if __name__ == '__main__': # # Add the G4FaserAlg # - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg cfg.merge(G4FaserAlgCfg(configFlags)) # # Dump config diff --git a/Control/CalypsoExample/Simulation/scripts/faser_simulate.py b/Control/CalypsoExample/Simulation/scripts/faser_simulate.py index ef8b6cc81e9912b0d03cdcb2d0a085a3b70ba8ea..de2d39029df29758ff7dedf87d7f09aaa5aae1b6 100755 --- a/Control/CalypsoExample/Simulation/scripts/faser_simulate.py +++ b/Control/CalypsoExample/Simulation/scripts/faser_simulate.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """ Produce simulated hits from input 4-vectors -Derived from G4FaserAlgConfigNew +Derived from G4FaserAlgConfig Usage: faser_simulate.py filepath outfile @@ -266,7 +266,7 @@ if __name__ == '__main__': # # Add the G4FaserAlg # - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg cfg.merge(G4FaserAlgCfg(configFlags)) # # Dump config diff --git a/Simulation/FaserGeant4/CMakeLists.txt b/Simulation/FaserGeant4/CMakeLists.txt index d77324613bf9dc535479bad1863316598b4764ea..d8e97ab01fb94693976a1b57051acd0abd583d57 100644 --- a/Simulation/FaserGeant4/CMakeLists.txt +++ b/Simulation/FaserGeant4/CMakeLists.txt @@ -30,7 +30,7 @@ set( FaserGeant4_TARGET_OBJECTS # Generation 5 # TRT_G4Utilities # LArG4ShowerLibSvcLib - # G4PhysicsLists + G4PhysicsLists # Pythia8DecayerLib # GeoMaterial2G4 # TrackWriteFastSimLib @@ -101,6 +101,7 @@ set( FaserGeant4Component_TARGET_OBJECTS # MagFieldUtils # MuonG4SD # G4AtlasServices + G4FaserServices # Charginos # Pythia8Decayer # ExtraParticles diff --git a/Simulation/G4Faser/G4FaserAlg/CMakeLists.txt b/Simulation/G4Faser/G4FaserAlg/CMakeLists.txt index ec6a1412d1b38f46b90b68cabf9fe44b82488877..0bb8f41442be5091de3617cccb11e69c5c2aa1b8 100644 --- a/Simulation/G4Faser/G4FaserAlg/CMakeLists.txt +++ b/Simulation/G4Faser/G4FaserAlg/CMakeLists.txt @@ -30,32 +30,32 @@ atlas_add_library( G4FaserAlg PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel CxxUtils GaudiKernel G4AtlasInterfaces G4FaserAlgLib SGTools StoreGateLib EventInfo GeneratorObjects FaserMCTruthBaseLib) atlas_add_test( G4FaserAlgConfig_TestFaser - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfigNew_Test.py GeoModel.FaserVersion="'FASER-01'" IOVDb.GlobalTag="'OFLCOND-FASER-01'" Output.HITSFileName='faser.HITS.pool.root' + SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfig_Test.py GeoModel.FaserVersion="'FASER-01'" IOVDb.GlobalTag="'OFLCOND-FASER-01'" Output.HITSFileName='faser.HITS.pool.root' PROPERTIES TIMEOUT 300 PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) atlas_add_test( G4FaserAlgConfig_TestFaserNu03 - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfigNew_Test.py GeoModel.FaserVersion="'FASERNU-03'" IOVDb.GlobalTag="'OFLCOND-FASER-02'" Output.HITSFileName='faserNu03.HITS.pool.root' + SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfig_Test.py GeoModel.FaserVersion="'FASERNU-03'" IOVDb.GlobalTag="'OFLCOND-FASER-02'" Output.HITSFileName='faserNu03.HITS.pool.root' PROPERTIES TIMEOUT 300 PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) atlas_add_test( G4FaserAlgConfig_TestFaserNu03_NewField - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfigNew_Test.py GeoModel.FaserVersion="'FASERNU-03'" IOVDb.GlobalTag="'OFLCOND-FASER-03'" Output.HITSFileName='faserNu03_NewField.HITS.pool.root' + SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfig_Test.py GeoModel.FaserVersion="'FASERNU-03'" IOVDb.GlobalTag="'OFLCOND-FASER-03'" Output.HITSFileName='faserNu03_NewField.HITS.pool.root' PROPERTIES TIMEOUT 300 PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) atlas_add_test( G4FaserAlgConfig_TestFaserNu04 - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfigNew_Test.py GeoModel.FaserVersion="'FASERNU-04'" IOVDb.GlobalTag="'OFLCOND-FASER-03'" Output.HITSFileName='faserNu04.HITS.pool.root' + SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfig_Test.py GeoModel.FaserVersion="'FASERNU-04'" IOVDb.GlobalTag="'OFLCOND-FASER-03'" Output.HITSFileName='faserNu04.HITS.pool.root' PROPERTIES TIMEOUT 300 PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) atlas_add_test( G4FaserAlgConfig_TestTestbeam00 - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfigNew_Test.py GeoModel.FaserVersion="'FASER-TB00'" IOVDb.GlobalTag="'OFLCOND-FASER-TB00'" Output.HITSFileName='tb00.HITS.pool.root' + SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfig_Test.py GeoModel.FaserVersion="'FASER-TB00'" IOVDb.GlobalTag="'OFLCOND-FASER-TB00'" Output.HITSFileName='tb00.HITS.pool.root' PROPERTIES TIMEOUT 300 PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) atlas_add_test( G4FaserAlgConfig_TestTestbeam01 - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfigNew_Test.py GeoModel.FaserVersion="'FASER-TB01'" IOVDb.GlobalTag="'OFLCOND-FASER-TB00'" Output.HITSFileName='tb01.HITS.pool.root' + SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/G4FaserAlgConfig_Test.py GeoModel.FaserVersion="'FASER-TB01'" IOVDb.GlobalTag="'OFLCOND-FASER-TB00'" Output.HITSFileName='tb01.HITS.pool.root' PROPERTIES TIMEOUT 300 PROPERTIES WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfigNew.py b/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py similarity index 94% rename from Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfigNew.py rename to Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py index 91ab70dc86ecdb2379005ceee2ba9019bb5982e3..5eafdc3d1f601958f24764a653d0b8807a072654 100644 --- a/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfigNew.py +++ b/Simulation/G4Faser/G4FaserAlg/python/G4FaserAlgConfig.py @@ -1,10 +1,10 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS and FASER collaborations -from G4FaserServices.G4FaserServicesConfigNew import DetectorGeometrySvcCfg, PhysicsListSvcCfg +from G4FaserServices.G4FaserServicesConfig import DetectorGeometrySvcCfg, FaserPhysicsListSvcCfg from FaserISF_Services.FaserISF_ServicesConfigNew import FaserTruthServiceCfg, FaserInputConverterCfg from FaserISF_Services.FaserISF_ServicesCoreConfigNew import FaserGeoIDSvcCfg from G4FaserTools.G4FaserToolsConfigNew import SensitiveDetectorMasterToolCfg # from G4FaserTools.G4FaserToolsConfigNew import FastSimulationMasterToolCfg -from G4FaserServices.G4FaserUserActionConfigNew import UserActionSvcCfg +from G4FaserServices.G4FaserUserActionConfig import FaserUserActionSvcCfg # from G4FaserApps.G4Faser_MetadataNew import writeSimulationParametersMetadata from AthenaConfiguration.ComponentFactory import CompFactory from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg, outputStreamName @@ -75,12 +75,12 @@ def G4FaserAlgBasicCfg(ConfigFlags, name="G4FaserAlg", **kwargs): # result.merge(writeSimulationParametersMetadata(ConfigFlags)) #User action services (Slow...) - result.merge( UserActionSvcCfg(ConfigFlags) ) - kwargs.setdefault("UserActionSvc", result.getService( "G4UA::UserActionSvc") ) + result.merge( FaserUserActionSvcCfg(ConfigFlags) ) + kwargs.setdefault("UserActionSvc", result.getService( "G4UA::FaserUserActionSvc") ) #PhysicsListSvc - result.merge( PhysicsListSvcCfg(ConfigFlags) ) - kwargs.setdefault("PhysicsListSvc", result.getService( "PhysicsListSvc") ) + result.merge( FaserPhysicsListSvcCfg(ConfigFlags) ) + kwargs.setdefault("PhysicsListSvc", result.getService( "FaserPhysicsListSvc") ) ## G4AtlasAlg verbosities (available domains = Navigator, Propagator, Tracking, Stepping, Stacking, Event) ## Set stepper verbose = 1 if the Athena logging level is <= DEBUG diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx index 6924ad2b99d983dbbfd4d4eec1a5246e74d1f092..e702e6fb6baedb0bbbd7d99ead433e7ec4506803 100644 --- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx +++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.cxx @@ -113,7 +113,7 @@ void G4FaserAlg::initializeOnce() { // Assign physics list if(m_physListSvc.retrieve().isFailure()) { - throw std::runtime_error("Could not initialize ATLAS PhysicsListSvc!"); + throw std::runtime_error("Could not initialize FASER PhysicsListSvc!"); } for (const auto& action_tool : m_actionTools) { if (m_userActionSvc->addActionTool(action_tool).isFailure()) { diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h index 0f8b97cf13514ebcc242cf0baa46622491d40e20..a494e4201e0dc5f99844d12b5c955d777298acad 100644 --- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h +++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserAlg.h @@ -146,7 +146,7 @@ private: /// Service to convert ISF_Particles into a G4Event ServiceHandle<ISF::IFaserInputConverter> m_inputConverter{this, "InputConverter", "ISF_FaserInputConverter", ""}; /// Physics List Tool - ServiceHandle<IPhysicsListSvc> m_physListSvc{this, "PhysicsListSvc", "PhysicsListSvc", ""}; + ServiceHandle<IPhysicsListSvc> m_physListSvc{this, "PhysicsListSvc", "FaserPhysicsListSvc", ""}; /// Sensitive Detector Master Tool PublicToolHandle<ISensitiveDetectorMasterTool> m_senDetTool{this, "SenDetMasterTool", "SensitiveDetectorMasterTool", ""}; /// Fast Simulation Master Tool diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserMTRunManager.cxx b/Simulation/G4Faser/G4FaserAlg/src/G4FaserMTRunManager.cxx index bb202547bbe5e872fd4949b7521e5c4a23acb4e7..a9477c8e62afe836d8ebff3186245f5d6be4c2c3 100644 --- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserMTRunManager.cxx +++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserMTRunManager.cxx @@ -26,7 +26,7 @@ G4FaserMTRunManager::G4FaserMTRunManager() : G4MTRunManager() , AthMessaging("G4FaserMTRunManager") , m_detGeoSvc("DetectorGeometrySvc", "G4FaserMTRunManager") - , m_physListSvc("PhysicsListSvc", "G4FaserMTRunManager") + , m_physListSvc("FaserPhysicsListSvc", "G4FaserMTRunManager") , m_fastSimTool("FastSimulationMasterTool") {} diff --git a/Simulation/G4Faser/G4FaserAlg/src/G4FaserRunManager.cxx b/Simulation/G4Faser/G4FaserAlg/src/G4FaserRunManager.cxx index 0b5a79fb758a05d494a3f93a07c3e0194331bc3d..35d05f2868676e56c4903844c6366d63e723b638 100644 --- a/Simulation/G4Faser/G4FaserAlg/src/G4FaserRunManager.cxx +++ b/Simulation/G4Faser/G4FaserAlg/src/G4FaserRunManager.cxx @@ -24,7 +24,7 @@ G4FaserRunManager::G4FaserRunManager() , AthMessaging("G4FaserRunManager") , m_recordFlux(false) // , m_fastSimTool("FastSimulationMasterTool") - , m_physListSvc("PhysicsListSvc", "G4FaserRunManager") + , m_physListSvc("FaserPhysicsListSvc", "G4FaserRunManager") , m_detGeoSvc("DetectorGeometrySvc", "G4FaserRunManager") , m_volumeSmartlessLevel({}) { } diff --git a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py similarity index 97% rename from Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py rename to Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py index 32608a216b2f7f21ea3ed47f7ce116b0afa4ab10..c5e834ec67c7e08174b83ba9876363468e7c6e76 100755 --- a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py +++ b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfig_Test.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -"""Run tests on G4FaserAlgConfigNew +"""Run tests on G4FaserAlgConfig Copyright (C) 2002-2021 CERN for the benefit of the ATLAS and FASER collaborations """ @@ -193,13 +193,13 @@ if __name__ == '__main__': # # Add the G4FaserAlg # - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg cfg.merge(G4FaserAlgCfg(configFlags)) # # Uncomment to check volumes for overlap - will cause CTest to fail due to overwriting file # # from G4DebuggingTools.G4DebuggingToolsConfigNew import VolumeDebugger -# cfg.merge(VolumeDebugger(configFlags, name="G4UA::UserActionSvc", TargetVolume="", Verbose=True)) +# cfg.merge(VolumeDebugger(configFlags, name="G4UA::FaserUserActionSvc", TargetVolume="", Verbose=True)) # # Dump config # diff --git a/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py b/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py index eeb261cee7f727d6eab973d6049ad46ecd98e364..1935a70573e46edaba70fe36f9a0b034c0b83b4d 100644 --- a/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py +++ b/Simulation/G4Faser/G4FaserAlg/test/runGeantinoScan.py @@ -18,8 +18,8 @@ if __name__ == "__main__": from McEventSelector.McEventSelectorConfig import McEventSelectorCfg from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg - from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg - from G4FaserServices.G4FaserServicesConfigNew import G4GeometryNotifierSvcCfg + from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg + from G4FaserServices.G4FaserServicesConfig import G4GeometryNotifierSvcCfg from G4FaserServices.G4FaserUserActionConfigNew import UserActionMaterialStepRecorderSvcCfg # # Set up logging and new style config diff --git a/Simulation/G4Faser/G4FaserAlg/test/runGen.py b/Simulation/G4Faser/G4FaserAlg/test/runGen.py index 134c637e076482d469901ad2ffd2c90d39b875ba..d963701f94fe2fee401f27bef0fc1e9108b37f80 100755 --- a/Simulation/G4Faser/G4FaserAlg/test/runGen.py +++ b/Simulation/G4Faser/G4FaserAlg/test/runGen.py @@ -18,8 +18,8 @@ if __name__ == "__main__": from McEventSelector.McEventSelectorConfig import McEventSelectorCfg from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg # from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg -# from G4FaserAlg.G4FaserAlgConfigNew import G4FaserAlgCfg -# from G4FaserServices.G4FaserServicesConfigNew import G4GeometryNotifierSvcCfg +# from G4FaserAlg.G4FaserAlgConfig import G4FaserAlgCfg +# from G4FaserServices.G4FaserServicesConfig import G4GeometryNotifierSvcCfg # # Set up logging and new style config # diff --git a/Simulation/G4Faser/G4FaserServices/CMakeLists.txt b/Simulation/G4Faser/G4FaserServices/CMakeLists.txt index e40958648eef2da90edb1cc71af75bc101e5e359..1b8b4e20762cac485a34f446871fb9351c73ce49 100644 --- a/Simulation/G4Faser/G4FaserServices/CMakeLists.txt +++ b/Simulation/G4Faser/G4FaserServices/CMakeLists.txt @@ -10,6 +10,19 @@ find_package( CLHEP ) find_package( Geant4 ) find_package( TBB ) find_package( XercesC) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( G4FaserServices + src/*.cxx + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS + PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} ${ROOT_LIBRARIES} + GaudiKernel AthenaBaseComps + G4AtlasInterfaces G4AtlasToolsLib G4PhysicsLists PathResolver MagFieldElements MagFieldInterfaces) +set_target_properties( G4FaserServices PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) # Component(s) in the package: #atlas_add_component( G4FaserServices diff --git a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py similarity index 90% rename from Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py rename to Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py index 871d7544b3d76de75880bb29d64f9c7af117d31c..d416be9c280c494197ed5f13a4cb68ec0f92366d 100644 --- a/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfigNew.py +++ b/Simulation/G4Faser/G4FaserServices/python/G4FaserServicesConfig.py @@ -3,7 +3,7 @@ from __future__ import print_function from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -DetectorGeometrySvc, G4AtlasSvc, G4GeometryNotifierSvc, PhysicsListSvc=CompFactory.getComps("DetectorGeometrySvc","G4AtlasSvc","G4GeometryNotifierSvc","PhysicsListSvc",) +DetectorGeometrySvc, G4AtlasSvc, G4GeometryNotifierSvc, FaserPhysicsListSvc=CompFactory.getComps("DetectorGeometrySvc","G4AtlasSvc","G4GeometryNotifierSvc","FaserPhysicsListSvc",) from G4FaserTools.G4GeometryToolConfig import G4AtlasDetectorConstructionToolCfg from G4StepLimitation.G4StepLimitationConfig import G4StepLimitationToolCfg from Pythia8Decayer.Pythia8DecayerConfigNew import Pythia8DecayerPhysicsToolCfg @@ -34,7 +34,7 @@ def G4GeometryNotifierSvcCfg(ConfigFlags, name="G4GeometryNotifierSvc", **kwargs return G4GeometryNotifierSvc(name, **kwargs) -def PhysicsListSvcCfg(ConfigFlags, name="PhysicsListSvc", **kwargs): +def FaserPhysicsListSvcCfg(ConfigFlags, name="FaserPhysicsListSvc", **kwargs): result = ComponentAccumulator() PhysOptionList = [ result.popToolsAndMerge(G4StepLimitationToolCfg(ConfigFlags)) ] #PhysOptionList += ConfigFlags.Sim.PhysicsOptions # FIXME Missing functionality @@ -60,7 +60,7 @@ def PhysicsListSvcCfg(ConfigFlags, name="PhysicsListSvc", **kwargs): """ ## kwargs.setdefault("EMDEDXBinning" , 77) ## kwargs.setdefault("EMLambdaBinning" , 77) - svc = CompFactory.PhysicsListSvc(name, **kwargs) + svc = CompFactory.FaserPhysicsListSvc(name, **kwargs) from AthenaCommon.Constants import VERBOSE svc.OutputLevel = VERBOSE result.addService(svc, primary = True) diff --git a/Simulation/G4Faser/G4FaserServices/python/G4FaserUserActionConfigNew.py b/Simulation/G4Faser/G4FaserServices/python/G4FaserUserActionConfig.py similarity index 92% rename from Simulation/G4Faser/G4FaserServices/python/G4FaserUserActionConfigNew.py rename to Simulation/G4Faser/G4FaserServices/python/G4FaserUserActionConfig.py index 4f09f21d761b03bf9b6f0bfa3f44907458390553..defb9e4f36aa0f4a51b198c422f943260d090e63 100644 --- a/Simulation/G4Faser/G4FaserServices/python/G4FaserUserActionConfigNew.py +++ b/Simulation/G4Faser/G4FaserServices/python/G4FaserUserActionConfig.py @@ -4,7 +4,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory # from FaserMCTruthBase.FaserMCTruthBaseConfigNew import MCTruthSteppingActionToolCfg -G4UA__UserActionSvc=CompFactory.G4UA.UserActionSvc +G4UA__FaserUserActionSvc=CompFactory.G4UA.FaserUserActionSvc from G4FaserUserActions.G4FaserUserActionsConfig import CalypsoStackingActionToolCfg, CalypsoTrackingActionToolCfg from TrkG4UserActions.TrkG4UserActionsConfig import MaterialStepRecorderCfg @@ -75,7 +75,7 @@ def getMaterialStepRecorderActions(ConfigFlags): return actions -def UserActionMaterialStepRecorderSvcCfg(ConfigFlags, name="G4UA::UserActionSvc", **kwargs): +def UserActionMaterialStepRecorderSvcCfg(ConfigFlags, name="G4UA::FaserUserActionSvc", **kwargs): """ Get the standard UA svc configurable with all default actions added. This function is normally called by the configured factory, not users. @@ -90,12 +90,12 @@ def UserActionMaterialStepRecorderSvcCfg(ConfigFlags, name="G4UA::UserActionSvc" getMaterialStepRecorderActions(ConfigFlags)) # placeholder for more advanced config, if needed - result.addService ( G4UA__UserActionSvc(name, **kwargs) ) + result.addService ( G4UA__FaserUserActionSvc(name, **kwargs) ) return result -def UserActionSvcCfg(ConfigFlags, name="G4UA::UserActionSvc", **kwargs): +def FaserUserActionSvcCfg(ConfigFlags, name="G4UA::FaserUserActionSvc", **kwargs): """ Get the standard UA svc configurable with all default actions added. This function is normally called by the configured factory, not users. @@ -110,7 +110,7 @@ def UserActionSvcCfg(ConfigFlags, name="G4UA::UserActionSvc", **kwargs): getDefaultActions(ConfigFlags)) # placeholder for more advanced config, if needed - result.addService ( G4UA__UserActionSvc(name, **kwargs) ) + result.addService ( G4UA__FaserUserActionSvc(name, **kwargs) ) return result diff --git a/Simulation/G4Faser/G4FaserServices/src/FaserPhysicsListSvc.cxx b/Simulation/G4Faser/G4FaserServices/src/FaserPhysicsListSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..40d47344fcdacc5e5ccb09b6ab1501901cb02c84 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/FaserPhysicsListSvc.cxx @@ -0,0 +1,222 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "FaserPhysicsListSvc.h" + +#include "G4VUserPhysicsList.hh" +#include "G4StateManager.hh" +#include "G4RunManager.hh" +#include "G4EmParameters.hh" +#include "G4UImanager.hh" +#include "G4PhysListFactory.hh" +// #include "G4AntiNeutron.hh" + +#include "CLHEP/Units/PhysicalConstants.h" + +#include "G4PhysicsLists/AtlasPhysListFactory.h" + +#include <limits> + +FaserPhysicsListSvc::FaserPhysicsListSvc(const std::string& name, ISvcLocator* pSvcLocator) + : base_class(name,pSvcLocator) +{ +} + + +StatusCode FaserPhysicsListSvc::initialize( ) +{ + ATH_MSG_DEBUG("FaserPhysicsListSvc::initialize()"); + if (m_phys_option.size()) + { + ATH_MSG_INFO( "Initializing list of " << m_phys_option.size() << " physics options" ); + CHECK( m_phys_option.retrieve() ); + } + + if (m_phys_decay.size()) + { + ATH_MSG_INFO( "Initializing list of " << m_phys_decay.size() << " Decays " ); + CHECK( m_phys_decay.retrieve() ); + } + + return StatusCode::SUCCESS; +} + + +void FaserPhysicsListSvc::CreatePhysicsList() +{ + ATH_MSG_DEBUG("FaserPhysicsListSvc::CreatePhysicsList()"); + if (m_physicsListName.value() != ""){ + G4PhysListFactory factory; + AtlasPhysListFactory Atlasfactory; + if (factory.IsReferencePhysList(m_physicsListName.value())) + { + ATH_MSG_INFO("Creating Geant4 PhysicsList: " << m_physicsListName.value()); + m_physicsList = factory.GetReferencePhysList(m_physicsListName.value()); + } + else if (Atlasfactory.IsReferencePhysList(m_physicsListName.value())) + { + ATH_MSG_INFO("Creating ATLAS PhysicsList: " << m_physicsListName.value()); + m_physicsList = Atlasfactory.GetReferencePhysList(m_physicsListName.value()); + } + } + + if (!m_physicsList) + { + ATH_MSG_ERROR("Unable to initialize physics List: " << m_physicsList); + throw "PhysicsListInitializationError"; + } + // Call these as functions. As this could be used as a base class, having + // these as separate functions lets someone who is inheriting from this use + // them... + + // sort m_phys_option list + std::vector<IPhysicsOptionTool*> sortedPhysicsOptions; + sortedPhysicsOptions.reserve(m_phys_option.size()); + // Manually sorting ToolHandleArray + { + // BSM Physics + for (auto& physOptTool: m_phys_option) { + if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::BSMPhysics) { + sortedPhysicsOptions.push_back(&*physOptTool); + } + } + + // Add particles from the PDG Table not currently known to Geant4 + for (auto& physOptTool: m_phys_option) { + if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::QS_ExtraParticles) { + sortedPhysicsOptions.push_back(&*physOptTool); + } + } + + // Add MSC and Ionisation processes for specific particles (possibly merge with the next one?) + for (auto& physOptTool: m_phys_option) { + if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::QS_ExtraProc) { + sortedPhysicsOptions.push_back(&*physOptTool); + } + } + + // G4StepLimitation, LUCID Op Process, TRT XTR process + for (auto& physOptTool: m_phys_option) { + if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::GlobalProcesses) { + sortedPhysicsOptions.push_back(&*physOptTool); + } + } + + // Unknown + for (auto& physOptTool: m_phys_option) { + if (physOptTool->GetOptionType() == G4AtlasPhysicsOption::Type::UnknownType) { + ATH_MSG_ERROR(physOptTool->name() << "set as UnknownType. This tool will not be used to modify the physics list of this job."); + } + } + } + + //Register physics options to the G4VModularPhysicsList + for (auto& physOptTool: sortedPhysicsOptions) + { + ATH_MSG_DEBUG("Registering " << physOptTool->name()); + m_physicsList->RegisterPhysics(physOptTool->GetPhysicsOption()); + } + //Register decays to the G4VModularPhysicsList + for (auto& physDecayTool: m_phys_decay) + { + ATH_MSG_DEBUG("Registering " << physDecayTool->name()); + m_physicsList->RegisterPhysics(physDecayTool->GetPhysicsOption()); + } + + //ConstructProcess(); + ATH_MSG_DEBUG("end of FaserPhysicsListSvc::CreatePhysicsList()"); +} + + +G4VUserPhysicsList* FaserPhysicsListSvc::GetPhysicsList() +{ + if (!m_physicsList) { + this->CreatePhysicsList(); + } + return m_physicsList; +} + + +void FaserPhysicsListSvc::SetPhysicsList() +{ + if(!m_physicsList) { + this->CreatePhysicsList(); + } + G4RunManager::GetRunManager()->SetUserInitialization(m_physicsList); +} + + +void FaserPhysicsListSvc::SetPhysicsOptions() +{ + if (!m_physicsList) + { + ATH_MSG_WARNING("Physics list not initialized before calling ConstructProcess()"); + return; + } + + if(m_generalCut.value() > 0. && std::abs(m_generalCut.value())>std::numeric_limits<double>::epsilon()) + { + m_physicsList->SetDefaultCutValue(m_generalCut.value()); + } + + std::vector<std::string> g4commands; + if (m_neutronTimeCut.value() > 0. && std::abs(m_neutronTimeCut.value())>std::numeric_limits<double>::epsilon()) + { + std::ostringstream oss; + oss<<"/physics_engine/neutron/timeLimit "<<m_neutronTimeCut.value()<<" ns"; + g4commands.push_back(oss.str()); + } + + if (m_neutronEnergyCut.value() > 0. && std::abs(m_neutronEnergyCut.value())>std::numeric_limits<double>::epsilon()) + { + std::ostringstream oss; + oss<<"/physics_engine/neutron/energyLimit "<<m_neutronEnergyCut.value()<<" MeV"; + g4commands.push_back(oss.str()); + } + + if(!g4commands.empty()) { + // Send UI commands + ATH_MSG_DEBUG("G4 Command: Trying in SetPhysicsOptions()"); + G4UImanager* ui = G4UImanager::GetUIpointer(); + for (const auto& g4command : g4commands) { + int returnCode = ui->ApplyCommand( g4command ); + CommandLog(returnCode, g4command); + } + } + + G4EmParameters* emp = G4EmParameters::Instance(); + if (m_emMaxEnergy.value()>=0) emp->SetMaxEnergy(m_emMaxEnergy.value()); + if (m_emNumberOfBinsPerDecade.value()>=0) emp->SetNumberOfBinsPerDecade(m_emNumberOfBinsPerDecade.value()); + if (m_emMinEnergy.value()>=0) emp->SetMinEnergy(m_emMinEnergy.value()); + if (m_applyEMCuts.value()) + { + emp->SetApplyCuts(true); + } + +// if (m_unstableAntiNeutrons) { +// G4AntiNeutron::Definition()->SetPDGStable(false); +// } + + return; +} + + +void FaserPhysicsListSvc::CommandLog(int returnCode, const std::string& commandString) const +{ + switch(returnCode) { + case 0: { ATH_MSG_DEBUG("G4 Command: " << commandString << " - Command Succeeded"); } break; + case 100: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Command Not Found!"); } break; + case 200: { + auto* stateManager = G4StateManager::GetStateManager(); + ATH_MSG_DEBUG("G4 Command: " << commandString << " - Illegal Application State (" << + stateManager->GetStateString(stateManager->GetCurrentState()) << ")!"); + } break; + case 300: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Out of Range!"); } break; + case 400: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Unreadable!"); } break; + case 500: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Parameter Out of Candidates!"); } break; + case 600: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Alias Not Found!"); } break; + default: { ATH_MSG_ERROR("G4 Command: " << commandString << " - Unknown Status!"); } break; + } + +} diff --git a/Simulation/G4Faser/G4FaserServices/src/FaserPhysicsListSvc.h b/Simulation/G4Faser/G4FaserServices/src/FaserPhysicsListSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..15e328d37e5cdb8420bc3358f15a25bed9f7ef90 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/FaserPhysicsListSvc.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef G4FASERSERVICES_FASERPHYSICSLISTSVC_H +#define G4FASERSERVICES_FASERPHYSICSLISTSVC_H + +// Base classes +#include "G4AtlasInterfaces/IPhysicsListSvc.h" +#include "AthenaBaseComps/AthService.h" + + +#include "G4AtlasInterfaces/IPhysicsOptionTool.h" +#include "GaudiKernel/ToolHandle.h" + +// Classes that are returned +class G4VModularPhysicsList; +class G4VUserPhysicsList; + +// STL library +#include <string> + +class FaserPhysicsListSvc : public extends<AthService, IPhysicsListSvc> +{ +public: + // Standard constructor and destructor + FaserPhysicsListSvc(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~FaserPhysicsListSvc() = default; + + + virtual StatusCode initialize( ) override; + // Base class methods from IPhysicsListSvc + virtual void CreatePhysicsList() override; + virtual G4VUserPhysicsList* GetPhysicsList() override; + virtual void SetPhysicsList() override; + virtual void SetPhysicsOptions() override; + +private: + + /// This command prints a message about a G4Command depending on its returnCode + void CommandLog(int returnCode, const std::string& commandString) const; + + ToolHandleArray<IPhysicsOptionTool> m_phys_option{this, "PhysOption", {}, "Tool handle array of physics options" }; + ToolHandleArray<IPhysicsOptionTool> m_phys_decay{this, "PhysicsDecay", {}, "Tool handle array of physics decays"}; + G4VModularPhysicsList* m_physicsList{}; ///!< Handle on the physics list + Gaudi::Property<std::string> m_physicsListName{this, "PhysicsList", "FTFP_BERT", "Name for physics list"}; ///!< Name for the physics list (property to be set in the tool) + Gaudi::Property<double> m_neutronTimeCut{this, "NeutronTimeCut", 0, "Time cut for neutron killer"}; ///!< Time cut for neutrons (in the neutron killer process) + Gaudi::Property<double> m_neutronEnergyCut{this, "NeutronEnergyCut", 0, "Energy cut for neutron killer"}; ///!< Energy cut for neutrons (in the neutron killer process) + Gaudi::Property<double> m_generalCut{this, "GeneralCut", 0, "General cut"}; ///!< A general cut - this isn't normally used in our simulation + Gaudi::Property<double> m_emMaxEnergy{this, "EMMaxEnergy", -1., "Maximum energy for EM tables"}; ///!< Maximum energy of the pre-calculated EM cross-section tables + Gaudi::Property<double> m_emMinEnergy{this, "EMMinEnergy", -1., "Minimum energy for EM tables"}; ///!< Minimum energy of the pre-calculated EM cross-section tables + /* --- ATLASSIM-3967 --- + Old methods SetDEDXBinning and SetLambdaBinning are replaced in G4 10.4 by + SetNumberOfBinsPerDecade which now controls both settings with the same + value. Instead of changing the overall number of bins, user should + specify the number of bins per energy decade instead. + */ + Gaudi::Property<int> m_emNumberOfBinsPerDecade{this, "EMNumberOfBinsPerDecade", -1, "Number of bins per Energy decade. Used for both DeDx and for the Lambda binning."}; ///!< Number of bins per Energy decade. Used for both DeDx and for the Lambda binning. + Gaudi::Property<bool> m_applyEMCuts{this, "ApplyEMCuts", true, "Apply cuts EM flag in Geant4"}; ///!< Switch for the G4 "apply cuts" EM physics flag + +// Gaudi::Property<bool> m_unstableAntiNeutrons{this, "UnstableAntiNeutrons",false,"Bugfix for ATLASSIM-6634 until we switch to using Geant4 11"}; +}; + +#endif diff --git a/Simulation/G4Faser/G4FaserServices/src/FaserUserActionSvc.cxx b/Simulation/G4Faser/G4FaserServices/src/FaserUserActionSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1647cd85639ab526b72456ba15a5cd029290f60f --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/FaserUserActionSvc.cxx @@ -0,0 +1,186 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <mutex> + +// Framework includes + +// Geant4 includes +#include "G4RunManager.hh" + +// Local includes +#include "FaserUserActionSvc.h" + +namespace G4UA +{ + + //--------------------------------------------------------------------------- + // Constructor + // I was using private tool handle arrays, but the OutputLevels weren't + // getting set correctly (in mig1), so I will just make them all public. + //--------------------------------------------------------------------------- + FaserUserActionSvc::FaserUserActionSvc(const std::string& name, + ISvcLocator* pSvcLocator) + : base_class(name, pSvcLocator) + , m_userActionTools(this) + { + declareProperty("UserActionTools", m_userActionTools); + } + + //--------------------------------------------------------------------------- + // Initialize the service + //--------------------------------------------------------------------------- + StatusCode FaserUserActionSvc::initialize() + { + ATH_MSG_INFO("Initializing " << m_userActionTools.size() << " user action tools."); + + for(const auto& action : m_userActionTools) { + ATH_MSG_INFO( " -> " << action.name() ); + } + + ATH_CHECK( m_userActionTools.retrieve() ); + + return StatusCode::SUCCESS; + } + StatusCode FaserUserActionSvc::addActionTool(const ToolHandle<IUserActionTool>& service_tool){ + + if (!service_tool.isPublic()){ + ATH_MSG_FATAL("Only public tools are allowed"); + return StatusCode::FAILURE; + } + if (service_tool.empty()) { + ATH_MSG_FATAL("NO point in adding empty tool handles here."); + return StatusCode::FAILURE; + } + ATH_MSG_INFO(" Add new tool "<<service_tool.name()); + m_userActionTools.push_back(service_tool); + return StatusCode::SUCCESS; + } + + //--------------------------------------------------------------------------- + // Initialize the user actions for the current thread. + // In this code, "action" refers to the G4 action classes, and "plugin" + // refers to the custom action objects that get assigned to the G4 action. + // TODO: this prototype could be cleaner + //--------------------------------------------------------------------------- + StatusCode FaserUserActionSvc::initializeActions() + { + // This method is called concurrently in AthenaMT during initialization. + // We conservatively just lock the whole thing to protect MsgStream and + // downstream code. + static std::mutex userActionMutex; + std::lock_guard<std::mutex> userActionLock(userActionMutex); + + ATH_MSG_DEBUG("initializeActions"); + + // sanity check: this is to make sure there are no other instances of this + // svc that have been already initialized, or that nobody else in some other + // code has already been registering actions to the run manager, which would + // be a major error in the configuration checking the run action is probably + // enough fo multiple instances of this service, since all roles are usually + // set at the same time. but other code may as well have registered just one + // role, so it is safer to do all checks here. + + if( G4RunManager::GetRunManager()->GetUserRunAction() || + G4RunManager::GetRunManager()->GetUserEventAction() || + G4RunManager::GetRunManager()->GetUserStackingAction() || + G4RunManager::GetRunManager()->GetUserTrackingAction() || + G4RunManager::GetRunManager()->GetUserSteppingAction() ) + { + ATH_MSG_FATAL("FaserUserActionSvc has found that actions were already " << + "registered to the G4RunManager. Check your code/configuration"); + return StatusCode::FAILURE; + } + + // Retrieve the new user actions + G4AtlasUserActions actions; + for(auto& tool : m_userActionTools) { + ATH_CHECK( tool->fillUserAction(actions) ); + } + + // Initialize the ATLAS run action. + if(m_runActions.get()) { + ATH_MSG_ERROR("Run action already exists for current thread!"); + return StatusCode::FAILURE; + } + auto runAction = std::make_unique<G4AtlasRunAction>(); + // Assign run plugins + for(auto* action : actions.runActions) + runAction->addRunAction(action); + G4RunManager::GetRunManager()->SetUserAction( runAction.get() ); + m_runActions.set( std::move(runAction) ); + + // Initialize the ATLAS event action. + if(m_eventActions.get()) { + ATH_MSG_ERROR("Event action already exists for current thread!"); + return StatusCode::FAILURE; + } + auto eventAction = std::make_unique<G4AtlasEventAction>(); + // Assign event plugins + for(auto* action : actions.eventActions) { + eventAction->addEventAction(action); + // set the event manager + action->SetEventManager( G4EventManager::GetEventManager() ); + } + G4RunManager::GetRunManager()->SetUserAction( eventAction.get() ); + m_eventActions.set( std::move(eventAction) ); + + // Initialize the ATLAS stacking action. + if(m_stackingActions.get()) { + ATH_MSG_ERROR("Stacking action already exists for current thread!"); + return StatusCode::FAILURE; + } + auto stackAction = std::make_unique<G4AtlasStackingAction>(); + // Assign stacking plugins + for(auto* action : actions.stackingActions) { + stackAction->addAction(action); + // set the stack manager + action->SetStackManager( G4EventManager::GetEventManager()->GetStackManager() ); + } + G4RunManager::GetRunManager()->SetUserAction( stackAction.get() ); + m_stackingActions.set( std::move(stackAction) ); + + // Initialize the ATLAS tracking action. + if(m_trackingActions.get()) { + ATH_MSG_ERROR("Tracking action already exists for current thread!"); + return StatusCode::FAILURE; + } + auto trackAction = std::make_unique<G4AtlasTrackingAction>(); + // Assign tracking plugins + for(auto* action : actions.trackingActions) { + trackAction->addTrackAction(action); + // set the tracking manager + action->SetTrackingManagerPointer ( G4EventManager::GetEventManager()->GetTrackingManager() ); + } + G4RunManager::GetRunManager()->SetUserAction( trackAction.get() ); + m_trackingActions.set( std::move(trackAction) ); + + // Initialize the ATLAS stepping action. + if(m_steppingActions.get()) { + ATH_MSG_ERROR("Stepping action already exists for current thread!"); + return StatusCode::FAILURE; + } + auto stepAction = std::make_unique<G4AtlasSteppingAction>(); + // Assign stepping plugins + for(auto* action : actions.steppingActions) { + stepAction->addAction(action); + // set the stepping manager + action->SetSteppingManagerPointer( G4EventManager::GetEventManager()->GetTrackingManager()->GetSteppingManager() ); + } + G4RunManager::GetRunManager()->SetUserAction( stepAction.get() ); + m_steppingActions.set( std::move(stepAction) ); + + return StatusCode::SUCCESS; + } + + // For ISF, get UserActions that could have stored secondary particles + StatusCode FaserUserActionSvc::getSecondaryActions( std::vector< G4UserSteppingAction* >& actions ) { + + // Only stepping actions can return secondaries? Maybe turn this into a templated method + actions = m_steppingActions.get()->getActions(); + + return StatusCode::SUCCESS; + } +} // namespace G4UA + diff --git a/Simulation/G4Faser/G4FaserServices/src/FaserUserActionSvc.h b/Simulation/G4Faser/G4FaserServices/src/FaserUserActionSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..2444f91ff2f4c88d31ef6bef7bf6a5560ea4882b --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/FaserUserActionSvc.h @@ -0,0 +1,83 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef G4FASERSERVICES__G4UA_FASERUSERACTIONSVC_H +#define G4FASERSERVICES__G4UA_FASERUSERACTIONSVC_H + + +// System includes +#include <thread> + +// Framework includes +#include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/ToolHandle.h" + +// G4Atlas includes +#include "G4AtlasRunAction.h" +#include "G4AtlasEventAction.h" +#include "G4AtlasStackingAction.h" +#include "G4AtlasTrackingAction.h" +#include "G4AtlasSteppingAction.h" +#include "G4AtlasInterfaces/IUserActionTool.h" +#include "G4AtlasInterfaces/IUserActionSvc.h" +#include "G4AtlasTools/ThreadActionHolder.h" + + +namespace G4UA +{ + + /// @class FaserUserActionSvc + /// @brief A service which manages the user actions for G4 simulation + /// @author Steve Farrell <Steven.Farrell@cern.ch> + /// + class FaserUserActionSvc : public extends<AthService, IUserActionSvc> + { + + public: + + /// Standard constructor + FaserUserActionSvc(const std::string& name, ISvcLocator* pSvcLocator); + + /// Initialize the service + StatusCode initialize() override; + + /// Initialize the user actions for the current thread + StatusCode initializeActions() override final; + + StatusCode getSecondaryActions( std::vector< G4UserSteppingAction* >& actions ) override final; + + StatusCode addActionTool(const ToolHandle<IUserActionTool>& service_tool) override final; + private: + + /// @name Handles to ATLAS action tools + /// @{ + + /// User action tools + ToolHandleArray<IUserActionTool> m_userActionTools; + + /// @} + + /// @name ATLAS Geant4 user actions + /// @{ + + /// Thread-local run action + ThreadActionHolder<G4AtlasRunAction> m_runActions; + /// Thread-local event action + ThreadActionHolder<G4AtlasEventAction> m_eventActions; + /// Thread-local stacking action + ThreadActionHolder<G4AtlasStackingAction> m_stackingActions; + /// Thread-local tracking action + ThreadActionHolder<G4AtlasTrackingAction> m_trackingActions; + /// Thread-local stepping action + ThreadActionHolder<G4AtlasSteppingAction> m_steppingActions; + + /// @} + + }; // class FaserUserActionSvc + +} + +#endif + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasEventAction.cxx b/Simulation/G4Faser/G4FaserServices/src/G4AtlasEventAction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..154cd06fa5f36da04f0a3174f018e7e12c4aedc6 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasEventAction.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Local includes +#include "G4AtlasEventAction.h" + +namespace G4UA +{ + + //--------------------------------------------------------------------------- + // Constructor + //--------------------------------------------------------------------------- + G4AtlasEventAction::G4AtlasEventAction() + { + } + + //--------------------------------------------------------------------------- + // Begin-event action + //--------------------------------------------------------------------------- + void G4AtlasEventAction::BeginOfEventAction(const G4Event* event) + { + // Loop over my pre-actions and apply each one in turn + for(auto action : m_eventActions){ + action->BeginOfEventAction(event); + } + } + + //--------------------------------------------------------------------------- + // End-event action + //--------------------------------------------------------------------------- + void G4AtlasEventAction::EndOfEventAction(const G4Event* event) + { + // Loop over my post-actions and apply each one in turn + for(auto action : m_eventActions){ + action->EndOfEventAction(event); + } + } + + //--------------------------------------------------------------------------- + // Add one action to the list + //--------------------------------------------------------------------------- + void G4AtlasEventAction::addEventAction(G4UserEventAction* action) + { + m_eventActions.push_back(action); + } + +} // namespace G4UA + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasEventAction.h b/Simulation/G4Faser/G4FaserServices/src/G4AtlasEventAction.h new file mode 100644 index 0000000000000000000000000000000000000000..542093e76e37b90e6ee29fbb525f89f3e633328d --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasEventAction.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef G4ATLASTOOLS__G4UA_G4ATLASEVENTACTION_H +#define G4ATLASTOOLS__G4UA_G4ATLASEVENTACTION_H + +// STL includes +#include <vector> + +// Geant4 includes +#include "G4UserEventAction.hh" + + +namespace G4UA +{ + + /// @class G4AtlasEventAction + /// @brief ATLAS subclass of the G4 event action. + /// + /// Maintains a list of custom actions for the beginning and end of an event + /// and when invoked by Geant4 will forward the call to each of them in turn. + /// + /// @todo TODO lifetime management of wrapper actions. + /// + /// @author Steve Farrell <Steven.Farrell@cern.ch> + /// + class G4AtlasEventAction : public G4UserEventAction + { + + public: + + /// Constructor + G4AtlasEventAction(); + + /// @brief Geant4 method for pre-event action. + /// This method forwards the G4 call onto each of its + /// pre-event ATLAS actions. + void BeginOfEventAction(const G4Event* event) override final; + + /// @brief Geant4 method for post-event action. + /// This method forwards the G4 call onto each of its + /// post-event ATLAS actions. + void EndOfEventAction(const G4Event* event) override final; + + /// Add one action to the list + void addEventAction(G4UserEventAction* action); + + private: + + /// List of ATLAS event actions + std::vector<G4UserEventAction*> m_eventActions; + + }; // class G4AtlasEventAction + +} + +#endif + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasRunAction.cxx b/Simulation/G4Faser/G4FaserServices/src/G4AtlasRunAction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3dcdbfa5e218ddeba68233911cf3e50ccc616c7 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasRunAction.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Local includes +#include "G4AtlasRunAction.h" + +namespace G4UA +{ + + //--------------------------------------------------------------------------- + // Constructor + //--------------------------------------------------------------------------- + G4AtlasRunAction::G4AtlasRunAction() + { + } + + //--------------------------------------------------------------------------- + // Begin-run action + //--------------------------------------------------------------------------- + void G4AtlasRunAction::BeginOfRunAction(const G4Run* run) + { + // Loop over my pre-actions and apply each one in turn + for(auto action : m_runActions){ + action->BeginOfRunAction(run); + } + } + + //--------------------------------------------------------------------------- + // End-run action + //--------------------------------------------------------------------------- + void G4AtlasRunAction::EndOfRunAction(const G4Run* run) + { + // Loop over my post-actions and apply each one in turn + for(auto action : m_runActions){ + action->EndOfRunAction(run); + } + } + + //--------------------------------------------------------------------------- + // Add one action to the list + //--------------------------------------------------------------------------- + void G4AtlasRunAction::addRunAction(G4UserRunAction* action) + { + m_runActions.push_back(action); + } + +} // namespace G4UA + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasRunAction.h b/Simulation/G4Faser/G4FaserServices/src/G4AtlasRunAction.h new file mode 100644 index 0000000000000000000000000000000000000000..df524bcbefc23f2fcf3c645bee802e2257bba825 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasRunAction.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef G4ATLASTOOLS__G4UA_G4ATLASRUNACTION_H +#define G4ATLASTOOLS__G4UA_G4ATLASRUNACTION_H + +// STL includes +#include <vector> + +// Geant4 includes +#include "G4UserRunAction.hh" + + +namespace G4UA +{ + + /// @class G4AtlasRunAction + /// @brief ATLAS subclass of the G4 run action. + /// + /// Maintains a list of custom actions for the beginning and end of an run + /// and when invoked by Geant4 will forward the call to each of them in turn. + /// + /// @todo TODO lifetime management of wrapper actions. + /// + /// @author Steve Farrell <Steven.Farrell@cern.ch> + /// + class G4AtlasRunAction : public G4UserRunAction + { + + public: + + /// Constructor + G4AtlasRunAction(); + + /// @brief Geant4 method for pre-run action. + /// This method forwards the G4 call onto each of its + /// pre-run ATLAS actions. + void BeginOfRunAction(const G4Run* run) override final; + + /// @brief Geant4 method for post-run action. + /// This method forwards the G4 call onto each of its + /// post-run ATLAS actions. + void EndOfRunAction(const G4Run* run) override final; + + /// Add one action to the list + void addRunAction(G4UserRunAction* action); + + private: + + /// List of ATLAS run actions + std::vector<G4UserRunAction*> m_runActions; + + }; // class G4AtlasRunAction + +} + +#endif + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasStackingAction.cxx b/Simulation/G4Faser/G4FaserServices/src/G4AtlasStackingAction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..441ca581eb58086af59e77d114f9b84040e8d560 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasStackingAction.cxx @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Local includes +#include "G4AtlasStackingAction.h" + +namespace G4UA +{ + + //--------------------------------------------------------------------------- + // Constructor + //--------------------------------------------------------------------------- + G4AtlasStackingAction::G4AtlasStackingAction() + { + } + + //--------------------------------------------------------------------------- + // Classify a new track + //--------------------------------------------------------------------------- + G4ClassificationOfNewTrack + G4AtlasStackingAction::ClassifyNewTrack(const G4Track* track) + { + // Loop over my actions and apply each one in turn + // TODO: decide how to properly handle multiple stacking action results. + // Maybe we just need to forbid it. See ATLASSIM-2421. + G4ClassificationOfNewTrack classification = fUrgent; + for(auto action : m_actions){ + classification = action->ClassifyNewTrack(track); + if(classification == fKill) return fKill; + } + return classification; + } + + //--------------------------------------------------------------------------- + // Start a new stack stage + //--------------------------------------------------------------------------- + void G4AtlasStackingAction::NewStage() + { + // Loop over my actions and apply each one in turn + for(auto action : m_actions){ + action->NewStage(); + } + } + + //--------------------------------------------------------------------------- + // Start a new event + //--------------------------------------------------------------------------- + void G4AtlasStackingAction::PrepareNewEvent() + { + // Loop over my actions and apply each one in turn + for(auto action : m_actions){ + action->PrepareNewEvent(); + } + } + + //--------------------------------------------------------------------------- + // Add one action to the action list + //--------------------------------------------------------------------------- + void G4AtlasStackingAction::addAction(G4UserStackingAction* action) + { + m_actions.push_back(action); + } + +} // namespace G4UA + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasStackingAction.h b/Simulation/G4Faser/G4FaserServices/src/G4AtlasStackingAction.h new file mode 100644 index 0000000000000000000000000000000000000000..6508864d5471cccb76ed474dc94adf7c1dcb6f89 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasStackingAction.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef G4ATLASTOOLS__G4UA_G4ATLASSTACKINGACTION_H +#define G4ATLASTOOLS__G4UA_G4ATLASSTACKINGACTION_H + +// System includes +#include <vector> + +// Geant4 includes +#include "G4UserStackingAction.hh" + + +namespace G4UA +{ + + /// @class G4AtlasStackingAction + /// @brief Atlas subclass of the G4 stacking action. + /// + /// This object maintains a list of custom actions and when invoked by + /// Geant4 will forward the call to each of them in turn. + /// + /// @todo TODO lifetime management of wrapper actions. + /// + /// @author Steve Farrell <Steven.Farrell@cern.ch> + /// + class G4AtlasStackingAction : public G4UserStackingAction + { + + public: + + /// Constructor + G4AtlasStackingAction(); + + /// @brief Geant4 method for classifying a new track. + /// This method will forward the call onto each of the actions + /// in its private list. + G4ClassificationOfNewTrack + ClassifyNewTrack(const G4Track* track) override final; + + /// @brief Geant4 method for starting a new stack. + /// Forwards the call onto each custom action. + void NewStage() override final; + + /// @brief Geant4 method for stack preparation at new event. + /// This method is possibly redundant so we may remove it. + void PrepareNewEvent() override final; + + /// @brief Add one action to the list + void addAction(G4UserStackingAction* action); + + private: + + /// List of ATLAS stacking actions + std::vector<G4UserStackingAction*> m_actions; + + }; // class G4AtlasStackingAction + +} // namespace G4UA + +#endif + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasSteppingAction.cxx b/Simulation/G4Faser/G4FaserServices/src/G4AtlasSteppingAction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..69f7bd80c9b122dd066e78c626bee2715a095137 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasSteppingAction.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Local includes +#include "G4AtlasSteppingAction.h" + +namespace G4UA +{ + + //--------------------------------------------------------------------------- + // Constructor + //--------------------------------------------------------------------------- + G4AtlasSteppingAction::G4AtlasSteppingAction() + { + } + + //--------------------------------------------------------------------------- + // Process one step + //--------------------------------------------------------------------------- + void G4AtlasSteppingAction::UserSteppingAction(const G4Step* step) + { + // Loop over my actions and apply each one in turn + for(auto action : m_actions){ + action->UserSteppingAction(step); + } + } + + //--------------------------------------------------------------------------- + // Add one action to the action list + //--------------------------------------------------------------------------- + void G4AtlasSteppingAction::addAction(G4UserSteppingAction* action) + { + m_actions.push_back(action); + } + +} // namespace G4UA + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasSteppingAction.h b/Simulation/G4Faser/G4FaserServices/src/G4AtlasSteppingAction.h new file mode 100644 index 0000000000000000000000000000000000000000..3d8c2843f570dbcec92900cbc3fc5f37ce8ce38b --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasSteppingAction.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef G4ATLASTOOLS__G4UA_G4ATLASSTEPPINGACTION_H +#define G4ATLASTOOLS__G4UA_G4ATLASSTEPPINGACTION_H + +// System includes +#include <vector> + +// Geant4 includes +#include "G4UserSteppingAction.hh" + + +namespace G4UA +{ + + /// @class G4AtlasSteppingAction + /// @brief Atlas subclass of the G4 stepping action. + /// + /// This object maintains a list of custom actions and when invoked by + /// Geant4 will forward the call to each of them in turn. + /// + /// @todo TODO lifetime management of wrapper actions. + /// + /// @author Steve Farrell <Steven.Farrell@cern.ch> + /// + class G4AtlasSteppingAction : public G4UserSteppingAction + { + + public: + + /// Constructor + G4AtlasSteppingAction(); + + /// @brief Geant4 method for processing one step. + /// This method will forward the call onto each of the actions + /// in its private list. + void UserSteppingAction(const G4Step* step) override final; + + /// @brief Add one action to the list + void addAction(G4UserSteppingAction* action); + + /// @brief Return the actions vector + std::vector<G4UserSteppingAction*>& getActions(){ return m_actions; }; + + private: + + /// List of ATLAS stepping actions + std::vector<G4UserSteppingAction*> m_actions; + + }; // class G4AtlasSteppingAction + +} // namespace G4UA + +#endif + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasTrackingAction.cxx b/Simulation/G4Faser/G4FaserServices/src/G4AtlasTrackingAction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2dd36455ef987d1d80229fabee2f0b2df904b4fb --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasTrackingAction.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Local includes +#include "G4AtlasTrackingAction.h" + +namespace G4UA +{ + + //--------------------------------------------------------------------------- + // Constructor + //--------------------------------------------------------------------------- + G4AtlasTrackingAction::G4AtlasTrackingAction() + { + } + + //--------------------------------------------------------------------------- + // Pre-tracking action + //--------------------------------------------------------------------------- + void G4AtlasTrackingAction::PreUserTrackingAction(const G4Track* trk) + { + // Loop over my pre-actions and apply each one in turn + for(auto action : m_trackActions){ + action->PreUserTrackingAction(trk); + } + } + + //--------------------------------------------------------------------------- + // Post-tracking action + //--------------------------------------------------------------------------- + void G4AtlasTrackingAction::PostUserTrackingAction(const G4Track* trk) + { + // Loop over my post-actions and apply each one in turn + for(auto action : m_trackActions){ + action->PostUserTrackingAction(trk); + } + } + + //--------------------------------------------------------------------------- + // Add one action to the list + //--------------------------------------------------------------------------- + void G4AtlasTrackingAction::addTrackAction(G4UserTrackingAction* action) + { + m_trackActions.push_back(action); + } + +} // namespace G4UA + diff --git a/Simulation/G4Faser/G4FaserServices/src/G4AtlasTrackingAction.h b/Simulation/G4Faser/G4FaserServices/src/G4AtlasTrackingAction.h new file mode 100644 index 0000000000000000000000000000000000000000..1df40bf51497cdffd50cc567aa5d8d171ad32bd7 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/G4AtlasTrackingAction.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef G4ATLASTOOLS__G4UA_G4ATLASTRACKINGACTION_H +#define G4ATLASTOOLS__G4UA_G4ATLASTRACKINGACTION_H + +// STL includes +#include <vector> + +// Geant4 includes +#include "G4UserTrackingAction.hh" + +namespace G4UA +{ + + /// @class G4AtlasTrackingAction + /// @brief Atlas subclass of the G4 tracking action. + /// + /// Maintains a list of custom tracking actions and when invoked by + /// Geant4 will forard the call to each of them in turn. + /// + /// @todo TODO lifetime management of wrapper actions. + /// + /// @author Steve Farrell <Steven.Farrell@cern.ch> + /// + class G4AtlasTrackingAction : public G4UserTrackingAction + { + + public: + + /// Constructor + G4AtlasTrackingAction(); + + /// @brief Geant4 method for pre-tracking action. + /// This method forwards the G4 call onto each of its + /// pre-tracking ATLAS actions. + void PreUserTrackingAction(const G4Track* trk) override final; + + /// @brief Geant4 method for post-tracking action. + /// This method forwards the G4 call onto each of its + /// post-tracking ATLAS actions. + void PostUserTrackingAction(const G4Track* trk) override final; + + /// @brief Add one action to the list + void addTrackAction(G4UserTrackingAction* action); + + private: + + /// List of ATLAS actions + std::vector<G4UserTrackingAction*> m_trackActions; + + }; // class G4AtlasTrackingAction + +} // namespace G4UA + +#endif + diff --git a/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx b/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1f65a5aacfabb622a44c3697aad5adea96eeee49 --- /dev/null +++ b/Simulation/G4Faser/G4FaserServices/src/components/G4FaserServices_entries.cxx @@ -0,0 +1,17 @@ +#include "../FaserPhysicsListSvc.h" +// #include "../UserLimitsSvc.h" +// #include "../G4AtlasSvc.h" +// #include "../G4GeometryNotifierSvc.h" +// #include "../DetectorGeometrySvc.h" +#include "../FaserUserActionSvc.h" +// #include "../ConstantFieldSvc.h" +// #include "../StandardFieldSvc.h" + +DECLARE_COMPONENT( FaserPhysicsListSvc ) +// DECLARE_COMPONENT( UserLimitsSvc ) +// DECLARE_COMPONENT( G4AtlasSvc ) +// DECLARE_COMPONENT( G4GeometryNotifierSvc ) +// DECLARE_COMPONENT( DetectorGeometrySvc ) +DECLARE_COMPONENT( G4UA::FaserUserActionSvc ) +// DECLARE_COMPONENT( ConstantFieldSvc ) +// DECLARE_COMPONENT( StandardFieldSvc ) diff --git a/Simulation/README.md b/Simulation/README.md index 4b9556c73de0e240dc4c14d3d407712fc24ed20a..ba900d1bae62abb5e5eb2b61541f94a44a0e6d81 100644 --- a/Simulation/README.md +++ b/Simulation/README.md @@ -1,13 +1,13 @@ To generate Calypso MC data from an installation (run) directory: -1) edit the G4FaserAlg/test/G4FaserAlgConfigNew_Test.py file to setup the job +1) edit the G4FaserAlg/test/G4FaserAlgConfig_Test.py file to setup the job ....the default generator is particle-gun; it can also read EVNT files but note that the Veto is far away from (0,0,0) where most ATLAS generators put things by default ....there are examples of single-particle (muon or electron), cosmic-rays and decay-in-flight. The parameters of each can be changed by passing keyword arguments ....read the comments carefully as a few other things have to be changed in the job options to switch between internal generator and generator data-file ....the geometry can be changed on the command line, using the GeoModel.FaserVersion flag and IOVDb.GlobalTag flags. See the tests in the CMakeLists.txt file for examples 2) source ./setup.sh -3) G4FaserAlgConfigNew_Test.py +3) G4FaserAlgConfig_Test.py (setup.sh will put the script in your path) diff --git a/Tracker/TrackerRecAlgs/TrackerData/README b/Tracker/TrackerRecAlgs/TrackerData/README index 5c7cd869e46e21b3f82e68d2d55811f8d5b9b0d9..585b677e7c6b29bb659c3dbd0459a8ee09d10d69 100644 --- a/Tracker/TrackerRecAlgs/TrackerData/README +++ b/Tracker/TrackerRecAlgs/TrackerData/README @@ -1,9 +1,9 @@ This package can be used to write out the data from simulated hits and from tracks reconstructed with the TrackerSegmentFit algorithm. -To write out information for the simulated hits run G4FaserAlgConfigNew_Test.py +To write out information for the simulated hits run G4FaserAlgConfig_Test.py to simulate hits and TrackerTruthDbg.py to write out the information. -To write out information for the tracks run G4FaserAlgConfigNew_Test.py to +To write out information for the tracks run G4FaserAlgConfig_Test.py to simulate hits, FaserSCT_DigitizationDbg.py to digitize them and TrackerSegmentFitDbg.py to write out the information. \ No newline at end of file diff --git a/Tracker/TrackerRecAlgs/TrackerTruth/ReadMe b/Tracker/TrackerRecAlgs/TrackerTruth/ReadMe index a763932b380cc4982774d5e409328dadea867411..be61aa49616f6e6a1bf96fe796b5c0cb903b8cd3 100644 --- a/Tracker/TrackerRecAlgs/TrackerTruth/ReadMe +++ b/Tracker/TrackerRecAlgs/TrackerTruth/ReadMe @@ -3,4 +3,4 @@ For particles the run number, event number, pdg code, vertex and momentum is wri run number, event number, station, plane, module, row, sensor, local position, global position and pdg code of the corresponding particle is written out. -To write out truth information generate MC data using the G4FaserAlgConfigNew_Test.py and run TrackerTruthDbg.py +To write out truth information generate MC data using the G4FaserAlgConfig_Test.py and run TrackerTruthDbg.py