diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py index c759bbb958f8e222eff5798130760525151c232a..0b28a9070f9b978296896205957d759ea211129d 100644 --- a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py +++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Tools configurations for ISF @@ -367,10 +367,16 @@ def getKernel_MC12G4_IDCalo(name="ISF_Kernel_MC12G4_IDCalo", **kwargs): ############## Simulator: G4FastCalo ############### def getKernel_G4FastCalo(name="ISF_Kernel_G4FastCalo", **kwargs): + kwargs.setdefault("ParticleBroker" , 'ISF_AFIIParticleBrokerSvc') kwargs.setdefault("BeamPipeSimulationSelectors", [ 'ISF_DefaultAFIIGeant4Selector' ] ) kwargs.setdefault("IDSimulationSelectors" , [ 'ISF_DefaultAFIIGeant4Selector' ] ) kwargs.setdefault("CaloSimulationSelectors" , [ 'ISF_MuonAFIIGeant4Selector', 'ISF_EtaGreater5ParticleKillerSimSelector', + 'ISF_PionG4FastCaloGeant4Selector', + 'ISF_ProtonG4FastCaloGeant4Selector', + 'ISF_NeutronG4FastCaloGeant4Selector', + 'ISF_ChargedKaonG4FastCaloGeant4Selector', + 'ISF_KLongG4FastCaloGeant4Selector', 'ISF_DefaultFastCaloSimV2Selector' ] ) kwargs.setdefault("MSSimulationSelectors" , [ 'ISF_DefaultAFIIGeant4Selector' ] ) kwargs.setdefault("CavernSimulationSelectors" , [ 'ISF_DefaultParticleKillerSelector' ] ) diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h index c1655f550908fbdbaa7f93bfe442b7cfbbd6c123..f020097eb5dff69f0e7af1e8162bfe2d1660e65d 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -39,6 +39,7 @@ namespace ISF { float m_cut_maxMomEta; //!< maximum pseudorapidity of particle momentum double m_cut_minMom2; //!< minimum squarde particle momentum magnitude double m_cut_maxMom2; //!< maximum squared particle momentum magnitude + double m_cut_maxEkin; //!< maximum particle kinetic energy float m_cut_charge; //!< particle charge int m_cut_pdg; //!< particle PDG code }; diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc index 6926d9260b10e13cc794495578b0465095122679..ea0a3934106bfb4cac0f04cf149a7ec5e0256a61 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/KinematicParticleCuts.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -17,6 +17,7 @@ ISF::KinematicParticleCuts::KinematicParticleCuts() : m_cut_maxMomEta( 99.f), m_cut_minMom2(-1.), m_cut_maxMom2(-1.), + m_cut_maxEkin(-1.), m_cut_charge(ISF_UNDEF_CHARGE), m_cut_pdg(0) { diff --git a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt index 458b240a713a751dbd611fe8359d19f24b20f88a..c45118e877e807a7f3c8c74598fdf6d69aa81a02 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt +++ b/Simulation/ISF/ISF_SimulationSelectors/CMakeLists.txt @@ -7,13 +7,14 @@ atlas_subdir( ISF_SimulationSelectors ) # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) +find_package( HepPDT ) # Component(s) in the package: atlas_add_component( ISF_SimulationSelectors src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib GaudiKernel BarcodeServicesLib ISF_Event ISF_InterfacesLib ISF_TrackingInterfacesLib ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib GaudiKernel BarcodeServicesLib ISF_Event ISF_InterfacesLib ISF_TrackingInterfacesLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py index 6c6900c4f7f6f8c2f36d86631b38675db31158b0..9e71c9a09f31734ee1f129ff3351867a3847e955 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py +++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ ISF_SimulationSelectors configurations for ISF Elmar Ritsch, 04/02/2013 @@ -159,6 +159,36 @@ def getPionAFIIGeant4Selector(name="ISF_PionAFIIGeant4Selector", **kwargs): kwargs.setdefault('SimulationFlavor', SimulationFlavor.Geant4) return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) +def getPionG4FastCaloGeant4Selector(name="ISF_PionG4FastCaloGeant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 200) + kwargs.setdefault('ParticlePDG' , 211) + kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + +def getProtonG4FastCaloGeant4Selector(name="ISF_ProtonG4FastCaloGeant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 2212) + kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + +def getNeutronG4FastCaloGeant4Selector(name="ISF_NeutronG4FastCaloGeant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 2112) + kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + +def getChargedKaonG4FastCaloGeant4Selector(name="ISF_ChargedKaonG4FastCaloGeant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 321) + kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + +def getKLongG4FastCaloGeant4Selector(name="ISF_KLongG4FastCaloGeant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 130) + kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + def getPionAFII_QS_Geant4Selector(name="ISF_PionAFII_QS_Geant4Selector", **kwargs): kwargs.setdefault('Simulator' , 'ISF_AFII_QS_Geant4SimSvc') return getPionAFIIGeant4Selector(name, **kwargs) diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py index 07f87b876cdb2e41df8ed34f19aba18834ec7f45..4fa66b226056da57755e18b477b45e053511b3b8 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py +++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Configuration database for ISF_SimulationSelectors Elmar Ritsch, 10/11/2014 @@ -12,6 +12,11 @@ addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getMuonGeant4Sele addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFIIGeant4Selector" , "ISF_ProtonAFIIGeant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFII_QS_Geant4Selector" , "ISF_ProtonAFII_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFIIGeant4Selector" , "ISF_PionAFIIGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionG4FastCaloGeant4Selector" , "ISF_PionG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonG4FastCaloGeant4Selector" , "ISF_ProtonG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getNeutronG4FastCaloGeant4Selector" , "ISF_NeutronG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonG4FastCaloGeant4Selector" , "ISF_ChargedKaonG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getKLongG4FastCaloGeant4Selector" , "ISF_KLongG4FastCaloGeant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFII_QS_Geant4Selector" , "ISF_PionAFII_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFIIGeant4Selector" , "ISF_ChargedKaonAFIIGeant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFII_QS_Geant4Selector" , "ISF_ChargedKaonAFII_QS_Geant4Selector" ) diff --git a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx index 74be16e56c25f68b3504453b6e940b2b8241e11a..f3e081da00ba76f427b6317ef5e306803c6e3d9f 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx +++ b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -9,17 +9,23 @@ // class include #include "KinematicSimSelector.h" +#include "HepPDT/ParticleDataTable.hh" +#include "HepPDT/ParticleData.hh" + + /** Constructor **/ ISF::KinematicSimSelector::KinematicSimSelector(const std::string& t, const std::string& n, const IInterface* p) : BaseSimulationSelector(t,n,p) , KinematicParticleCuts() + , m_partPropSvc("PartPropSvc", name()) { declareProperty("MinPosEta", m_cut_minPosEta , "Minimum Position Pseudorapidity" ); declareProperty("MaxPosEta", m_cut_maxPosEta , "Maximum Position Pseudorapidity" ); declareProperty("MinMomEta", m_cut_minMomEta , "Minimum Momentum Pseudorapidity" ); declareProperty("MaxMomEta", m_cut_maxMomEta , "Maximum Momentum Pseudorapidity" ); declareProperty("MinMom", m_cut_minMom2 , "Minimum Particle Momentum" ); - declareProperty("MaxMom", m_cut_maxMom2 , "Maximum Particle Moemntum" ); + declareProperty("MaxMom", m_cut_maxMom2 , "Maximum Particle Momentum" ); + declareProperty("MaxEkin", m_cut_maxEkin , "Maximum Particle Kinetic Energy" ); declareProperty("Charge", m_cut_charge , "Particle Charge" ); declareProperty("ParticlePDG", m_cut_pdg , "Particle PDG Code" ); } @@ -33,11 +39,30 @@ ISF::KinematicSimSelector::~KinematicSimSelector() StatusCode ISF::KinematicSimSelector::initialize() { ATH_MSG_VERBOSE("Initializing ..."); + ATH_CHECK(m_partPropSvc.retrieve()); + + HepPDT::ParticleDataTable* particleDataTable; + particleDataTable = (HepPDT::ParticleDataTable*) m_partPropSvc->PDT(); + + if(particleDataTable == 0) + { + ATH_MSG_ERROR("PDG table not found"); + return StatusCode::FAILURE; + } + + const HepPDT::ParticleData* data = particleDataTable->particle(HepPDT::ParticleID(abs(m_cut_pdg))); + + double mass = 0; + if(data) mass = data->mass().value(); + // compute and store the square of the momentum cuts (faster comparisons) if ( !(m_cut_minMom2<0.)) m_cut_minMom2 *= m_cut_minMom2; if ( !(m_cut_maxMom2<0.)) m_cut_maxMom2 *= m_cut_maxMom2; + // if use kinetic energy + if(!(m_cut_maxEkin < 0.)) m_cut_maxMom2 = m_cut_maxEkin * (m_cut_maxEkin + 2 * mass); + return StatusCode::SUCCESS; } diff --git a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h index 503a13b80af04f9d3bcd6cbe7aec279505e2c30c..e45215ce8ff29370cbf718d3bc3290dc9bed2a3b 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h +++ b/Simulation/ISF/ISF_SimulationSelectors/src/KinematicSimSelector.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -9,6 +9,9 @@ #ifndef ISF_TOOLS_KINEMATICSIMSELECTOR_H #define ISF_TOOLS_KINEMATICSIMSELECTOR_H 1 +#include "GaudiKernel/IPartPropSvc.h" + + // ISF includes #include "ISF_Event/KinematicParticleCuts.h" #include "BaseSimulationSelector.h" @@ -25,6 +28,8 @@ namespace ISF class KinematicSimSelector final : public BaseSimulationSelector, public KinematicParticleCuts { + ServiceHandle<IPartPropSvc> m_partPropSvc; + public: /** Constructor with parameters */ KinematicSimSelector( const std::string& t, const std::string& n, const IInterface* p );