ATLAS Offline Software
Loading...
Searching...
No Matches
python.MCTruthCommonConfig Namespace Reference

Functions

 TruthMetaDataWriterCfg (flags, name)
 HepMCtoXAODTruthCfg (flags)
 AddTruthJetsCfg (flags)
 AddTruthMETCfg (flags)
 TruthClassificationAugmentationsCfg (flags, **kwargs)
 PreJetMCTruthAugmentationsCfg (flags, **kwargs)
 PostJetMCTruthAugmentationsCfg (flags, **kwargs)
 AddStandardTruthContentsCfg (flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, navInputCollections=["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix='')
 AddParentAndDownstreamParticlesCfg (flags, generations=1, parents=[6], prefix='TopQuark', collection_prefix=None, rejectHadronChildren=False)
 AddBosonsAndDownstreamParticlesCfg (flags, generations=1, rejectHadronChildren=False)
 Add taus and their downstream particles (immediate and further decay products) in a special collection def addTausAndDownstreamParticles(kernel=None, generations=1): return addParentAndDownstreamParticles(kernel=kernel, generations=generations, parents=[15], prefix='Tau')
 AddTopQuarkAndDownstreamParticlesCfg (flags, generations=1, rejectHadronChildren=False)
 AddTauAndDownstreamParticlesCfg (flags, generations=-1, rejectHadronChildren=False)
 AddHFAndDownstreamParticlesCfg (flags, **kwargs)
 Add electrons, photons, and their downstream particles in a special collection def addEgammaAndDownstreamParticles(kernel=None, generations=1): return addParentAndDownstreamParticles(kernel=kernel, generations=generations, parents=[11,22], prefix='Egamma')
 AddPVCollectionCfg (flags)
 AddTruthCollectionNavigationDecorationsCfg (flags, TruthCollections=[], prefix='')
 AddBSMAndDownstreamParticlesCfg (flags, generations=-1)
 AddBornLeptonCollectionCfg (flags)
 AddLargeRJetD2Cfg (flags)
 DFCommonTruthEDDecoratorCfg (flags, name="DFCommonTruthEDDecorator", **kwargs)
 DFCommonTruthCentralEDAlgCfg (flags)
 DFCommonTruthForwardEDAlgCfg (flags)
 AddTruthEnergyDensityCfg (flags)
 AddMiniTruthCollectionLinksCfg (flags, **kwargs)
 addTruth3ContentToSlimmerTool (slimmer)

Function Documentation

◆ AddBornLeptonCollectionCfg()

python.MCTruthCommonConfig.AddBornLeptonCollectionCfg ( flags)
Add born leptons as a mini collection

Definition at line 383 of file MCTruthCommonConfig.py.

383def AddBornLeptonCollectionCfg(flags):
384 """Add born leptons as a mini collection"""
385 acc = ComponentAccumulator()
386 # Set up a tool to keep the taus and all downstream particles
387 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthBornLeptonCollectionMakerCfg
388 DFCommonBornLeptonCollTool = acc.getPrimaryAndMerge(TruthBornLeptonCollectionMakerCfg(flags,
389 name = "DFCommonBornLeptonCollTool",
390 NewCollectionName ="BornLeptons"))
391 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
392 acc.addEventAlgo(CommonAugmentation("MCTruthCommonBornLeptonsKernel", AugmentationTools = [DFCommonBornLeptonCollTool] ))
393 return acc
394

◆ AddBosonsAndDownstreamParticlesCfg()

python.MCTruthCommonConfig.AddBosonsAndDownstreamParticlesCfg ( flags,
generations = 1,
rejectHadronChildren = False )

Add taus and their downstream particles (immediate and further decay products) in a special collection def addTausAndDownstreamParticles(kernel=None, generations=1): return addParentAndDownstreamParticles(kernel=kernel, generations=generations, parents=[15], prefix='Tau')

Add W bosons and their downstream particles def addWbosonsAndDownstreamParticles(kernel=None, generations=1, rejectHadronChildren=False): return addParentAndDownstreamParticles(kernel=kernel, generations=generations, parents=[24], prefix='Wboson', rejectHadronChildren=rejectHadronChildren)

Add bosons and downstream particles (not photons/gluons)

Definition at line 261 of file MCTruthCommonConfig.py.

263 rejectHadronChildren=False):
264 """Add bosons and downstream particles (not photons/gluons)"""
265 return AddParentAndDownstreamParticlesCfg(flags,
266 generations = generations,
267 parents = [23,24,25],
268 prefix = 'Bosons',
269 rejectHadronChildren = rejectHadronChildren)
270
271# Add top quark and their downstream particles

◆ AddBSMAndDownstreamParticlesCfg()

python.MCTruthCommonConfig.AddBSMAndDownstreamParticlesCfg ( flags,
generations = -1 )
Add BSM particles and their downstream particles in a special collection

Definition at line 366 of file MCTruthCommonConfig.py.

366def AddBSMAndDownstreamParticlesCfg(flags, generations=-1):
367 """Add BSM particles and their downstream particles in a special collection"""
368 acc = ComponentAccumulator()
369 # Set up a tool to keep the taus and all downstream particles
370 collection_name = "TruthBSMWithDecay"
371 DFCommonBSMAndDecaysTool = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(flags,
372 name = "DFCommonBSMAndDecaysTool",
373 NewParticleKey = collection_name+'Particles',
374 NewVertexKey = collection_name+'Vertices',
375 KeepBSM = True,
376 Generations = generations))
377 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
378 acc.addEventAlgo(CommonAugmentation(name = "MCTruthCommonBSMAndDecaysKernel",
379 AugmentationTools = [DFCommonBSMAndDecaysTool] ))
380 return acc
381
382# Add a mini-collection for the born leptons

