ATLAS Offline Software
Loading...
Searching...
No Matches
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
8from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9from AthenaConfiguration.ComponentFactory import CompFactory
10
11# Jet related
12from DerivationFrameworkJetEtMiss.JetCommonConfig import AddBadBatmanCfg, AddDistanceInTrainCfg, AddSidebandEventShapeCfg, AddEventCleanFlagsCfg
13
14
16def 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
32def 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
58from DerivationFrameworkMCTruth.MCTruthCommonConfig import (HepMCtoXAODTruthCfg, PreJetMCTruthAugmentationsCfg, PostJetMCTruthAugmentationsCfg, AddTruthCollectionNavigationDecorationsCfg, AddBosonsAndDownstreamParticlesCfg, AddBSMAndDownstreamParticlesCfg, AddTruthEnergyDensityCfg)
59
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
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
PostTLAJetMCTruthAugmentationsCfg(flags, **kwargs)
AddStandardTLATruthContentsCfg(flags, decorationDressing='dressedPhoton', includeTausInDressingPhotonRemoval=False, prefix='', useTLAPostJetAugmentations=True)
TLAJetCommonCfg(ConfigFlags)
These jet related functions are a copy of the ones in the JetCommonConfig file but we remove the jet ...