ATLAS Offline Software
Functions
python.MCTruthCommonConfig Namespace Reference

Functions

def TruthMetaDataWriterCfg (flags, name)
 
def HepMCtoXAODTruthCfg (flags)
 
def AddTruthJetsCfg (flags)
 
def AddTruthMETCfg (flags)
 
def PreJetMCTruthAugmentationsCfg (flags, **kwargs)
 
def PostJetMCTruthAugmentationsCfg (flags, **kwargs)
 
def AddStandardTruthContentsCfg (flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, 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 AddHardScatterCollectionCfg (flags, generations=1)
 
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 369 of file MCTruthCommonConfig.py.

369 def AddBornLeptonCollectionCfg(flags):
370  """Add born leptons as a mini collection"""
371  acc = ComponentAccumulator()
372  # Set up a tool to keep the taus and all downstream particles
373  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthBornLeptonCollectionMakerCfg
374  DFCommonBornLeptonCollTool = acc.getPrimaryAndMerge(TruthBornLeptonCollectionMakerCfg(flags,
375  name = "DFCommonBornLeptonCollTool",
376  NewCollectionName ="BornLeptons"))
377  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
378  acc.addEventAlgo(CommonAugmentation("MCTruthCommonBornLeptonsKernel", AugmentationTools = [DFCommonBornLeptonCollTool] ))
379  return acc
380 

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

244  generations=1,
245  rejectHadronChildren=False):
246  """Add bosons and downstream particles (not photons/gluons)"""
248  generations = generations,
249  parents = [23,24,25],
250  prefix = 'Bosons',
251  rejectHadronChildren = rejectHadronChildren)
252 
253 # 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 353 of file MCTruthCommonConfig.py.

353 def AddBSMAndDownstreamParticlesCfg(flags, generations=-1):
354  """Add BSM particles and their downstream particles in a special collection"""
355  acc = ComponentAccumulator()
356  # Set up a tool to keep the taus and all downstream particles
357 
358  DFCommonBSMAndDecaysTool = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(flags,
359  name = "DFCommonBSMAndDecaysTool",
360  NewCollectionName = "TruthBSMWithDecay",
361  KeepBSM = True,
362  Generations = generations))
363  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
364  acc.addEventAlgo(CommonAugmentation(name = "MCTruthCommonBSMAndDecaysKernel",
365  AugmentationTools = [DFCommonBSMAndDecaysTool] ))
366  return acc
367 
368 # Add a mini-collection for the born leptons

◆ AddHardScatterCollectionCfg()

def python.MCTruthCommonConfig.AddHardScatterCollectionCfg (   flags,
  generations = 1 
)
Add a mini-collection for the hard scatter and N subsequent generations

Definition at line 331 of file MCTruthCommonConfig.py.

331 def AddHardScatterCollectionCfg(flags, generations=1):
332  """Add a mini-collection for the hard scatter and N subsequent generations"""
333  # Set up a tool to keep the taus and all downstream particles
334  acc = ComponentAccumulator()
335  return acc
336 
337 # Add navigation decorations on the truth collections

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

293 def AddHFAndDownstreamParticlesCfg(flags, **kwargs):
294  """Add b/c-hadrons and their downstream particles"""
295  kwargs.setdefault("addB",True)
296  kwargs.setdefault("addC",True)
297  kwargs.setdefault("generations",-1)
298  kwargs.setdefault("prefix",'')
299  acc = ComponentAccumulator()
300  # Set up a tool to keep b- and c-quarks and all downstream particles
301  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthDecayCollectionMakerCfg
302  DFCommonHFAndDecaysTool = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(
303  flags,
304  name=kwargs['prefix']+"DFCommonHFAndDecaysTool",
305  NewCollectionName=kwargs['prefix']+"TruthHFWithDecay",
306  KeepBHadrons=kwargs['addB'],
307  KeepCHadrons=kwargs['addC'],
308  Generations=kwargs['generations']))
309  acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
310  kwargs['prefix']+"MCTruthCommonHFAndDecaysKernel",
311  AugmentationTools = [DFCommonHFAndDecaysTool] ))
312  return acc
313 
314 
315 # Add a one-vertex-per event "primary vertex" container

