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
 useJVT
 useFJVT
 selectionNameFJVT
list invisible
 saveSignificance
str jetCalibConfig = "":
str jetCalibArea = "00-04-81"
str jetCalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'
str egammaESModel = "":
 containerName
 addExtraSignificanceVars

Detailed Description

the ConfigBlock for the MET configuration

Definition at line 9 of file MetAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MetAnalysisConfig.MetAnalysisConfig.__init__ ( self)

Definition at line 12 of file MetAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 85 of file MetAnalysisConfig.py.

85 def instanceName (self) :
86 """Return the instance name for this block"""
87 return self.containerName
88

◆ makeAlgs()

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

Definition at line 89 of file MetAnalysisConfig.py.

89 def makeAlgs (self, config) :
90
91 if config.isPhyslite() :
92 metSuffix = 'AnalysisMET'
93 else :
94 jetContainer = config.originalName (self.jets)
95 metSuffix = jetContainer[:-4]
96 if self.useLRT:
97 metSuffix += "_LRT"
98
99 # Remove b-tagging calibration from the MET suffix name
100 btIndex = metSuffix.find('_BTagging')
101 if btIndex != -1:
102 metSuffix = metSuffix[:btIndex]
103
104 # Set up the met maker algorithm:
105 alg = config.createAlgorithm( 'CP::MetMakerAlg', 'MetMakerAlg' )
106 config.addPrivateTool( 'makerTool', 'met::METMaker' )
107 alg.makerTool.skipSystematicJetSelection = self.skipSystematicJetSelection
108
109 alg.doJetJVT = self.useJVT
110 if self.useJVT:
111 config.addPrivateTool( 'makerTool.JvtSelTool', 'CP::NNJvtSelectionTool' )
112 alg.makerTool.JvtSelTool.JetContainer = config.readName (self.jets)
113 alg.makerTool.JvtSelTool.JvtMomentName = "NNJvt"
114 if self.useFJVT:
115 # for backwards compatibility with "old" FJVT handling in JetAnalysisConfig.py
116 if not self.selectionNameFJVT:
117 alg.makerTool.JetRejectionDec = 'fjvt_selection'
118 # otherwise get the decoration from the selection
119 else:
120 fjvt_decoration = config.getFullSelection(self.jets, self.selectionNameFJVT, skipBase=True).replace(",as_char", "")
121 alg.makerTool.JetRejectionDec = fjvt_decoration
122
123 alg.makerTool.JetSelection = self.metWP
124 alg.makerTool.DoPFlow = 'PFlow' in metSuffix or metSuffix=="AnalysisMET"
125 alg.makerTool.DoSetMuonJetEMScale = self.setMuonJetEMScale if self.muons else False
126 alg.switchTauMu = self.switchTauMuOrder
127
128 if config.dataType() is not DataType.Data :
129 config.addPrivateTool( 'systematicsTool', 'met::METSystematicsTool' )
130
131 alg.metCore = 'MET_Core_' + metSuffix
132 alg.metAssociation = 'METAssoc_' + metSuffix
133 alg.jets = config.readName (self.jets)
134 alg.softTermKey = "PVSoftTrk" if not self.useCaloSoftTerm else "SoftClus"
135 if self.muons != "" :
136 alg.muons, alg.muonsSelection = config.readNameAndSelection (self.muons, excludeFrom={'or'})
137 if self.electrons != "" :
138 alg.electrons, alg.electronsSelection = config.readNameAndSelection (self.electrons, excludeFrom={'or'})
139 if self.photons != "" :
140 alg.photons, alg.photonsSelection = config.readNameAndSelection (self.photons, excludeFrom={'or'})
141 if self.taus != "" :
142 alg.taus, alg.tausSelection = config.readNameAndSelection (self.taus, excludeFrom={'or'})
143 if self.invisible:
144 if isinstance(self.invisible, str):
145 self.invisible = [self.invisible]
146 invisibleContainers, invisibleSelections = zip(*[config.readNameAndSelection (container, excludeFrom={'or'}) for container in self.invisible])
147 alg.invisible = list(invisibleContainers)
148 alg.invisibleSelection = list(invisibleSelections)
149 alg.met = config.writeName (self.containerName, isMet = True)
150
151
152 # Set up the met builder algorithm:
153 alg = config.createAlgorithm( 'CP::MetBuilderAlg', 'MetBuilderAlg' )
154 alg.softTerm = "PVSoftTrk" if not self.useCaloSoftTerm else "SoftClus"
155 alg.met = config.readName (self.containerName)
156
157
158 # Set up the met significance algorithm:
159 if self.saveSignificance:
160 alg = config.createAlgorithm( 'CP::MetSignificanceAlg', 'MetSignificanceAlg' )
161 config.addPrivateTool( 'significanceTool', 'met::METSignificance' )
162 if self.muons != "" :
163 config.addPrivateTool( 'significanceTool.MuonCalibTool', 'CP::MuonCalibTool' )
164 # Retrieve the calibMode from the container name.selections
165 alg.significanceTool.MuonCalibTool.calibMode = (
166 config.getContainerMeta(self.muons.split(".")[0], 'calibMode', failOnMiss=True))
167
168 # Preliminary R22 recommendation is to use R21 jet resolutions from 2018 for MET significance.
169 # See Jet/Etmiss recommendation documentation for details.
170 if self.jetCalibConfig == "":
171 self.jetCalibConfig = "JES_data2017_2016_2015_Recommendation_PFlow_Aug2018_rel21.config"
172 self.jetCalibArea = "00-04-81"
173 # Include Smear and not InSitu, even when running on data.
174 # This is for technical reasons and allows access to the correct resolutions for both data and MC.
175 self.jetCalibSequence = 'JetArea_Residual_EtaJES_GSC_Smear'
176
177 # Standard e/gamma calibration. Must be kept in agreement with ElectronAnalysisConfig.py
178 if self.egammaESModel == "":
179 if config.geometry() is LHCPeriod.Run2:
180 self.egammaESModel = 'es2023_R22_Run2_v1'
181 elif config.geometry() is LHCPeriod.Run3:
182 self.egammaESModel = 'es2024_Run3_v0'
183
184 alg.significanceTool.SoftTermParam = 0
185 if self.softTermResolution > 0:
186 alg.significanceTool.SoftTermReso = self.softTermResolution
187 alg.significanceTool.TreatPUJets = self.treatPUJets
188 alg.significanceTool.JetCalibConfig = self.jetCalibConfig
189 alg.significanceTool.JetCalibSequence = self.jetCalibSequence
190 alg.significanceTool.JetCalibArea = self.jetCalibArea
191 alg.significanceTool.EgammaESModel = self.egammaESModel
192 alg.significanceTool.EgammaDecorrelationModel = self.egammaDecorrelationModel
193 alg.significanceTool.EgammaUseFastsim = (config.dataType() is DataType.FastSim)
194 alg.significanceTool.TauTESConfig = self.tauTESConfig
195 alg.significanceTool.TauUseMVAResolution = self.tauUseMVAResolution
196 alg.met = config.readName (self.containerName)
197 config.addOutputVar (self.containerName, 'significance_%SYS%', 'significance')
198 if self.addExtraSignificanceVars:
199 alg.sigDirectionalDecoration = "sigDirectional_%SYS%"
200 alg.METOverSqrtSumETDecoration = "METOverSqrtSumET_%SYS%"
201 alg.METOverSqrtHTDecoration = "METOverSqrtHT_%SYS%"
202 config.addOutputVar (self.containerName, 'sigDirectional_%SYS%', 'sigDirectional')
203 config.addOutputVar (self.containerName, 'METOverSqrtSumET_%SYS%', 'METOverSqrtSumET')
204 config.addOutputVar (self.containerName, 'METOverSqrtHT_%SYS%', 'METOverSqrtHT')
205
206 config.addOutputVar (self.containerName, 'met', 'met')
207 config.addOutputVar (self.containerName, 'phi', 'phi')
208 config.addOutputVar (self.containerName, 'sumet', 'sumet')
209 config.addOutputVar (self.containerName, 'name', 'name', noSys=True, enabled=False)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:310
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

Member Data Documentation

◆ addExtraSignificanceVars

python.MetAnalysisConfig.MetAnalysisConfig.addExtraSignificanceVars

Definition at line 198 of file MetAnalysisConfig.py.

◆ containerName

python.MetAnalysisConfig.MetAnalysisConfig.containerName

Definition at line 197 of file MetAnalysisConfig.py.

◆ egammaESModel

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

Definition at line 178 of file MetAnalysisConfig.py.

◆ invisible

python.MetAnalysisConfig.MetAnalysisConfig.invisible

Definition at line 143 of file MetAnalysisConfig.py.

◆ jetCalibArea

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

Definition at line 172 of file MetAnalysisConfig.py.

◆ jetCalibConfig

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

Definition at line 170 of file MetAnalysisConfig.py.

◆ jetCalibSequence

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

Definition at line 175 of file MetAnalysisConfig.py.

◆ saveSignificance

python.MetAnalysisConfig.MetAnalysisConfig.saveSignificance

Definition at line 159 of file MetAnalysisConfig.py.

◆ selectionNameFJVT

python.MetAnalysisConfig.MetAnalysisConfig.selectionNameFJVT

Definition at line 116 of file MetAnalysisConfig.py.

◆ useFJVT

python.MetAnalysisConfig.MetAnalysisConfig.useFJVT

Definition at line 114 of file MetAnalysisConfig.py.

◆ useJVT

python.MetAnalysisConfig.MetAnalysisConfig.useJVT

Definition at line 110 of file MetAnalysisConfig.py.

◆ useLRT

python.MetAnalysisConfig.MetAnalysisConfig.useLRT

Definition at line 96 of file MetAnalysisConfig.py.


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