1 """ComponentAccumulator service configuration for ISF
3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from SimulationConfig.SimEnums
import TruthStrategy
8 from ISF_HepMC_Tools.ISF_HepMC_ToolsConfig
import (
9 KeepLLPDecayChildrenStrategyCfg,
10 KeepLLPHadronicInteractionChildrenStrategyCfg,
11 TruthStrategyGroupID_MC15Cfg,
12 TruthStrategyGroupIDHadInt_MC15Cfg,
14 TruthStrategyGroupCaloDecay_MC15Cfg,
16 TruthStrategyGroupIDCfg,
17 TruthStrategyGroupIDHadIntCfg,
18 TruthStrategyGroupCaloMuBremCfg,
19 ValidationTruthStrategyCfg,
20 FCSParamTruthStrategyCfg
22 from BarcodeServices.BarcodeServicesConfig
import BarcodeSvcCfg
23 from ISF_Geant4CommonTools.ISF_Geant4CommonToolsConfig
import (
24 EntryLayerToolCfg, ATLFAST_EntryLayerToolCfg
26 from ISF_Tools.ISF_ToolsConfig
import ParticleOrderingToolCfg
30 cppyy.include(
"AtlasDetDescr/AtlasRegion.h")
35 kwargs.setdefault(
"QuasiStableParticlesIncluded", flags.Sim.ISF.Simulator.isQuasiStable())
36 kwargs.setdefault(
"UseShadowEvent", flags.Sim.UseShadowEvent)
37 kwargs.setdefault(
"UseGeneratedParticleMass",
False)
38 if "GenParticleFilters" not in kwargs:
39 from ISF_HepMC_Tools.ISF_HepMC_ToolsConfig
import GenParticleFilterToolsCfg
41 result.addService(CompFactory.ISF.InputConverter(name, **kwargs), primary =
True)
47 if "EntryLayerTool" not in kwargs:
48 kwargs.setdefault(
"EntryLayerTool", result.addPublicTool(result.popToolsAndMerge(EntryLayerToolCfg(flags))))
49 kwargs.setdefault(
"GeoIDSvc", result.getService(
"ISF_GeoIDSvc").name)
51 kwargs.setdefault(
"AlwaysUseGeoIDSvc",
False)
52 kwargs.setdefault(
"ValidateGeoIDs", flags.Sim.ISF.ValidationMode)
53 kwargs.setdefault(
"ValidationOutput", flags.Sim.ISF.ValidationMode)
54 kwargs.setdefault(
"ValidationStreamName",
"ParticleBroker")
56 result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs), primary =
True)
66 result.addService(pbsvc, primary =
True)
73 kwargs.setdefault(
"GeoIDSvc", result.getService(
"ISF_ATLFAST_GeoIDSvc").name)
75 result.addService(pbsvc, primary =
True)
81 """Return the TruthService config flagged by Sim.TruthStrategy"""
83 TruthStrategy.MC12: MC12TruthServiceCfg,
84 TruthStrategy.MC12LLP: MC12LLPTruthServiceCfg,
85 TruthStrategy.MC12Plus: MC12PlusTruthServiceCfg,
86 TruthStrategy.MC15: MC15TruthServiceCfg,
87 TruthStrategy.MC15a: MC15aTruthServiceCfg,
88 TruthStrategy.MC15aPlus: MC15aPlusTruthServiceCfg,
89 TruthStrategy.MC15aPlusLLP: MC15aPlusLLPTruthServiceCfg,
90 TruthStrategy.MC16: MC16TruthServiceCfg,
91 TruthStrategy.MC16LLP: MC16LLPTruthServiceCfg,
92 TruthStrategy.MC18: MC18TruthServiceCfg,
93 TruthStrategy.MC18LLP: MC18LLPTruthServiceCfg,
96 TruthStrategy.Validation: ValidationTruthServiceCfg,
99 xCfg = stratmap[flags.Sim.TruthStrategy]
100 return xCfg(flags, **kwargs)
105 kwargs.setdefault(
"BarcodeSvc", result.getPrimaryAndMerge(
BarcodeSvcCfg(flags)).name)
107 kwargs.setdefault(
"SkipIfNoChildren",
True)
108 kwargs.setdefault(
"SkipIfNoParentId",
True)
109 kwargs.setdefault(
"ForceEndVtxInRegions", [])
111 if flags.Sim.ISF.Simulator.isQuasiStable():
112 kwargs.setdefault(
"QuasiStableParticlesIncluded",
True)
113 kwargs.setdefault(
"QuasiStableParticleOverwrite",
not flags.Sim.UseShadowEvent)
114 svc = CompFactory.ISF.TruthSvc(name, **kwargs)
115 result.addService(svc, primary=
True)
122 kwargs.setdefault(
"IgnoreUndefinedBarcodes",
True)
123 kwargs.setdefault(
"PassWholeVertices",
True)
125 result.addService(truthService, primary=
True)
131 return [
"ISF_MCTruthStrategyGroupID"]
135 return [
"ISF_MCTruthStrategyGroupID",
"ISF_MCTruthStrategyGroupIDHadInt"]
139 return [
"ISF_MCTruthStrategyGroupCaloMuBrem"]
148 if "TruthStrategies" not in kwargs:
150 TruthStrategyGroupIDCfg,
151 TruthStrategyGroupIDHadIntCfg,
152 TruthStrategyGroupCaloMuBremCfg,
154 truthStrats = [result.popToolsAndMerge(
cfg(flags))
for cfg
in truthCfgs]
155 kwargs.setdefault(
"TruthStrategies", truthStrats)
156 kwargs.setdefault(
"IgnoreUndefinedBarcodes",
False)
157 kwargs.setdefault(
"PassWholeVertices",
True)
159 result.addService(truthService, primary=
True)
166 TruthStrategyGroupIDCfg,
167 TruthStrategyGroupIDHadIntCfg,
168 TruthStrategyGroupCaloMuBremCfg,
171 truthStrats = [result.popToolsAndMerge(
cfg(flags))
for cfg
in truthCfgs]
172 kwargs.setdefault(
"TruthStrategies", truthStrats)
174 result.addService(truthService, primary =
True)
179 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
180 kwargs.setdefault(
"ForceEndVtxInRegions", [AtlasRegion.fAtlasID] )
186 return [
"ISF_MCTruthStrategyGroupID_MC15"]
190 return [
"ISF_MCTruthStrategyGroupID_MC15",
"ISF_MCTruthStrategyGroupIDHadInt_MC15"]
194 return [
"ISF_MCTruthStrategyGroupCaloMuBrem",
"ISF_MCTruthStrategyGroupCaloMuBrem_MC15"]
202 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
204 if "TruthStrategies" not in kwargs:
206 TruthStrategyGroupID_MC15Cfg,
207 TruthStrategyGroupIDHadInt_MC15Cfg,
208 TruthStrategyGroupCaloMuBremCfg,
209 TruthStrategyGroupCaloDecay_MC15Cfg ]
210 if flags.Sim.RecordStepInfo:
212 truthCfgs = [ FCSParamTruthStrategyCfg ]
213 truthStrats = [result.popToolsAndMerge(
cfg(flags))
for cfg
in truthCfgs]
214 kwargs.setdefault(
"TruthStrategies", truthStrats)
216 kwargs.setdefault(
"IgnoreUndefinedBarcodes",
False)
217 kwargs.setdefault(
"PassWholeVertices",
False)
218 kwargs.setdefault(
"ForceEndVtxInRegions", [AtlasRegion.fAtlasID])
220 result.addService(truthService, primary=
True)
225 kwargs.setdefault(
"ForceEndVtxInRegions", [])
230 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
232 kwargs.setdefault(
"ForceEndVtxInRegions", [AtlasRegion.fAtlasID])
239 KeepLLPDecayChildrenStrategyCfg,
240 KeepLLPHadronicInteractionChildrenStrategyCfg,
241 TruthStrategyGroupID_MC15Cfg,
242 TruthStrategyGroupIDHadInt_MC15Cfg,
243 TruthStrategyGroupCaloMuBremCfg,
244 TruthStrategyGroupCaloDecay_MC15Cfg,
247 truthStrats = [result.popToolsAndMerge(
cfg(flags))
for cfg
in truthCfgs]
248 kwargs.setdefault(
"TruthStrategies", truthStrats)
250 result.addService(truthService, primary =
True)