ATLAS Offline Software
Loading...
Searching...
No Matches
python.MetAnalysisConfig.MetAnalysisConfig Class Reference
Inheritance diagram for python.MetAnalysisConfig.MetAnalysisConfig:
Collaboration diagram for python.MetAnalysisConfig.MetAnalysisConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)

Public Attributes

 useLRT
 useNN
 networkFile
 useJVT
 useFJVT
 selectionNameFJVT
list invisible
 containerName
 saveSignificance
str jetCalibConfig = "":
str jetCalibArea = "00-04-81"
str jetCalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'
str egammaESModel = "":
str egammaDecorrelationModel = "":
 addExtraSignificanceVars

Detailed Description

the ConfigBlock for the MET configuration

Definition at line 8 of file MetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MetAnalysisConfig.MetAnalysisConfig.__init__ ( self)

Definition at line 11 of file MetAnalysisConfig.py.

11 def __init__ (self) :
12 super (MetAnalysisConfig, self).__init__ ()
13 self.addOption('containerName', '', type=str,
14 noneAction='error',
15 info="the name of the output container.",
16 meta={'role':'container'})
17 self.addOption ('useJVT', True, type=bool,
18 info="whether to use the JVT decision in the MET calculation.")
19 self.addOption ('useFJVT', False, type=bool,
20 info="whether to use the forward JVT decision in the MET calculation.")
21 self.addOption ('selectionNameFJVT', "", type=str,
22 info="name of the forward JVT selection to be used if `useFJVT` is activated.",
23 meta={'role':'selection'})
24 self.addOption ('treatPUJets', False, type=bool,
25 info="whether to treat pile-up jets in the MET significance calculation.")
26 self.addOption ('setMuonJetEMScale', True, type=bool,
27 info="enables the handling of muons in jets for the MET calculation. "
28 "Should be turned off for analyses where muons are not reconstructed "
29 "at all.")
30 self.addOption ('jets', "", type=str,
31 info="the input jet container.",
32 meta={'role':'containerRef'})
33 self.addOption ('electrons', "", type=str,
34 info="the input electron container, with a possible selection, in "
35 "the format `container` or `container.selection`.",
36 meta={'role':'containerRef'})
37 self.addOption ('muons', "", type=str,
38 info="the input muon container, with a possible selection, in the "
39 "format `container` or `container.selection`.",
40 meta={'role':'containerRef'})
41 self.addOption ('photons', "", type=str,
42 info="the input photon container, with a possible selection, in "
43 "the format `container` or `container.selection`.",
44 meta={'role':'containerRef'})
45 self.addOption ('taus', "", type=str,
46 info="the input tau-jet container, with a possible selection, in "
47 "the format `container` or `container.selection`.",
48 meta={'role':'containerRef'})
49 self.addOption ('invisible', [], type=None,
50 info="any input containers to be treated as invisible particles, "
51 "as a single string or a list of strings in the format `container` or `container.selection`.",
52 meta={'role':'containerRef'})
53 self.addOption ('metWP', "Tight", type=str,
54 info="the MET working point to use: `Loose`, `Tight`, `Tighter`, "
55 "`Tenacious`.",
56 meta={'choices':(['Loose','Tight','Tighter','Tenacious'],1)})
57 self.addOption ('skipSystematicJetSelection', False, type=bool,
58 info="EXPERIMENTAL: whether to use simplified OR based on nominal jets "
59 "and for jet-related systematics only. "
60 "WARNING: this option is strictly for doing physics studies of the feasibility "
61 "of this OR scheme, it should not be used in a regular analysis.",
62 expertMode=True)
63 self.addOption ('saveSignificance', True, type=bool,
64 info="whether to save the MET significance.")
65 self.addOption ('jetCalibConfig', "", type=str,
66 info="config file used in jet calibration (for MET significance).")
67 self.addOption ('jetCalibSequence', "", type=str,
68 info="jet calibration sequence (for MET significance).")
69 self.addOption ('jetCalibArea', "", type=str,
70 info="name of the CalibArea used in jet calibration (for MET significance).")
71 self.addOption ('egammaESModel', "", type=str,
72 info="ESModel for EGamma calibration (for MET significance).")
73 self.addOption ('egammaDecorrelationModel', "", type=str,
74 info="decorrelation model for EGamma calibration (for MET significance).")
75 self.addOption ('tauTESConfig', "CombinedTES_R22_Round2.5_v2.root", type=str,
76 info="config file for tau energy scale calibration (for MET significance).")
77 self.addOption ('tauUseMVAResolution', True, type=bool,
78 info="whether to use MVA resolution for taus-jets (for MET significance).")
79 self.addOption ('addExtraSignificanceVars', False, type=bool,
80 info="whether to save some additional (event-based) MET significance variables.")
81 self.addOption ('useLRT', False, type=bool,
82 info="whether to use LRT MET Core and association map.")
83 self.addOption ('useCaloSoftTerm', False, type=bool,
84 info="whether to use calo- instead of track-based soft term.",
85 expertMode=True)
86 self.addOption ('softTermResolution', -1.0, type=float,
87 info="override the default soft term resolution in METSignificance.",
88 expertMode=True)
89 self.addOption ('switchTauMuOrder', False, type=bool,
90 info="whether to switch order of taus and muons",
91 expertMode=True)
92 self.addOption ('useNN', False, type=bool,
93 info="use the METNet neural-network MET tool (met::METNet) instead of "
94 "met::METMaker. Produces the NN MET as the container's Final term.")
95 self.addOption ('networkFile', "", type=str,
96 info="path to the METNet ONNX network file (required when useNN=True).")
97

