ATLAS Offline Software
Loading...
Searching...
No Matches
ISF_HepMC_ToolsConfig.py
Go to the documentation of this file.
1"""ComponentAccumulator HepMC tools configurations for ISF
2
3Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4"""
5from AthenaConfiguration.AccumulatorCache import AccumulatorCache
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7from AthenaConfiguration.ComponentFactory import CompFactory
8from AthenaCommon.SystemOfUnits import MeV, mm
9from ISF_Services.ISF_ServicesCoreConfig import GeoIDSvcCfg
10
11
12# GenParticleFilters
13def ParticleFinalStateFilterCfg(flags, name="ISF_ParticleFinalStateFilter", **kwargs):
14 result = ComponentAccumulator()
15 G4NotInUse = not flags.Sim.UsingGeant4
16 G4NotInUse = G4NotInUse and flags.Sim.ISFRun
17 # use CheckGenInteracting==False to allow GenEvent neutrinos to propagate into the simulation
18 kwargs.setdefault("CheckGenSimStable", G4NotInUse)
19 kwargs.setdefault("CheckGenInteracting", G4NotInUse)
20 result.setPrivateTools(CompFactory.ISF.GenParticleFinalStateFilter(name, **kwargs))
21 return result
22
23
24def ParticleSimAcceptListCfg(flags, name="ISF_ParticleSimAcceptList", **kwargs):
25 result = ComponentAccumulator()
26 kwargs.setdefault("UseShadowEvent", flags.Sim.UseShadowEvent)
27 result.setPrivateTools(CompFactory.ISF.GenParticleSimAcceptList(name, **kwargs))
28 return result
29
30
31def GenParticleSimQuasiStableFilterCfg(flags, name="ISF_GenParticleSimQuasiStableFilter", **kwargs):
32 result = ComponentAccumulator()
33 result.setPrivateTools(CompFactory.ISF.GenParticleSimQuasiStableFilter(name, **kwargs))
34 return result
35
36
37@AccumulatorCache
38def ParticleSimAcceptList_ExtraParticlesCfg(flags, name="ISF_ParticleSimAcceptList_ExtraParticles", **kwargs):
39 result = ComponentAccumulator()
40 acceptLists = ["G4particle_acceptlist.txt"]
41 # Basically a copy of code from ExtraParticles.ExtraParticlesConfig for now.
42 from ExtraParticles import PDGHelpers
43 if PDGHelpers.getPDGTABLE('PDGTABLE.MeV'):
44 parser = PDGHelpers.PDGParser('PDGTABLE.MeV', '111-556,1112-9090226')
45 parser.createList() # NB ignore output here
46 acceptLists += ["G4particle_acceptlist_ExtraParticles.txt"]
47 else:
48 print ('ERROR Failed to find PDGTABLE.MeV file')
49 kwargs.setdefault("AcceptLists" , acceptLists )
50 kwargs.setdefault("UseShadowEvent", flags.Sim.UseShadowEvent)
51 result.setPrivateTools(CompFactory.ISF.GenParticleSimAcceptList(name, **kwargs))
52 return result
53
54
55def ParticlePositionFilterCfg(flags, name="ISF_ParticlePositionFilter", **kwargs):
56 result = ComponentAccumulator()
57 # ParticlePositionFilter
58 kwargs.setdefault("GeoIDService", result.getPrimaryAndMerge(GeoIDSvcCfg(flags)))
59 result.setPrivateTools(CompFactory.ISF.GenParticlePositionFilter(name, **kwargs))
60 return result
61
62
63def ParticlePositionFilterIDCfg(flags, name="ISF_ParticlePositionFilterID", **kwargs):
64 # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
65 import ROOT, cppyy
66 cppyy.load_library("libAtlasDetDescrDict")
67 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
68
69 kwargs.setdefault("CheckRegion" , [ AtlasRegion.fAtlasID ] )
70 return ParticlePositionFilterCfg(flags, name, **kwargs)
71
72
73def ParticlePositionFilterCaloCfg(flags, name="ISF_ParticlePositionFilterCalo", **kwargs):
74 # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
75 import ROOT, cppyy
76 cppyy.load_library("libAtlasDetDescrDict")
77 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
78
79 kwargs.setdefault("CheckRegion" , [ AtlasRegion.fAtlasID,
80 AtlasRegion.fAtlasForward,
81 AtlasRegion.fAtlasCalo ] )
82 return ParticlePositionFilterCfg(flags, name, **kwargs)
83
84
85def ParticlePositionFilterMSCfg(name="ISF_ParticlePositionFilterMS", **kwargs):
86 # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
87 import ROOT, cppyy
88 cppyy.load_library("libAtlasDetDescrDict")
89 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
90
91 kwargs.setdefault("CheckRegion" , [ AtlasRegion.fAtlasID,
92 AtlasRegion.fAtlasForward,
93 AtlasRegion.fAtlasCalo,
94 AtlasRegion.fAtlasMS ] )
95 return ParticlePositionFilterCfg(name, **kwargs)
96
97
98def ParticlePositionFilterWorldCfg(flags, name="ISF_ParticlePositionFilterWorld", **kwargs):
99 # importing Reflex dictionary to access AtlasDetDescr::AtlasRegion enum
100 import ROOT, cppyy
101 cppyy.load_library("libAtlasDetDescrDict")
102 AtlasRegion = ROOT.AtlasDetDescr.AtlasRegion
103 kwargs.setdefault("CheckRegion" , [ AtlasRegion.fAtlasID,
104 AtlasRegion.fAtlasForward,
105 AtlasRegion.fAtlasCalo,
106 AtlasRegion.fAtlasMS,
107 AtlasRegion.fAtlasCavern ] )
108 return ParticlePositionFilterCfg(flags, name, **kwargs)
109
110
111def ParticlePositionFilterDynamicCfg(flags, name="ISF_ParticlePositionFilterDynamic", **kwargs):
112 # automatically choose the best fitting filter region
113
114 if flags.Detector.EnableMuon:
115 return ParticlePositionFilterWorldCfg(flags, name, **kwargs)
116 elif flags.Detector.EnableCalo:
117 return ParticlePositionFilterCaloCfg(flags, name, **kwargs)
118 elif flags.Detector.EnableID:
119 return ParticlePositionFilterIDCfg(flags, name, **kwargs)
120 else:
121 return ParticlePositionFilterWorldCfg(flags, name, **kwargs)
122
123
124def GenParticleInteractingFilterCfg(flags, name="ISF_GenParticleInteractingFilter", **kwargs):
125 result = ComponentAccumulator()
126 kwargs.setdefault("AdditionalInteractingParticleTypes", eval(flags.Input.SpecialConfiguration.get("InteractingPDGCodes", "[]")))
127 kwargs.setdefault("AdditionalNonInteractingParticleTypes", eval(flags.Input.SpecialConfiguration.get("NonInteractingPDGCodes", "[]")))
128 result.setPrivateTools(CompFactory.ISF.GenParticleInteractingFilter(name, **kwargs))
129 return result
130
131
132def EtaPhiFilterCfg(flags, name="ISF_EtaPhiFilter", **kwargs):
133 result = ComponentAccumulator()
134 # EtaPhiFilter
135 EtaRange = 7.0 if flags.Detector.EnableLucid else 6.0
136 kwargs.setdefault("MinEta" , -EtaRange)
137 kwargs.setdefault("MaxEta" , EtaRange)
138 kwargs.setdefault("MaxApplicableRadius", 30*mm)
139
140 result.setPrivateTools(CompFactory.ISF.GenParticleGenericFilter(name, **kwargs))
141 return result
142
143
145 result = ComponentAccumulator()
146 genParticleFilterList = []
147 if flags.Sim.ISF.Simulator.isQuasiStable():
148 genParticleFilterList += [result.popToolsAndMerge(ParticleSimAcceptList_ExtraParticlesCfg(flags))]
149 else:
150 genParticleFilterList += [result.popToolsAndMerge(ParticleFinalStateFilterCfg(flags))]
151 if "ATLAS" in flags.GeoModel.Layout or "atlas" in flags.GeoModel.Layout:
152 from AthenaConfiguration.Enums import BeamType
153 if flags.Beam.Type not in [BeamType.Cosmics, BeamType.TestBeam]:
154 genParticleFilterList += [result.popToolsAndMerge(ParticlePositionFilterDynamicCfg(flags))]
155 from SimulationConfig.SimEnums import CavernBackground
156 if not (flags.Detector.GeometryAFP or flags.Detector.GeometryALFA or flags.Detector.GeometryFwdRegion) \
157 and not flags.Detector.GeometryCavern \
158 and flags.Sim.CavernBackground in [CavernBackground.Off, CavernBackground.Signal]:
159 genParticleFilterList += [result.popToolsAndMerge(EtaPhiFilterCfg(flags))]
160 genParticleFilterList += [result.popToolsAndMerge(GenParticleInteractingFilterCfg(flags))]
161 result.setPrivateTools(genParticleFilterList)
162 return result
163
164
165def TruthPreselectionToolCfg(flags, name="TruthPreselectionTool", **kwargs):
166 result = ComponentAccumulator()
167 kwargs.setdefault( "GenParticleFilters", result.popToolsAndMerge(GenParticleFilterToolsCfg(flags)) )
168 kwargs.setdefault("QuasiStableParticleFilter", result.popToolsAndMerge(GenParticleSimQuasiStableFilterCfg(flags)))
169 result.setPrivateTools(CompFactory.ISF.TruthPreselectionTool(name, **kwargs))
170 return result
171
172#--------------------------------------------------------------------------------------------------
173
174
175# Brems: fBremsstrahlung (3)
176# Conversion: fGammaConversion (14), fGammaConversionToMuMu (15), fPairProdByCharged (4)
177# Decay: 201-298, fAnnihilation(5), fAnnihilationToMuMu (6), fAnnihilationToHadrons (7)
178# Ionization: fIonisation (2), fPhotoElectricEffect (12)
179# Hadronic: (111,121,131,141,151,161,210)
180# Compton: fComptonScattering (13)
181# G4 process types:
182# http://www-geant4.kek.jp/lxr/source//processes/management/include/G4ProcessType.hh
183# G4 EM sub types:
184# http://www-geant4.kek.jp/lxr/source//processes/electromagnetic/utils/include/G4EmProcessSubType.hh
185# G4 HadInt sub types:
186# http://www-geant4.kek.jp/lxr/source//processes/hadronic/management/include/G4HadronicProcessType.hh#L46
187def TruthStrategyGroupID_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupID_MC15", **kwargs):
188 result = ComponentAccumulator()
189 kwargs.setdefault("ParentMinPt", 100.*MeV)
190 kwargs.setdefault("ChildMinPt" , 300.*MeV)
191 kwargs.setdefault("VertexTypes", [3, 14, 15, 4, 5, 6, 7, 2, 12, 13])
192 kwargs.setdefault("VertexTypeRangeLow", 201) # All kinds of decay processes
193 kwargs.setdefault("VertexTypeRangeHigh", 298) # ...
194 kwargs.setdefault("Regions", [1,2]) # Could import AtlasDetDescr::AtlasRegion enum as in TruthService Cfg methods here
195 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
196 return result
197
198
199def TruthStrategyGroupIDHadInt_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupIDHadInt_MC15", **kwargs):
200 result = ComponentAccumulator()
201 kwargs.setdefault("ParentMinPt", 100.*MeV)
202 kwargs.setdefault("ChildMinPt" , 300.*MeV)
203 kwargs.setdefault("VertexTypes", [111, 121, 131, 141, 151, 161, 210])
204 kwargs.setdefault("AllowChildrenOrParentPassKineticCuts", True)
205 kwargs.setdefault("Regions", [1])
206 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
207 return result
208
209
210def TruthStrategyGroupCaloMuBremCfg(flags, name="ISF_MCTruthStrategyGroupCaloMuBrem", **kwargs):
211 result = ComponentAccumulator()
212 kwargs.setdefault("ParentMinEkin", 500.*MeV)
213 kwargs.setdefault("ChildMinEkin" , 100.*MeV)
214 kwargs.setdefault("VertexTypes" , [3])
215 kwargs.setdefault("ParentPDGCodes", [13, -13])
216 kwargs.setdefault("Regions", [3])
217 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
218 return result
219
220
221def TruthStrategyGroupCaloDecay_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupCaloDecay_MC15", **kwargs):
222 result = ComponentAccumulator()
223 kwargs.setdefault("ParentMinEkin", 1000.*MeV)
224 kwargs.setdefault("ChildMinEkin" , 500.*MeV)
225 kwargs.setdefault("VertexTypes" , [5, 6, 7])
226 kwargs.setdefault("VertexTypeRangeLow" , 201) # All kinds of decay processes
227 kwargs.setdefault("VertexTypeRangeHigh", 298) # ...
228 kwargs.setdefault("Regions", [3])
229 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
230 return result
231
232
233def TruthStrategyGroupIDCfg(flags, name="ISF_MCTruthStrategyGroupID", **kwargs):
234 result = ComponentAccumulator()
235 kwargs.setdefault("ParentMinPt", 100.*MeV)
236 kwargs.setdefault("ChildMinPt" , 100.*MeV)
237 kwargs.setdefault("VertexTypes", [3, 14, 15, 4, 5, 6, 7, 2, 12, 13])
238 kwargs.setdefault("VertexTypeRangeLow" , 201) # All kinds of decay processes
239 kwargs.setdefault("VertexTypeRangeHigh" , 298) # ...
240 kwargs.setdefault("Regions", [1,2])
241 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
242 return result
243
244
245def TruthStrategyGroupIDHadIntCfg(flags, name="ISF_MCTruthStrategyGroupIDHadInt", **kwargs):
246 result = ComponentAccumulator()
247 kwargs.setdefault("ParentMinPt", 100.*MeV)
248 kwargs.setdefault("ChildMinPt" , 100.*MeV)
249 kwargs.setdefault("VertexTypes", [111, 121, 131, 141, 151, 161, 210])
250 kwargs.setdefault("AllowChildrenOrParentPassKineticCuts", True)
251 kwargs.setdefault("Regions", [1])
252 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
253 return result
254
255
256def TruthStrategyGroupCaloMuBrem_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupCaloMuBrem_MC15", **kwargs):
257 result = ComponentAccumulator()
258 kwargs.setdefault("ParentMinEkin", 500.*MeV)
259 kwargs.setdefault("ChildMinEkin" , 300.*MeV)
260 kwargs.setdefault("VertexTypes" , [3])
261 kwargs.setdefault("ParentPDGCodes", [13, -13])
262 kwargs.setdefault("Regions", [3])
263 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
264 return result
265
266
267def TruthStrategyGroupCaloDecayCfg(flags, name="ISF_MCTruthStrategyGroupCaloDecay", **kwargs):
268 result = ComponentAccumulator()
269 kwargs.setdefault("ParentMinPt", 1000.*MeV)
270 kwargs.setdefault("ChildMinPt" , 500.*MeV)
271 kwargs.setdefault("VertexTypes", [5, 6, 7])
272 kwargs.setdefault("VertexTypeRangeLow" , 201) # All kinds of decay processes
273 kwargs.setdefault("VertexTypeRangeHigh", 298) # ...
274 kwargs.setdefault("Regions", [3])
275 result.setPrivateTools(CompFactory.ISF.GenericTruthStrategy(name, **kwargs))
276 return result
277
278def ValidationTruthStrategyCfg(flags, name="ISF_ValidationTruthStrategy", **kwargs):
279 result = ComponentAccumulator()
280 kwargs.setdefault("ParentMinP", 50.*MeV)
281 kwargs.setdefault("Regions", [1,2,3,4])
282 result.setPrivateTools(CompFactory.ISF.ValidationTruthStrategy(name, **kwargs))
283 return result
284
285
286def FCSParamTruthStrategyCfg(flags, name="ISF_ValidationTruthStrategy", **kwargs):
287 result = ComponentAccumulator()
288 kwargs.setdefault("ParentMinP", 150.*MeV)
289 kwargs.setdefault("Regions", [3])
290 result.setPrivateTools(CompFactory.ISF.ValidationTruthStrategy(name, **kwargs))
291 return result
292
293
294def LLPTruthStrategyCfg(flags, name="ISF_LLPTruthStrategy", **kwargs):
295 result = ComponentAccumulator()
296 kwargs.setdefault("PassProcessCodeRangeLow", 200)
297 kwargs.setdefault("PassProcessCodeRangeHigh", 299)
298 # ProcessCategory==9 corresponds to the "fUserDefined" G4ProcessType:
299 # http://www-geant4.kek.jp/lxr/source//processes/management/include/G4ProcessType.hh
300 kwargs.setdefault("PassProcessCategory", 9) # ==
301 kwargs.setdefault("Regions", [1,2,3,4])
302 result.setPrivateTools(CompFactory.ISF.LLPTruthStrategy(name, **kwargs))
303 return result
304
305
306def KeepLLPDecayChildrenStrategyCfg(flags, name="ISF_KeepLLPDecayChildrenStrategy", **kwargs):
307 result = ComponentAccumulator()
308 # ProcessCategory==9 corresponds to the "fUserDefined" G4ProcessType:
309 # http://www-geant4.kek.jp/lxr/source//processes/management/include/G4ProcessType.hh
310 kwargs.setdefault("PassProcessCategory", 9) # ==
311 kwargs.setdefault("VertexTypeRangeLow" , 200) # All kinds of decay processes
312 kwargs.setdefault("VertexTypeRangeHigh", 299) # ...
313 kwargs.setdefault("BSMParent" , True)
314 result.setPrivateTools(CompFactory.ISF.KeepChildrenTruthStrategy(name, **kwargs))
315 return result
316
317
318def KeepLLPHadronicInteractionChildrenStrategyCfg(flags, name="ISF_KeepLLPHadronicInteractionChildrenStrategy", **kwargs):
319 result = ComponentAccumulator()
320 kwargs.setdefault("VertexTypes", [111, 121, 131, 141, 151, 161, 210])
321 kwargs.setdefault("BSMParent" , True)
322 result.setPrivateTools(CompFactory.ISF.KeepChildrenTruthStrategy(name, **kwargs))
323 return result
324
325
326def KeepAllDecayChildrenStrategyCfg(flags, name="ISF_KeepAllDecayChildrenStrategy", **kwargs):
327 result = ComponentAccumulator()
328 # ProcessCategory==9 corresponds to the "fUserDefined" G4ProcessType:
329 # http://www-geant4.kek.jp/lxr/source//processes/management/include/G4ProcessType.hh
330 kwargs.setdefault("PassProcessCategory", 9) # ==
331 kwargs.setdefault("VertexTypeRangeLow" , 200) # All kinds of decay processes
332 kwargs.setdefault("VertexTypeRangeHigh", 299) # ...
333 result.setPrivateTools(CompFactory.ISF.KeepChildrenTruthStrategy(name, **kwargs))
334 return result
335
336
337def KeepHadronicInteractionChildrenStrategyCfg(flags, name="ISF_KeepHadronicInteractionChildrenStrategy", **kwargs):
338 result = ComponentAccumulator()
339 kwargs.setdefault("VertexTypes", [111, 121, 131, 141, 151, 161, 210])
340 result.setPrivateTools(CompFactory.ISF.KeepChildrenTruthStrategy(name, **kwargs))
341 return result
ParticlePositionFilterMSCfg(name="ISF_ParticlePositionFilterMS", **kwargs)
ParticlePositionFilterIDCfg(flags, name="ISF_ParticlePositionFilterID", **kwargs)
TruthStrategyGroupCaloMuBrem_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupCaloMuBrem_MC15", **kwargs)
TruthStrategyGroupCaloDecayCfg(flags, name="ISF_MCTruthStrategyGroupCaloDecay", **kwargs)
TruthStrategyGroupIDHadIntCfg(flags, name="ISF_MCTruthStrategyGroupIDHadInt", **kwargs)
GenParticleInteractingFilterCfg(flags, name="ISF_GenParticleInteractingFilter", **kwargs)
TruthStrategyGroupID_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupID_MC15", **kwargs)
Truth Strategies.
TruthStrategyGroupCaloMuBremCfg(flags, name="ISF_MCTruthStrategyGroupCaloMuBrem", **kwargs)
ParticlePositionFilterCfg(flags, name="ISF_ParticlePositionFilter", **kwargs)
LLPTruthStrategyCfg(flags, name="ISF_LLPTruthStrategy", **kwargs)
KeepAllDecayChildrenStrategyCfg(flags, name="ISF_KeepAllDecayChildrenStrategy", **kwargs)
KeepHadronicInteractionChildrenStrategyCfg(flags, name="ISF_KeepHadronicInteractionChildrenStrategy", **kwargs)
ParticlePositionFilterCaloCfg(flags, name="ISF_ParticlePositionFilterCalo", **kwargs)
ParticleSimAcceptListCfg(flags, name="ISF_ParticleSimAcceptList", **kwargs)
ParticleFinalStateFilterCfg(flags, name="ISF_ParticleFinalStateFilter", **kwargs)
ParticlePositionFilterDynamicCfg(flags, name="ISF_ParticlePositionFilterDynamic", **kwargs)
KeepLLPHadronicInteractionChildrenStrategyCfg(flags, name="ISF_KeepLLPHadronicInteractionChildrenStrategy", **kwargs)
TruthStrategyGroupIDHadInt_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupIDHadInt_MC15", **kwargs)
FCSParamTruthStrategyCfg(flags, name="ISF_ValidationTruthStrategy", **kwargs)
KeepLLPDecayChildrenStrategyCfg(flags, name="ISF_KeepLLPDecayChildrenStrategy", **kwargs)
EtaPhiFilterCfg(flags, name="ISF_EtaPhiFilter", **kwargs)
GenParticleSimQuasiStableFilterCfg(flags, name="ISF_GenParticleSimQuasiStableFilter", **kwargs)
ParticlePositionFilterWorldCfg(flags, name="ISF_ParticlePositionFilterWorld", **kwargs)
TruthStrategyGroupIDCfg(flags, name="ISF_MCTruthStrategyGroupID", **kwargs)
TruthStrategyGroupCaloDecay_MC15Cfg(flags, name="ISF_MCTruthStrategyGroupCaloDecay_MC15", **kwargs)
TruthPreselectionToolCfg(flags, name="TruthPreselectionTool", **kwargs)
ValidationTruthStrategyCfg(flags, name="ISF_ValidationTruthStrategy", **kwargs)
ParticleSimAcceptList_ExtraParticlesCfg(flags, name="ISF_ParticleSimAcceptList_ExtraParticles", **kwargs)
getPDGTABLE(table)
Definition PDGHelpers.py:37