◆ AddHFAndDownstreamParticlesCfg()

python.MCTruthCommonConfig.AddHFAndDownstreamParticlesCfg ( flags,
** kwargs )

Add electrons, photons, and their downstream particles in a special collection def addEgammaAndDownstreamParticles(kernel=None, generations=1): return addParentAndDownstreamParticles(kernel=kernel, generations=generations, parents=[11,22], prefix='Egamma')

Add b/c-hadrons and their downstream particles

Definition at line 311 of file MCTruthCommonConfig.py.

311def AddHFAndDownstreamParticlesCfg(flags, **kwargs):
312 """Add b/c-hadrons and their downstream particles"""
313 kwargs.setdefault("addB",True)
314 kwargs.setdefault("addC",True)
315 kwargs.setdefault("generations",-1)
316 kwargs.setdefault("prefix",'')
317 acc = TruthClassificationAugmentationsCfg(flags)
318 # Set up a tool to keep b- and c-quarks and all downstream particles
319 collection_name = kwargs['prefix']+"TruthHFWithDecay"
320 DFCommonHFAndDecaysTool = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(
321 flags,
322 name=kwargs['prefix']+"DFCommonHFAndDecaysTool",
323 NewParticleKey = collection_name+'Particles',
324 NewVertexKey = collection_name+'Vertices',
325 KeepBHadrons=kwargs['addB'],
326 KeepCHadrons=kwargs['addC'],
327 Generations=kwargs['generations']))
328 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
329 kwargs['prefix']+"MCTruthCommonHFAndDecaysKernel",
330 AugmentationTools = [DFCommonHFAndDecaysTool] ))
331 return acc
332
333
334# Add a one-vertex-per event "primary vertex" container

◆ AddLargeRJetD2Cfg()

python.MCTruthCommonConfig.AddLargeRJetD2Cfg ( flags)
Add large-R jet D2 variable

Definition at line 395 of file MCTruthCommonConfig.py.

395def AddLargeRJetD2Cfg(flags):
396 """Add large-R jet D2 variable"""
397 #Extra classifier for D2 variable
398 acc = ComponentAccumulator()
399 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthD2DecoratorCfg
400 theTruthD2Decorator = acc.getPrimaryAndMerge(TruthD2DecoratorCfg(flags,
401 name = "TruthD2Decorator",
402 JetContainerKey = "AntiKt10TruthSoftDropBeta100Zcut10Jets",
403 DecorationName = "D2"))
404 TruthD2DecoratorKernel = CompFactory.DerivationFramework.CommonAugmentation
405 acc.addEventAlgo(TruthD2DecoratorKernel("TRUTHD2Kernel", AugmentationTools = [theTruthD2Decorator] ))
406 return acc
407
408

◆ AddMiniTruthCollectionLinksCfg()

python.MCTruthCommonConfig.AddMiniTruthCollectionLinksCfg ( flags,
** kwargs )
Tool to move pointers to new mini truth collections

Definition at line 469 of file MCTruthCommonConfig.py.

