123 def makeAlgs(self, config):
124 self.parseSelectionRegionsConfig()
125 for perRegionConfig
in self.perRegionConfiguration:
126 selectionName = perRegionConfig[
"selectionName"]
127 alg = config.createAlgorithm(
128 "EventReco::RunKLFitterAlg",
129 f
"RunKLFitterAlg_{self.containerName}_{selectionName}",
132 alg.electrons, alg.electronSelection = config.readNameAndSelection(
135 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
136 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
137 alg.met = config.readName(self.met)
138 alg.result = self.containerName +
"_%SYS%"
141 alg.SaveAllPermutations = self.saveAllPermutations
144 alg.selectionDecorationName = selectionName +
"_%SYS%,as_char"
145 alg.LHType = self.likelihoodType
146 alg.LeptonType = perRegionConfig.get(
"leptonType", self.leptonType)
147 alg.JetSelectionMode = perRegionConfig.get(
148 "jetSelectionMode", self.jetSelectionMode
150 btagAlgo = perRegionConfig.get(
"btagger", self.btagger)
151 btagWP = perRegionConfig.get(
"btagWP", self.btagWP)
152 alg.BTaggingDecoration = f
"ftag_select_{btagAlgo}_{btagWP}"
154 alg.BTaggingMethod = perRegionConfig.get(
155 "btaggingMethod", self.btaggingMethod
157 if alg.BTaggingMethod ==
"kWorkingPoint":
158 config.addPrivateTool(
"btagEffTool",
"BTaggingEfficiencyTool")
159 alg.btagEffTool.TaggerName = self.btagger
160 alg.btagEffTool.OperatingPoint = self.btagWP
161 jetCollection = config.originalName(self.jets.
split(
".")[0])
162 alg.btagEffTool.JetAuthor = jetCollection
163 alg.btagEffTool.ScaleFactorFileName = (
165 if self.bTagCDIFile
is None
166 else self.bTagCDIFile
168 alg.btagEffTool.IgnoreOutOfValidityRange = (
169 self.btagIgnoreOutOfValidityRange
171 alg.btagEffTool.MinPt = (
177 finalizeAlg = config.createAlgorithm(
178 "EventReco::KLFitterFinalizeOutputAlg",
179 "KLFitterFinalizeOutputAlg_" + self.containerName,
181 finalizeAlg.resultContainerToCheck = self.containerName +
"_%SYS%"
182 finalizeAlg.resultContainerToWrite = self.containerName +
"_%SYS%"
184 config.setSourceName(self.containerName, self.containerName)
185 config.addOutputContainer(self.containerName, self.containerName +
"_%SYS%")
187 config.addOutputVar(self.containerName,
"eventProbability",
"eventProbability")
188 config.addOutputVar(self.containerName,
"logLikelihood",
"logLikelihood")
189 if self.saveAllPermutations:
190 config.addOutputVar(self.containerName,
"selected",
"selected")
192 if self.likelihoodType !=
"ttbar_AllHad":
194 self.containerName,
"model_bhad_jetIndex",
"bhad_jetIndex"
197 self.containerName,
"model_blep_jetIndex",
"blep_jetIndex"
200 self.containerName,
"model_lq1_jetIndex",
"lq1_jetIndex"
202 if self.likelihoodType !=
"ttbar_BoostedLJets":
204 self.containerName,
"model_lq2_jetIndex",
"lq2_jetIndex"
206 if self.likelihoodType ==
"ttH":
208 self.containerName,
"model_Higgs_b1_jetIndex",
"Higgs_b1_jetIndex"
211 self.containerName,
"model_Higgs_b2_jetIndex",
"Higgs_b2_jetIndex"
214 config.addOutputVar(self.containerName,
"model_nu_pt",
"nu_pt")
215 config.addOutputVar(self.containerName,
"model_nu_eta",
"nu_eta")
216 config.addOutputVar(self.containerName,
"model_nu_phi",
"nu_phi")
217 config.addOutputVar(self.containerName,
"model_nu_E",
"nu_E")
219 if self.likelihoodType ==
"ttZTrilepton":
220 config.addOutputVar(self.containerName,
"model_lep_index",
"lep_index")
222 self.containerName,
"model_lepZ1_index",
"lepZ1_index"
225 self.containerName,
"model_lepZ2_index",
"lepZ2_index"
229 self.containerName,
"model_b_from_top1_jetIndex",
"b_from_top1_jetIndex"
232 self.containerName,
"model_b_from_top2_jetIndex",
"b_from_top2_jetIndex"
236 "model_lj1_from_top1_jetIndex",
237 "lj1_from_top1_jetIndex",
241 "model_lj2_from_top1_jetIndex",
242 "lj2_from_top1_jetIndex",
246 "model_lj1_from_top2_jetIndex",
247 "lj1_from_top2_jetIndex",
251 "model_lj2_from_top2_jetIndex",
252 "lj2_from_top2_jetIndex",