213 def makeAlgs (self, config) :
214
215 selectionPostfix = self.selectionName
216 if selectionPostfix != '' and selectionPostfix[0] != '_' :
217 selectionPostfix = '_' + selectionPostfix
218
219 postfix = self.postfix
220 if postfix is None :
221 postfix = self.selectionName
222 if postfix != '' and postfix[0] != '_' :
223 postfix = '_' + postfix
224
225
226 if self.useSelectionConfigFile:
227 nameFormat = 'TauAnalysisAlgorithms/tau_selection_'
228 if self.dropPtCut:
229 nameFormat = nameFormat + 'nopt_'
230 if self.useLowPt:
231 nameFormat = nameFormat + 'lowpt_'
232 if self.useGNTau:
233 nameFormat = nameFormat + 'gntau_'
234 nameFormat = nameFormat + '{}_'
235 if self.use_eVeto:
236 nameFormat = nameFormat + 'eleid'
237 else:
238 nameFormat = nameFormat + 'noeleid'
239 if self.use_muonOLR:
240 nameFormat = nameFormat + '_muonolr'
241 nameFormat = nameFormat + '.conf'
242
243 if self.quality not in ['Tight', 'Medium', 'Loose', 'VeryLoose', 'Baseline', 'BaselineForFakes'] :
244 raise ValueError ("invalid tau quality: \"" + self.quality +
245 "\", allowed values are Tight, Medium, Loose, " +
246 "VeryLoose, Baseline, BaselineForFakes")
247
248
249 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'TauSelectionAlg' )
250 config.addPrivateTool( 'selectionTool', 'TauAnalysisTools::TauSelectionTool' )
251 alg.selectionTool.TauContainerName = config.readName (self.containerName, nominal=True)
252 if self.useSelectionConfigFile:
253 inputfile = nameFormat.format(self.quality.lower())
254 alg.selectionTool.ConfigPath = inputfile
255 else:
256
257 from ROOT import TauAnalysisTools
258 selectioncuts = TauAnalysisTools.SelectionCuts
259 alg.selectionTool.ConfigPath = ""
260 alg.selectionTool.SelectionCuts = int(selectioncuts.CutPt |
261 selectioncuts.CutAbsEta |
262 selectioncuts.CutAbsCharge |
263 selectioncuts.CutNTrack |
264 selectioncuts.CutJetRNNScoreSigTrans |
265 selectioncuts.CutGNTauScoreSigTrans |
266 selectioncuts.CutJetIDWP |
267 selectioncuts.CutEleIDWP |
268 selectioncuts.CutMuonOLR)
269
270 alg.selectionTool.PtMin = self.manual_sel_minpt
271 alg.selectionTool.AbsEtaRegion = self.manual_sel_absetaregion
272 alg.selectionTool.AbsCharges = self.manual_sel_abscharges
273 alg.selectionTool.NTracks = self.manual_sel_ntracks
274 alg.selectionTool.JetRNNSigTransMin = self.manual_sel_minrnnscore
275 alg.selectionTool.GNTauSigTransMin = self.manual_sel_mingntauscore
276
277 if self.manual_sel_minrnnscore != -1 and self.manual_sel_mingntauscore != -1:
278 raise RuntimeError("manual_sel_minrnnscore and manual_sel_mingntauscore have been both set; please choose only one type of ID: RNN or GNTau, not both")
279
280 if self.manual_sel_rnnwp is None:
281 alg.selectionTool.JetIDWP = 1
282 elif self.manual_sel_rnnwp == "veryloose":
283 alg.selectionTool.JetIDWP = 6
284 elif self.manual_sel_rnnwp == "loose":
285 alg.selectionTool.JetIDWP = 7
286 elif self.manual_sel_rnnwp == "medium":
287 alg.selectionTool.JetIDWP = 8
288 elif self.manual_sel_rnnwp == "tight":
289 alg.selectionTool.JetIDWP = 9
290 else:
291 raise ValueError ("invalid RNN TauID WP: \"" + self.manual_sel_rnnwp + "\". Allowed values are None, veryloose, loose, medium, tight")
292
293
294 if self.manual_sel_minrnnscore != -1 and self.manual_sel_rnnwp is not None:
295 raise RuntimeError("manual_sel_minrnnscore and manual_sel_rnnwp have been both set; please set only one of them")
296
297
298 if self.manual_sel_gntauwp is None:
299 alg.selectionTool.JetIDWP = 1
300 elif self.manual_sel_gntauwp == "veryloose":
301 alg.selectionTool.JetIDWP = 10
302 elif self.manual_sel_gntauwp == "loose":
303 alg.selectionTool.JetIDWP = 11
304 elif self.manual_sel_gntauwp == "medium":
305 alg.selectionTool.JetIDWP = 12
306 elif self.manual_sel_gntauwp == "tight":
307 alg.selectionTool.JetIDWP = 13
308 else:
309 raise ValueError ("invalid GNN Tau ID WP: \"" + self.manual_sel_gntauwp + "\". Allowed values are None, veryloose, loose, medium, tight")
310
311
312 if self.manual_sel_mingntauscore != -1 and self.manual_sel_gntauwp is not None:
313 raise RuntimeError("manual_sel_mingntauscore and manual_sel_gntauwp have been both set; please set only one of them")
314
315
316 if self.manual_sel_evetowp is None:
317 alg.selectionTool.EleIDWP = 1
318 elif self.manual_sel_evetowp == "loose":
319 alg.selectionTool.EleIDWP = 2
320 elif self.manual_sel_evetowp == "medium":
321 alg.selectionTool.EleIDWP = 3
322 elif self.manual_sel_evetowp == "tight":
323 alg.selectionTool.EleIDWP = 4
324 else:
325 raise ValueError ("invalid eVeto WP: \"" + self.manual_sel_evetowp + "\". Allowed values are None, loose, medium, tight")
326
327
328 alg.selectionTool.MuonOLR = self.manual_sel_muonolr
329
330 alg.selectionDecoration = 'selected_tau' + selectionPostfix + ',as_char'
331 alg.particles = config.readName (self.containerName)
332 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
333 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
334 preselection=self.addSelectionToPreselection)
335
336