469def AddMiniTruthCollectionLinksCfg(flags, **kwargs):
470 """Tool to move pointers to new mini truth collections"""
471 acc = ComponentAccumulator()
472 kwargs.setdefault("doElectrons",True)
473 kwargs.setdefault("doPhotons",True)
474 kwargs.setdefault("doMuons",True)
475 aug_tools = []
476 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthLinkRepointToolCfg
477 if kwargs['doElectrons']:
478 electron_relink = acc.getPrimaryAndMerge(TruthLinkRepointToolCfg(
479 flags,
480 name="ElMiniCollectionTruthLinkTool",
481 RecoCollection="Electrons",
482 TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]))
483 aug_tools += [ electron_relink ]
484 if kwargs['doPhotons']:
485 photon_relink = acc.getPrimaryAndMerge(TruthLinkRepointToolCfg(
486 flags,
487 name="PhMiniCollectionTruthLinkTool",
488 RecoCollection="Photons",
489 TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]))
490 aug_tools += [ photon_relink ]
491 if kwargs['doMuons']:
492 muon_relink = acc.getPrimaryAndMerge(TruthLinkRepointToolCfg(
493 flags,
494 name="MuMiniCollectionTruthLinkTool",
495 RecoCollection="Muons",
496 TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]))
497 aug_tools += [ muon_relink ]
498 for i, tool in enumerate(aug_tools):
499 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
500 "MiniCollectionTruthLinkKernelNo{num}".format(num=i+1),
501 AugmentationTools = [tool] ))
502 return acc
503
504

◆ AddParentAndDownstreamParticlesCfg()

python.MCTruthCommonConfig.AddParentAndDownstreamParticlesCfg ( flags,
generations = 1,
parents = [6],
prefix = 'TopQuark',
collection_prefix = None,
rejectHadronChildren = False )
Configure tools for adding immediate parents and descendants

Definition at line 221 of file MCTruthCommonConfig.py.

226 rejectHadronChildren=False):
227 """Configure tools for adding immediate parents and descendants"""
228 acc = ComponentAccumulator()
229 collection_name=collection_prefix+'WithDecay' if collection_prefix is not None else 'Truth'+prefix+'WithDecay'
230 # Set up a tool to keep the W/Z/H bosons and all downstream particles
231 collection_maker = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(flags,
232 name ='DFCommon'+prefix+'AndDecaysTool',
233 NewParticleKey = collection_name+'Particles',
234 NewVertexKey = collection_name+'Vertices',
235 PDGIDsToKeep = parents,
236 Generations = generations,
237 RejectHadronChildren = rejectHadronChildren))
238 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
239 kernel_name = 'MCTruthCommon'+prefix+'AndDecaysKernel'
240 acc.addEventAlgo(CommonAugmentation(kernel_name, AugmentationTools = [collection_maker] ))
241 return acc
242
243# Next two don't seem to be used for anything...

◆ AddPVCollectionCfg()

python.MCTruthCommonConfig.AddPVCollectionCfg ( flags)
Add a one-vertex-per event "primary vertex" container

Definition at line 335 of file MCTruthCommonConfig.py.

335def AddPVCollectionCfg(flags):
336 """Add a one-vertex-per event "primary vertex" container"""
337 acc = ComponentAccumulator()
338 # Set up a tool to keep the primary vertices
339 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthPVCollectionMakerCfg
340 DFCommonTruthPVCollTool = acc.getPrimaryAndMerge(TruthPVCollectionMakerCfg(
341 flags,
342 name="DFCommonTruthPVCollTool",
343 NewCollectionName="TruthPrimaryVertices"))
344 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
345 "MCTruthCommonTruthPVCollKernel",
346 AugmentationTools = [DFCommonTruthPVCollTool] ))
347 return acc
348
349
350# Add navigation decorations on the truth collections

◆ AddStandardTruthContentsCfg()

python.MCTruthCommonConfig.AddStandardTruthContentsCfg ( flags,
decorationDressing = 'dressedPhoton',
includeTausInDressingPhotonRemoval = False,
navInputCollections = ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"],
prefix = '' )

Definition at line 182 of file MCTruthCommonConfig.py.

186 prefix=''):
187
188 acc = ComponentAccumulator()
189
190 # Schedule HepMC->xAOD truth conversion
191 acc.merge(HepMCtoXAODTruthCfg(flags))
192
193 # Local flag
194 isEVNT = False
195 if "McEventCollection#GEN_EVENT" in flags.Input.TypedCollections: isEVNT = True
196 # Tools that must come before jets
197 acc.merge(PreJetMCTruthAugmentationsCfg(flags,decorationDressing = decorationDressing))
198 # Jets and MET
199 acc.merge(AddTruthJetsCfg(flags))
200 acc.merge(AddTruthMETCfg(flags))
201 # Tools that must come after jets
202 acc.merge(PostJetMCTruthAugmentationsCfg(flags))
203 # Should photons that are dressed onto taus also be removed from truth jets?
204 if includeTausInDressingPhotonRemoval:
205 acc.getPublicTool("DFCommonTruthTauDressingTool").decorationName=decorationDressing+"_tau"
206
207 # Add back the navigation contect for the collections we want
208 acc.merge(AddTruthCollectionNavigationDecorationsCfg(flags, navInputCollections, prefix=prefix))
209 # Some more additions for standard TRUTH3
210 acc.merge(AddBosonsAndDownstreamParticlesCfg(flags))
211 if isEVNT: acc.merge(AddLargeRJetD2Cfg(flags))
212 # Special collection for BSM particles
213 acc.merge(AddBSMAndDownstreamParticlesCfg(flags))
214 # Special collection for Born leptons
215 acc.merge(AddBornLeptonCollectionCfg(flags))
216 # Energy density for isolation corrections
217 if isEVNT: acc.merge(AddTruthEnergyDensityCfg(flags))
218
219 return acc
220

