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}")
36 """Electron truth collection maker"""
38 name =
"DFCommonTruthElectronTool",
39 NewCollectionName =
"TruthElectrons",
40 KeepNavigationInfo =
False,
41 ParticleSelectionString = f
"(abs(TruthParticles.pdgId) == 11) && (TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}")
44 """Photon truth collection maker"""
46 name =
"DFCommonTruthPhotonTool",
47 NewCollectionName =
"TruthPhotons",
48 KeepNavigationInfo =
False,
49 ParticleSelectionString = f
"(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}")
53 """Tool for making TruthPhotons from sim samples"""
55 name =
"DFCommonTruthPhotonToolSim",
56 NewCollectionName =
"TruthPhotons",
57 KeepNavigationInfo =
False,
58 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} )")
61 """Neutrino truth collection maker"""
62 neutrinoexpression = f
"(TruthParticles.isNeutrino && TruthParticles.status == 1) && TruthParticles.barcode < {flags.Sim.SimBarcodeOffset}"
64 name =
"DFCommonTruthNeutrinoTool",
65 NewCollectionName =
"TruthNeutrinos",
66 KeepNavigationInfo =
False,
67 ParticleSelectionString = neutrinoexpression)
70 """B-quark truth collection maker"""
72 name =
"DFCommonTruthBottomTool",
73 NewCollectionName =
"TruthBottom",
74 KeepNavigationInfo =
False,
75 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 5)",
79 """Top-quark truth collection maker"""
81 name =
"DFCommonTruthTopTool",
82 NewCollectionName =
"TruthTop",
83 KeepNavigationInfo =
False,
84 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 6)",
88 """Gauge bosons and Higgs truth collection maker"""
90 name =
"DFCommonTruthBosonTool",
91 NewCollectionName =
"TruthBoson",
92 KeepNavigationInfo =
False,
93 ParticleSelectionString =
"(abs(TruthParticles.pdgId) == 23 || abs(TruthParticles.pdgId) == 24 || abs(TruthParticles.pdgId) == 25)",
98 """BSM particles truth collection maker"""
100 name =
"DFCommonTruthBSMTool",
101 NewCollectionName =
"TruthBSM",
102 KeepNavigationInfo =
False,
103 ParticleSelectionString =
"(TruthParticles.isBSM)",
107 """Forward proton truth collection maker"""
108 beam_energy = flags.Beam.Energy
110 name =
"DFCommonTruthForwardProtonTool",
111 NewCollectionName =
"TruthForwardProtons",
112 KeepNavigationInfo =
False,
113 ParticleSelectionString =
"(TruthParticles.status==1) && (abs(TruthParticles.pdgId)==2212) && (TruthParticles.e>0.8*"+
str(beam_energy)+
")",
121 """Configure the truth D2 decorator tool"""
123 TruthD2Decorator = CompFactory.DerivationFramework.TruthD2Decorator
124 acc.addPublicTool(TruthD2Decorator(name, **kwargs), primary =
True)
128 """Configure the MCTruthClassifier tool"""
130 MCTruthClassifier = CompFactory.MCTruthClassifier
131 acc.addPublicTool(
MCTruthClassifier(name =
"DFCommonTruthClassifier", ParticleCaloExtensionTool =
""),
136 """Configure the TruthClassificationDecorator tool"""
138 TruthClassificationDecorator = CompFactory.DerivationFramework.TruthClassificationDecorator
139 acc.addPublicTool(TruthClassificationDecorator(name = name, **kwargs),
144 """Config the MuonTruthClassifierFallback tool"""
147 if "MCTruthClassifierTool" not in kwargs:
148 from MCTruthClassifier.MCTruthClassifierConfig
import (
149 MCTruthClassifierCfg)
150 kwargs.setdefault(
"MCTruthClassifierTool", acc.popToolsAndMerge(
153 MuonTruthClassifierFallback = CompFactory.DerivationFramework.MuonTruthClassifierFallback
154 acc.addPublicTool(MuonTruthClassifierFallback(name = name, **kwargs),
159 """Configure the TruthDressingTool"""
161 TruthDressingTool = CompFactory.DerivationFramework.TruthDressingTool
162 acc.addPublicTool(TruthDressingTool( name = name, **kwargs),
167 """Configure the truth isolation tool"""
169 TruthIsolationTool = CompFactory.DerivationFramework.TruthIsolationTool
175 """Configure the MuonTruthIsolationTool"""
177 acc.addEventAlgo(CompFactory.DerivationFramework.MuonTruthIsolationDecorAlg(name = name, **kwargs),
182 """Configure the quark/gluon decoration tool"""
184 TruthQGDecorationTool = CompFactory.DerivationFramework.TruthQGDecorationTool
185 acc.addPublicTool(TruthQGDecorationTool(name = name, **kwargs),
190 """Congigure the truth navigation decorator tool"""
192 TruthNavigationDecorator = CompFactory.DerivationFramework.TruthNavigationDecorator
193 acc.addPublicTool(TruthNavigationDecorator(name = name, **kwargs),
198 """Configure the truth decay collection maker"""
200 TruthDecayCollectionMaker = CompFactory.DerivationFramework.TruthDecayCollectionMaker
201 acc.addPublicTool(TruthDecayCollectionMaker(name = name, **kwargs),
206 """Configure the truth Born lepton collection tool"""
208 TruthBornLeptonCollectionMaker = CompFactory.DerivationFramework.TruthBornLeptonCollectionMaker
209 acc.addPublicTool(TruthBornLeptonCollectionMaker(name = name, **kwargs),
214 """Add a mini-collection for the hard scatter and N subsequent generations"""
220 """dress the main truth collection with the classification"""
222 DFCommonTruthClassifier = accMCTC.getPrimary()
224 name =
"DFCommonTruthClassificationTool",
225 ParticlesKey =
"TruthParticles",
226 MCTruthClassifier = DFCommonTruthClassifier)
232 """get the hadron origin classification"""
234 HadronOriginClassifier = CompFactory.DerivationFramework.HadronOriginClassifier
235 acc.addPublicTool(HadronOriginClassifier(name = name, **kwargs),
240 """decorate with the hadron origin classification"""
242 HadronOriginDecorator = CompFactory.DerivationFramework.HadronOriginDecorator
243 acc.addPublicTool(HadronOriginDecorator(name = name, **kwargs),
250 """Configure the electron truth dressing tool"""
252 name =
"DFCommonTruthElectronDressingTool",
253 dressParticlesKey =
"TruthElectrons",
254 usePhotonsFromHadrons =
False,
255 dressingConeSize = 0.1,
256 particleIDsToDress = [11],
257 decorationName = decorationName)
260 """Configure the muon truth dressing tool"""
262 name =
"DFCommonTruthMuonDressingTool",
263 dressParticlesKey =
"TruthMuons",
264 usePhotonsFromHadrons =
False,
265 dressingConeSize = 0.1,
266 particleIDsToDress = [13],
267 decorationName = decorationName)
270 """Configure the tau truth dressing tool"""
272 name =
"DFCommonTruthTauDressingTool",
273 dressParticlesKey =
"TruthTaus",
274 usePhotonsFromHadrons =
False,
275 dressingConeSize = 0.2,
276 particleIDsToDress = [15])
279 """Configure the electron isolation tool, cone=0.2"""
281 name =
"DFCommonTruthElectronIsolationTool1",
282 isoParticlesKey =
"TruthElectrons",
283 allParticlesKey =
"TruthParticles",
284 particleIDsToCalculate = [11],
285 IsolationConeSizes = [0.2],
286 IsolationVarNamePrefix =
'etcone',
287 ChargedParticlesOnly =
False)
290 """Configure the electron isolation tool, cone=0.3"""
292 name =
"DFCommonTruthElectronIsolationTool2",
293 isoParticlesKey =
"TruthElectrons",
294 allParticlesKey =
"TruthParticles",
295 particleIDsToCalculate = [11],
296 IsolationConeSizes = [0.3],
297 IsolationVarNamePrefix =
'ptcone',
298 ChargedParticlesOnly =
True)
301 """Configure the muon isolation tool, cone=0.2"""
303 name =
"DFCommonTruthMuonIsolationTool1",
304 isoParticlesKey =
"TruthMuons",
305 allParticlesKey =
"TruthParticles",
306 particleIDsToCalculate = [13],
307 IsolationConeSizes = [0.2],
308 IsolationVarNamePrefix =
'etcone',
309 ChargedParticlesOnly =
False)
312 """Configure the muon isolation tool, cone=0.3"""
314 name =
"DFCommonTruthMuonIsolationTool2",
315 isoParticlesKey =
"TruthMuons",
316 allParticlesKey =
"TruthParticles",
317 particleIDsToCalculate = [13],
318 IsolationConeSizes = [0.3],
319 IsolationVarNamePrefix =
'ptcone',
320 ChargedParticlesOnly =
True)
323 """Configure the photon isolation tool, etcone"""
325 name =
"DFCommonTruthPhotonIsolationTool1",
326 isoParticlesKey =
"TruthPhotons",
327 allParticlesKey =
"TruthParticles",
328 particleIDsToCalculate = [22],
329 IsolationConeSizes = [0.2],
330 IsolationVarNamePrefix =
'etcone',
331 ChargedParticlesOnly =
False)
335 """Configure the photon isolation tool, ptcone"""
337 name =
"DFCommonTruthPhotonIsolationTool2",
338 isoParticlesKey =
"TruthPhotons",
339 allParticlesKey =
"TruthParticles",
340 particleIDsToCalculate = [22],
341 IsolationConeSizes = [0.2],
342 IsolationVarNamePrefix =
'ptcone',
343 ChargedParticlesOnly =
True)
346 """Configure the photon isolation tool, etcone=0.4"""
348 name =
"DFCommonTruthPhotonIsolationTool3",
349 isoParticlesKey =
"TruthPhotons",
350 allParticlesKey =
"TruthParticles",
351 particleIDsToCalculate = [22],
352 IsolationConeSizes = [0.4],
353 IsolationVarNamePrefix =
'etcone',
354 ChargedParticlesOnly =
False)
358 """Configure the QG decoration tool for AntiKt4TruthDressedWZJets"""
360 name =
"DFCommonTruthDressedWZQGLabelTool",
361 JetCollection =
"AntiKt4TruthDressedWZJets")
370 """Configure the menu truth thinning tool"""
372 MenuTruthThinning = CompFactory.DerivationFramework.MenuTruthThinning
373 acc.addPublicTool(MenuTruthThinning(name, **kwargs),
383 """Configure the truth link repointing tool"""
385 TruthLinkRepointTool = CompFactory.DerivationFramework.TruthLinkRepointTool
386 acc.addPublicTool(TruthLinkRepointTool(name, **kwargs),
393 """Configure the truth PV collection maker tool"""
395 TruthPVCollectionMaker = CompFactory.DerivationFramework.TruthPVCollectionMaker
396 acc.addPublicTool(TruthPVCollectionMaker(name, **kwargs),
402 """Configure the GenericTruthThinning tool"""
404 GenericTruthThinning = CompFactory.DerivationFramework.GenericTruthThinning
405 acc.addPublicTool(GenericTruthThinning(name, **kwargs),