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 380 of file MCTruthCommonConfig.py.

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

◆ 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 258 of file MCTruthCommonConfig.py.

260 rejectHadronChildren=False):
261 """Add bosons and downstream particles (not photons/gluons)"""
262 return AddParentAndDownstreamParticlesCfg(flags,
263 generations = generations,
264 parents = [23,24,25],
265 prefix = 'Bosons',
266 rejectHadronChildren = rejectHadronChildren)
267
268# 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 363 of file MCTruthCommonConfig.py.

363def AddBSMAndDownstreamParticlesCfg(flags, generations=-1):
364 """Add BSM particles and their downstream particles in a special collection"""
365 acc = ComponentAccumulator()
366 # Set up a tool to keep the taus and all downstream particles
367 collection_name = "TruthBSMWithDecay"
368 DFCommonBSMAndDecaysTool = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(flags,
369 name = "DFCommonBSMAndDecaysTool",
370 NewParticleKey = collection_name+'Particles',
371 NewVertexKey = collection_name+'Vertices',
372 KeepBSM = True,
373 Generations = generations))
374 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
375 acc.addEventAlgo(CommonAugmentation(name = "MCTruthCommonBSMAndDecaysKernel",
376 AugmentationTools = [DFCommonBSMAndDecaysTool] ))
377 return acc
378
379# 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 308 of file MCTruthCommonConfig.py.

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

◆ AddLargeRJetD2Cfg()

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

Definition at line 392 of file MCTruthCommonConfig.py.

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

◆ AddMiniTruthCollectionLinksCfg()

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

Definition at line 467 of file MCTruthCommonConfig.py.

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

◆ 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 218 of file MCTruthCommonConfig.py.

223 rejectHadronChildren=False):
224 """Configure tools for adding immediate parents and descendants"""
225 acc = ComponentAccumulator()
226 collection_name=collection_prefix+'WithDecay' if collection_prefix is not None else 'Truth'+prefix+'WithDecay'
227 # Set up a tool to keep the W/Z/H bosons and all downstream particles
228 collection_maker = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(flags,
229 name ='DFCommon'+prefix+'AndDecaysTool',
230 NewParticleKey = collection_name+'Particles',
231 NewVertexKey = collection_name+'Vertices',
232 PDGIDsToKeep = parents,
233 Generations = generations,
234 RejectHadronChildren = rejectHadronChildren))
235 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
236 kernel_name = 'MCTruthCommon'+prefix+'AndDecaysKernel'
237 acc.addEventAlgo(CommonAugmentation(kernel_name, AugmentationTools = [collection_maker] ))
238 return acc
239
240# 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 332 of file MCTruthCommonConfig.py.

332def AddPVCollectionCfg(flags):
333 """Add a one-vertex-per event "primary vertex" container"""
334 acc = ComponentAccumulator()
335 # Set up a tool to keep the primary vertices
336 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthPVCollectionMakerCfg
337 DFCommonTruthPVCollTool = acc.getPrimaryAndMerge(TruthPVCollectionMakerCfg(
338 flags,
339 name="DFCommonTruthPVCollTool",
340 NewCollectionName="TruthPrimaryVertices"))
341 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
342 "MCTruthCommonTruthPVCollKernel",
343 AugmentationTools = [DFCommonTruthPVCollTool] ))
344 return acc
345
346
347# 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 179 of file MCTruthCommonConfig.py.

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

◆ AddTauAndDownstreamParticlesCfg()

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

Definition at line 279 of file MCTruthCommonConfig.py.

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

◆ AddTopQuarkAndDownstreamParticlesCfg()

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

Definition at line 269 of file MCTruthCommonConfig.py.

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

◆ addTruth3ContentToSlimmerTool()

python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool ( slimmer)

Definition at line 503 of file MCTruthCommonConfig.py.

503def addTruth3ContentToSlimmerTool(slimmer):
504 slimmer.ExtraVariables += [
505 "AntiKt4TruthDressedWZJets.GhostCHadronsFinalCount.GhostBHadronsFinalCount.pt.HadronConeExclTruthLabelID.PartonTruthLabelID.TrueFlavor",
506 "AntiKt10TruthSoftDropBeta100Zcut10Jets.pt.Tau1_wta.Tau2_wta.Tau3_wta.D2",
507 "TruthEvents.Q.XF1.XF2.PDGID1.PDGID2.PDFID1.PDFID2.X1.X2.crossSection",
508 "MET_Truth.mpx.mpy.sumet.name.source",
509 "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",
510 "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",
511 "TruthPhotons.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.ptcone20.etcone20.etcone40.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
512 "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",
513 "TruthNeutrinos.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
514 "TruthBSM.barcode.childLinks.Classification.classifierParticleOrigin.classifierParticleOutCome.classifierParticleType.decayVtxLink.e.m.parentLinks.pdgId.polarizationPhi.polarizationTheta.prodVtxLink.px.py.pz.status",
515 "TruthBottom.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
516 "TruthTop.m.px.py.pz.e.pdgId.barcode.status.prodVtxLink.decayVtxLink.parentLinks.childLinks.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.polarizationPhi.polarizationTheta.uid",
517 "TruthBoson.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.parentLinks.childLinks.polarizationPhi.polarizationTheta.uid",
518 "TruthForwardProtons.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.prodVtxLink.decayVtxLink.polarizationPhi.polarizationTheta.uid",
519 "BornLeptons.prodVtxLink.decayVtxLink.m.px.py.pz.e.pdgId.classifierParticleOrigin.Classification.barcode.status.classifierParticleType.classifierParticleOutCome.polarizationPhi.polarizationTheta.uid",
520 "TruthBosonsWithDecayParticles.m.px.py.pz.e.pdgId.barcode.status.classifierParticleOrigin.classifierParticleType.classifierParticleOutCome.Classification.barcode.id.x.y.z.t.prodVtxLink.decayVtxLink.incomingParticleLinks.outgoingParticleLinks.uid",
521 "TruthBosonsWithDecayVertices.barcode.id.x.y.z.t.prodVtxLink.decayVtxLink.incomingParticleLinks.outgoingParticleLinks.uid.status",
522 "TruthBSMWithDecayParticles.barcode.Classification.classifierParticleOrigin.classifierParticleOutCome.classifierParticleType.decayVtxLink.e.m.pdgId.prodVtxLink.px.py.pz.status",
523 "TruthBSMWithDecayVertices.barcode.id.incomingParticleLinks.outgoingParticleLinks.t.x.y.z"
524 ]