◆ AddTauAndDownstreamParticlesCfg()

python.MCTruthCommonConfig.AddTauAndDownstreamParticlesCfg ( flags,
generations = -1,
rejectHadronChildren = False )
Add tau and downstream particles

Definition at line 282 of file MCTruthCommonConfig.py.

284 rejectHadronChildren=False):
285 """Add tau and downstream particles"""
286 return AddParentAndDownstreamParticlesCfg(flags,
287 generations=generations,
288 parents=[15],
289 prefix='Taus',
290 rejectHadronChildren=rejectHadronChildren)
291
292# Following commented methods don't seem to be used for anything...
293
294#def addBottomQuarkAndDownstreamParticles(kernel=None, generations=1, rejectHadronChildren=False):
295# return addParentAndDownstreamParticles(kernel=kernel,
296# generations=generations,
297# parents=[5],
298# prefix='BottomQuark',
299# rejectHadronChildren=rejectHadronChildren)
300#
301#

◆ AddTopQuarkAndDownstreamParticlesCfg()

python.MCTruthCommonConfig.AddTopQuarkAndDownstreamParticlesCfg ( flags,
generations = 1,
rejectHadronChildren = False )
Add top quarks and downstream particles

Definition at line 272 of file MCTruthCommonConfig.py.

274 rejectHadronChildren=False):
275 """Add top quarks and downstream particles"""
276 return AddParentAndDownstreamParticlesCfg(flags,
277 generations=generations,
278 parents=[6],
279 prefix='TopQuark',
280 rejectHadronChildren=rejectHadronChildren)
281

◆ addTruth3ContentToSlimmerTool()

python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool ( slimmer)

Definition at line 505 of file MCTruthCommonConfig.py.

505def addTruth3ContentToSlimmerTool(slimmer):
506 slimmer.ExtraVariables += [
507 "AntiKt4TruthDressedWZJets.GhostCHadronsFinalCount.GhostBHadronsFinalCount.pt.HadronConeExclTruthLabelID.PartonTruthLabelID.TrueFlavor",
508 "AntiKt10TruthSoftDropBeta100Zcut10Jets.pt.Tau1_wta.Tau2_wta.Tau3_wta.D2",
509 "TruthEvents.Q.XF1.XF2.PDGID1.PDGID2.PDFID1.PDFID2.X1.X2.crossSection",
510 "MET_Truth.mpx.mpy.sumet.name.source",
511 "TruthElectrons.prodVtxLink.decayVtxLink.parentLinks.childLinks.m.px.py.pz.e.pdgId.ptcone30.etcone20.classifierParticleOrigin.Classification.barcode.status.classifierParticleType.classifierParticleOutCome.polarizationPhi.polarizationTheta.e_dressed.pt_dressed.eta_dressed.phi_dressed.nPhotons_dressed.uid",
512 "TruthMuons.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.e_dressed.pt_dressed.eta_dressed.phi_dressed.nPhotons_dressed.ptcone30.etcone20.decayVtxLink.prodVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
513 "TruthPhotons.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.ptcone20.etcone20.etcone40.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
514 "TruthTaus.prodVtxLink.decayVtxLink.parentLinks.childLinks.m.px.py.pz.e.pdgId.classifierParticleOrigin.Classification.pt_vis.eta_vis.phi_vis.m_vis.barcode.status.classifierParticleType.classifierParticleOutCome.originalTruthParticle.polarizationPhi.polarizationTheta.pt_vis_dressed.eta_vis_dressed.phi_vis_dressed.m_vis_dressed.nPhotons_dressed.numCharged.numChargedPion.numNeutral.numNeutralPion.IsHadronicTau.pt_invis.eta_invis.phi_invis.m_invis.pt_vis_neutral.eta_vis_neutral.phi_vis_neutral.m_vis_neutral.DecayModeVector.decay_vertex_x.decay_vertex_y.decay_vertex_z.prod_vertex_x.prod_vertex_y.prod_vertex_z.uid",
515 "TruthNeutrinos.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
516 "TruthBSM.barcode.childLinks.Classification.classifierParticleOrigin.classifierParticleOutCome.classifierParticleType.decayVtxLink.e.m.parentLinks.pdgId.polarizationPhi.polarizationTheta.prodVtxLink.px.py.pz.status",
517 "TruthBottom.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
518 "TruthTop.m.px.py.pz.e.pdgId.barcode.status.prodVtxLink.decayVtxLink.parentLinks.childLinks.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.polarizationPhi.polarizationTheta.uid",
519 "TruthBoson.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
520 "TruthForwardProtons.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.polarizationPhi.polarizationTheta.uid",
521 "BornLeptons.prodVtxLink.decayVtxLink.m.px.py.pz.e.pdgId.classifierParticleOrigin.Classification.barcode.status.classifierParticleType.classifierParticleOutCome.polarizationPhi.polarizationTheta.uid",
522 "TruthBosonsWithDecayParticles.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.barcode.id.x.y.z.t.prodVtxLink.decayVtxLink.incomingParticleLinks.outgoingParticleLinks.uid",
523 "TruthBosonsWithDecayVertices.barcode.id.x.y.z.t.prodVtxLink.decayVtxLink.incomingParticleLinks.outgoingParticleLinks.uid.status",
524 "TruthBSMWithDecayParticles.barcode.Classification.classifierParticleOrigin.classifierParticleOutCome.classifierParticleType.decayVtxLink.e.m.pdgId.prodVtxLink.px.py.pz.status",
525 "TruthBSMWithDecayVertices.barcode.id.incomingParticleLinks.outgoingParticleLinks.t.x.y.z"
526 ]

