95 if config.isPhyslite() :
96 metSuffix =
'AnalysisMET'
98 jetContainer = config.originalName (self.jets)
99 metSuffix = jetContainer.removesuffix(
'Jets')
104 btIndex = metSuffix.find(
'_BTagging')
106 metSuffix = metSuffix[:btIndex]
109 alg = config.createAlgorithm(
'CP::MetMakerAlg',
'MetMakerAlg' )
112 raise ValueError(
"MissingET: useNN=True requires 'networkFile'.")
113 config.addPrivateTool(
'makerTool',
'met::METNet' )
115 alg.makerTool.JetContainer = config.readName (self.jets)
116 alg.evaluateNNMET =
True
117 alg.doJetJVT = self.
useJVT
121 config.addPrivateTool(
'makerTool',
'met::METMaker' )
122 alg.makerTool.skipSystematicJetSelection = self.skipSystematicJetSelection
124 alg.doJetJVT = self.
useJVT
126 config.addPrivateTool(
'makerTool.JvtSelTool',
'CP::NNJvtSelectionTool' )
127 alg.makerTool.JvtSelTool.JetContainer = config.readName (self.jets)
128 alg.makerTool.JvtSelTool.JvtMomentName =
"NNJvt"
132 alg.makerTool.JetRejectionDec =
'fjvt_selection'
136 alg.makerTool.JetRejectionDec = fjvt_decoration
138 alg.makerTool.JetSelection = self.metWP
139 alg.makerTool.DoPFlow =
'PFlow' in metSuffix
or metSuffix==
"AnalysisMET"
140 alg.makerTool.DoSetMuonJetEMScale = self.setMuonJetEMScale
if self.muons
else False
141 alg.switchTauMu = self.switchTauMuOrder
143 if config.dataType()
is not DataType.Data :
144 config.addPrivateTool(
'systematicsTool',
'met::METSystematicsTool' )
146 alg.metCore =
'MET_Core_' + metSuffix
147 alg.metAssociation =
'METAssoc_' + metSuffix
148 alg.jets = config.readName (self.jets)
149 alg.softTermKey =
"PVSoftTrk" if not self.useCaloSoftTerm
else "SoftClus"
150 if self.muons !=
"" :
151 alg.muons, alg.muonsSelection = config.readNameAndSelection (self.muons, excludeFrom={
'or'})
152 if self.electrons !=
"" :
153 alg.electrons, alg.electronsSelection = config.readNameAndSelection (self.electrons, excludeFrom={
'or'})
154 if self.photons !=
"" :
155 alg.photons, alg.photonsSelection = config.readNameAndSelection (self.photons, excludeFrom={
'or'})
157 alg.taus, alg.tausSelection = config.readNameAndSelection (self.taus, excludeFrom={
'or'})
161 invisibleContainers, invisibleSelections = zip(*[config.readNameAndSelection (container, excludeFrom={
'or'})
for container
in self.
invisible])
162 alg.invisible = list(invisibleContainers)
163 alg.invisibleSelection = list(invisibleSelections)
164 alg.met = config.writeName (self.
containerName, isMet =
True)
170 config.addOutputVar (self.
containerName,
'name',
'name', noSys=
True, enabled=
False)
181 alg = config.createAlgorithm(
'CP::MetBuilderAlg',
'MetBuilderAlg' )
182 alg.softTerm =
"PVSoftTrk" if not self.useCaloSoftTerm
else "SoftClus"
188 alg = config.createAlgorithm(
'CP::MetSignificanceAlg',
'MetSignificanceAlg' )
189 config.addPrivateTool(
'significanceTool',
'met::METSignificance' )
190 if self.muons !=
"" :
191 config.addPrivateTool(
'significanceTool.MuonCalibTool',
'CP::MuonCalibTool' )
193 alg.significanceTool.MuonCalibTool.calibMode = (
194 config.getContainerMeta(self.muons.
split(
".")[0],
'calibMode', failOnMiss=
True))
199 self.
jetCalibConfig =
"JES_data2017_2016_2015_Recommendation_PFlow_Aug2018_rel21.config"
208 config.getContainerMeta(self.electrons.
split(
".")[0],
'ESModel', failOnMiss=
True))
211 config.getContainerMeta(self.electrons.
split(
".")[0],
'decorrelationModel', failOnMiss=
True))
213 alg.significanceTool.SoftTermParam = 0
214 if self.softTermResolution > 0:
215 alg.significanceTool.SoftTermReso = self.softTermResolution
216 alg.significanceTool.TreatPUJets = self.treatPUJets
222 alg.significanceTool.EgammaUseFastsim = (config.dataType()
is DataType.FastSim)
223 alg.significanceTool.TauTESConfig = self.tauTESConfig
224 alg.significanceTool.TauUseMVAResolution = self.tauUseMVAResolution
226 config.addOutputVar (self.
containerName,
'significance_%SYS%',
'significance')
228 alg.sigDirectionalDecoration =
"sigDirectional_%SYS%"
229 alg.METOverSqrtSumETDecoration =
"METOverSqrtSumET_%SYS%"
230 alg.METOverSqrtHTDecoration =
"METOverSqrtHT_%SYS%"
231 config.addOutputVar (self.
containerName,
'sigDirectional_%SYS%',
'sigDirectional')
232 config.addOutputVar (self.
containerName,
'METOverSqrtSumET_%SYS%',
'METOverSqrtSumET')
233 config.addOutputVar (self.
containerName,
'METOverSqrtHT_%SYS%',
'METOverSqrtHT')