ATLAS Offline Software
TLACommonConfigFunctions.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #==============================================================================
4 # Contains the configuration for TLA jet reconstruction + decorations
5 # used in analysis DAODs
6 #==============================================================================
7 
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 
11 # Jet related
12 from DerivationFrameworkJetEtMiss.JetCommonConfig import AddBadBatmanCfg, AddDistanceInTrainCfg, AddSidebandEventShapeCfg, AddEventCleanFlagsCfg
13 
14 
16 def TLAJetCommonCfg(ConfigFlags):
17  """TLA config for jet reconstruction and decorations"""
18 
19  acc = ComponentAccumulator()
20 
21  acc.merge(StandardTLAJetsCfg(ConfigFlags))
22 
23 
24  if "McEventCollection#GEN_EVENT" not in ConfigFlags.Input.TypedCollections:
25  acc.merge(AddBadBatmanCfg(ConfigFlags))
26  acc.merge(AddDistanceInTrainCfg(ConfigFlags))
27  acc.merge(AddSidebandEventShapeCfg(ConfigFlags))
28  acc.merge(AddEventCleanFlagsCfg(ConfigFlags))
29 
30  return acc
31 
32 def StandardTLAJetsCfg(ConfigFlags):
33  """Standard (offline) jets needed for TLA derivations"""
34 
35  from JetRecConfig.StandardSmallRJets import AntiKt4EMTopo,AntiKt4EMPFlow
36  from JetRecConfig.JetRecConfig import JetRecCfg
37 
38  acc = ComponentAccumulator()
39 
40  AntiKt4EMTopo_deriv = AntiKt4EMTopo.clone(
41  modifiers = AntiKt4EMTopo.modifiers+("JetPtAssociation","QGTagging")
42  )
43 
44  AntiKt4EMPFlow_deriv = AntiKt4EMPFlow.clone(
45  modifiers = AntiKt4EMPFlow.modifiers+("JetPtAssociation","QGTagging","fJVT","NNJVT","CaloEnergiesClus")
46  )
47 
48  jetList = [AntiKt4EMTopo_deriv, AntiKt4EMPFlow_deriv]
49 
50 
51  for jd in jetList:
52  acc.merge(JetRecCfg(ConfigFlags,jd))
53 
54  return acc
55 
56 
58 from DerivationFrameworkMCTruth.MCTruthCommonConfig import (HepMCtoXAODTruthCfg, PreJetMCTruthAugmentationsCfg, PostJetMCTruthAugmentationsCfg, AddTruthCollectionNavigationDecorationsCfg, AddBosonsAndDownstreamParticlesCfg, AddBSMAndDownstreamParticlesCfg, AddTruthEnergyDensityCfg)
59 
60 def AddTLATruthJetsCfg(flags):
61  acc = ComponentAccumulator()
62 
63  from JetRecConfig.StandardSmallRJets import AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ
64  from JetRecConfig.JetRecConfig import JetRecCfg
65 
66 
67  jetList = [AntiKt4Truth,AntiKt4TruthWZ,AntiKt4TruthDressedWZ]
68 
69  for jd in jetList:
70  acc.merge(JetRecCfg(flags,jd))
71 
72  return acc
73 
74 def PostTLAJetMCTruthAugmentationsCfg(flags, **kwargs):
75 
76  acc = ComponentAccumulator()
77 
78  # Tau collections are built separately
79  # truth tau matching needs truth jets, truth electrons and truth muons
80  from DerivationFrameworkTau.TauTruthCommonConfig import TauTruthToolsCfg
81  acc.merge(TauTruthToolsCfg(flags))
82  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthTauDressingToolCfg
83  augmentationToolsList = [ acc.getPrimaryAndMerge(DFCommonTruthTauDressingToolCfg(flags)) ]
84 
85 
86  from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonTruthDressedWZQGLabelToolCfg
87  augmentationToolsList += [ acc.getPrimaryAndMerge(DFCommonTruthDressedWZQGLabelToolCfg(flags))]
88 
89  # SUSY signal decorations
90  from DerivationFrameworkSUSY.DecorateSUSYProcessConfig import IsSUSYSignalRun3
91  if IsSUSYSignalRun3(flags):
92  from DerivationFrameworkSUSY.DecorateSUSYProcessConfig import SUSYSignalTaggerCfg
93  augmentationToolsList += [acc.getPrimaryAndMerge(SUSYSignalTaggerCfg(flags, 'MCTruthCommon'))]
94 
95  CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
96  acc.addEventAlgo(CommonAugmentation(name = "MCTruthCommonPostJetKernel",
97  AugmentationTools = augmentationToolsList))
98 
99  # add SoW of individual SUSY final states, relies on augmentation from DecorateSUSYProcess()
100  if IsSUSYSignalRun3(flags):
101  from DerivationFrameworkSUSY.SUSYWeightMetadataConfig import AddSUSYWeightsCfg
102  acc.merge(AddSUSYWeightsCfg(flags))
103 
104  return(acc)
105 
106 # This adds the entirety of TRUTH3
108  decorationDressing='dressedPhoton',
109  includeTausInDressingPhotonRemoval=False,
110  prefix='',
111  # default is true to prevent crashes when AntiKt10TruthJets is not built
112  useTLAPostJetAugmentations=True):
113 
114  acc = ComponentAccumulator()
115 
116  # Schedule HepMC->xAOD truth conversion
117  acc.merge(HepMCtoXAODTruthCfg(flags))
118 
119  # Local flag
120  isEVNT = False
121  if "McEventCollection#GEN_EVENT" in flags.Input.TypedCollections: isEVNT = True
122  # Tools that must come before jets
123  acc.merge(PreJetMCTruthAugmentationsCfg(flags,decorationDressing = decorationDressing))
124  # Jets and MET
125  acc.merge(AddTLATruthJetsCfg(flags))
126  # Tools that must come after jets
127  # configured for compatibility in case we want to
128  # revert to common MCTruth version
129  if not useTLAPostJetAugmentations:
130  acc.merge(PostJetMCTruthAugmentationsCfg(flags, decorationDressing = decorationDressing))
131  else:
132  acc.merge(PostTLAJetMCTruthAugmentationsCfg(flags, decorationDressing = decorationDressing))
133  # Should photons that are dressed onto taus also be removed from truth jets?
134  if includeTausInDressingPhotonRemoval:
135  acc.getPublicTool("DFCommonTruthTauDressingTool").decorationName=decorationDressing
136  acc.addEventAlgo(CompFactory.DerivationFramework.LockDecorations(name ="AddStandardTLATruthContentsLockDecoration", Decorations = ['TruthParticles.' + decorationDressing]))
137 
138  # Add back the navigation contect for the collections we want
139  acc.merge(AddTruthCollectionNavigationDecorationsCfg(flags, ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix=prefix))
140  # Some more additions for standard TRUTH3
141  acc.merge(AddBosonsAndDownstreamParticlesCfg(flags))
142 
143  # Special collection for BSM particles
144  acc.merge(AddBSMAndDownstreamParticlesCfg(flags))
145 
146  # Energy density for isolation corrections
147  if isEVNT: acc.merge(AddTruthEnergyDensityCfg(flags))
148 
149  return acc
150 
TLACommonConfigFunctions.AddTLATruthJetsCfg
def AddTLATruthJetsCfg(flags)
Definition: TLACommonConfigFunctions.py:60
python.JetCommonConfig.AddSidebandEventShapeCfg
def AddSidebandEventShapeCfg(ConfigFlags)
Definition: JetCommonConfig.py:77
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
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:242
python.TruthDerivationToolsConfig.DFCommonTruthTauDressingToolCfg
def DFCommonTruthTauDressingToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:269
python.MCTruthCommonConfig.AddBSMAndDownstreamParticlesCfg
def AddBSMAndDownstreamParticlesCfg(flags, generations=-1)
Definition: MCTruthCommonConfig.py:346
python.JetRecConfig.JetRecCfg
def JetRecCfg(flags, jetdef, returnConfiguredDef=False)
Top level functions returning ComponentAccumulator out of JetDefinition.
Definition: JetRecConfig.py:36
python.MCTruthCommonConfig.PreJetMCTruthAugmentationsCfg
def PreJetMCTruthAugmentationsCfg(flags, **kwargs)
Definition: MCTruthCommonConfig.py:91
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:127
python.MCTruthCommonConfig.AddTruthEnergyDensityCfg
def AddTruthEnergyDensityCfg(flags)
Definition: MCTruthCommonConfig.py:388
python.TauTruthCommonConfig.TauTruthToolsCfg
def TauTruthToolsCfg(flags)
Definition: TauTruthCommonConfig.py:44
python.DecorateSUSYProcessConfig.IsSUSYSignalRun3
def IsSUSYSignalRun3(flags)
Definition: DecorateSUSYProcessConfig.py:8
python.DecorateSUSYProcessConfig.SUSYSignalTaggerCfg
def SUSYSignalTaggerCfg(flags, derivationName)
Definition: DecorateSUSYProcessConfig.py:49
python.MCTruthCommonConfig.AddTruthCollectionNavigationDecorationsCfg
def AddTruthCollectionNavigationDecorationsCfg(flags, TruthCollections=[], prefix='')
Definition: MCTruthCommonConfig.py:331
TLACommonConfigFunctions.StandardTLAJetsCfg
def StandardTLAJetsCfg(ConfigFlags)
Definition: TLACommonConfigFunctions.py:32
TLACommonConfigFunctions.AddStandardTLATruthContentsCfg
def AddStandardTLATruthContentsCfg(flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, prefix='', useTLAPostJetAugmentations=True)
Definition: TLACommonConfigFunctions.py:107
TLACommonConfigFunctions.TLAJetCommonCfg
def TLAJetCommonCfg(ConfigFlags)
These jet related functions are a copy of the ones in the JetCommonConfig file but we remove the jet ...
Definition: TLACommonConfigFunctions.py:16
python.TruthDerivationToolsConfig.DFCommonTruthDressedWZQGLabelToolCfg
def DFCommonTruthDressedWZQGLabelToolCfg(flags)
Definition: TruthDerivationToolsConfig.py:357
python.JetCommonConfig.AddBadBatmanCfg
def AddBadBatmanCfg(ConfigFlags)
Definition: JetCommonConfig.py:53
python.JetCommonConfig.AddDistanceInTrainCfg
def AddDistanceInTrainCfg(ConfigFlags)
Definition: JetCommonConfig.py:65
TLACommonConfigFunctions.PostTLAJetMCTruthAugmentationsCfg
def PostTLAJetMCTruthAugmentationsCfg(flags, **kwargs)
Definition: TLACommonConfigFunctions.py:74
python.JetCommonConfig.AddEventCleanFlagsCfg
def AddEventCleanFlagsCfg(ConfigFlags, workingPoints=['Loose', 'Tight', 'LooseLLP'])
Definition: JetCommonConfig.py:115