◆ AddTruthCollectionNavigationDecorationsCfg()

python.MCTruthCommonConfig.AddTruthCollectionNavigationDecorationsCfg ( flags,
TruthCollections = [],
prefix = '' )
Tool to add navigation decorations on the truth collections

Definition at line 351 of file MCTruthCommonConfig.py.

351def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix=''):
352 """Tool to add navigation decorations on the truth collections"""
353 acc = ComponentAccumulator()
354 if len(TruthCollections) > 0:
355 # Set up a tool to add the navigation decorations
356 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthNavigationDecoratorCfg
357 DFCommonTruthNavigationDecorator = acc.getPrimaryAndMerge(TruthNavigationDecoratorCfg(flags,
358 name = prefix+'DFCommonTruthNavigationDecorator',
359 InputCollections = TruthCollections))
360 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
361 acc.addEventAlgo(CommonAugmentation(prefix+"MCTruthNavigationDecoratorKernel",
362 AugmentationTools = [DFCommonTruthNavigationDecorator] ))
363 return acc
364
365# Add BSM particles and their downstream particles (immediate and further decay products) in a special collection

◆ AddTruthEnergyDensityCfg()

python.MCTruthCommonConfig.AddTruthEnergyDensityCfg ( flags)
Truth energy density tools

Definition at line 454 of file MCTruthCommonConfig.py.

454def AddTruthEnergyDensityCfg(flags):
455 """Truth energy density tools"""
456 acc = ComponentAccumulator()
457 # Algorithms for the energy density - needed only if e/gamma hasn't set things up already
458 acc.merge(DFCommonTruthCentralEDAlgCfg(flags))
459 acc.merge(DFCommonTruthForwardEDAlgCfg(flags))
460
461 DFCommonTruthEDKernel = CompFactory.DerivationFramework.CommonAugmentation("DFCommonTruthEDKernel",
462 AugmentationTools =
463 [acc.addPublicTool(acc.popToolsAndMerge(DFCommonTruthEDDecoratorCfg(flags)))] )
464 acc.addEventAlgo(DFCommonTruthEDKernel)
465 return acc
466
467
468# Sets up modifiers to move pointers to old truth collections to new mini truth collections

◆ AddTruthJetsCfg()

python.MCTruthCommonConfig.AddTruthJetsCfg ( flags)

Definition at line 65 of file MCTruthCommonConfig.py.

65def AddTruthJetsCfg(flags):
66
67 acc = ComponentAccumulator()
68
69 from JetRecConfig.StandardSmallRJets import AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ,AntiKtVRTruthCharged
70 from JetRecConfig.StandardLargeRJets import AntiKt10TruthSoftDrop
71 from JetRecConfig.JetRecConfig import JetRecCfg
72
73 inputCollections = set(flags.Input.Collections)
74 jetList = [AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ,AntiKtVRTruthCharged,
75 AntiKt10TruthSoftDrop]
76
77 for jd in jetList:
78 # Encode the expected name to match the bytes in inputCollections.
79 expectedName = jd.fullname().encode("utf-8")
80 if expectedName in inputCollections:
81 continue
82 acc.merge(JetRecCfg(flags, jd))
83 return acc
84
85# Helper for scheduling the truth MET collection
STL class.