◆ AddTruthCollectionNavigationDecorationsCfg()

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

Definition at line 348 of file MCTruthCommonConfig.py.

348def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix=''):
349 """Tool to add navigation decorations on the truth collections"""
350 acc = ComponentAccumulator()
351 if len(TruthCollections) > 0:
352 # Set up a tool to add the navigation decorations
353 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthNavigationDecoratorCfg
354 DFCommonTruthNavigationDecorator = acc.getPrimaryAndMerge(TruthNavigationDecoratorCfg(flags,
355 name = prefix+'DFCommonTruthNavigationDecorator',
356 InputCollections = TruthCollections))
357 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
358 acc.addEventAlgo(CommonAugmentation(prefix+"MCTruthNavigationDecoratorKernel",
359 AugmentationTools = [DFCommonTruthNavigationDecorator] ))
360 return acc
361
362# 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 452 of file MCTruthCommonConfig.py.

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

◆ AddTruthJetsCfg()

python.MCTruthCommonConfig.AddTruthJetsCfg ( flags)

Definition at line 62 of file MCTruthCommonConfig.py.

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

◆ AddTruthMETCfg()

python.MCTruthCommonConfig.AddTruthMETCfg ( flags)

Definition at line 83 of file MCTruthCommonConfig.py.

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

◆ DFCommonTruthCentralEDAlgCfg()

python.MCTruthCommonConfig.DFCommonTruthCentralEDAlgCfg ( flags)
 

Definition at line 419 of file MCTruthCommonConfig.py.

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

◆ DFCommonTruthEDDecoratorCfg()

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

Definition at line 406 of file MCTruthCommonConfig.py.

406def DFCommonTruthEDDecoratorCfg(flags, name="DFCommonTruthEDDecorator", **kwargs):
407 """Truth energy density decorator"""
408 acc = ComponentAccumulator()
409 eventInfoKey = kwargs.setdefault("EventInfoName", "EventInfo")
410 kwargs.setdefault("EventShapeKeys", ["TruthIsoCentralEventShape","TruthIsoForwardEventShape"])
411 suffix = kwargs.pop("DecorationSuffix", "_rho")
412 kwargs.setdefault("EnergyDensityDecorKeys", [ eventInfoKey + "." + x + suffix for x in kwargs["EventShapeKeys"] ])
413 # FIXME Once WriteDecorHandleKeyArray is updated the above line can be simplified
414 acc.setPrivateTools(CompFactory.DerivationFramework.TruthEDDecorator(name, **kwargs))
415 return acc
416
417
418# Truth energy density tools

◆ DFCommonTruthForwardEDAlgCfg()

python.MCTruthCommonConfig.DFCommonTruthForwardEDAlgCfg ( flags)
 

Definition at line 435 of file MCTruthCommonConfig.py.

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

◆ 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:
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="EventInfo", disableBeamSpot=True))
35
36 # Build truth collection if input is HepMC. Must be scheduled first to allow slimming.
37 # Input file is event generator output (EVNT)
38 from xAODTruthCnv.xAODTruthCnvConfig import GEN_EVNT2xAODCfg
39 if "McEventCollection#GEN_EVENT" in flags.Input.TypedCollections:
40 acc.merge(GEN_EVNT2xAODCfg(flags,name="GEN_EVNT2xAOD",AODContainerName="GEN_EVENT"))
41 isEVNT = True
42 # Input file is simulation output (HITS)
43 elif "McEventCollection#TruthEvent" in flags.Input.TypedCollections:
44 acc.merge(GEN_EVNT2xAODCfg(flags,name="GEN_EVNT2xAOD",AODContainerName="TruthEvent"))
45 # This is not really EVNT, but we do need to treat it like EVNT for Metadata
46 isEVNT = True
47 # Input file already has xAOD truth. Don't do anything.
48 elif "xAOD::TruthEventContainer#TruthEvents" in flags.Input.TypedCollections:
49 pass
50 else:
51 raise RuntimeError("No recognised HepMC truth information found in the input")
52
53 # If it isn't available, make a truth meta data object (will hold MC Event Weights)
54 if "TruthMetaDataContainer#TruthMetaData" not in flags.Input.TypedCollections and not isEVNT:
55 # If we are going to be making the truth collection (isEVNT) then this will be made elsewhere
56 acc.merge(TruthMetaDataWriterCfg(flags, name = 'DFCommonTruthMetaDataWriter'))
57
58 return acc
59
60
61# Helper for adding truth jet collections via new jet config

◆ PostJetMCTruthAugmentationsCfg()

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

Definition at line 142 of file MCTruthCommonConfig.py.

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

◆ PreJetMCTruthAugmentationsCfg()

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

Definition at line 107 of file MCTruthCommonConfig.py.

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

◆ TruthClassificationAugmentationsCfg()

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

Definition at line 96 of file MCTruthCommonConfig.py.

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

◆ 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