Member Function Documentation

◆ instanceName()

python.MetAnalysisConfig.MetAnalysisConfig.instanceName ( self)
Return the instance name for this block

Definition at line 98 of file MetAnalysisConfig.py.

98 def instanceName (self) :
99 """Return the instance name for this block"""
100 return self.containerName
101

◆ makeAlgs()

python.MetAnalysisConfig.MetAnalysisConfig.makeAlgs ( self,
config )

Definition at line 102 of file MetAnalysisConfig.py.

102 def makeAlgs (self, config) :
103
104 if config.isPhyslite() :
105 metSuffix = 'AnalysisMET'
106 else :
107 jetContainer = config.originalName (self.jets)
108 metSuffix = jetContainer.removesuffix('Jets')
109 if self.useLRT:
110 metSuffix += "_LRT"
111
112 # Remove b-tagging calibration from the MET suffix name
113 btIndex = metSuffix.find('_BTagging')
114 if btIndex != -1:
115 metSuffix = metSuffix[:btIndex]
116
117 # Set up the met maker algorithm:
118 alg = config.createAlgorithm( 'CP::MetMakerAlg', 'MetMakerAlg' )
119 if self.useNN:
120 if not self.networkFile:
121 raise ValueError("MissingET: useNN=True requires 'networkFile'.")
122 config.addPrivateTool( 'makerTool', 'met::METNet' )
123 alg.makerTool.NetworkFile = self.networkFile
124 alg.makerTool.JetContainer = config.readName (self.jets)
125 alg.evaluateNNMET = True
126 alg.doJetJVT = self.useJVT
127 # NOTE: no met::METSystematicsTool for the NN path — soft-term
128 # systematics are not defined for the network output.
129 else:
130 config.addPrivateTool( 'makerTool', 'met::METMaker' )
131 alg.makerTool.skipSystematicJetSelection = self.skipSystematicJetSelection
132
133 alg.doJetJVT = self.useJVT
134 if self.useJVT:
135 config.addPrivateTool( 'makerTool.JvtSelTool', 'CP::NNJvtSelectionTool' )
136 alg.makerTool.JvtSelTool.JetContainer = config.readName (self.jets)
137 alg.makerTool.JvtSelTool.JvtMomentName = "NNJvt"
138 if self.useFJVT:
139 # for backwards compatibility with "old" FJVT handling in JetAnalysisConfig.py
140 if not self.selectionNameFJVT:
141 alg.makerTool.JetRejectionDec = 'fjvt_selection'
142 # otherwise get the decoration from the selection
143 else:
144 fjvt_decoration = config.getFullSelection(self.jets, self.selectionNameFJVT, skipBase=True).replace(",as_char", "")
145 alg.makerTool.JetRejectionDec = fjvt_decoration
146
147 alg.makerTool.JetSelection = self.metWP
148 alg.makerTool.DoPFlow = 'PFlow' in metSuffix or metSuffix=="AnalysisMET"
149 alg.makerTool.DoSetMuonJetEMScale = self.setMuonJetEMScale if self.muons else False
150 alg.switchTauMu = self.switchTauMuOrder
151
152 if config.dataType() is not DataType.Data :
153 config.addPrivateTool( 'systematicsTool', 'met::METSystematicsTool' )
154
155 alg.metCore = 'MET_Core_' + metSuffix
156 alg.metAssociation = 'METAssoc_' + metSuffix
157 alg.jets = config.readName (self.jets)
158 alg.softTermKey = "PVSoftTrk" if not self.useCaloSoftTerm else "SoftClus"
159 if self.muons != "" :
160 alg.muons, alg.muonsSelection = config.readNameAndSelection (self.muons, excludeFrom={'or'})
161 if self.electrons != "" :
162 alg.electrons, alg.electronsSelection = config.readNameAndSelection (self.electrons, excludeFrom={'or'})
163 if self.photons != "" :
164 alg.photons, alg.photonsSelection = config.readNameAndSelection (self.photons, excludeFrom={'or'})
165 if self.taus != "" :
166 alg.taus, alg.tausSelection = config.readNameAndSelection (self.taus, excludeFrom={'or'})
167 if self.invisible:
168 if isinstance(self.invisible, str):
169 self.invisible = [self.invisible]
170 invisibleContainers, invisibleSelections = zip(*[config.readNameAndSelection (container, excludeFrom={'or'}) for container in self.invisible])
171 alg.invisible = list(invisibleContainers)
172 alg.invisibleSelection = list(invisibleSelections)
173 alg.met = config.writeName (self.containerName, isMet = True)
174
175 # met/phi are decorated on every term by the maker alg (for the NN path
176 # directly via evaluateNNMET), so they are output on both paths.
177 config.addOutputVar (self.containerName, 'met', 'met')
178 config.addOutputVar (self.containerName, 'phi', 'phi')
179 config.addOutputVar (self.containerName, 'name', 'name', noSys=True, enabled=False)
180
181 # The NN path writes the Final term directly (a builder sum would clobber
182 # it) and produces no meaningful sumet/significance, so it needs neither
183 # the met builder nor the significance algorithm.
184 if self.useNN:
185 return
186
187 config.addOutputVar (self.containerName, 'sumet', 'sumet')
188
189 # Set up the met builder algorithm:
190 alg = config.createAlgorithm( 'CP::MetBuilderAlg', 'MetBuilderAlg' )
191 alg.softTerm = "PVSoftTrk" if not self.useCaloSoftTerm else "SoftClus"
192 alg.met = config.readName (self.containerName)
193
194
195 # Set up the met significance algorithm:
196 if self.saveSignificance:
197 alg = config.createAlgorithm( 'CP::MetSignificanceAlg', 'MetSignificanceAlg' )
198 config.addPrivateTool( 'significanceTool', 'met::METSignificance' )
199 if self.muons != "" :
200 config.addPrivateTool( 'significanceTool.MuonCalibTool', 'CP::MuonCalibTool' )
201 # Retrieve the calibMode from the container name.selections
202 alg.significanceTool.MuonCalibTool.calibMode = (
203 config.getContainerMeta(self.muons.split(".")[0], 'calibMode', failOnMiss=True))
204
205 # Preliminary R22 recommendation is to use R21 jet resolutions from 2018 for MET significance.
206 # See Jet/Etmiss recommendation documentation for details.
207 if self.jetCalibConfig == "":
208 self.jetCalibConfig = "JES_data2017_2016_2015_Recommendation_PFlow_Aug2018_rel21.config"
209 self.jetCalibArea = "00-04-81"
210 # Include Smear and not InSitu, even when running on data.
211 # This is for technical reasons and allows access to the correct resolutions for both data and MC.
212 self.jetCalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'
213
214 # Standard e/gamma calibration. Must be kept in agreement with ElectronAnalysisConfig.py
215 if self.electrons != "" :
216 if self.egammaESModel == "":
217 self.egammaESModel = (
218 config.getContainerMeta(self.electrons.split(".")[0], 'ESModel', failOnMiss=True))
219 if self.egammaDecorrelationModel == "":
220 self.egammaDecorrelationModel = (
221 config.getContainerMeta(self.electrons.split(".")[0], 'decorrelationModel', failOnMiss=True))
222
223 alg.significanceTool.SoftTermParam = 0
224 if self.softTermResolution > 0:
225 alg.significanceTool.SoftTermReso = self.softTermResolution
226 alg.significanceTool.TreatPUJets = self.treatPUJets
227 alg.significanceTool.JetCalibConfig = self.jetCalibConfig
228 alg.significanceTool.JetCalibSequence = self.jetCalibSequence
229 alg.significanceTool.JetCalibArea = self.jetCalibArea
230 alg.significanceTool.EgammaESModel = self.egammaESModel
231 alg.significanceTool.EgammaDecorrelationModel = self.egammaDecorrelationModel
232 alg.significanceTool.EgammaUseFastsim = (config.dataType() is DataType.FastSim)
233 alg.significanceTool.TauTESConfig = self.tauTESConfig
234 alg.significanceTool.TauUseMVAResolution = self.tauUseMVAResolution
235 alg.met = config.readName (self.containerName)
236 config.addOutputVar (self.containerName, 'significance_%SYS%', 'significance')
237 if self.addExtraSignificanceVars:
238 alg.sigDirectionalDecoration = "sigDirectional_%SYS%"
239 alg.METOverSqrtSumETDecoration = "METOverSqrtSumET_%SYS%"
240 alg.METOverSqrtHTDecoration = "METOverSqrtHT_%SYS%"
241 config.addOutputVar (self.containerName, 'sigDirectional_%SYS%', 'sigDirectional')
242 config.addOutputVar (self.containerName, 'METOverSqrtSumET_%SYS%', 'METOverSqrtSumET')
243 config.addOutputVar (self.containerName, 'METOverSqrtHT_%SYS%', 'METOverSqrtHT')
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:312
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179

