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