◆ AddTruthMETCfg()

python.MCTruthCommonConfig.AddTruthMETCfg ( flags)

Definition at line 86 of file MCTruthCommonConfig.py.

86def AddTruthMETCfg(flags):
87
88 acc = ComponentAccumulator()
89
90 # Only do this if the truth MET is not present
91 # This should handle EVNT correctly without an explicit check
92 if ( "MissingETContainer#MET_Truth") not in flags.Input.TypedCollections:
93 from METReconstruction.METTruth_Cfg import METTruth_Cfg
94 acc.merge(METTruth_Cfg(flags))
95
96 return acc
97
98

◆ DFCommonTruthCentralEDAlgCfg()

python.MCTruthCommonConfig.DFCommonTruthCentralEDAlgCfg ( flags)
 

Definition at line 421 of file MCTruthCommonConfig.py.

421def DFCommonTruthCentralEDAlgCfg(flags):
422 """ """
423 acc = ComponentAccumulator()
424 from EventShapeTools.EventDensityConfig import configEventDensityTool
425 from JetRecConfig.StandardJetConstits import stdConstitDic as cst
426 DFCommonTruthCentralEDTool = configEventDensityTool("DFCommonTruthCentralEDTool",
427 cst.Truth,
428 0.5,
429 AbsRapidityMax = 1.5,
430 OutputContainer = "TruthIsoCentralEventShape",
431 )
432 acc.addEventAlgo(CompFactory.EventDensityAthAlg("DFCommonTruthCentralEDAlg",
433 EventDensityTool = DFCommonTruthCentralEDTool ))
434 return acc
435
436

◆ DFCommonTruthEDDecoratorCfg()

python.MCTruthCommonConfig.DFCommonTruthEDDecoratorCfg ( flags,
name = "DFCommonTruthEDDecorator",
** kwargs )
Truth energy density decorator

Definition at line 409 of file MCTruthCommonConfig.py.

409def DFCommonTruthEDDecoratorCfg(flags, name="DFCommonTruthEDDecorator", **kwargs):
410 """Truth energy density decorator"""
411 acc = ComponentAccumulator()
412 kwargs.setdefault("EventInfoName", "EventInfo")
413 kwargs.setdefault("EventShapeKeys", ["TruthIsoCentralEventShape","TruthIsoForwardEventShape"])
414 suffix = kwargs.pop("DecorationSuffix", "_rho")
415 kwargs.setdefault("EnergyDensityDecorKeys", [ x + suffix for x in kwargs["EventShapeKeys"] ])
416 acc.setPrivateTools(CompFactory.DerivationFramework.TruthEDDecorator(name, **kwargs))
417 return acc
418
419
420# Truth energy density tools

◆ DFCommonTruthForwardEDAlgCfg()

python.MCTruthCommonConfig.DFCommonTruthForwardEDAlgCfg ( flags)
 

Definition at line 437 of file MCTruthCommonConfig.py.

437def DFCommonTruthForwardEDAlgCfg(flags):
438 """ """
439 acc = ComponentAccumulator()
440 from EventShapeTools.EventDensityConfig import configEventDensityTool
441 from JetRecConfig.StandardJetConstits import stdConstitDic as cst
442 DFCommonTruthForwardEDTool = configEventDensityTool("DFCommonTruthForwardEDTool",
443 cst.Truth,
444 0.5,
445 AbsRapidityMin = 1.5,
446 AbsRapidityMax = 3.0,
447 OutputContainer = "TruthIsoForwardEventShape",
448 )
449 acc.addEventAlgo(CompFactory.EventDensityAthAlg("DFCommonTruthForwardEDAlg",
450 EventDensityTool = DFCommonTruthForwardEDTool ))
451 return acc
452
453

◆ HepMCtoXAODTruthCfg()

python.MCTruthCommonConfig.HepMCtoXAODTruthCfg ( flags)
Conversion of HepMC to xAOD truth

Definition at line 19 of file MCTruthCommonConfig.py.

