139 raise ValueError(
"KLFitterConfig: the likelihoodType option must be set")
142 selectionName = perRegionConfig[
"selectionName"]
143 alg = config.createAlgorithm(
144 "EventReco::RunKLFitterAlg",
145 f
"RunKLFitterAlg_{selectionName}",
148 alg.electrons, alg.electronSelection = config.readNameAndSelection(
151 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
152 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
153 alg.met = config.readName(self.met)
160 alg.selectionDecorationName = selectionName +
"_%SYS%,as_char"
162 alg.LeptonType = perRegionConfig.get(
"leptonType", self.leptonType)
163 alg.JetSelectionMode = perRegionConfig.get(
164 "jetSelectionMode", self.jetSelectionMode
166 btagAlgo = perRegionConfig.get(
"btagger", self.btagger)
167 btagWP = perRegionConfig.get(
"btagWP", self.btagWP)
168 alg.BTaggingDecoration = f
"ftag_select_{btagAlgo}_{btagWP}"
170 alg.BTaggingMethod = perRegionConfig.get(
171 "btaggingMethod", self.btaggingMethod
173 if alg.BTaggingMethod ==
"kWorkingPoint":
174 config.addPrivateTool(
"btagEffTool",
"BTaggingEfficiencyTool")
175 alg.btagEffTool.TaggerName = btagAlgo
176 alg.btagEffTool.OperatingPoint = btagWP
177 jetCollection = config.originalName(self.jets.
split(
".")[0])
178 alg.btagEffTool.JetAuthor = jetCollection
179 alg.btagEffTool.ScaleFactorFileName = (
180 getRecommendedBTagCalib(config.geometry(), btagWP)
181 if self.bTagCDIFile
is None
182 else self.bTagCDIFile
184 alg.btagEffTool.IgnoreOutOfValidityRange = (
185 self.btagIgnoreOutOfValidityRange
187 alg.btagEffTool.MinPt = (
193 finalizeAlg = config.createAlgorithm(
194 "EventReco::KLFitterFinalizeOutputAlg",
195 "KLFitterFinalizeOutputAlg",
197 finalizeAlg.resultContainerToCheck = self.
containerName +
"_%SYS%"
198 finalizeAlg.resultContainerToWrite = self.
containerName +
"_%SYS%"
202 config.addOutputVar(self.
containerName,
"eventProbability",
"eventProbability", auxType=
"float")
203 config.addOutputVar(self.
containerName,
"logLikelihood",
"logLikelihood", auxType=
"float")
205 config.addOutputVar(self.
containerName,
"bestPermutation",
"bestPermutation", auxType=
"unsigned_int")
209 self.
containerName,
"model_bhad_jetIndex",
"bhad_jetIndex", auxType=
"unsigned_int"
212 self.
containerName,
"model_blep_jetIndex",
"blep_jetIndex", auxType=
"unsigned_int"
215 self.
containerName,
"model_lq1_jetIndex",
"lq1_jetIndex", auxType=
"unsigned_int"
219 self.
containerName,
"model_lq2_jetIndex",
"lq2_jetIndex", auxType=
"unsigned_int"
223 self.
containerName,
"model_Higgs_b1_jetIndex",
"Higgs_b1_jetIndex", auxType=
"unsigned_int"
226 self.
containerName,
"model_Higgs_b2_jetIndex",
"Higgs_b2_jetIndex", auxType=
"unsigned_int"
229 config.addOutputVar(self.
containerName,
"model_nu_pt",
"nu_pt", auxType=
"float")
230 config.addOutputVar(self.
containerName,
"model_nu_eta",
"nu_eta", auxType=
"float")
231 config.addOutputVar(self.
containerName,
"model_nu_phi",
"nu_phi", auxType=
"float")
232 config.addOutputVar(self.
containerName,
"model_nu_E",
"nu_E", auxType=
"float")
235 config.addOutputVar(self.
containerName,
"model_lep_index",
"lep_index", auxType=
"unsigned_int")
237 self.
containerName,
"model_lepZ1_index",
"lepZ1_index", auxType=
"unsigned_int"
240 self.
containerName,
"model_lepZ2_index",
"lepZ2_index", auxType=
"unsigned_int"
244 self.
containerName,
"model_b_from_top1_jetIndex",
"b_from_top1_jetIndex", auxType=
"unsigned_int"
247 self.
containerName,
"model_b_from_top2_jetIndex",
"b_from_top2_jetIndex", auxType=
"unsigned_int"
251 "model_lj1_from_top1_jetIndex",
252 "lj1_from_top1_jetIndex",
253 auxType=
"unsigned_int"
257 "model_lj2_from_top1_jetIndex",
258 "lj2_from_top1_jetIndex",
259 auxType=
"unsigned_int"
263 "model_lj1_from_top2_jetIndex",
264 "lj1_from_top2_jetIndex",
265 auxType=
"unsigned_int"
269 "model_lj2_from_top2_jetIndex",
270 "lj2_from_top2_jetIndex",
271 auxType=
"unsigned_int"