From d6e00d06cbbdff7b58cb8b1ac75d0defe64867c3 Mon Sep 17 00:00:00 2001 From: Tadej Novak <tadej.novak@cern.ch> Date: Fri, 8 Oct 2021 11:47:58 +0200 Subject: [PATCH] Properly define ITk volumes to G4 --- .../python/SubDetectorEnvelopesConfigNew.py | 4 ++-- .../python/G4AtlasUserActionConfigNew.py | 3 ++- .../G4AtlasTools/python/G4FieldConfigNew.py | 11 +++++++++- .../G4AtlasTools/python/G4GeometryConfig.py | 5 +---- .../python/G4GeometryToolConfig.py | 6 ++++- .../python/G4PhysicsRegionConfigNew.py | 5 ++++- .../python/MCTruthBaseConfigNew.py | 2 ++ .../src/helper/G4DebuggingHelper.cxx | 10 ++++++++- .../G4ProfilingTools/src/TestActionTimer.cxx | 19 ++++++++++++++-- .../G4ProfilingTools/src/TestActionTimer.h | 4 ++-- .../src/TestActionTimerTool.cxx | 6 ++--- .../src/VolumeTreeNavigator.cxx | 4 ++-- .../python/ISF_Geant4CommonToolsConfigNew.py | 22 ++++++++++++++++++- .../ISF_Geant4Event/src/ISFG4GeoHelper.cxx | 3 ++- .../python/ISF_Geant4ServicesConfigNew.py | 4 ++-- .../src/TrackProcessorUserActionFullG4.cxx | 7 +++--- .../src/TrackProcessorUserActionFullG4.h | 8 +++---- .../TrackProcessorUserActionFullG4Tool.cxx | 3 ++- 18 files changed, 94 insertions(+), 32 deletions(-) diff --git a/AtlasGeometryCommon/SubDetectorEnvelopes/python/SubDetectorEnvelopesConfigNew.py b/AtlasGeometryCommon/SubDetectorEnvelopes/python/SubDetectorEnvelopesConfigNew.py index 27c4db91697..38cd6ae3541 100644 --- a/AtlasGeometryCommon/SubDetectorEnvelopes/python/SubDetectorEnvelopesConfigNew.py +++ b/AtlasGeometryCommon/SubDetectorEnvelopes/python/SubDetectorEnvelopesConfigNew.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration """ SubDetectorEnvelopes configurations for AtlasGeometryCommon @@ -13,8 +13,8 @@ DetDescrDBEnvelopeSvc=CompFactory.DetDescrDBEnvelopeSvc def EnvelopeDefSvcCfg(ConfigFlags, name="AtlasGeometry_EnvelopeDefSvc", **kwargs): result = ComponentAccumulator() - kwargs.setdefault("DBInDetNode" , 'InDetEnvelope' ) kwargs.setdefault("DBBeamPipeNode" , 'BeamPipeEnvelope' ) + kwargs.setdefault("DBInDetNode" , 'InDetEnvelope' if ConfigFlags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3'] else 'ITkEnvelope' ) kwargs.setdefault("DBCaloNode" , 'CaloEnvelope' ) kwargs.setdefault("DBMSNode" , 'MuonEnvelope' ) kwargs.setdefault("DBCavernNode" , 'CavernEnvelope' ) diff --git a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py index e41234e5ee0..ca856e7bb7e 100644 --- a/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasServices/python/G4AtlasUserActionConfigNew.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -31,6 +31,7 @@ def FullG4TrackProcessorUserActionToolCfg(flags, name="FullG4TrackProcessorUserA kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc")) if flags.Detector.GeometryCavern: kwargs.setdefault("TruthVolumeLevel", 2) + kwargs.setdefault("IsITkGeometry", flags.GeoModel.Run not in ['RUN1', 'RUN2', 'RUN3']) result.setPrivateTools(CompFactory.G4UA.iGeant4.TrackProcessorUserActionFullG4Tool(name, **kwargs)) return result diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py b/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py index 72a9ef731d0..5f04528e1f9 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4FieldConfigNew.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration # ComponentAccumulator based configuration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -62,6 +62,15 @@ def InDetFieldManagerToolCfg(ConfigFlags, name='InDetFieldManager', **kwargs): kwargs.setdefault('MinimumEpsilonStep', 0.00001) return BasicDetectorFieldManagerToolCfg(ConfigFlags, name, **kwargs) +def ITkFieldManagerToolCfg(ConfigFlags, name='ITkFieldManager', **kwargs): + kwargs.setdefault("LogicalVolumes", ['ITK::ITK']) + #kwargs.setdefault('DeltaChord', 0.00001) + kwargs.setdefault('DeltaIntersection', 0.00001) + kwargs.setdefault('DeltaOneStep', 0.0001) + kwargs.setdefault('MaximumEpsilonStep', 0.001) + kwargs.setdefault('MinimumEpsilonStep', 0.00001) + return BasicDetectorFieldManagerToolCfg(ConfigFlags, name, **kwargs) + def MuonsOnlyInCaloFieldManagerToolCfg(ConfigFlags, name='MuonsOnlyInCaloFieldManager', **kwargs): kwargs.setdefault("LogicalVolumes", ['CALO::CALO']) #kwargs.setdefault('DeltaChord', 0.00000002) diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py index 541f0219f31..05b49921bf9 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryConfig.py @@ -65,7 +65,6 @@ def getCavernInfraGeoDetectorTool(name='CavernInfra', **kwargs): def getIDETEnvelope(name="IDET", **kwargs): from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags - isUpgrade = commonGeoFlags.Run()=="RUN4" or (commonGeoFlags.Run()=="UNDEFINED" and geoFlags.isSLHC()) isRUN2 = (commonGeoFlags.Run() in ["RUN2", "RUN3"]) or (commonGeoFlags.Run()=="UNDEFINED" and geoFlags.isIBL()) #isRUN1 = not (isRUN2 or isUpgrade) @@ -73,8 +72,6 @@ def getIDETEnvelope(name="IDET", **kwargs): innerRadius = 37.*mm # RUN1 default if isRUN2: innerRadius = 28.9*mm #29.15*mm - if isUpgrade: - innerRadius = 32.15*mm kwargs.setdefault("InnerRadius", innerRadius) kwargs.setdefault("OuterRadius", 1.148*m) kwargs.setdefault("dZ", 347.5*cm) @@ -84,7 +81,7 @@ def getIDETEnvelope(name="IDET", **kwargs): SubDetectorList += ['Pixel'] if DetFlags.geometry.SCT_on(): SubDetectorList += ['SCT'] - if DetFlags.geometry.TRT_on() and not isUpgrade: + if DetFlags.geometry.TRT_on(): SubDetectorList += ['TRT'] SubDetectorList += ['IDetServicesMat'] kwargs.setdefault("SubDetectors", SubDetectorList) diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py index f6ccbe12ebd..4ec431ec8fd 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4GeometryToolConfig.py @@ -11,7 +11,7 @@ from G4AtlasTools.G4PhysicsRegionConfigNew import SX1PhysicsRegionToolCfg, Bedro from G4AtlasTools.G4PhysicsRegionConfigNew import DriftWallPhysicsRegionToolCfg, DriftWall1PhysicsRegionToolCfg, DriftWall2PhysicsRegionToolCfg, MuonSystemFastPhysicsRegionToolCfg #the field config tools -from G4AtlasTools.G4FieldConfigNew import ATLASFieldManagerToolCfg, TightMuonsATLASFieldManagerToolCfg, BeamPipeFieldManagerToolCfg, InDetFieldManagerToolCfg, MuonsOnlyInCaloFieldManagerToolCfg, MuonFieldManagerToolCfg, Q1FwdFieldManagerToolCfg, Q2FwdFieldManagerToolCfg, Q3FwdFieldManagerToolCfg, D1FwdFieldManagerToolCfg, D2FwdFieldManagerToolCfg, Q4FwdFieldManagerToolCfg, Q5FwdFieldManagerToolCfg, Q6FwdFieldManagerToolCfg, Q7FwdFieldManagerToolCfg, Q1HKickFwdFieldManagerToolCfg, Q1VKickFwdFieldManagerToolCfg, Q2HKickFwdFieldManagerToolCfg, Q2VKickFwdFieldManagerToolCfg, Q3HKickFwdFieldManagerToolCfg, Q3VKickFwdFieldManagerToolCfg, Q4VKickAFwdFieldManagerToolCfg, Q4HKickFwdFieldManagerToolCfg, Q4VKickBFwdFieldManagerToolCfg, Q5HKickFwdFieldManagerToolCfg, Q6VKickFwdFieldManagerToolCfg, FwdRegionFieldManagerToolCfg +from G4AtlasTools.G4FieldConfigNew import ATLASFieldManagerToolCfg, TightMuonsATLASFieldManagerToolCfg, BeamPipeFieldManagerToolCfg, InDetFieldManagerToolCfg, ITkFieldManagerToolCfg, MuonsOnlyInCaloFieldManagerToolCfg, MuonFieldManagerToolCfg, Q1FwdFieldManagerToolCfg, Q2FwdFieldManagerToolCfg, Q3FwdFieldManagerToolCfg, D1FwdFieldManagerToolCfg, D2FwdFieldManagerToolCfg, Q4FwdFieldManagerToolCfg, Q5FwdFieldManagerToolCfg, Q6FwdFieldManagerToolCfg, Q7FwdFieldManagerToolCfg, Q1HKickFwdFieldManagerToolCfg, Q1VKickFwdFieldManagerToolCfg, Q2HKickFwdFieldManagerToolCfg, Q2VKickFwdFieldManagerToolCfg, Q3HKickFwdFieldManagerToolCfg, Q3VKickFwdFieldManagerToolCfg, Q4VKickAFwdFieldManagerToolCfg, Q4HKickFwdFieldManagerToolCfg, Q4VKickBFwdFieldManagerToolCfg, Q5HKickFwdFieldManagerToolCfg, Q6VKickFwdFieldManagerToolCfg, FwdRegionFieldManagerToolCfg from G4AtlasTools.G4AtlasToolsConfigNew import SensitiveDetectorMasterToolCfg @@ -623,6 +623,10 @@ def ATLAS_FieldMgrListCfg(ConfigFlags): acc = InDetFieldManagerToolCfg(ConfigFlags) tool = result.popToolsAndMerge(acc) fieldMgrList += [tool] + if ConfigFlags.Detector.GeometryITk: + acc = ITkFieldManagerToolCfg(ConfigFlags) + tool = result.popToolsAndMerge(acc) + fieldMgrList += [tool] #if ConfigFlags.Detector.GeometryCalo and simFlags.MuonFieldOnlyInCalo.statusOn and simFlags.MuonFieldOnlyInCalo(): if False: acc = MuonsOnlyInCaloFieldManagerToolCfg(ConfigFlags) diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4PhysicsRegionConfigNew.py b/Simulation/G4Atlas/G4AtlasTools/python/G4PhysicsRegionConfigNew.py index f795c0f2e9e..32ec5769d1f 100644 --- a/Simulation/G4Atlas/G4AtlasTools/python/G4PhysicsRegionConfigNew.py +++ b/Simulation/G4Atlas/G4AtlasTools/python/G4PhysicsRegionConfigNew.py @@ -274,7 +274,10 @@ def MuonSystemFastPhysicsRegionToolCfg(ConfigFlags, name='MuonSystemFastPhysicsR kwargs.setdefault("RegionName", 'MuonSystemFastRegion') volumeList = [] if ConfigFlags.Sim.CavernBG == 'World': - volumeList += ['BeamPipe::BeamPipe', 'IDET::IDET'] + if ConfigFlags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: + volumeList += ['BeamPipe::BeamPipe', 'IDET::IDET'] + else: + volumeList += ['BeamPipe::BeamPipe', 'ITK::ITK'] volumeList = ['Muon::MuonSys'] kwargs.setdefault("VolumeList", volumeList) kwargs.setdefault("ElectronCut", 1.0) diff --git a/Simulation/G4Sim/MCTruthBase/python/MCTruthBaseConfigNew.py b/Simulation/G4Sim/MCTruthBase/python/MCTruthBaseConfigNew.py index 59d32a72dcb..b06629360c8 100644 --- a/Simulation/G4Sim/MCTruthBase/python/MCTruthBaseConfigNew.py +++ b/Simulation/G4Sim/MCTruthBase/python/MCTruthBaseConfigNew.py @@ -40,6 +40,8 @@ def getEnvelopeMap(ConfigFlags): if not ConfigFlags.Sim.ISFRun: if ConfigFlags.Detector.GeometryID: envelopeMap['IDET::IDET'] = 'CaloEntryLayer' + if ConfigFlags.Detector.GeometryITk: + envelopeMap['ITK::ITK'] = 'CaloEntryLayer' if ConfigFlags.Detector.GeometryCalo: envelopeMap['CALO::CALO'] = 'MuonEntryLayer' if ConfigFlags.Detector.GeometryMuon: #was geometry in old style, should it be? diff --git a/Simulation/G4Utilities/G4DebuggingTools/src/helper/G4DebuggingHelper.cxx b/Simulation/G4Utilities/G4DebuggingTools/src/helper/G4DebuggingHelper.cxx index 60c9cd2bc17..fbdf6a98d15 100644 --- a/Simulation/G4Utilities/G4DebuggingTools/src/helper/G4DebuggingHelper.cxx +++ b/Simulation/G4Utilities/G4DebuggingTools/src/helper/G4DebuggingHelper.cxx @@ -101,6 +101,12 @@ namespace G4DebuggingHelpers { || nom.contains("station") ) { return "Muon"; } + else if ( nom.length() >= 8 && nom.substr(0, 8) == "ITkPixel" ) { + return "ITkPixel"; + } + else if ( nom.length() >= 8 && nom.substr(0, 8) == "ITkStrip" ) { + return "ITkStrip"; + } else if ( ( nom.length() >= 5 && nom.substr(0, 5) == "Pixel" ) || nom == "Outside Barrel Service") { return "Pixel"; @@ -119,9 +125,11 @@ namespace G4DebuggingHelpers { return "Section"; else if ( ( nom.length() >= 12 && nom.substr(0, 12) == "InDetServMat" ) || ( nom.length() >= 4 && nom.substr(0, 4) == "IDET" ) + || ( nom.length() >= 3 && nom.substr(0, 3) == "ITK" ) || ( nom.length() >= 8 && nom.substr(0, 8) == "BeamPipe" ) || ( nom.length() >= 3 && - ( nom.substr(0, 3) == "BLM" || nom.substr(0, 3) == "BCM" ) ) ) { + ( nom.substr(0, 3) == "BLM" || nom.substr(0, 3) == "BCM" || nom.substr(0, 3) == "PLR" ) ) + || ( nom.length() >= 8 && nom.substr(0, 8) == "BCMPrime") ) { return "Service"; } return "other"; diff --git a/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.cxx b/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.cxx index 2879b8e2816..56978d37d49 100644 --- a/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.cxx +++ b/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -60,6 +60,8 @@ namespace G4UA m_report.timeName[eCry] = "Cry"; m_report.timeName[eLAr] = "LAr"; m_report.timeName[eHCB] = "HCB"; + m_report.timeName[eITkPix] = "ITkPixel"; + m_report.timeName[eITkStrip] = "ITkStrip"; m_report.timeName[ePre] = "Pre"; m_report.timeName[eMu] = "Mu"; m_report.timeName[ePx] = "Px"; @@ -304,6 +306,14 @@ namespace G4UA nom.contains("station") ){ return eMu; } + else if ( nom.length() >= 8 && + nom(0,8) == "ITkPixel" ){ + return eITkPix; + } + else if ( nom.length() >= 8 && + nom(0,8) == "ITkStrip" ){ + return eITkStrip; + } else if ((nom.length() >= 5 && nom(0,5) == "Pixel") || nom == "Outside Barrel Service"){ @@ -326,13 +336,18 @@ namespace G4UA nom(0,12) == "InDetServMat" ) || ( nom.length() >= 4 && nom(0,4) == "IDET" ) || + ( nom.length() >= 3 && + nom(0,3) == "ITK" ) || ( nom.length() >= 8 && nom(0,8) == "BeamPipe" ) || ( nom.length() >= 7 && nom(0,7) == "Section" ) || ( nom.length() >= 3 && ( nom(0,3) == "BLM" || - nom(0,3) == "BCM" ) ) ){ + nom(0,3) == "BCM" || + nom(0,3) == "PLR" ) ) || + ( nom.length() >= 8 && + nom(0,8) == "BCMPrime" ) ){ return eSev; } return eOther; diff --git a/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.h b/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.h index 750afde193d..21b2d3abbff 100644 --- a/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.h +++ b/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimer.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -92,7 +92,7 @@ namespace G4UA First timers are by subdetector, second few are by particle These are not straightforward for the non-expert to interpret*/ enum { eEMB, eEMEC, eFC1, eFC23, eFCO, eHEC, eCry, eLAr, eHCB, - ePre, eMu, ePx, eSct, eSev, eTrt, eOther, + ePre, eMu, ePx, eSct, eITkPix, eITkStrip, eSev, eTrt, eOther, eElec, ePos, eGam, eNeut, eMax }; private: diff --git a/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimerTool.cxx b/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimerTool.cxx index 22110620007..22e827354f8 100644 --- a/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimerTool.cxx +++ b/Simulation/G4Utilities/G4ProfilingTools/src/TestActionTimerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "TestActionTimerTool.h" @@ -71,7 +71,7 @@ namespace G4UA ATH_MSG_INFO("FCAL\t" << (report.time[TestActionTimer::eFC1]+report.time[TestActionTimer::eFC23]+report.time[TestActionTimer::eFCO])/report.nev); ATH_MSG_INFO("HEC\t" << (report.time[TestActionTimer::eHEC])/report.nev); ATH_MSG_INFO("Tile\t" << (report.time[TestActionTimer::eHCB])/report.nev); - ATH_MSG_INFO("Tracker\t" << (report.time[TestActionTimer::ePx]+report.time[TestActionTimer::eSct]+report.time[TestActionTimer::eTrt]+report.time[TestActionTimer::eSev])/report.nev); + ATH_MSG_INFO("Tracker\t" << (report.time[TestActionTimer::ePx]+report.time[TestActionTimer::eSct]+report.time[TestActionTimer::eITkPix]+report.time[TestActionTimer::eITkStrip]+report.time[TestActionTimer::eTrt]+report.time[TestActionTimer::eSev])/report.nev); ATH_MSG_INFO("Muons\t" << (report.time[TestActionTimer::eMu])/report.nev); ATH_MSG_INFO("Oth.LAr\t" << (report.time[TestActionTimer::ePre]+report.time[TestActionTimer::TestActionTimer::eCry]+report.time[TestActionTimer::eLAr])/report.nev); ATH_MSG_INFO("Other\t" << (report.time[TestActionTimer::eOther])/report.nev); @@ -82,7 +82,7 @@ namespace G4UA ATH_MSG_INFO("FCAL\t" << (report.time[TestActionTimer::eFC1]+report.time[TestActionTimer::eFC23]+report.time[TestActionTimer::eFCO])/report.runTime*100.); ATH_MSG_INFO("HEC\t" << (report.time[TestActionTimer::eHEC])/report.runTime*100.); ATH_MSG_INFO("Tile\t" << (report.time[TestActionTimer::eHCB])/report.runTime*100.); - ATH_MSG_INFO("Tracker\t" << (report.time[TestActionTimer::ePx]+report.time[TestActionTimer::eSct]+report.time[TestActionTimer::eTrt]+report.time[TestActionTimer::eSev])/report.runTime*100.); + ATH_MSG_INFO("Tracker\t" << (report.time[TestActionTimer::ePx]+report.time[TestActionTimer::eSct]+report.time[TestActionTimer::eITkPix]+report.time[TestActionTimer::eITkStrip]+report.time[TestActionTimer::eTrt]+report.time[TestActionTimer::eSev])/report.runTime*100.); ATH_MSG_INFO("Muons\t" << (report.time[TestActionTimer::eMu])/report.runTime*100.); ATH_MSG_INFO("Oth.LAr\t" << (report.time[TestActionTimer::ePre]+report.time[TestActionTimer::eCry]+report.time[TestActionTimer::eLAr])/report.runTime*100.); ATH_MSG_INFO("Other\t" << (report.time[TestActionTimer::eOther])/report.runTime*100.); diff --git a/Simulation/G4Utilities/G4ProfilingTools/src/VolumeTreeNavigator.cxx b/Simulation/G4Utilities/G4ProfilingTools/src/VolumeTreeNavigator.cxx index 2c3f60ce3d7..7414237b908 100644 --- a/Simulation/G4Utilities/G4ProfilingTools/src/VolumeTreeNavigator.cxx +++ b/Simulation/G4Utilities/G4ProfilingTools/src/VolumeTreeNavigator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ void VolumeTreeNavigator::SetDepthCutSimple(const int CALO, const int BeamPipe, string name = stringify(m_history[1].first->GetName()); if (name == "CALO::CALO") cut = CALO+1; else if (name == "BeamPipe::BeamPipe") cut = BeamPipe+1; - else if (name == "IDET::IDET") cut = IDET+1; + else if (name == "IDET::IDET" || name == "ITK::ITK") cut = IDET+1; else if (name == "MUONQ02::MUONQ02") cut = MUONQ02+1; else { log<< MSG::INFO <<"Level 1 volume not found, output default depth"<< endmsg; } } diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py index 2b0f8fb50f3..930cf06cec8 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py @@ -1,6 +1,6 @@ """ComponentAccumulator Geant4 tools config for ISF -Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration """ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -17,6 +17,11 @@ def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) + if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: + kwargs.setdefault("CaloEntryVolumeString", "IDET::IDET") + else: + kwargs.setdefault("CaloEntryVolumeString", "ITK::ITK") + if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") acc.addService(OEsvc) @@ -35,6 +40,11 @@ def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) + if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: + kwargs.setdefault("CaloEntryVolumeString", "IDET::IDET") + else: + kwargs.setdefault("CaloEntryVolumeString", "ITK::ITK") + if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") acc.addService(OEsvc) @@ -53,6 +63,11 @@ def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs): filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) + if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: + kwargs.setdefault("CaloEntryVolumeString", "IDET::IDET") + else: + kwargs.setdefault("CaloEntryVolumeString", "ITK::ITK") + if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") acc.addService(OEsvc) @@ -71,6 +86,11 @@ def AFIIEntryLayerToolMTCfg(flags, name="ISF_AFIIEntryLayerToolMT", **kwargs): filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) kwargs.setdefault("ParticleFilters", [filt]) + if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3']: + kwargs.setdefault("CaloEntryVolumeString", "IDET::IDET") + else: + kwargs.setdefault("CaloEntryVolumeString", "ITK::ITK") + if flags.Sim.DoFullChain: OEsvc = CompFactory.StoreGateSvc("OriginalEvent_SG") acc.addService(OEsvc) diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4GeoHelper.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4GeoHelper.cxx index 4763d95f710..b1cf73fee5f 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4GeoHelper.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4GeoHelper.cxx @@ -31,7 +31,7 @@ iGeant4::ISFG4GeoHelper::nextGeoId(const G4Step* aStep, int truthVolLevel, ISF:: if ( !(*lvs)[i] ) { continue; } if ( (*lvs)[i]->GetName() == "BeamPipe::BeamPipe" ) { BPholder = (*lvs)[i]; } - else if ( (*lvs)[i]->GetName() == "IDET::IDET" ) { IDholder = (*lvs)[i]; } + else if ( (*lvs)[i]->GetName() == "IDET::IDET" || (*lvs)[i]->GetName() == "ITK::ITK" ) { IDholder = (*lvs)[i]; } else if ( (*lvs)[i]->GetName() == "CALO::CALO" ) { CALOholder = (*lvs)[i]; } else if ( (*lvs)[i]->GetName() == "MUONQ02::MUONQ02" ) { MUholder = (*lvs)[i]; } else if ( (*lvs)[i]->GetName() == "TTR_BARREL::TTR_BARREL" ) {TTRholder = (*lvs)[i]; } @@ -116,6 +116,7 @@ bool iGeant4::ISFG4GeoHelper::checkVolumeDepth(G4LogicalVolume* lv, int volLevel if ( lv->GetName() == "BeamPipe::BeamPipe" || lv->GetName() == "IDET::IDET" || + lv->GetName() == "ITK::ITK" || lv->GetName() == "CALO::CALO" || lv->GetName() == "MUONQ02::MUONQ02" || lv->GetName() == "TTR_BARREL::TTR_BARREL" ) { diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfigNew.py index 4aa7376992c..8d7a985c2d3 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Services/python/ISF_Geant4ServicesConfigNew.py @@ -1,6 +1,6 @@ """Geant4 services config for ISF with ComponentAccumulator -Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration """ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -15,7 +15,7 @@ def Geant4SimCfg(flags, name="ISFG4SimSvc", **kwargs): G4_DDDBEnvelopeDefSvc = CompFactory.DetDescrDBEnvelopeSvc("G4EnvelopeDefSvc") G4_DDDBEnvelopeDefSvc.DBBeamPipeNode = "BPipeEnvelopeG4" - G4_DDDBEnvelopeDefSvc.DBInDetNode = "InDetEnvelopeG4" + G4_DDDBEnvelopeDefSvc.DBInDetNode = "InDetEnvelopeG4" if flags.GeoModel.Run in ['RUN1', 'RUN2', 'RUN3'] else "ITkEnvelopeG4" G4_DDDBEnvelopeDefSvc.DBCaloNode = "CaloEnvelopeG4" G4_DDDBEnvelopeDefSvc.DBMSNode = "MuonEnvelopeG4" G4_DDDBEnvelopeDefSvc.DBCavernNode = "CavernEnvelopeG4" diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx index 145e6d77553..31e69527687 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // class header @@ -73,7 +73,7 @@ namespace G4UA{ m_entryLayerMap["CALO::CALO"] = m_config.truthVolLevel+1; m_entryLayerMap["MUONQ02::MUONQ02"] = m_config.truthVolLevel+1; - m_entryLayerMap["IDET::IDET"] = m_config.truthVolLevel+1; + m_entryLayerMap[m_config.isITkGeometry ? "ITK::ITK" : "IDET::IDET"] = m_config.truthVolLevel+1; } @@ -207,7 +207,8 @@ namespace G4UA{ ISF::EntryLayer layer=ISF::fUnsetEntryLayer; if (pass) { - if (vname1=="IDET::IDET") layer=ISF::fAtlasCaloEntry; + if (!m_config.isITkGeometry && vname1=="IDET::IDET") layer=ISF::fAtlasCaloEntry; + else if ( m_config.isITkGeometry && vname1=="ITK::ITK") layer=ISF::fAtlasCaloEntry; else if (vname1=="CALO::CALO") layer=ISF::fAtlasMuonEntry; else if (vname1=="MUONQ02::MUONQ02") layer=ISF::fAtlasMuonExit; } diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.h b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.h index 91088c41fef..0848f2c9d5e 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.h +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ @@ -38,15 +38,15 @@ namespace G4UA{ Config() = delete; Config(const std::string& name): entryLayerTool(""), - geoIDSvc("",name), - truthVolLevel(1) + geoIDSvc("",name) {} /** access to the ISF Entry Layer tool which is used to record entry-layer collections */ ToolHandle<ISF::IEntryLayerTool> entryLayerTool; /** access to the central ISF GeoID service*/ ServiceHandle<ISF::IGeoIDSvc> geoIDSvc; - int truthVolLevel; + int truthVolLevel{1}; unsigned int verboseLevel=0; + bool isITkGeometry{}; }; TrackProcessorUserActionFullG4(const Config& config); diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4Tool.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4Tool.cxx index 768cc48873e..f339ba775bd 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4Tool.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4Tool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "TrackProcessorUserActionFullG4Tool.h" @@ -20,6 +20,7 @@ namespace G4UA declareProperty("EntryLayerTool", m_config.entryLayerTool, "ISF Entry Layer Tool"); declareProperty("GeoIDSvc", m_config.geoIDSvc, "ISF GeoIDService" ); declareProperty("TruthVolumeLevel", m_config.truthVolLevel, "Level in geo hierarchy for the truth volumes"); + declareProperty("IsITkGeometry", m_config.isITkGeometry, "toggle for ITk"); } std::unique_ptr<TrackProcessorUserActionFullG4> -- GitLab