129 def makeAlgs(self, config):
130 self.parseSelectionRegionsConfig()
131 for perRegionConfig
in self.perRegionConfiguration:
132 selectionName = perRegionConfig[
"selectionName"]
133 alg = config.createAlgorithm(
134 "EventReco::RunKLFitterAlg",
135 f
"RunKLFitterAlg_{selectionName}",
138 alg.electrons, alg.electronSelection = config.readNameAndSelection(
141 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
142 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
143 alg.met = config.readName(self.met)
144 alg.result = self.containerName +
"_%SYS%"
147 alg.SaveAllPermutations = self.saveAllPermutations
150 alg.selectionDecorationName = selectionName +
"_%SYS%,as_char"
151 alg.LHType = self.likelihoodType
152 alg.LeptonType = perRegionConfig.get(
"leptonType", self.leptonType)
153 alg.JetSelectionMode = perRegionConfig.get(
154 "jetSelectionMode", self.jetSelectionMode
156 btagAlgo = perRegionConfig.get(
"btagger", self.btagger)
157 btagWP = perRegionConfig.get(
"btagWP", self.btagWP)
158 alg.BTaggingDecoration = f
"ftag_select_{btagAlgo}_{btagWP}"
160 alg.BTaggingMethod = perRegionConfig.get(
161 "btaggingMethod", self.btaggingMethod
163 if alg.BTaggingMethod ==
"kWorkingPoint":
164 config.addPrivateTool(
"btagEffTool",
"BTaggingEfficiencyTool")
165 alg.btagEffTool.TaggerName = self.btagger
166 alg.btagEffTool.OperatingPoint = self.btagWP
167 jetCollection = config.originalName(self.jets.
split(
".")[0])
168 alg.btagEffTool.JetAuthor = jetCollection
169 alg.btagEffTool.ScaleFactorFileName = (
171 if self.bTagCDIFile
is None
172 else self.bTagCDIFile
174 alg.btagEffTool.IgnoreOutOfValidityRange = (
175 self.btagIgnoreOutOfValidityRange
177 alg.btagEffTool.MinPt = (
183 finalizeAlg = config.createAlgorithm(
184 "EventReco::KLFitterFinalizeOutputAlg",
185 "KLFitterFinalizeOutputAlg",
187 finalizeAlg.resultContainerToCheck = self.containerName +
"_%SYS%"
188 finalizeAlg.resultContainerToWrite = self.containerName +
"_%SYS%"
190 config.setSourceName(self.containerName, self.containerName)
191 config.addOutputContainer(self.containerName, self.containerName +
"_%SYS%")
193 config.addOutputVar(self.containerName,
"eventProbability",
"eventProbability")
194 config.addOutputVar(self.containerName,
"logLikelihood",
"logLikelihood")
195 if self.saveAllPermutations:
196 config.addOutputVar(self.containerName,
"selected",
"selected")
198 if self.likelihoodType !=
"ttbar_AllHad":
200 self.containerName,
"model_bhad_jetIndex",
"bhad_jetIndex"
203 self.containerName,
"model_blep_jetIndex",
"blep_jetIndex"
206 self.containerName,
"model_lq1_jetIndex",
"lq1_jetIndex"
208 if self.likelihoodType !=
"ttbar_BoostedLJets":
210 self.containerName,
"model_lq2_jetIndex",
"lq2_jetIndex"
212 if self.likelihoodType ==
"ttH":
214 self.containerName,
"model_Higgs_b1_jetIndex",
"Higgs_b1_jetIndex"
217 self.containerName,
"model_Higgs_b2_jetIndex",
"Higgs_b2_jetIndex"
220 config.addOutputVar(self.containerName,
"model_nu_pt",
"nu_pt")
221 config.addOutputVar(self.containerName,
"model_nu_eta",
"nu_eta")
222 config.addOutputVar(self.containerName,
"model_nu_phi",
"nu_phi")
223 config.addOutputVar(self.containerName,
"model_nu_E",
"nu_E")
225 if self.likelihoodType ==
"ttZTrilepton":
226 config.addOutputVar(self.containerName,
"model_lep_index",
"lep_index")
228 self.containerName,
"model_lepZ1_index",
"lepZ1_index"
231 self.containerName,
"model_lepZ2_index",
"lepZ2_index"
235 self.containerName,
"model_b_from_top1_jetIndex",
"b_from_top1_jetIndex"
238 self.containerName,
"model_b_from_top2_jetIndex",
"b_from_top2_jetIndex"
242 "model_lj1_from_top1_jetIndex",
243 "lj1_from_top1_jetIndex",
247 "model_lj2_from_top1_jetIndex",
248 "lj2_from_top1_jetIndex",
252 "model_lj1_from_top2_jetIndex",
253 "lj1_from_top2_jetIndex",
257 "model_lj2_from_top2_jetIndex",
258 "lj2_from_top2_jetIndex",