19def HepMCtoXAODTruthCfg(flags):
20 """Conversion of HepMC to xAOD truth"""
21 acc = ComponentAccumulator()
22
23 # Only run for MC input
24 if flags.Input.isMC is False and flags.Overlay.DataOverlay is False:
25 raise RuntimeError("Common MC truth building requested for non-MC input")
26
27 # Local steering flag to identify EVNT input
28 # Commented because the block it is needed for isn't working (TruthMetaData)
29 isEVNT = False
30
31 # Ensure EventInfoCnvAlg is scheduled
32 if "EventInfo#McEventInfo" in flags.Input.TypedCollections and "xAOD::EventInfo#EventInfo" not in flags.Input.TypedCollections:
33 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoCnvAlgCfg
34 acc.merge(EventInfoCnvAlgCfg(flags, inputKey="McEventInfo", outputKey="Input_EventInfo", disableBeamSpot=True))
35
36 from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoUpdateFromContextAlgCfg
37 acc.merge(EventInfoUpdateFromContextAlgCfg(flags, disableBeamSpot=True))
38
39 # Build truth collection if input is HepMC. Must be scheduled first to allow slimming.
40 # Input file is event generator output (EVNT)
41 from xAODTruthCnv.xAODTruthCnvConfig import GEN_EVNT2xAODCfg
42 if "McEventCollection#GEN_EVENT" in flags.Input.TypedCollections:
43 acc.merge(GEN_EVNT2xAODCfg(flags,name="GEN_EVNT2xAOD",AODContainerName="GEN_EVENT"))
44 isEVNT = True
45 # Input file is simulation output (HITS)
46 elif "McEventCollection#TruthEvent" in flags.Input.TypedCollections:
47 acc.merge(GEN_EVNT2xAODCfg(flags,name="GEN_EVNT2xAOD",AODContainerName="TruthEvent"))
48 # This is not really EVNT, but we do need to treat it like EVNT for Metadata
49 isEVNT = True
50 # Input file already has xAOD truth. Don't do anything.
51 elif "xAOD::TruthEventContainer#TruthEvents" in flags.Input.TypedCollections:
52 pass
53 else:
54 raise RuntimeError("No recognised HepMC truth information found in the input")
55
56 # If it isn't available, make a truth meta data object (will hold MC Event Weights)
57 if "TruthMetaDataContainer#TruthMetaData" not in flags.Input.TypedCollections and not isEVNT:
58 # If we are going to be making the truth collection (isEVNT) then this will be made elsewhere
59 acc.merge(TruthMetaDataWriterCfg(flags, name = 'DFCommonTruthMetaDataWriter'))
60
61 return acc
62
63
64# Helper for adding truth jet collections via new jet config

◆ PostJetMCTruthAugmentationsCfg()

python.MCTruthCommonConfig.PostJetMCTruthAugmentationsCfg ( flags,
** kwargs )

Definition at line 145 of file MCTruthCommonConfig.py.

145def PostJetMCTruthAugmentationsCfg(flags, **kwargs):
146
147 acc = ComponentAccumulator()
148
149 # Tau collections are built separately
150 # truth tau matching needs truth jets, truth electrons and truth muons
151 from DerivationFrameworkTau.TauTruthCommonConfig import TauTruthToolsCfg
152 acc.merge(TauTruthToolsCfg(flags))
153 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthTauDressingToolCfg
154 augmentationToolsList = [ acc.getPrimaryAndMerge(DFCommonTruthTauDressingToolCfg(flags)) ]
155
156 #Save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo)
157 from DerivationFrameworkMCTruth.GenFilterToolConfig import GenFilterToolCfg
158 # schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below
159 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthDressedWZQGLabelToolCfg
160 augmentationToolsList += [ acc.addPublicTool(acc.popToolsAndMerge(GenFilterToolCfg(flags))),
161 acc.getPrimaryAndMerge(DFCommonTruthDressedWZQGLabelToolCfg(flags))]
162
163 # SUSY signal decorations
164 from DerivationFrameworkSUSY.DecorateSUSYProcessConfig import IsSUSYSignalRun3
165 if IsSUSYSignalRun3(flags):
166 from DerivationFrameworkSUSY.DecorateSUSYProcessConfig import SUSYSignalTaggerCfg
167 augmentationToolsList += [ acc.getPrimaryAndMerge(SUSYSignalTaggerCfg(flags, 'MCTruthCommon')) ]
168
169 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
170 for i, tool in enumerate(augmentationToolsList):
171 acc.addEventAlgo(CommonAugmentation(name = "MCTruthCommonPostJetKernelNo{num}".format(num = i+1),
172 AugmentationTools = [tool]))
173
174 # add SoW of individual SUSY final states, relies on augmentation from DecorateSUSYProcess()
175 if IsSUSYSignalRun3(flags):
176 from DerivationFrameworkSUSY.SUSYWeightMetadataConfig import AddSUSYWeightsCfg
177 acc.merge(AddSUSYWeightsCfg(flags))
178
179 return(acc)
180
181# This adds the entirety of TRUTH3

