ATLAS Offline Software
Functions
python.MCTruthCommonConfig Namespace Reference

Functions

def TruthMetaDataWriterCfg (flags, name)
 
def HepMCtoXAODTruthCfg (flags)
 
def AddTruthJetsCfg (flags)
 
def AddTruthMETCfg (flags)
 
def TruthClassificationAugmentationsCfg (flags, **kwargs)
 
def PreJetMCTruthAugmentationsCfg (flags, **kwargs)
 
def PostJetMCTruthAugmentationsCfg (flags, **kwargs)
 
def AddStandardTruthContentsCfg (flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, navInputCollections=["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix='')
 
def AddParentAndDownstreamParticlesCfg (flags, generations=1, parents=[6], prefix='TopQuark', collection_prefix=None, rejectHadronChildren=False)
 
def 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') More...
 
def AddTopQuarkAndDownstreamParticlesCfg (flags, generations=1, rejectHadronChildren=False)
 
def AddTauAndDownstreamParticlesCfg (flags, generations=-1, rejectHadronChildren=False)
 
def 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') More...
 
def AddPVCollectionCfg (flags)
 
def AddTruthCollectionNavigationDecorationsCfg (flags, TruthCollections=[], prefix='')
 
def AddBSMAndDownstreamParticlesCfg (flags, generations=-1)
 
def AddBornLeptonCollectionCfg (flags)
 
def AddLargeRJetD2Cfg (flags)
 
def AddTruthEnergyDensityCfg (flags)
 
def AddMiniTruthCollectionLinksCfg (flags, **kwargs)
 
def addTruth3ContentToSlimmerTool (slimmer)
 

Function Documentation

◆ AddBornLeptonCollectionCfg()

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

Definition at line 380 of file MCTruthCommonConfig.py.

380 def 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()

def 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.

259  generations=1,
260  rejectHadronChildren=False):
261  """Add bosons and downstream particles (not photons/gluons)"""
263  generations = generations,
264  parents = [23,24,25],
265  prefix = 'Bosons',
266  rejectHadronChildren = rejectHadronChildren)
267 
268 # Add top quark and their downstream particles

◆ AddBSMAndDownstreamParticlesCfg()

def 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.

363 def 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()

def 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.

308 def 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",'')
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()

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

Definition at line 392 of file MCTruthCommonConfig.py.

392 def 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 # Truth energy density tools

◆ AddMiniTruthCollectionLinksCfg()

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

Definition at line 445 of file MCTruthCommonConfig.py.

445 def AddMiniTruthCollectionLinksCfg(flags, **kwargs):
446  """Tool to move pointers to new mini truth collections"""
447  acc = ComponentAccumulator()
448  kwargs.setdefault("doElectrons",True)
449  kwargs.setdefault("doPhotons",True)
450  kwargs.setdefault("doMuons",True)
451  aug_tools = []
452  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthLinkRepointToolCfg
453  if kwargs['doElectrons']:
454  electron_relink = acc.getPrimaryAndMerge(TruthLinkRepointToolCfg(
455  flags,
456  name="ElMiniCollectionTruthLinkTool",
457  RecoCollection="Electrons",
458  TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]))
459  aug_tools += [ electron_relink ]
460  if kwargs['doPhotons']:
461  photon_relink = acc.getPrimaryAndMerge(TruthLinkRepointToolCfg(
462  flags,
463  name="PhMiniCollectionTruthLinkTool",
464  RecoCollection="Photons",
465  TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]))
466  aug_tools += [ photon_relink ]
467  if kwargs['doMuons']:
468  muon_relink = acc.getPrimaryAndMerge(TruthLinkRepointToolCfg(
469  flags,
470  name="MuMiniCollectionTruthLinkTool",
471  RecoCollection="Muons",
472  TargetCollections=["TruthMuons","TruthPhotons","TruthElectrons"]))
473  aug_tools += [ muon_relink ]
474  for i, tool in enumerate(aug_tools):
475  acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
476  "MiniCollectionTruthLinkKernelNo{num}".format(num=i+1),
477  AugmentationTools = [tool] ))
478  return acc
479 

◆ AddParentAndDownstreamParticlesCfg()

def 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.

219  generations=1,
220  parents=[6],
221  prefix='TopQuark',
222  collection_prefix=None,
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()

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

Definition at line 332 of file MCTruthCommonConfig.py.

332 def 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()

def 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.

180  decorationDressing='dressedPhoton',
181  includeTausInDressingPhotonRemoval=False,
182  navInputCollections = ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"],
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()

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