◆ AddLargeRJetD2Cfg()

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

Definition at line 381 of file MCTruthCommonConfig.py.

381 def AddLargeRJetD2Cfg(flags):
382  """Add large-R jet D2 variable"""
383  #Extra classifier for D2 variable
384  acc = ComponentAccumulator()
385  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthD2DecoratorCfg
386  theTruthD2Decorator = acc.getPrimaryAndMerge(TruthD2DecoratorCfg(flags,
387  name = "TruthD2Decorator",
388  JetContainerKey = "AntiKt10TruthSoftDropBeta100Zcut10Jets",
389  DecorationName = "D2"))
390  TruthD2DecoratorKernel = CompFactory.DerivationFramework.CommonAugmentation
391  acc.addEventAlgo(TruthD2DecoratorKernel("TRUTHD2Kernel", AugmentationTools = [theTruthD2Decorator] ))
392  return acc
393 
394 # Truth energy density tools

◆ AddMiniTruthCollectionLinksCfg()

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

Definition at line 434 of file MCTruthCommonConfig.py.

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

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

205  generations=1,
206  parents=[6],
207  prefix='TopQuark',
208  collection_prefix=None,
209  rejectHadronChildren=False):
210  """Configure tools for adding immediate parents and descendants"""
211  acc = ComponentAccumulator()
212  collection_name=collection_prefix+'WithDecay' if collection_prefix is not None else 'Truth'+prefix+'WithDecay'
213  # Set up a tool to keep the W/Z/H bosons and all downstream particles
214  collection_maker = acc.getPrimaryAndMerge(TruthDecayCollectionMakerCfg(flags,
215  name ='DFCommon'+prefix+'AndDecaysTool',
216  NewCollectionName = collection_name,
217  PDGIDsToKeep = parents,
218  Generations = generations,
219  RejectHadronChildren = rejectHadronChildren))
220  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
221  kernel_name = 'MCTruthCommon'+prefix+'AndDecaysKernel'
222  acc.addEventAlgo(CommonAugmentation(kernel_name, AugmentationTools = [collection_maker] ))
223  return acc
224 
225 # 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 316 of file MCTruthCommonConfig.py.

316 def AddPVCollectionCfg(flags):
317  """Add a one-vertex-per event "primary vertex" container"""
318  acc = ComponentAccumulator()
319  # Set up a tool to keep the primary vertices
320  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthPVCollectionMakerCfg
321  DFCommonTruthPVCollTool = acc.getPrimaryAndMerge(TruthPVCollectionMakerCfg(
322  flags,
323  name="DFCommonTruthPVCollTool",
324  NewCollectionName="TruthPrimaryVertices"))
325  acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
326  "MCTruthCommonTruthPVCollKernel",
327  AugmentationTools = [DFCommonTruthPVCollTool] ))
328  return acc
329 
330 # Add a mini-collection for the hard scatter and N subsequent generations

◆ AddStandardTruthContentsCfg()

def python.MCTruthCommonConfig.AddStandardTruthContentsCfg (   flags,
  decorationDressing = 'dressedPhoton',
  includeTausInDressingPhotonRemoval = False,
  prefix = '' 
)

Definition at line 165 of file MCTruthCommonConfig.py.

