11 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
12 from AthenaConfiguration.ComponentFactory
import CompFactory
20 """Configure the TruthCollectionMaker tool"""
22 TruthCollectionMaker = CompFactory.DerivationFramework.TruthCollectionMaker
23 acc.addPublicTool(TruthCollectionMaker(name = name,**kwargs),
28 """Muon truth collection maker"""
30 name =
"DFCommonTruthMuonTool",
31 NewCollectionName =
"TruthMuons",
32 KeepNavigationInfo =
False,
33 ParticleSelectionString = f
"(abs(TruthParticles.pdgId) == 13) && (TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}")
37 """Electron truth collection maker"""
39 name =
"DFCommonTruthElectronTool",
40 NewCollectionName =
"TruthElectrons",
41 KeepNavigationInfo =
False,
42 ParticleSelectionString = f
"(abs(TruthParticles.pdgId) == 11) && (TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}")
45 """Photon truth collection maker"""
47 name =
"DFCommonTruthPhotonTool",
48 NewCollectionName =
"TruthPhotons",
49 KeepNavigationInfo =
False,
50 ParticleSelectionString = f
"(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}")
54 """Tool for making TruthPhotons from sim samples"""
56 name =
"DFCommonTruthPhotonToolSim",
57 NewCollectionName =
"TruthPhotons",
58 KeepNavigationInfo =
False,
59 ParticleSelectionString = f
"(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && ((TruthParticles.classifierParticleOrigin != 42 && TruthParticles.classifierParticleOrigin !=23) || (TruthParticles.pt > 20.0*GeV)) && ( TruthParticles.barcode < {flags.Sim.SimBarcodeOffset} )")
62 """Neutrino truth collection maker"""
63 neutrinoexpression = f
"(TruthParticles.isNeutrino && TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}"
65 name =
"DFCommonTruthNeutrinoTool",
66 NewCollectionName =
"TruthNeutrinos",
67 KeepNavigationInfo =
False,
68 ParticleSelectionString = neutrinoexpression)
71 """B-quark truth collection maker"""
73 name =
"DFCommonTruthBottomTool",
74 NewCollectionName =
"TruthBottom",
75 KeepNavigationInfo =
False,
76 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 5)",
80 """Top-quark truth collection maker"""
82 name =
"DFCommonTruthTopTool",
83 NewCollectionName =
"TruthTop",
84 KeepNavigationInfo =
False,
85 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 6)",
89 """Gauge bosons and Higgs truth collection maker"""
91 name =
"DFCommonTruthBosonTool",
92 NewCollectionName =
"TruthBoson",
93 KeepNavigationInfo =
False,
94 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 23 || abs(TruthParticles.pdgId) == 24 || abs(TruthParticles.pdgId) == 25)",
99 """BSM particles truth collection maker"""
101 name =
"DFCommonTruthBSMTool",
102 NewCollectionName =
"TruthBSM",
103 KeepNavigationInfo =
False,
104 ParticleSelectionString =
"(TruthParticles.isBSM)",
108 """Forward proton truth collection maker"""
109 beam_energy = flags.Beam.Energy
111 name =
"DFCommonTruthForwardProtonTool",
112 NewCollectionName =
"TruthForwardProtons",
113 KeepNavigationInfo =
False,
114 ParticleSelectionString =
"(TruthParticles.status==1) && (abs(TruthParticles.pdgId)==2212) && (TruthParticles.e>0.8*"+
str(beam_energy)+
")",
122 """Configure the truth D2 decorator tool"""
124 TruthD2Decorator = CompFactory.DerivationFramework.TruthD2Decorator
125 acc.addPublicTool(TruthD2Decorator(name, **kwargs), primary =
True)
129 """Configure the MCTruthClassifier tool"""
131 MCTruthClassifier = CompFactory.MCTruthClassifier
132 acc.addPublicTool(
MCTruthClassifier(name =
"DFCommonTruthClassifier", ParticleCaloExtensionTool =
""),
137 """Configure the TruthClassificationDecorator tool"""
139 TruthClassificationDecorator = CompFactory.DerivationFramework.TruthClassificationDecorator
140 acc.addPublicTool(TruthClassificationDecorator(name = name, **kwargs),
145 """Config the MuonTruthClassifierFallback tool"""
148 if "MCTruthClassifierTool" not in kwargs:
149 from MCTruthClassifier.MCTruthClassifierConfig
import (
150 MCTruthClassifierCfg)
151 kwargs.setdefault(
"MCTruthClassifierTool", acc.popToolsAndMerge(
154 MuonTruthClassifierFallback = CompFactory.DerivationFramework.MuonTruthClassifierFallback
155 acc.addPublicTool(MuonTruthClassifierFallback(name = name, **kwargs),
160 """Configure the TruthDressingTool"""
162 TruthDressingTool = CompFactory.DerivationFramework.TruthDressingTool
163 acc.addPublicTool(TruthDressingTool( name = name, **kwargs),
168 """Configure the truth isolation tool"""
170 TruthIsolationTool = CompFactory.DerivationFramework.TruthIsolationTool
176 """Configure the MuonTruthIsolationTool"""
178 acc.addEventAlgo(CompFactory.DerivationFramework.MuonTruthIsolationDecorAlg(name = name, **kwargs),
183 """Configure the quark/gluon decoration tool"""
185 TruthQGDecorationTool = CompFactory.DerivationFramework.TruthQGDecorationTool
186 acc.addPublicTool(TruthQGDecorationTool(name = name, **kwargs),
191 """Congigure the truth navigation decorator tool"""
193 TruthNavigationDecorator = CompFactory.DerivationFramework.TruthNavigationDecorator
194 acc.addPublicTool(TruthNavigationDecorator(name = name, **kwargs),
199 """Configure the truth decay collection maker"""
201 TruthDecayCollectionMaker = CompFactory.DerivationFramework.TruthDecayCollectionMaker
202 acc.addPublicTool(TruthDecayCollectionMaker(name = name, **kwargs),
207 """Configure the truth Born lepton collection tool"""
209 TruthBornLeptonCollectionMaker = CompFactory.DerivationFramework.TruthBornLeptonCollectionMaker
210 acc.addPublicTool(TruthBornLeptonCollectionMaker(name = name, **kwargs),
215 """Add a mini-collection for the hard scatter and N subsequent generations"""
221 """dress the main truth collection with the classification"""
223 DFCommonTruthClassifier = accMCTC.getPrimary()
225 name =
"DFCommonTruthClassificationTool",
226 ParticlesKey =
"TruthParticles",
227 MCTruthClassifier = DFCommonTruthClassifier)
233 """get the hadron origin classification"""
235 HadronOriginClassifier = CompFactory.DerivationFramework.HadronOriginClassifier
236 acc.addPublicTool(HadronOriginClassifier(name = name, **kwargs),
241 """decorate with the hadron origin classification"""
243 HadronOriginDecorator = CompFactory.DerivationFramework.HadronOriginDecorator
244 acc.addPublicTool(HadronOriginDecorator(name = name, **kwargs),
251 """Configure the electron truth dressing tool"""
253 name =
"DFCommonTruthElectronDressingTool",
254 dressParticlesKey =
"TruthElectrons",
255 usePhotonsFromHadrons =
False,
256 dressingConeSize = 0.1,
257 particleIDsToDress = [11],
258 decorationName = decorationName)
261 """Configure the muon truth dressing tool"""
263 name =
"DFCommonTruthMuonDressingTool",
264 dressParticlesKey =
"TruthMuons",
265 usePhotonsFromHadrons =
False,
266 dressingConeSize = 0.1,
267 particleIDsToDress = [13],
268 decorationName = decorationName)
271 """Configure the tau truth dressing tool"""
273 name =
"DFCommonTruthTauDressingTool",
274 dressParticlesKey =
"TruthTaus",
275 usePhotonsFromHadrons =
False,
276 dressingConeSize = 0.2,
277 particleIDsToDress = [15])
280 """Configure the electron isolation tool, cone=0.2"""
282 name =
"DFCommonTruthElectronIsolationTool1",
283 isoParticlesKey =
"TruthElectrons",
284 allParticlesKey =
"TruthParticles",
285 particleIDsToCalculate = [11],
286 IsolationConeSizes = [0.2],
287 IsolationVarNamePrefix =
'etcone',
288 ChargedParticlesOnly =
False)
291 """Configure the electron isolation tool, cone=0.3"""
293 name =
"DFCommonTruthElectronIsolationTool2",
294 isoParticlesKey =
"TruthElectrons",
295 allParticlesKey =
"TruthParticles",
296 particleIDsToCalculate = [11],
297 IsolationConeSizes = [0.3],
298 IsolationVarNamePrefix =
'ptcone',
299 ChargedParticlesOnly =
True)
302 """Configure the muon isolation tool, cone=0.2"""
304 name =
"DFCommonTruthMuonIsolationTool1",
305 isoParticlesKey =
"TruthMuons",
306 allParticlesKey =
"TruthParticles",
307 particleIDsToCalculate = [13],
308 IsolationConeSizes = [0.2],
309 IsolationVarNamePrefix =
'etcone',
310 ChargedParticlesOnly =
False)
313 """Configure the muon isolation tool, cone=0.3"""
315 name =
"DFCommonTruthMuonIsolationTool2",
316 isoParticlesKey =
"TruthMuons",
317 allParticlesKey =
"TruthParticles",
318 particleIDsToCalculate = [13],
319 IsolationConeSizes = [0.3],
320 IsolationVarNamePrefix =
'ptcone',
321 ChargedParticlesOnly =
True)
324 """Configure the photon isolation tool, etcone"""
326 name =
"DFCommonTruthPhotonIsolationTool1",
327 isoParticlesKey =
"TruthPhotons",
328 allParticlesKey =
"TruthParticles",
329 particleIDsToCalculate = [22],
330 IsolationConeSizes = [0.2],
331 IsolationVarNamePrefix =
'etcone',
332 ChargedParticlesOnly =
False)
336 """Configure the photon isolation tool, ptcone"""
338 name =
"DFCommonTruthPhotonIsolationTool2",
339 isoParticlesKey =
"TruthPhotons",
340 allParticlesKey =
"TruthParticles",
341 particleIDsToCalculate = [22],
342 IsolationConeSizes = [0.2],
343 IsolationVarNamePrefix =
'ptcone',
344 ChargedParticlesOnly =
True)
347 """Configure the photon isolation tool, etcone=0.4"""
349 name =
"DFCommonTruthPhotonIsolationTool3",
350 isoParticlesKey =
"TruthPhotons",
351 allParticlesKey =
"TruthParticles",
352 particleIDsToCalculate = [22],
353 IsolationConeSizes = [0.4],
354 IsolationVarNamePrefix =
'etcone',
355 ChargedParticlesOnly =
False)
359 """Configure the QG decoration tool for AntiKt4TruthDressedWZJets"""
361 name =
"DFCommonTruthDressedWZQGLabelTool",
362 JetCollection =
"AntiKt4TruthDressedWZJets")
371 """Configure the menu truth thinning tool"""
373 MenuTruthThinning = CompFactory.DerivationFramework.MenuTruthThinning
374 acc.addPublicTool(MenuTruthThinning(name, **kwargs),
384 """Configure the truth link repointing tool"""
386 TruthLinkRepointTool = CompFactory.DerivationFramework.TruthLinkRepointTool
387 acc.addPublicTool(TruthLinkRepointTool(name, **kwargs),
394 """Configure the truth PV collection maker tool"""
396 TruthPVCollectionMaker = CompFactory.DerivationFramework.TruthPVCollectionMaker
397 acc.addPublicTool(TruthPVCollectionMaker(name, **kwargs),
403 """Configure the GenericTruthThinning tool"""
405 GenericTruthThinning = CompFactory.DerivationFramework.GenericTruthThinning
406 acc.addPublicTool(GenericTruthThinning(name, **kwargs),