11 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
12 from AthenaConfiguration.ComponentFactory
import CompFactory
20 """Configure the TruthCollectionMaker tool"""
22 acc.addPublicTool(CompFactory.DerivationFramework.TruthCollectionMaker(name = name,**kwargs),
28 """Muon truth collection maker"""
30 name =
"DFCommonTruthMuonTool",
31 OutputCollectionName =
"TruthMuons",
32 KeepNavigationInfo =
False,
33 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 13) && TruthParticles.isGenStable")
37 """Charm truth collection maker"""
41 OutputCollectionName =
"TruthCharm",
42 KeepNavigationInfo =
False,
43 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 4)",
48 """Electron truth collection maker"""
50 name =
"DFCommonTruthElectronTool",
51 OutputCollectionName =
"TruthElectrons",
52 KeepNavigationInfo =
False,
53 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 11) && TruthParticles.isGenStable")
57 """Photon truth collection maker (Currently unused?)"""
59 name =
"DFCommonTruthPhotonTool",
60 OutputCollectionName =
"TruthPhotons",
61 KeepNavigationInfo =
False,
62 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 22) && TruthParticles.isGenStable")
67 """Tool for making TruthPhotons from sim samples"""
69 name =
"DFCommonTruthPhotonToolSim",
70 OutputCollectionName =
"TruthPhotons",
71 KeepNavigationInfo =
False,
72 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 22) && TruthParticles.isGenStable && ((TruthParticles.classifierParticleOrigin != 42 && TruthParticles.classifierParticleOrigin !=23) || (TruthParticles.pt > 20.0*GeV))")
76 """Neutrino truth collection maker"""
77 neutrinoexpression =
"(TruthParticles.isNeutrino && TruthParticles.isGenStable)"
79 name =
"DFCommonTruthNeutrinoTool",
80 OutputCollectionName =
"TruthNeutrinos",
81 KeepNavigationInfo =
False,
82 ParticleSelectionString = neutrinoexpression)
86 """B-quark truth collection maker"""
88 name =
"DFCommonTruthBottomTool",
89 OutputCollectionName =
"TruthBottom",
90 KeepNavigationInfo =
False,
91 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 5)",
96 """Top-quark truth collection maker"""
98 name =
"DFCommonTruthTopTool",
99 OutputCollectionName =
"TruthTop",
100 KeepNavigationInfo =
False,
101 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 6)",
106 """Gauge bosons and Higgs truth collection maker"""
108 name =
"DFCommonTruthBosonTool",
109 OutputCollectionName =
"TruthBoson",
110 KeepNavigationInfo =
False,
111 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 23 || abs(TruthParticles.pdgId) == 24 || abs(TruthParticles.pdgId) == 25)",
117 """BSM particles truth collection maker"""
119 name =
"DFCommonTruthBSMTool",
120 OutputCollectionName =
"TruthBSM",
121 KeepNavigationInfo =
False,
122 ParticleSelectionString =
"(TruthParticles.isBSM)",
127 """Forward proton truth collection maker"""
128 beam_energy = flags.Beam.Energy
130 name =
"DFCommonTruthForwardProtonTool",
131 OutputCollectionName =
"TruthForwardProtons",
132 KeepNavigationInfo =
False,
133 ParticleSelectionString =
"(TruthParticles.isStable) && (abs(TruthParticles.pdgId)==2212) && (TruthParticles.e>0.8*"+
str(beam_energy)+
")",
141 """Configure the truth D2 decorator tool"""
143 TruthD2Decorator = CompFactory.DerivationFramework.TruthD2Decorator
144 acc.addPublicTool(TruthD2Decorator(name, **kwargs), primary =
True)
149 """Configure the TruthClassificationDecorator tool"""
151 from MCTruthClassifier.MCTruthClassifierConfig
import DFCommonMCTruthClassifierCfg
153 TruthClassificationDecorator = CompFactory.DerivationFramework.TruthClassificationDecorator
154 acc.setPrivateTools(TruthClassificationDecorator(name = name, **kwargs))
159 """Config the MuonTruthClassifierFallback tool"""
162 if "MCTruthClassifierTool" not in kwargs:
163 from MCTruthClassifier.MCTruthClassifierConfig
import (
164 MCTruthClassifierCfg)
165 kwargs.setdefault(
"MCTruthClassifierTool", acc.popToolsAndMerge(
168 MuonTruthClassifierFallback = CompFactory.DerivationFramework.MuonTruthClassifierFallback
169 acc.addPublicTool(MuonTruthClassifierFallback(name = name, **kwargs),
175 """Configure the TruthDressingTool"""
177 TruthDressingTool = CompFactory.DerivationFramework.TruthDressingTool
178 acc.addPublicTool(TruthDressingTool( name = name, **kwargs),
184 """Configure the truth isolation tool"""
186 TruthIsolationTool = CompFactory.DerivationFramework.TruthIsolationTool
193 """Configure the MuonTruthIsolationTool"""
195 acc.addEventAlgo(CompFactory.DerivationFramework.MuonTruthIsolationDecorAlg(name = name, **kwargs),
201 """Configure the quark/gluon decoration tool"""
203 TruthQGDecorationTool = CompFactory.DerivationFramework.TruthQGDecorationTool
204 acc.addPublicTool(TruthQGDecorationTool(name = name, **kwargs),
210 """Congigure the truth navigation decorator tool"""
212 kwargs.setdefault(
"InputCollections", [])
213 kwargs.setdefault(
"parentDecorKeys", [ key +
".parentLinks" for key
in kwargs[
"InputCollections"] ])
214 kwargs.setdefault(
"childDecorKeys", [ key +
".childLinks" for key
in kwargs[
"InputCollections"] ])
215 TruthNavigationDecorator = CompFactory.DerivationFramework.TruthNavigationDecorator
216 acc.addPublicTool(TruthNavigationDecorator(name = name, **kwargs),
222 """Configure the truth decay collection maker"""
224 TruthDecayCollectionMaker = CompFactory.DerivationFramework.TruthDecayCollectionMaker
225 acc.addPublicTool(TruthDecayCollectionMaker(name = name, **kwargs),
231 """Configure the truth Born lepton collection tool"""
233 TruthBornLeptonCollectionMaker = CompFactory.DerivationFramework.TruthBornLeptonCollectionMaker
234 acc.addPublicTool(TruthBornLeptonCollectionMaker(name = name, **kwargs),
240 """Add a mini-collection for the hard scatter and N subsequent generations"""
247 """dress the main truth collection with the classification"""
249 name =
"DFCommonTruthClassificationTool",
250 ParticlesKey =
"TruthParticles")
255 """get the hadron origin classification"""
257 HadronOriginClassifier = CompFactory.DerivationFramework.HadronOriginClassifier
258 kwargs.setdefault(
"DSID", flags.Input.MCChannelNumber)
259 acc.addPublicTool(HadronOriginClassifier(name = name, **kwargs),
265 """decorate with the hadron origin classification"""
267 if not hasattr(kwargs,
"ToolName"):
269 name=
"DFCommonHadronOriginClassifier")))
270 acc.addPublicTool(CompFactory.DerivationFramework.HadronOriginDecorator
271 (name = name, **kwargs),
278 """Configure the electron truth dressing tool"""
280 name =
"DFCommonTruthElectronDressingTool",
281 dressParticlesKey =
"TruthElectrons",
282 usePhotonsFromHadrons =
False,
283 dressingConeSize = 0.1,
284 particleIDsToDress = [11],
285 decorationName = decorationName+
"_e")
289 """Configure the muon truth dressing tool"""
291 name =
"DFCommonTruthMuonDressingTool",
292 dressParticlesKey =
"TruthMuons",
293 usePhotonsFromHadrons =
False,
294 dressingConeSize = 0.1,
295 particleIDsToDress = [13],
296 decorationName = decorationName+
"_mu")
300 """Configure the tau truth dressing tool"""
302 name =
"DFCommonTruthTauDressingTool",
303 dressParticlesKey =
"TruthTaus",
304 usePhotonsFromHadrons =
False,
305 dressingConeSize = 0.2,
306 particleIDsToDress = [15],
307 decoratePhotons =
False)
311 """Configure the electron isolation tool, cone=0.2"""
313 name =
"DFCommonTruthElectronIsolationTool1",
314 isoParticlesKey =
"TruthElectrons",
315 allParticlesKey =
"TruthParticles",
316 particleIDsToCalculate = [11],
317 IsolationConeSizes = [0.2],
318 IsolationVarNamePrefix =
'etcone',
319 ChargedParticlesOnly =
False)
323 """Configure the electron isolation tool, cone=0.3"""
325 name =
"DFCommonTruthElectronIsolationTool2",
326 isoParticlesKey =
"TruthElectrons",
327 allParticlesKey =
"TruthParticles",
328 particleIDsToCalculate = [11],
329 IsolationConeSizes = [0.3],
330 IsolationVarNamePrefix =
'ptcone',
331 ChargedParticlesOnly =
True)
335 """Configure the muon isolation tool, cone=0.2"""
337 name =
"DFCommonTruthMuonIsolationTool1",
338 isoParticlesKey =
"TruthMuons",
339 allParticlesKey =
"TruthParticles",
340 particleIDsToCalculate = [13],
341 IsolationConeSizes = [0.2],
342 IsolationVarNamePrefix =
'etcone',
343 ChargedParticlesOnly =
False)
347 """Configure the muon isolation tool, cone=0.3"""
349 name =
"DFCommonTruthMuonIsolationTool2",
350 isoParticlesKey =
"TruthMuons",
351 allParticlesKey =
"TruthParticles",
352 particleIDsToCalculate = [13],
353 IsolationConeSizes = [0.3],
354 IsolationVarNamePrefix =
'ptcone',
355 ChargedParticlesOnly =
True)
359 """Configure the photon isolation tool, etcone"""
361 name =
"DFCommonTruthPhotonIsolationTool1",
362 isoParticlesKey =
"TruthPhotons",
363 allParticlesKey =
"TruthParticles",
364 particleIDsToCalculate = [22],
365 IsolationConeSizes = [0.2],
366 IsolationVarNamePrefix =
'etcone',
367 ChargedParticlesOnly =
False)
371 """Configure the photon isolation tool, ptcone"""
373 name =
"DFCommonTruthPhotonIsolationTool2",
374 isoParticlesKey =
"TruthPhotons",
375 allParticlesKey =
"TruthParticles",
376 particleIDsToCalculate = [22],
377 IsolationConeSizes = [0.2],
378 IsolationVarNamePrefix =
'ptcone',
379 ChargedParticlesOnly =
True)
383 """Configure the photon isolation tool, etcone=0.4"""
385 name =
"DFCommonTruthPhotonIsolationTool3",
386 isoParticlesKey =
"TruthPhotons",
387 allParticlesKey =
"TruthParticles",
388 particleIDsToCalculate = [22],
389 IsolationConeSizes = [0.4],
390 IsolationVarNamePrefix =
'etcone',
391 ChargedParticlesOnly =
False)
396 """Configure the QG decoration tool for AntiKt4TruthDressedWZJets"""
398 name =
"DFCommonTruthDressedWZQGLabelTool",
399 JetCollection =
"AntiKt4TruthDressedWZJets")
408 """Configure the menu truth thinning tool"""
410 MenuTruthThinning = CompFactory.DerivationFramework.MenuTruthThinning
411 acc.addPublicTool(MenuTruthThinning(name, **kwargs),
421 """Configure the truth link repointing tool"""
423 TruthLinkRepointTool = CompFactory.DerivationFramework.TruthLinkRepointTool
424 acc.addPublicTool(TruthLinkRepointTool(name, **kwargs),
432 """Configure the truth PV collection maker tool"""
434 TruthPVCollectionMaker = CompFactory.DerivationFramework.TruthPVCollectionMaker
435 acc.addPublicTool(TruthPVCollectionMaker(name, **kwargs),
442 """Configure the GenericTruthThinning tool"""
444 GenericTruthThinning = CompFactory.DerivationFramework.GenericTruthThinning
445 acc.addPublicTool(GenericTruthThinning(name, **kwargs),