166  decorationDressing='dressedPhoton',
167  includeTausInDressingPhotonRemoval=False,
168  prefix=''):
169 
170  acc = ComponentAccumulator()
171 
172  # Schedule HepMC->xAOD truth conversion
173  acc.merge(HepMCtoXAODTruthCfg(flags))
174 
175  # Local flag
176  isEVNT = False
177  if "McEventCollection#GEN_EVENT" in flags.Input.TypedCollections: isEVNT = True
178  # Tools that must come before jets
179  acc.merge(PreJetMCTruthAugmentationsCfg(flags,decorationDressing = decorationDressing))
180  # Should photons that are dressed onto taus also be removed from truth jets?
181  if includeTausInDressingPhotonRemoval:
182  acc.getPublicTool("DFCommonTruthTauDressingTool").decorationName=decorationDressing
183  # Jets and MET
184  acc.merge(AddTruthJetsCfg(flags))
185  acc.merge(AddTruthMETCfg(flags))
186  # Tools that must come after jets
187  acc.merge(PostJetMCTruthAugmentationsCfg(flags, decorationDressing = decorationDressing))
188  # Add back the navigation contect for the collections we want
189  acc.merge(AddTruthCollectionNavigationDecorationsCfg(flags, ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix=prefix))
190  # Some more additions for standard TRUTH3
191  acc.merge(AddBosonsAndDownstreamParticlesCfg(flags))
192  if isEVNT: acc.merge(AddLargeRJetD2Cfg(flags))
193  # Special collection for BSM particles
194  acc.merge(AddBSMAndDownstreamParticlesCfg(flags))
195  # Special collection for Born leptons
196  acc.merge(AddBornLeptonCollectionCfg(flags))
197  # Special collection for hard scatter (matrix element) - save TWO extra generations of particles
198  acc.merge(AddHardScatterCollectionCfg(flags, 2))
199  # Energy density for isolation corrections
200  if isEVNT: acc.merge(AddTruthEnergyDensityCfg(flags))
201 
202  return acc
203 

◆ AddTauAndDownstreamParticlesCfg()

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

Definition at line 264 of file MCTruthCommonConfig.py.

265  generations=-1,
266  rejectHadronChildren=False):
267  """Add tau and downstream particles"""
269  generations=generations,
270  parents=[15],
271  prefix='Taus',
272  rejectHadronChildren=rejectHadronChildren)
273 
274 # Following commented methods don't seem to be used for anything...
275 
276 #def addBottomQuarkAndDownstreamParticles(kernel=None, generations=1, rejectHadronChildren=False):
277 # return addParentAndDownstreamParticles(kernel=kernel,
278 # generations=generations,
279 # parents=[5],
280 # prefix='BottomQuark',
281 # rejectHadronChildren=rejectHadronChildren)
282 #
283 #

◆ AddTopQuarkAndDownstreamParticlesCfg()

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

Definition at line 254 of file MCTruthCommonConfig.py.

255  generations=1,
256  rejectHadronChildren=False):
257  """Add top quarks and downstream particles"""
259  generations=generations,
260  parents=[6],
261  prefix='TopQuark',
262  rejectHadronChildren=rejectHadronChildren)
263 

◆ addTruth3ContentToSlimmerTool()

def python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool (   slimmer)

Definition at line 469 of file MCTruthCommonConfig.py.

469 def addTruth3ContentToSlimmerTool(slimmer):
470  slimmer.AllVariables += [
471  "MET_Truth",
472  "TruthElectrons",
473  "TruthMuons",
474  "TruthPhotons",
475  "TruthTaus",
476  "TruthNeutrinos",
477  "TruthBSM",
478  "TruthBottom",
479  "TruthTop",
480  "TruthBoson",
481  "TruthForwardProtons",
482  "BornLeptons",
483  "TruthBosonsWithDecayParticles",
484  "TruthBosonsWithDecayVertices",
485  "TruthBSMWithDecayParticles",
486  "TruthBSMWithDecayVertices",
487  "HardScatterParticles",
488  "HardScatterVertices",
489  ]
490  slimmer.ExtraVariables += [
491  "AntiKt4TruthDressedWZJets.GhostCHadronsFinalCount.GhostBHadronsFinalCount.pt.HadronConeExclTruthLabelID.ConeTruthLabelID.PartonTruthLabelID.TrueFlavor",
492  "AntiKt10TruthSoftDropBeta100Zcut10Jets.pt.Tau1_wta.Tau2_wta.Tau3_wta.D2",
493  "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 338 of file MCTruthCommonConfig.py.

338 def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix=''):
339  """Tool to add navigation decorations on the truth collections"""
340  acc = ComponentAccumulator()
341  if len(TruthCollections)==0: return
342  # Set up a tool to add the navigation decorations
343  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import TruthNavigationDecoratorCfg
344  DFCommonTruthNavigationDecorator = acc.getPrimaryAndMerge(TruthNavigationDecoratorCfg(flags,
345  name = prefix+'DFCommonTruthNavigationDecorator',
346  InputCollections = TruthCollections))
347  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
348  acc.addEventAlgo(CommonAugmentation(prefix+"MCTruthNavigationDecoratorKernel",
349  AugmentationTools = [DFCommonTruthNavigationDecorator] ))
350  return acc
351 
352 # 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 395 of file MCTruthCommonConfig.py.