Member Data Documentation

◆ addExtraSignificanceVars

python.MetAnalysisConfig.MetAnalysisConfig.addExtraSignificanceVars

Definition at line 237 of file MetAnalysisConfig.py.

◆ containerName

python.MetAnalysisConfig.MetAnalysisConfig.containerName

Definition at line 177 of file MetAnalysisConfig.py.

◆ egammaDecorrelationModel

str python.MetAnalysisConfig.MetAnalysisConfig.egammaDecorrelationModel = "":

Definition at line 219 of file MetAnalysisConfig.py.

◆ egammaESModel

str python.MetAnalysisConfig.MetAnalysisConfig.egammaESModel = "":

Definition at line 216 of file MetAnalysisConfig.py.

◆ invisible

python.MetAnalysisConfig.MetAnalysisConfig.invisible

Definition at line 167 of file MetAnalysisConfig.py.

◆ jetCalibArea

str python.MetAnalysisConfig.MetAnalysisConfig.jetCalibArea = "00-04-81"

Definition at line 209 of file MetAnalysisConfig.py.

◆ jetCalibConfig

str python.MetAnalysisConfig.MetAnalysisConfig.jetCalibConfig = "":

Definition at line 207 of file MetAnalysisConfig.py.

◆ jetCalibSequence

str python.MetAnalysisConfig.MetAnalysisConfig.jetCalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'

Definition at line 212 of file MetAnalysisConfig.py.

◆ networkFile

python.MetAnalysisConfig.MetAnalysisConfig.networkFile

Definition at line 120 of file MetAnalysisConfig.py.

◆ saveSignificance

python.MetAnalysisConfig.MetAnalysisConfig.saveSignificance

Definition at line 196 of file MetAnalysisConfig.py.

◆ selectionNameFJVT

python.MetAnalysisConfig.MetAnalysisConfig.selectionNameFJVT

Definition at line 140 of file MetAnalysisConfig.py.

◆ useFJVT

python.MetAnalysisConfig.MetAnalysisConfig.useFJVT

Definition at line 138 of file MetAnalysisConfig.py.

◆ useJVT

python.MetAnalysisConfig.MetAnalysisConfig.useJVT

Definition at line 134 of file MetAnalysisConfig.py.

◆ useLRT

python.MetAnalysisConfig.MetAnalysisConfig.useLRT

Definition at line 109 of file MetAnalysisConfig.py.

◆ useNN

python.MetAnalysisConfig.MetAnalysisConfig.useNN

Definition at line 119 of file MetAnalysisConfig.py.


The documentation for this class was generated from the following file: