104 if config.isPhyslite() :
105 metSuffix =
'AnalysisMET'
107 jetContainer = config.originalName (self.jets)
108 metSuffix = jetContainer.removesuffix(
'Jets')
113 btIndex = metSuffix.find(
'_BTagging')
115 metSuffix = metSuffix[:btIndex]
118 alg = config.createAlgorithm(
'CP::MetMakerAlg',
'MetMakerAlg' )
121 raise ValueError(
"MissingET: useNN=True requires 'networkFile'.")
122 config.addPrivateTool(
'makerTool',
'met::METNet' )
124 alg.makerTool.JetContainer = config.readName (self.jets)
125 alg.evaluateNNMET =
True
126 alg.doJetJVT = self.
useJVT
130 config.addPrivateTool(
'makerTool',
'met::METMaker' )
131 alg.makerTool.skipSystematicJetSelection = self.skipSystematicJetSelection
133 alg.doJetJVT = self.
useJVT
135 config.addPrivateTool(
'makerTool.JvtSelTool',
'CP::NNJvtSelectionTool' )
136 alg.makerTool.JvtSelTool.JetContainer = config.readName (self.jets)
137 alg.makerTool.JvtSelTool.JvtMomentName =
"NNJvt"
141 alg.makerTool.JetRejectionDec =
'fjvt_selection'
145 alg.makerTool.JetRejectionDec = fjvt_decoration
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
152 if config.dataType()
is not DataType.Data :
153 config.addPrivateTool(
'systematicsTool',
'met::METSystematicsTool' )
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'})
166 alg.taus, alg.tausSelection = config.readNameAndSelection (self.taus, excludeFrom={
'or'})
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)
179 config.addOutputVar (self.
containerName,
'name',
'name', noSys=
True, enabled=
False)
190 alg = config.createAlgorithm(
'CP::MetBuilderAlg',
'MetBuilderAlg' )
191 alg.softTerm =
"PVSoftTrk" if not self.useCaloSoftTerm
else "SoftClus"
197 alg = config.createAlgorithm(
'CP::MetSignificanceAlg',
'MetSignificanceAlg' )
198 config.addPrivateTool(
'significanceTool',
'met::METSignificance' )
199 if self.muons !=
"" :
200 config.addPrivateTool(
'significanceTool.MuonCalibTool',
'CP::MuonCalibTool' )
202 alg.significanceTool.MuonCalibTool.calibMode = (
203 config.getContainerMeta(self.muons.
split(
".")[0],
'calibMode', failOnMiss=
True))
208 self.
jetCalibConfig =
"JES_data2017_2016_2015_Recommendation_PFlow_Aug2018_rel21.config"
215 if self.electrons !=
"" :
218 config.getContainerMeta(self.electrons.
split(
".")[0],
'ESModel', failOnMiss=
True))
221 config.getContainerMeta(self.electrons.
split(
".")[0],
'decorrelationModel', failOnMiss=
True))
223 alg.significanceTool.SoftTermParam = 0
224 if self.softTermResolution > 0:
225 alg.significanceTool.SoftTermReso = self.softTermResolution
226 alg.significanceTool.TreatPUJets = self.treatPUJets
232 alg.significanceTool.EgammaUseFastsim = (config.dataType()
is DataType.FastSim)
233 alg.significanceTool.TauTESConfig = self.tauTESConfig
234 alg.significanceTool.TauUseMVAResolution = self.tauUseMVAResolution
236 config.addOutputVar (self.
containerName,
'significance_%SYS%',
'significance')
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')