395 def AddTruthEnergyDensityCfg(flags):
396  """Truth energy density tools"""
397  acc = ComponentAccumulator()
398  from EventShapeTools.EventDensityConfig import configEventDensityTool
399  from JetRecConfig.StandardJetConstits import stdConstitDic as cst
400  EventDensityAthAlg = CompFactory.EventDensityAthAlg
401  # Algorithms for the energy density - needed only if e/gamma hasn't set things up already
402  DFCommonTruthCentralEDTool = configEventDensityTool("DFCommonTruthCentralEDTool",
403  cst.Truth,
404  0.5,
405  AbsRapidityMax = 1.5,
406  OutputContainer = "TruthIsoCentralEventShape",
407  )
408  acc.addPublicTool(DFCommonTruthCentralEDTool)
409  acc.addEventAlgo(EventDensityAthAlg("DFCommonTruthCentralEDAlg", EventDensityTool = DFCommonTruthCentralEDTool ))
410  DFCommonTruthForwardEDTool = configEventDensityTool("DFCommonTruthForwardEDTool",
411  cst.Truth,
412  0.5,
413  AbsRapidityMin = 1.5,
414  AbsRapidityMax = 3.0,
415  OutputContainer = "TruthIsoForwardEventShape",
416  )
417  acc.addPublicTool(DFCommonTruthForwardEDTool)
418  acc.addEventAlgo(EventDensityAthAlg("DFCommonTruthForwardEDAlg", EventDensityTool = DFCommonTruthForwardEDTool ))
419 
420  # Now add the tool to do the decoration
421  DFCommonTruthEDDecorator = CompFactory.DerivationFramework.TruthEDDecorator("DFCommonTruthEDDecorator",
422  EventInfoName="EventInfo",
423  EnergyDensityKeys=["TruthIsoCentralEventShape","TruthIsoForwardEventShape"],
424  DecorationSuffix="_rho"
425  )
426  acc.addPublicTool(DFCommonTruthEDDecorator)
427 
428  DFCommonTruthEDKernel = CompFactory.DerivationFramework.CommonAugmentation
429  acc.addEventAlgo(DFCommonTruthEDKernel("DFCommonTruthEDKernel", AugmentationTools = [DFCommonTruthEDDecorator] ))
430  return acc
431 
432 
433 # 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  acc = ComponentAccumulator()
64 
65  from JetRecConfig.StandardSmallRJets import AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ,AntiKtVRTruthCharged
66  from JetRecConfig.StandardLargeRJets import AntiKt10TruthTrimmed,AntiKt10TruthSoftDrop
67  from JetRecConfig.JetRecConfig import JetRecCfg
68  from JetRecConfig.JetConfigFlags import jetInternalFlags
69 
70  jetInternalFlags.isRecoJob = True
71 
72  jetList = [AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ,AntiKtVRTruthCharged,
73  AntiKt10TruthTrimmed,AntiKt10TruthSoftDrop]
74 
75  for jd in jetList:
76  acc.merge(JetRecCfg(flags,jd))
77 
78  return acc
79 
80 # Helper for scheduling the truth MET collection

◆ AddTruthMETCfg()

def python.MCTruthCommonConfig.AddTruthMETCfg (   flags)

Definition at line 81 of file MCTruthCommonConfig.py.

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

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

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

◆ PreJetMCTruthAugmentationsCfg()

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

Definition at line 93 of file MCTruthCommonConfig.py.