Definition at line 279 of file MCTruthCommonConfig.py.

280  generations=-1,
281  rejectHadronChildren=False):
282  """Add tau and downstream particles"""
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()

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

Definition at line 269 of file MCTruthCommonConfig.py.

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

◆ addTruth3ContentToSlimmerTool()

def python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool (   slimmer)

Definition at line 480 of file MCTruthCommonConfig.py.

480 def addTruth3ContentToSlimmerTool(slimmer):
481  slimmer.AllVariables += [
482  "MET_Truth",
483  "TruthElectrons",
484  "TruthMuons",
485  "TruthPhotons",
486  "TruthTaus",
487  "TruthNeutrinos",
488  "TruthBSM",
489  "TruthBottom",
490  "TruthTop",
491  "TruthBoson",
492  "TruthForwardProtons",
493  "BornLeptons",
494  "TruthBosonsWithDecayParticles",
495  "TruthBosonsWithDecayVertices",
496  "TruthBSMWithDecayParticles",
497  "TruthBSMWithDecayVertices",
498  ]
499  slimmer.ExtraVariables += [
500  "AntiKt4TruthDressedWZJets.GhostCHadronsFinalCount.GhostBHadronsFinalCount.pt.HadronConeExclTruthLabelID.PartonTruthLabelID.TrueFlavor",
501  "AntiKt10TruthSoftDropBeta100Zcut10Jets.pt.Tau1_wta.Tau2_wta.Tau3_wta.D2",
502  "TruthEvents.Q.XF1.XF2.PDGID1.PDGID2.PDFID1.PDFID2.X1.X2.crossSection"]

◆ AddTruthCollectionNavigationDecorationsCfg()

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

Definition at line 348 of file MCTruthCommonConfig.py.

348 def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix=''):
349  """Tool to add navigation decorations on the truth collections"""
350  acc = ComponentAccumulator()
351  if len(TruthCollections)==0: return
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()

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

Definition at line 406 of file MCTruthCommonConfig.py.

406 def AddTruthEnergyDensityCfg(flags):
407  """Truth energy density tools"""
408  acc = ComponentAccumulator()
409  from EventShapeTools.EventDensityConfig import configEventDensityTool
410  from JetRecConfig.StandardJetConstits import stdConstitDic as cst
411  EventDensityAthAlg = CompFactory.EventDensityAthAlg
412  # Algorithms for the energy density - needed only if e/gamma hasn't set things up already
413  DFCommonTruthCentralEDTool = configEventDensityTool("DFCommonTruthCentralEDTool",
414  cst.Truth,
415  0.5,
416  AbsRapidityMax = 1.5,
417  OutputContainer = "TruthIsoCentralEventShape",
418  )
419  acc.addPublicTool(DFCommonTruthCentralEDTool)
420  acc.addEventAlgo(EventDensityAthAlg("DFCommonTruthCentralEDAlg", EventDensityTool = DFCommonTruthCentralEDTool ))
421  DFCommonTruthForwardEDTool = configEventDensityTool("DFCommonTruthForwardEDTool",
422  cst.Truth,
423  0.5,
424  AbsRapidityMin = 1.5,
425  AbsRapidityMax = 3.0,
426  OutputContainer = "TruthIsoForwardEventShape",
427  )
428  acc.addPublicTool(DFCommonTruthForwardEDTool)
429  acc.addEventAlgo(EventDensityAthAlg("DFCommonTruthForwardEDAlg", EventDensityTool = DFCommonTruthForwardEDTool ))
430 
431  # Now add the tool to do the decoration
432  DFCommonTruthEDDecorator = CompFactory.DerivationFramework.TruthEDDecorator("DFCommonTruthEDDecorator",
433  EventInfoName="EventInfo",
434  EventShapeKeys=["TruthIsoCentralEventShape","TruthIsoForwardEventShape"],
435  DecorationSuffix="_rho"
436  )
437  acc.addPublicTool(DFCommonTruthEDDecorator)
438 
439  DFCommonTruthEDKernel = CompFactory.DerivationFramework.CommonAugmentation
440  acc.addEventAlgo(DFCommonTruthEDKernel("DFCommonTruthEDKernel", AugmentationTools = [DFCommonTruthEDDecorator] ))
441  return acc
442 
443 
444 # Sets up modifiers to move pointers to old truth collections to new mini truth collections

◆ AddTruthJetsCfg()

def python.MCTruthCommonConfig.AddTruthJetsCfg (   flags)

Definition at line 62 of file MCTruthCommonConfig.py.

62 def 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

◆ AddTruthMETCfg()

def python.MCTruthCommonConfig.AddTruthMETCfg (   flags)

Definition at line 83 of file MCTruthCommonConfig.py.

83 def 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 

◆ HepMCtoXAODTruthCfg()

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

Definition at line 19 of file MCTruthCommonConfig.py.

19 def 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()

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

Definition at line 142 of file MCTruthCommonConfig.py.

142 def 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.getPrimaryAndMerge(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()

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

Definition at line 107 of file MCTruthCommonConfig.py.

107 def PreJetMCTruthAugmentationsCfg(flags, **kwargs):
108 
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()

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

Definition at line 96 of file MCTruthCommonConfig.py.

96 def 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.getPrimaryAndMerge(DFCommonTruthClassificationToolCfg(flags)) ]))
103 
104  return acc
105 
106 

◆ TruthMetaDataWriterCfg()

def python.MCTruthCommonConfig.TruthMetaDataWriterCfg (   flags,
  name 
)

Definition at line 11 of file MCTruthCommonConfig.py.

11 def 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 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
python.TruthDerivationToolsConfig.TruthD2DecoratorCfg
def TruthD2DecoratorCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:140
python.TruthDerivationToolsConfig.TruthBornLeptonCollectionMakerCfg
def TruthBornLeptonCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:226
python.MCTruthCommonConfig.AddBosonsAndDownstreamParticlesCfg
def AddBosonsAndDownstreamParticlesCfg(flags, generations=1, rejectHadronChildren=False)
Add taus and their downstream particles (immediate and further decay products) in a special collectio...
Definition: MCTruthCommonConfig.py:258
python.TruthDerivationToolsConfig.DFCommonTruthClassificationToolCfg
def DFCommonTruthClassificationToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:242
python.MCTruthCommonConfig.AddTauAndDownstreamParticlesCfg
def AddTauAndDownstreamParticlesCfg(flags, generations=-1, rejectHadronChildren=False)
Definition: MCTruthCommonConfig.py:279
python.MCTruthCommonConfig.AddMiniTruthCollectionLinksCfg
def AddMiniTruthCollectionLinksCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:445
python.MCTruthCommonConfig.AddPVCollectionCfg
def AddPVCollectionCfg(flags)
Definition: MCTruthCommonConfig.py:332
EventDensityConfig.configEventDensityTool
def configEventDensityTool(name, jetOrConstitdef, radius=0.4, **options)
Definition: EventDensityConfig.py:36
python.TruthDerivationToolsConfig.TruthLinkRepointToolCfg
def TruthLinkRepointToolCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:422
python.TruthDerivationToolsConfig.TruthDecayCollectionMakerCfg
def TruthDecayCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:217
python.MCTruthCommonConfig.TruthMetaDataWriterCfg
def TruthMetaDataWriterCfg(flags, name)
Definition: MCTruthCommonConfig.py:11
python.MCTruthCommonConfig.AddTopQuarkAndDownstreamParticlesCfg
def AddTopQuarkAndDownstreamParticlesCfg(flags, generations=1, rejectHadronChildren=False)
Definition: MCTruthCommonConfig.py:269
xAODTruthCnvConfig.GEN_EVNT2xAODCfg
def GEN_EVNT2xAODCfg(flags, name="GEN_EVNT2xAOD", **kwargs)
Definition: xAODTruthCnvConfig.py:5
python.MCTruthCommonConfig.AddLargeRJetD2Cfg
def AddLargeRJetD2Cfg(flags)
Definition: MCTruthCommonConfig.py:392
python.MCTruthCommonConfig.AddBornLeptonCollectionCfg
def AddBornLeptonCollectionCfg(flags)
Definition: MCTruthCommonConfig.py:380
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
python.TruthDerivationToolsConfig.DFCommonTruthTauDressingToolCfg
def DFCommonTruthTauDressingToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:301
AtlasMcWeight::encode
number_type encode(double weight)
Definition: AtlasMcWeight.cxx:65
python.MCTruthCommonConfig.AddTruthMETCfg
def AddTruthMETCfg(flags)
Definition: MCTruthCommonConfig.py:83
python.MCTruthCommonConfig.AddBSMAndDownstreamParticlesCfg
def AddBSMAndDownstreamParticlesCfg(flags, generations=-1)
Definition: MCTruthCommonConfig.py:363
python.JetRecConfig.JetRecCfg
def JetRecCfg(flags, jetdef, returnConfiguredDef=False)
Top level functions returning ComponentAccumulator out of JetDefinition.
Definition: JetRecConfig.py:36
python.TruthDerivationToolsConfig.DFCommonTruthForwardProtonToolCfg
def DFCommonTruthForwardProtonToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:126
python.MCTruthCommonConfig.PreJetMCTruthAugmentationsCfg
def PreJetMCTruthAugmentationsCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:107
python.SUSYWeightMetadataConfig.AddSUSYWeightsCfg
def AddSUSYWeightsCfg(flags, pref="")
Definition: SUSYWeightMetadataConfig.py:31
python.MCTruthCommonConfig.HepMCtoXAODTruthCfg
def HepMCtoXAODTruthCfg(flags)
Definition: MCTruthCommonConfig.py:19
python.MCTruthCommonConfig.PostJetMCTruthAugmentationsCfg
def PostJetMCTruthAugmentationsCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:142
python.MCTruthCommonConfig.AddTruthEnergyDensityCfg
def AddTruthEnergyDensityCfg(flags)
Definition: MCTruthCommonConfig.py:406
python.MCTruthCommonConfig.AddParentAndDownstreamParticlesCfg
def AddParentAndDownstreamParticlesCfg(flags, generations=1, parents=[6], prefix='TopQuark', collection_prefix=None, rejectHadronChildren=False)
Definition: MCTruthCommonConfig.py:218
python.GenFilterToolConfig.GenFilterToolCfg
def GenFilterToolCfg(flags)
Definition: GenFilterToolConfig.py:8
python.MCTruthCommonConfig.TruthClassificationAugmentationsCfg
def TruthClassificationAugmentationsCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:96
python.TruthDerivationToolsConfig.DFCommonTruthMuonDressingToolCfg
def DFCommonTruthMuonDressingToolCfg(flags, decorationName="dressedPhoton")
Definition: TruthDerivationToolsConfig.py:290
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.MCTruthCommonConfig.AddStandardTruthContentsCfg
def AddStandardTruthContentsCfg(flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, navInputCollections=["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix='')
Definition: MCTruthCommonConfig.py:179
python.TruthDerivationToolsConfig.TruthPVCollectionMakerCfg
def TruthPVCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:433
python.TruthDerivationToolsConfig.TruthNavigationDecoratorCfg
def TruthNavigationDecoratorCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:208
python.TauTruthCommonConfig.TauTruthToolsCfg
def TauTruthToolsCfg(flags)
Definition: TauTruthCommonConfig.py:44
python.MCTruthCommonConfig.AddHFAndDownstreamParticlesCfg
def AddHFAndDownstreamParticlesCfg(flags, **kwargs)
Add electrons, photons, and their downstream particles in a special collection def addEgammaAndDownst...
Definition: MCTruthCommonConfig.py:308
python.DecorateSUSYProcessConfig.IsSUSYSignalRun3
def IsSUSYSignalRun3(flags)
Definition: DecorateSUSYProcessConfig.py:8
python.DecorateSUSYProcessConfig.SUSYSignalTaggerCfg
def SUSYSignalTaggerCfg(flags, derivationName)
Definition: DecorateSUSYProcessConfig.py:49
python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool
def addTruth3ContentToSlimmerTool(slimmer)
Definition: MCTruthCommonConfig.py:480
python.MCTruthCommonConfig.AddTruthCollectionNavigationDecorationsCfg
def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix='')
Definition: MCTruthCommonConfig.py:348
python.TruthDerivationToolsConfig.DFCommonTruthDressedWZQGLabelToolCfg
def DFCommonTruthDressedWZQGLabelToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:397
EventDensityAthAlg
Definition: EventDensityAthAlg.h:24
python.xAODEventInfoCnvConfig.EventInfoCnvAlgCfg
def EventInfoCnvAlgCfg(flags, name="EventInfoCnvAlg", inputKey="McEventInfo", outputKey="EventInfo", disableBeamSpot=False, **kwargs)
Definition: xAODEventInfoCnvConfig.py:11
python.TruthDerivationToolsConfig.DFCommonTruthElectronDressingToolCfg
def DFCommonTruthElectronDressingToolCfg(flags, decorationName="dressedPhoton")
Definition: TruthDerivationToolsConfig.py:279
python.MCTruthCommonConfig.AddTruthJetsCfg
def AddTruthJetsCfg(flags)
Definition: MCTruthCommonConfig.py:62
METTruth_Cfg
Definition: METTruth_Cfg.py:1