◆ PreJetMCTruthAugmentationsCfg()

python.MCTruthCommonConfig.PreJetMCTruthAugmentationsCfg ( flags,
** kwargs )

Definition at line 110 of file MCTruthCommonConfig.py.

110def PreJetMCTruthAugmentationsCfg(flags, **kwargs):
111
112 acc = TruthClassificationAugmentationsCfg(flags)
113
114 augmentationToolsList = []
115
116 # These augmentations do *not* require truth jets at all
117 # If requested, add a decoration to photons that were used in the dressing
118
119 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import ( DFCommonTruthElectronDressingToolCfg,
120 DFCommonTruthMuonDressingToolCfg, DFCommonTruthMuonToolCfg, DFCommonTruthElectronToolCfg,
121 DFCommonTruthPhotonToolSimCfg, DFCommonTruthNeutrinoToolCfg, DFCommonTruthBottomToolCfg, DFCommonTruthTopToolCfg,
122 DFCommonTruthBosonToolCfg, DFCommonTruthBSMToolCfg, DFCommonTruthForwardProtonToolCfg, DFCommonTruthElectronIsolationTool1Cfg,
123 DFCommonTruthElectronIsolationTool2Cfg, DFCommonTruthMuonIsolationTool1Cfg, DFCommonTruthMuonIsolationTool2Cfg,
124 DFCommonTruthPhotonIsolationTool1Cfg, DFCommonTruthPhotonIsolationTool2Cfg, DFCommonTruthPhotonIsolationTool3Cfg )
125
126 # schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below
127 for item in [ DFCommonTruthMuonToolCfg, DFCommonTruthElectronToolCfg,
128 DFCommonTruthPhotonToolSimCfg, DFCommonTruthNeutrinoToolCfg, DFCommonTruthBottomToolCfg, DFCommonTruthTopToolCfg,
129 DFCommonTruthBosonToolCfg, DFCommonTruthBSMToolCfg, DFCommonTruthElectronIsolationTool1Cfg,
130 DFCommonTruthElectronIsolationTool2Cfg, DFCommonTruthMuonIsolationTool1Cfg, DFCommonTruthMuonIsolationTool2Cfg,
131 DFCommonTruthPhotonIsolationTool1Cfg, DFCommonTruthPhotonIsolationTool2Cfg, DFCommonTruthPhotonIsolationTool3Cfg]:
132 augmentationToolsList.append(acc.getPrimaryAndMerge(item(flags)))
133 augmentationToolsList.append(acc.getPrimaryAndMerge(DFCommonTruthForwardProtonToolCfg(flags)))
134
135 if 'decorationDressing' in kwargs:
136 augmentationToolsList.append(acc.getPrimaryAndMerge(DFCommonTruthElectronDressingToolCfg(flags, decorationName = kwargs['decorationDressing'])))
137 augmentationToolsList.append(acc.getPrimaryAndMerge(DFCommonTruthMuonDressingToolCfg(flags, decorationName = kwargs['decorationDressing'])))
138
139 for i, tool in enumerate(augmentationToolsList):
140 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(name ="MCTruthCommonPreJetKernelNo{num}".format(num = i+1), AugmentationTools = [tool]))
141
142 return(acc)
143
144

◆ TruthClassificationAugmentationsCfg()

python.MCTruthCommonConfig.TruthClassificationAugmentationsCfg ( flags,
** kwargs )

Definition at line 99 of file MCTruthCommonConfig.py.

99def TruthClassificationAugmentationsCfg(flags, **kwargs):
100
101 acc = ComponentAccumulator()
102
103 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthClassificationToolCfg
104 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(name ="MCTruthClassificationKernel",
105 AugmentationTools = [ acc.addPublicTool(acc.popToolsAndMerge(DFCommonTruthClassificationToolCfg(flags))) ]))
106
107 return acc
108
109

◆ TruthMetaDataWriterCfg()

python.MCTruthCommonConfig.TruthMetaDataWriterCfg ( flags,
name )

Definition at line 11 of file MCTruthCommonConfig.py.

11def TruthMetaDataWriterCfg(flags, name):
12 acc = ComponentAccumulator()
13 theTruthMetaDataWriter = CompFactory.DerivationFramework.TruthMetaDataWriter(name)
14 acc.addPublicTool(theTruthMetaDataWriter)
15 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
16 acc.addEventAlgo(CommonAugmentation(f"{name}Kernel", AugmentationTools = [theTruthMetaDataWriter]))
17 return acc
18