93 def PreJetMCTruthAugmentationsCfg(flags, **kwargs):
94 
95  acc = ComponentAccumulator()
96 
97  augmentationToolsList = []
98 
99  # These augmentations do *not* require truth jets at all
100  # If requested, add a decoration to photons that were used in the dressing
101 
102  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import ( DFCommonTruthElectronDressingToolCfg,
103  DFCommonTruthMuonDressingToolCfg, DFCommonTruthClassificationToolCfg, DFCommonTruthMuonToolCfg, DFCommonTruthElectronToolCfg,
104  DFCommonTruthPhotonToolSimCfg, DFCommonTruthNeutrinoToolCfg, DFCommonTruthBottomToolCfg, DFCommonTruthTopToolCfg,
105  DFCommonTruthBosonToolCfg, DFCommonTruthBSMToolCfg, DFCommonTruthForwardProtonToolCfg, DFCommonTruthElectronIsolationTool1Cfg,
106  DFCommonTruthElectronIsolationTool2Cfg, DFCommonTruthMuonIsolationTool1Cfg, DFCommonTruthMuonIsolationTool2Cfg,
107  DFCommonTruthPhotonIsolationTool1Cfg, DFCommonTruthPhotonIsolationTool2Cfg, DFCommonTruthPhotonIsolationTool3Cfg )
108 
109  # schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below
110  for item in [ DFCommonTruthClassificationToolCfg, DFCommonTruthMuonToolCfg, DFCommonTruthElectronToolCfg,
111  DFCommonTruthPhotonToolSimCfg, DFCommonTruthNeutrinoToolCfg, DFCommonTruthBottomToolCfg, DFCommonTruthTopToolCfg,
112  DFCommonTruthBosonToolCfg, DFCommonTruthBSMToolCfg, DFCommonTruthElectronIsolationTool1Cfg,
113  DFCommonTruthElectronIsolationTool2Cfg, DFCommonTruthMuonIsolationTool1Cfg, DFCommonTruthMuonIsolationTool2Cfg,
114  DFCommonTruthPhotonIsolationTool1Cfg, DFCommonTruthPhotonIsolationTool2Cfg, DFCommonTruthPhotonIsolationTool3Cfg]:
115  augmentationToolsList.append(acc.getPrimaryAndMerge(item(flags)))
116  augmentationToolsList.append(acc.getPrimaryAndMerge(DFCommonTruthForwardProtonToolCfg(flags)))
117 
118  if 'decorationDressing' in kwargs:
119  augmentationToolsList.append(acc.getPrimaryAndMerge(DFCommonTruthElectronDressingToolCfg(flags, decorationName = kwargs['decorationDressing'])))
120  augmentationToolsList.append(acc.getPrimaryAndMerge(DFCommonTruthMuonDressingToolCfg(flags, decorationName = kwargs['decorationDressing'])))
121 
122  for i, tool in enumerate(augmentationToolsList):
123  acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(name ="MCTruthCommonPreJetKernelNo{num}".format(num = i+1), AugmentationTools = [tool]))
124 
125  return(acc)
126 
127 

◆ 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:121
python.MCTruthCommonConfig.AddStandardTruthContentsCfg
def AddStandardTruthContentsCfg(flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, prefix='')
Definition: MCTruthCommonConfig.py:165
python.TruthDerivationToolsConfig.TruthBornLeptonCollectionMakerCfg
def TruthBornLeptonCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:206
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:243
python.MCTruthCommonConfig.AddTauAndDownstreamParticlesCfg
def AddTauAndDownstreamParticlesCfg(flags, generations=-1, rejectHadronChildren=False)
Definition: MCTruthCommonConfig.py:264
python.MCTruthCommonConfig.AddMiniTruthCollectionLinksCfg
def AddMiniTruthCollectionLinksCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:434
python.MCTruthCommonConfig.AddPVCollectionCfg
def AddPVCollectionCfg(flags)
Definition: MCTruthCommonConfig.py:316
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:383
python.TruthDerivationToolsConfig.TruthDecayCollectionMakerCfg
def TruthDecayCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:198
python.MCTruthCommonConfig.TruthMetaDataWriterCfg
def TruthMetaDataWriterCfg(flags, name)
Definition: MCTruthCommonConfig.py:11
python.MCTruthCommonConfig.AddTopQuarkAndDownstreamParticlesCfg
def AddTopQuarkAndDownstreamParticlesCfg(flags, generations=1, rejectHadronChildren=False)
Definition: MCTruthCommonConfig.py:254
xAODTruthCnvConfig.GEN_EVNT2xAODCfg
def GEN_EVNT2xAODCfg(flags, name="GEN_EVNT2xAOD", **kwargs)
Definition: xAODTruthCnvConfig.py:5
python.MCTruthCommonConfig.AddLargeRJetD2Cfg
def AddLargeRJetD2Cfg(flags)
Definition: MCTruthCommonConfig.py:381
python.MCTruthCommonConfig.AddBornLeptonCollectionCfg
def AddBornLeptonCollectionCfg(flags)
Definition: MCTruthCommonConfig.py:369
python.TruthDerivationToolsConfig.DFCommonTruthTauDressingToolCfg
def DFCommonTruthTauDressingToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:270
python.MCTruthCommonConfig.AddTruthMETCfg
def AddTruthMETCfg(flags)
Definition: MCTruthCommonConfig.py:81
python.MCTruthCommonConfig.AddBSMAndDownstreamParticlesCfg
def AddBSMAndDownstreamParticlesCfg(flags, generations=-1)
Definition: MCTruthCommonConfig.py:353
python.JetRecConfig.JetRecCfg
def JetRecCfg(flags, jetdef, returnConfiguredDef=False)
Top level functions returning ComponentAccumulator out of JetDefinition.
Definition: JetRecConfig.py:37
python.TruthDerivationToolsConfig.DFCommonTruthForwardProtonToolCfg
def DFCommonTruthForwardProtonToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:107
python.MCTruthCommonConfig.PreJetMCTruthAugmentationsCfg
def PreJetMCTruthAugmentationsCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:93
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:128
python.MCTruthCommonConfig.AddTruthEnergyDensityCfg
def AddTruthEnergyDensityCfg(flags)
Definition: MCTruthCommonConfig.py:395
python.MCTruthCommonConfig.AddParentAndDownstreamParticlesCfg
def AddParentAndDownstreamParticlesCfg(flags, generations=1, parents=[6], prefix='TopQuark', collection_prefix=None, rejectHadronChildren=False)
Definition: MCTruthCommonConfig.py:204
python.GenFilterToolConfig.GenFilterToolCfg
def GenFilterToolCfg(flags)
Definition: GenFilterToolConfig.py:8
python.TruthDerivationToolsConfig.DFCommonTruthMuonDressingToolCfg
def DFCommonTruthMuonDressingToolCfg(flags, decorationName="dressedPhoton")
Definition: TruthDerivationToolsConfig.py:260
python.TruthDerivationToolsConfig.TruthPVCollectionMakerCfg
def TruthPVCollectionMakerCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:393
python.TruthDerivationToolsConfig.TruthNavigationDecoratorCfg
def TruthNavigationDecoratorCfg(flags, name, **kwargs)
Definition: TruthDerivationToolsConfig.py:190
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:293
python.DecorateSUSYProcessConfig.IsSUSYSignalRun3
def IsSUSYSignalRun3(flags)
Definition: DecorateSUSYProcessConfig.py:8
python.DecorateSUSYProcessConfig.SUSYSignalTaggerCfg
def SUSYSignalTaggerCfg(flags, derivationName)
Definition: DecorateSUSYProcessConfig.py:49
item
Definition: ItemListSvc.h:43
python.MCTruthCommonConfig.addTruth3ContentToSlimmerTool
def addTruth3ContentToSlimmerTool(slimmer)
Definition: MCTruthCommonConfig.py:469
python.MCTruthCommonConfig.AddTruthCollectionNavigationDecorationsCfg
def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix='')
Definition: MCTruthCommonConfig.py:338
python.TruthDerivationToolsConfig.DFCommonTruthDressedWZQGLabelToolCfg
def DFCommonTruthDressedWZQGLabelToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:358
EventDensityAthAlg
Definition: EventDensityAthAlg.h:24
python.MCTruthCommonConfig.AddHardScatterCollectionCfg
def AddHardScatterCollectionCfg(flags, generations=1)
Definition: MCTruthCommonConfig.py:331
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:250
python.MCTruthCommonConfig.AddTruthJetsCfg
def AddTruthJetsCfg(flags)
Definition: MCTruthCommonConfig.py:62
METTruth_Cfg
Definition: METTruth_Cfg.py:1