ATLAS Offline Software
TauSelectionCuts.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // local include(s)
9 
10 // framework include(s)
13 
14 // EDM include(s)
15 #include "xAODMuon/MuonContainer.h"
16 
17 using namespace TauAnalysisTools;
18 
19 //______________________________________________________________________________
21  : m_sName(sName)
22  , m_hHistCutPre(nullptr)
23  , m_hHistCut(nullptr)
24  , m_tTST(tTST)
25 {
26 }
27 
28 //______________________________________________________________________________
30 {
31  // FIXME: could use unique_ptr
32  delete m_hHistCutPre;
33  delete m_hHistCut;
34 }
35 
36 //______________________________________________________________________________
38 {
39  m_hHistCutPre->Write();
40  m_hHistCut->Write();
41 }
42 
43 //______________________________________________________________________________
44 TH1F* TauSelectionCut::CreateControlPlot(const char* sName, const char* sTitle, int iBins, double dXLow, double dXUp)
45 {
47  {
48  TH1F* hHist = new TH1F(sName, sTitle, iBins, dXLow, dXUp);
49  hHist->SetDirectory(0);
50  return hHist;
51  }
52 
53  return nullptr;
54 }
55 
56 //______________________________________________________________________________
58 {
60 }
61 
62 //______________________________________________________________________________
64 {
65  fillHistogram(xTau, *m_hHistCut);
66 }
67 
68 
69 //______________________________________________________________________________
70 void TauSelectionCut::setProperty(const std::string& name, const std::string& value)
71 {
73  if(it == m_mProperties.end() )
74  throw std::runtime_error (("Undeclared property: " + name + "\n").c_str());
75  it->second = value;
76 }
77 
78 //______________________________________________________________________________
79 void TauSelectionCut::declareProperty(const std::string& name, std::string& loc)
80 {
81  std::pair<std::string, std::string&> p(name, loc);
82  m_mProperties.insert(p);
83 }
84 
85 //______________________________________________________________________________
86 std::string TauSelectionCut::getProperty(const std::string& name)
87 {
89  if(it == m_mProperties.end() )
90  throw std::runtime_error (("Undeclared property: " + name + "\n").c_str());
91 
92  return it->second;
93 }
94 
95 
96 //_______________________________SelectionCutPt_________________________________
97 //______________________________________________________________________________
99  : TauSelectionCut("CutPt", tTST)
100 {
101  m_hHistCutPre = CreateControlPlot("hPt_pre","Pt_pre;#tau-p_{T} [GeV]; events",100,0,100);
102  m_hHistCut = CreateControlPlot("hPt_cut","Pt_cut;#tau-p_{T} [GeV]; events",100,0,100);
103 }
104 
105 //______________________________________________________________________________
106 void TauSelectionCutPt::fillHistogram(const xAOD::TauJet& xTau, TH1F& hHist) const
107 {
108  hHist.Fill(xTau.pt()/1000.);
109 }
110 
111 //______________________________________________________________________________
113 {
114  info.addCut( "Pt",
115  "Selection of taus according to their transverse momentum" );
116 }
117 //______________________________________________________________________________
119  asg::AcceptData& acceptData)
120 {
121  // save tau pt in GeV
122  double pt = xTau.pt() / 1000.;
123  // in case of only one entry in vector, run for lower limits
124  if (m_tTST->m_vPtRegion.size() == 1)
125  {
126  if ( pt >= m_tTST->m_vPtRegion.at(0) )
127  {
128  acceptData.setCutResult( "Pt", true );
129  return true;
130  }
131  }
132  unsigned int iNumPtRegion = m_tTST->m_vPtRegion.size()/2;
133  for( unsigned int iPtRegion = 0; iPtRegion < iNumPtRegion; iPtRegion++ )
134  {
135  if ( pt >= m_tTST->m_vPtRegion.at(iPtRegion*2) and pt <= m_tTST->m_vPtRegion.at(iPtRegion*2+1))
136  {
137  acceptData.setCutResult( "Pt", true );
138  return true;
139  }
140  }
141  m_tTST->msg() << MSG::VERBOSE << "Tau failed pt requirement, tau pt [GeV]: " << pt << endmsg;
142  return false;
143 }
144 
145 //_____________________________SelectionCutAbsEta_______________________________
146 //______________________________________________________________________________
148  : TauSelectionCut("CutAbsEta", tTST)
149 {
150  m_hHistCutPre = CreateControlPlot("hEta_pre","Eta_pre;#tau-#eta; events",100,-3,3);
151  m_hHistCut = CreateControlPlot("hEta_cut","Eta_cut;#tau-#eta; events",100,-3,3);
152 }
153 
154 //______________________________________________________________________________
156 {
157  hHist.Fill(xTau.eta());
158 }
159 
160 //______________________________________________________________________________
162 {
163  info.addCut( "AbsEta",
164  "Selection of taus according to their absolute pseudorapidity" );
165 }
166 //______________________________________________________________________________
168  asg::AcceptData& acceptData)
169 {
170  // check regions of eta, if tau is in one region then return true; false otherwise
171  unsigned int iNumEtaRegion = m_tTST->m_vAbsEtaRegion.size()/2;
172  for( unsigned int iEtaRegion = 0; iEtaRegion < iNumEtaRegion; iEtaRegion++ )
173  {
174  if ( std::abs( xTau.eta() ) >= m_tTST->m_vAbsEtaRegion.at(iEtaRegion*2) and std::abs( xTau.eta() ) <= m_tTST->m_vAbsEtaRegion.at(iEtaRegion*2+1))
175  {
176  acceptData.setCutResult( "AbsEta", true );
177  return true;
178  }
179  }
180  m_tTST->msg() << MSG::VERBOSE << "Tau failed eta requirement, tau eta: " << xTau.eta() << endmsg;
181  return false;
182 }
183 
184 //____________________________SelectionCutAbsCharge_____________________________
185 //______________________________________________________________________________
187  : TauSelectionCut("CutAbsCharge", tTST)
188 {
189  m_hHistCutPre = CreateControlPlot("hCharge_pre","Charge_pre;charge; events",7,-3.5,3.5);
190  m_hHistCut = CreateControlPlot("hCharge_cut","Charge_cut;charge; events",7,-3.5,3.5);
191 }
192 
193 //______________________________________________________________________________
195 {
196  hHist.Fill(xTau.charge());
197 }
198 
199 //______________________________________________________________________________
201 {
202  info.addCut( "AbsCharge",
203  "Selection of taus according to their absolute charge" );
204 }
205 //______________________________________________________________________________
207  asg::AcceptData& acceptData)
208 {
209  // check charge, if tau has one of the charges requiered then return true; false otherwise
210  for( unsigned int iCharge = 0; iCharge < m_tTST->m_vAbsCharges.size(); iCharge++ )
211  {
212  if ( std::abs( xTau.charge() ) == m_tTST->m_vAbsCharges.at(iCharge) )
213  {
214  acceptData.setCutResult( "AbsCharge", true );
215  return true;
216  }
217  }
218  m_tTST->msg() << MSG::VERBOSE << "Tau failed charge requirement, tau charge: " << xTau.charge() << endmsg;
219  return false;
220 }
221 
222 //_____________________________SelectionCutNTracks______________________________
223 //______________________________________________________________________________
225  : TauSelectionCut("CutNTrack", tTST)
226 {
227  m_hHistCutPre = CreateControlPlot("hNTrack_pre","NTrack_pre;number of tracks; events",22,-1.5,20.5);
228  m_hHistCut = CreateControlPlot("hNTrack_cut","NTrack_cut;number of tracks; events",22,-1.5,20.5);
229 }
230 
231 //______________________________________________________________________________
233 {
234  hHist.Fill(xTau.nTracks());
235 }
236 
237 //______________________________________________________________________________
239 {
240  info.addCut( "NTrack",
241  "Selection of taus according to their number of associated tracks" );
242 }
243 //______________________________________________________________________________
245  asg::AcceptData& acceptData)
246 {
247  // check track multiplicity, if tau has one of the number of tracks requiered then return true; false otherwise
248  for( size_t iNumTrack = 0; iNumTrack < m_tTST->m_vNTracks.size(); iNumTrack++ )
249  {
250  if ( static_cast<unsigned> (xTau.nTracks()) == m_tTST->m_vNTracks.at(iNumTrack) )
251  {
252  acceptData.setCutResult( "NTrack", true );
253  return true;
254  }
255  }
256  m_tTST->msg() << MSG::VERBOSE << "Tau failed nTracks requirement, tau number of tracks: " << xTau.nTracks() << endmsg;
257  return false;
258 }
259 
260 //___________________________SelectionCutRNNJetScoreSigTrans____________________________
261 //______________________________________________________________________________
263  : TauSelectionCut("CutJetRNNScoreSigTrans", tTST)
264 {
265  m_hHistCutPre = CreateControlPlot("hJetRNNSigTrans_pre","JetRNNSigTrans_pre;RNNJetSigTransScore; events",100,0,1);
266  m_hHistCut = CreateControlPlot("hJetRNNSigTrans_cut","JetRNNSigTrans_cut;RNNJetSigTransScore; events",100,0,1);
267 }
268 //______________________________________________________________________________
270 {
272 }
273 //______________________________________________________________________________
275 {
276  info.addCut( "JetRNNScoreSigTrans",
277  "Selection of taus according to their JetRNNScore" );
278 }
279 //______________________________________________________________________________
281  asg::AcceptData& acceptData)
282 {
283  // check JetRNNscore, if tau has a JetRNN score in one of the regions requiered then return true; false otherwise
284  double dJetRNNScoreSigTrans = xTau.discriminant(xAOD::TauJetParameters::RNNJetScoreSigTrans);
285  unsigned int iNumJetRNNSigTransRegion = m_tTST->m_vJetRNNSigTransRegion.size()/2;
286  for( unsigned int iJetRNNSigTransRegion = 0; iJetRNNSigTransRegion < iNumJetRNNSigTransRegion; iJetRNNSigTransRegion++ )
287  {
288  if ( dJetRNNScoreSigTrans >= m_tTST->m_vJetRNNSigTransRegion.at(iJetRNNSigTransRegion*2) and dJetRNNScoreSigTrans <= m_tTST->m_vJetRNNSigTransRegion.at(iJetRNNSigTransRegion*2+1))
289  {
290  acceptData.setCutResult( "JetRNNScoreSigTrans", true );
291  return true;
292  }
293  }
294  m_tTST->msg() << MSG::VERBOSE << "Tau failed JetRNNScore requirement, tau JetRNNScore: " << dJetRNNScoreSigTrans << endmsg;
295  return false;
296 }
297 
298 //___________________________SelectionCutGNTauScoreSigTrans____________________________
299 //______________________________________________________________________________
301  : TauSelectionCut("CutGNTauScoreSigTrans", tTST)
302 {
303  m_hHistCutPre = CreateControlPlot("hGNTauSigTrans_pre","GNTauSigTrans_pre;GNTauSigTransScore; events",100,0,1);
304  m_hHistCut = CreateControlPlot("hGNTauSigTrans_cut","GNTauSigTrans_cut;GNTauSigTransScore; events",100,0,1);
305 }
306 //______________________________________________________________________________
308 {
309  SG::ConstAccessor<float> acc ("GNTauScoreSigTrans_v1trunc");
310  hHist.Fill(acc(xTau));
311 }
312 //______________________________________________________________________________
314 {
315  info.addCut( "GNTauScoreSigTrans",
316  "Selection of taus according to their GNTauScore" );
317 }
318 //______________________________________________________________________________
320  asg::AcceptData& acceptData)
321 {
322  // check GNTau score, if tau has a GNTau score in one of the regions requiered then return true; false otherwise
323  SG::ConstAccessor<float> acc ("GNTauScoreSigTrans_v1trunc");
324  double dGNTauScoreSigTrans = acc(xTau);
325  unsigned int iNumGNTauSigTransRegion = m_tTST->m_vGNTauSigTransRegion.size()/2;
326  for( unsigned int iGNTauSigTransRegion = 0; iGNTauSigTransRegion < iNumGNTauSigTransRegion; iGNTauSigTransRegion++ )
327  {
328  if ( dGNTauScoreSigTrans >= m_tTST->m_vGNTauSigTransRegion.at(iGNTauSigTransRegion*2) and dGNTauScoreSigTrans <= m_tTST->m_vGNTauSigTransRegion.at(iGNTauSigTransRegion*2+1))
329  {
330  acceptData.setCutResult( "GNTauScoreSigTrans", true );
331  return true;
332  }
333  }
334  m_tTST->msg() << MSG::VERBOSE << "Tau failed GNTauScore requirement, tau GNTauScore: " << dGNTauScoreSigTrans << endmsg;
335  return false;
336 }
337 
338 //_____________________________SelectionCutJetIDWP______________________________
339 //______________________________________________________________________________
341  : TauSelectionCut("CutJetIDWP", tTST)
342 {
343  m_hHistCutPre = CreateControlPlot("hJetIDWP_pre","JetIDWP_pre;; events",8,-.5,7.5);
344  m_hHistCut = CreateControlPlot("hJetIDWP_cut","JetIDWP_cut;; events",8,-.5,7.5);
345  // only proceed if histograms are defined
346  if (!m_hHistCutPre or !m_hHistCut)
347  return;
348 
349  m_hHistCutPre->GetXaxis()->SetBinLabel(1,"!VeryLoose");
350  m_hHistCutPre->GetXaxis()->SetBinLabel(2,"VeryLoose");
351  m_hHistCutPre->GetXaxis()->SetBinLabel(3,"!Loose");
352  m_hHistCutPre->GetXaxis()->SetBinLabel(4,"Loose");
353  m_hHistCutPre->GetXaxis()->SetBinLabel(5,"!Medium");
354  m_hHistCutPre->GetXaxis()->SetBinLabel(6,"Medium");
355  m_hHistCutPre->GetXaxis()->SetBinLabel(7,"!Tight");
356  m_hHistCutPre->GetXaxis()->SetBinLabel(8,"Tight");
357  m_hHistCut->GetXaxis()->SetBinLabel(1,"!VeryLoose");
358  m_hHistCut->GetXaxis()->SetBinLabel(2,"VeryLoose");
359  m_hHistCut->GetXaxis()->SetBinLabel(3,"!Loose");
360  m_hHistCut->GetXaxis()->SetBinLabel(4,"Loose");
361  m_hHistCut->GetXaxis()->SetBinLabel(5,"!Medium");
362  m_hHistCut->GetXaxis()->SetBinLabel(6,"Medium");
363  m_hHistCut->GetXaxis()->SetBinLabel(7,"!Tight");
364  m_hHistCut->GetXaxis()->SetBinLabel(8,"Tight");
365 }
366 
367 //______________________________________________________________________________
369 {
370  // FIXME: should this be extended to gntau ID?
372  hHist.Fill(xTau.isTau(xAOD::TauJetParameters::JetRNNSigLoose)+2);
374  hHist.Fill(xTau.isTau(xAOD::TauJetParameters::JetRNNSigTight)+6);
375 }
376 
377 //______________________________________________________________________________
379 {
380  info.addCut( "JetIDWP",
381  "Selection of taus according to their JetIDScore" );
382 }
383 //______________________________________________________________________________
385  asg::AcceptData& acceptData)
386 {
387  // check Jet ID working point, if tau passes JetID working point then return true; false otherwise
388  bool bPass = false;
389  switch (m_tTST->m_iJetIDWP)
390  {
391  case JETIDNONE:
392  bPass = true;
393  break;
395  bPass = true;
396  break;
397  case JETIDRNNVERYLOOSE:
398  if (xTau.isTau(xAOD::TauJetParameters::JetRNNSigVeryLoose)) bPass = true;
399  break;
400  case JETIDRNNLOOSE:
401  if (xTau.isTau(xAOD::TauJetParameters::JetRNNSigLoose)) bPass = true;
402  break;
403  case JETIDRNNMEDIUM:
404  if (xTau.isTau(xAOD::TauJetParameters::JetRNNSigMedium)) bPass = true;
405  break;
406  case JETIDRNNTIGHT:
407  if (xTau.isTau(xAOD::TauJetParameters::JetRNNSigTight)) bPass = true;
408  break;
409  case JETIDGNTAUVERYLOOSE:
410  static const SG::ConstAccessor<char> acc_gnTauVeryLoose("GNTauVL_v1trunc");
411  if (!acc_gnTauVeryLoose.isAvailable(xTau)) m_tTST->msg() << MSG::WARNING << "GnTau VeryLoose WP not available" << endmsg;
412  else bPass = acc_gnTauVeryLoose(xTau);
413  break;
414  case JETIDGNTAULOOSE:
415  static const SG::ConstAccessor<char> acc_gnTauLoose("GNTauL_v1trunc");
416  if (!acc_gnTauLoose.isAvailable(xTau)) m_tTST->msg() << MSG::WARNING << "GnTau Loose WP not available" << endmsg;
417  else bPass = acc_gnTauLoose(xTau);
418  break;
419  case JETIDGNTAUMEDIUM:
420  static const SG::ConstAccessor<char> acc_gnTauMedium("GNTauM_v1trunc");
421  if (!acc_gnTauMedium.isAvailable(xTau)) m_tTST->msg() << MSG::WARNING << "GnTau Medium WP not available" << endmsg;
422  else bPass = acc_gnTauMedium(xTau);
423  break;
424  case JETIDGNTAUTIGHT:
425  static const SG::ConstAccessor<char> acc_gnTauTight("GNTauT_v1trunc");
426  if (!acc_gnTauTight.isAvailable(xTau)) m_tTST->msg() << MSG::WARNING << "GnTau Tight WP not available" << endmsg;
427  else bPass = acc_gnTauTight(xTau);
428  break;
429  default:
430  m_tTST->msg() << MSG::WARNING << "The jet ID working point with the enum " << m_tTST->m_iJetIDWP << " is not available" << endmsg;
431  break;
432  }
433  if (bPass)
434  {
435  acceptData.setCutResult( "JetIDWP", true );
436  return true;
437  }
438  m_tTST->msg() << MSG::VERBOSE << "Tau failed JetIDWP requirement, tau transformed RNN score: " << xTau.discriminant(xAOD::TauJetParameters::RNNJetScoreSigTrans) << endmsg;
439  return false;
440 }
441 
442 //___________________________SelectionCutRNNEleScore____________________________
443 //______________________________________________________________________________
445  : TauSelectionCut("CutEleRNNScore", tTST)
446 {
447  m_hHistCutPre = CreateControlPlot("hEleRNN_pre","EleRNN_pre;RNNEleScore; events",100,0,1);
448  m_hHistCut = CreateControlPlot("hEleRNN_cut","EleRNN_cut;RNNEleScore; events",100,0,1);
449 }
450 
451 //______________________________________________________________________________
453 {
455  if(m_tTST->m_iEleIDVersion!=0){
456  hHist.Fill(acc(xTau));
457  } else {
459  }
460 }
461 
462 //______________________________________________________________________________
464 {
465  info.addCut( "EleRNNScore",
466  "Selection of taus according to their EleRNNScore" );
467 }
468 //______________________________________________________________________________
470  asg::AcceptData& acceptData)
471 {
473  double fEleRNNScore = 0.;
474  if(m_tTST->m_iEleIDVersion!=0){
475  fEleRNNScore = acc(xTau);
476  }else{
478  }
479  unsigned int iNumEleRNNRegion = m_tTST->m_vEleRNNRegion.size()/2;
480  for( unsigned int iEleRNNRegion = 0; iEleRNNRegion < iNumEleRNNRegion; iEleRNNRegion++ )
481  {
482  if ( fEleRNNScore >= m_tTST->m_vEleRNNRegion.at(iEleRNNRegion*2) and fEleRNNScore <= m_tTST->m_vEleRNNRegion.at(iEleRNNRegion*2+1))
483  {
484  acceptData.setCutResult("EleRNNScore", true );
485  return true;
486  }
487  }
488  m_tTST->msg() << MSG::VERBOSE << "Tau failed EleRNNScore requirement, tau EleRNNScore: " << fEleRNNScore << endmsg;
489  return false;
490 }
491 
492 //____________________________SelectionCutEleIDWP______________________________
493 //______________________________________________________________________________
495  : TauSelectionCut("CutEleIDWP", tTST)
496 {
497  m_hHistCutPre = CreateControlPlot("hEleIDWP_pre","EleIDWP_pre;; events",6,-.5,5.5);
498  m_hHistCut = CreateControlPlot("hEleIDWP_cut","EleIDWP_cut;; events",6,-.5,5.5);
499  // only proceed if histograms are defined
500  if (!m_hHistCutPre or !m_hHistCut)
501  return;
502  m_hHistCutPre->GetXaxis()->SetBinLabel(1,"!Loose");
503  m_hHistCutPre->GetXaxis()->SetBinLabel(2,"Loose");
504  m_hHistCutPre->GetXaxis()->SetBinLabel(3,"!Medium");
505  m_hHistCutPre->GetXaxis()->SetBinLabel(4,"Medium");
506  m_hHistCutPre->GetXaxis()->SetBinLabel(5,"!Tight");
507  m_hHistCutPre->GetXaxis()->SetBinLabel(6,"Tight");
508  m_hHistCut->GetXaxis()->SetBinLabel(1,"!Loose");
509  m_hHistCut->GetXaxis()->SetBinLabel(2,"Loose");
510  m_hHistCut->GetXaxis()->SetBinLabel(3,"!Medium");
511  m_hHistCut->GetXaxis()->SetBinLabel(4,"Medium");
512  m_hHistCut->GetXaxis()->SetBinLabel(5,"!Tight");
513  m_hHistCut->GetXaxis()->SetBinLabel(6,"Tight");
514 }
515 
516 //___________________________________________________________________________
518 {
519  if (m_tTST->m_iEleIDVersion!=0){
520  SG::ConstAccessor<char> accLoose ("EleRNNLoose_v"+std::to_string(m_tTST->m_iEleIDVersion));
521  SG::ConstAccessor<char> accMedium ("EleRNNMedium_v"+std::to_string(m_tTST->m_iEleIDVersion));
522  SG::ConstAccessor<char> accTight ("EleRNNTight_v"+std::to_string(m_tTST->m_iEleIDVersion));
523  hHist.Fill((accLoose(xTau) == 1));
524  hHist.Fill((accMedium(xTau) == 1)+2);
525  hHist.Fill((accTight(xTau) == 1)+4);
526  }
527  else{
528  hHist.Fill(xTau.isTau(xAOD::TauJetParameters::EleRNNLoose));
529  hHist.Fill(xTau.isTau(xAOD::TauJetParameters::EleRNNMedium)+2);
530  hHist.Fill(xTau.isTau(xAOD::TauJetParameters::EleRNNTight)+4);
531  }
532 }
533 
534 //______________________________________________________________________________
536 {
537  info.addCut( "EleIDWP",
538  "Selection of taus according to their EleID working point" );
539 }
540 //______________________________________________________________________________
542  asg::AcceptData& acceptData)
543 {
544  // check EleID WP, if tau passes EleID working point then return true; false otherwise
545  bool bPass = false;
546  switch (m_tTST->m_iEleIDWP)
547  {
548  case ELEIDNONE:
549  bPass = true;
550  break;
552  bPass = true;
553  break;
554  case ELEIDRNNLOOSE:
555  if (m_tTST->m_iEleIDVersion!=0){
556  SG::ConstAccessor<char> accLoose ("EleRNNLoose_v"+std::to_string(m_tTST->m_iEleIDVersion));
557  if (accLoose(xTau) == 1)bPass = true;
558  }
559  else if (xTau.isTau(xAOD::TauJetParameters::EleRNNLoose)) bPass = true;
560  break;
561  case ELEIDRNNMEDIUM:
562  if (m_tTST->m_iEleIDVersion!=0){
563  SG::ConstAccessor<char> accMedium ("EleRNNMedium_v"+std::to_string(m_tTST->m_iEleIDVersion));
564  if (accMedium(xTau) == 1)bPass = true;
565  }
566  else if (xTau.isTau(xAOD::TauJetParameters::EleRNNMedium)) bPass = true;
567  break;
568  case ELEIDRNNTIGHT:
569  if (m_tTST->m_iEleIDVersion!=0){
570  SG::ConstAccessor<char> accTight ("EleRNNTight_v"+std::to_string(m_tTST->m_iEleIDVersion));
571  if (accTight(xTau) == 1)bPass = true;
572  }
573  else if (xTau.isTau(xAOD::TauJetParameters::EleRNNTight)) bPass = true;
574  break;
575  default:
576  m_tTST->msg() << MSG::WARNING << "The electron ID working point with the enum " << m_tTST->m_iEleIDWP << " is not available" << endmsg;
577  break;
578  }
579 
580  if (bPass)
581  {
582  acceptData.setCutResult( "EleIDWP", true );
583  return true;
584  }
585  m_tTST->msg() << MSG::VERBOSE << "Tau failed EleID WP requirement" << endmsg;
586  return false;
587 }
588 
589 //added by Li-Gang Xia < ligang.xia@cern.ch >
590 //____________________________SelectionCutMuonOLR______________________________
591 //______________________________________________________________________________
593  : TauSelectionCut("CutMuonOLR", tTST)
594  , m_bTauMuonOLR(true)
595 {
596  m_hHistCutPre = CreateControlPlot("hMuonOLR_pre","MuonOLR_pre;; events",2,-.5,1.5);
597  m_hHistCut = CreateControlPlot("hMuonOLR_cut","MuonOLR_cut;; events",2,-.5,1.5);
598  // only proceed if histograms are defined
599  if (!m_hHistCutPre or !m_hHistCut)
600  return;
601  m_hHistCutPre->GetXaxis()->SetBinLabel(1,"!MuonOLR");
602  m_hHistCutPre->GetXaxis()->SetBinLabel(2,"MuonOLR");
603  m_hHistCut->GetXaxis()->SetBinLabel(1,"!MuonOLR");
604  m_hHistCut->GetXaxis()->SetBinLabel(2,"MuonOLR");
605 }
606 
607 //______________________________________________________________________________
608 void TauSelectionCutMuonOLR::fillHistogram(const xAOD::TauJet& /*xTau*/, TH1F& hHist) const
609 {
610  hHist.Fill(m_bTauMuonOLR);
611 }
612 
613 //______________________________________________________________________________
615 {
616  info.addCut( "MuonOLR",
617  "Selection of taus according to their MuonOLR" );
618 }
619 //______________________________________________________________________________
621  asg::AcceptData& acceptData)
622 {
623  if (!m_tTST->m_bMuonOLR)
624  {
625  acceptData.setCutResult( "MuonOLR", true );
626  return true;
627  }
628 
629  // MuonOLR : removing tau overlapped with muon satisfying pt>2GeV and not calo-tagged
630  m_bTauMuonOLR = true;
631 
633  if (!muonContainerHandle.isValid()) {
634  m_tTST->msg() << MSG::ERROR << "Could not retrieve xAOD::MuonContainer with key " << muonContainerHandle.key() << endmsg;
635  return false;
636  }
637  const xAOD::MuonContainer* muonContainer = muonContainerHandle.cptr();
638 
639  for( auto xMuon : *muonContainer )
640  {
641  if(xMuon->pt() < 2000.) continue; // pt > 2 GeV
642  if(xMuon->muonType() == xAOD::Muon::CaloTagged) continue; // not calo-tagged
643  if(xMuon->p4().DeltaR( xTau.p4() ) > 0.2 ) continue; // delta R < 0.2
644  m_bTauMuonOLR = false; // muon-tau overlapped
645  break;
646  }
647  if(m_bTauMuonOLR)
648  {
649  acceptData.setCutResult( "MuonOLR", true );
650  return true;
651  }
652 
653  m_tTST->msg() << MSG::VERBOSE << "Tau failed MuonOLR requirement" << endmsg;
654  return false;
655 }
grepfile.info
info
Definition: grepfile.py:38
muonContainer
xAOD::MuonContainer * muonContainer
Definition: TrigGlobEffCorrValidation.cxx:188
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TauAnalysisTools::TauSelectionCutAbsCharge::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:200
TauAnalysisTools::TauSelectionTool::m_vPtRegion
std::vector< float > m_vPtRegion
Definition: TauSelectionTool.h:119
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
TauAnalysisTools::TauSelectionCutJetIDWP::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:384
TauAnalysisTools::TauSelectionCut::setProperty
void setProperty(const std::string &name, const std::string &value)
Definition: TauSelectionCuts.cxx:70
xAOD::TauJetParameters::RNNJetScoreSigTrans
@ RNNJetScoreSigTrans
RNN score which is signal transformed/flattened.
Definition: TauDefs.h:92
TauAnalysisTools::TauSelectionCut::CreateControlPlot
TH1F * CreateControlPlot(const char *sName, const char *sTitle, int iBins, double dXLow, double dXUp)
Definition: TauSelectionCuts.cxx:44
xAOD::TauJetParameters::RNNEleScoreSigTrans
@ RNNEleScoreSigTrans
RNN score which is signal transformed/flattened.
Definition: TauDefs.h:96
TauAnalysisTools::TauSelectionCut::m_mProperties
std::map< std::string, std::string & > m_mProperties
Definition: TauSelectionCuts.h:58
TauAnalysisTools::TauSelectionCutAbsEta::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:161
TauAnalysisTools::ELEIDNONEUNCONFIGURED
@ ELEIDNONEUNCONFIGURED
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:31
TauAnalysisTools::TauSelectionCutMuonOLR::TauSelectionCutMuonOLR
TauSelectionCutMuonOLR(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:592
TauAnalysisTools::TauSelectionCutMuonOLR::m_bTauMuonOLR
bool m_bTauMuonOLR
Definition: TauSelectionCuts.h:184
TauAnalysisTools::TauSelectionCut::getProperty
std::string getProperty(const std::string &name)
Definition: TauSelectionCuts.cxx:86
xAOD::TauJet_v3::discriminant
double discriminant(TauJetParameters::TauID discID) const
Get value of discriminant.
Definition: TauJet_v3.cxx:253
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TauAnalysisTools::TauSelectionCutPt::TauSelectionCutPt
TauSelectionCutPt(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:98
xAOD::TauJet_v3::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
TauAnalysisTools::JETIDRNNTIGHT
@ JETIDRNNTIGHT
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:22
TauAnalysisTools::TauSelectionTool
Definition: TauSelectionTool.h:53
TauAnalysisTools::TauSelectionCutRNNEleScore::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:452
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TauAnalysisTools::JETIDRNNMEDIUM
@ JETIDRNNMEDIUM
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:21
TauAnalysisTools::TauSelectionCutRNNJetScoreSigTrans::TauSelectionCutRNNJetScoreSigTrans
TauSelectionCutRNNJetScoreSigTrans(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:262
TauAnalysisTools::TauSelectionCutRNNEleScore::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:463
xAOD::TauJet_v3::nTracks
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Definition: TauJet_v3.cxx:526
TauAnalysisTools::JETIDGNTAULOOSE
@ JETIDGNTAULOOSE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:24
skel.it
it
Definition: skel.GENtoEVGEN.py:396
test_pyathena.pt
pt
Definition: test_pyathena.py:11
TauAnalysisTools::TauSelectionCut::~TauSelectionCut
virtual ~TauSelectionCut()
Definition: TauSelectionCuts.cxx:29
TauAnalysisTools::TauSelectionTool::m_vJetRNNSigTransRegion
std::vector< float > m_vJetRNNSigTransRegion
Definition: TauSelectionTool.h:127
TauAnalysisTools::TauSelectionTool::m_vGNTauSigTransRegion
std::vector< float > m_vGNTauSigTransRegion
Definition: TauSelectionTool.h:129
TauAnalysisTools::JETIDRNNLOOSE
@ JETIDRNNLOOSE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:20
athena.value
value
Definition: athena.py:124
TauAnalysisTools::TauSelectionCut::writeControlHistograms
void writeControlHistograms()
Definition: TauSelectionCuts.cxx:37
TauAnalysisTools::TauSelectionCutJetIDWP::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:378
TauAnalysisTools::TauSelectionCutNTracks::TauSelectionCutNTracks
TauSelectionCutNTracks(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:224
SG::ConstAccessor< float >
TauAnalysisTools::TauSelectionCut::fillHistogramCut
void fillHistogramCut(const xAOD::TauJet &xTau)
Definition: TauSelectionCuts.cxx:63
TauAnalysisTools::TauSelectionCutMuonOLR::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:620
TauAnalysisTools::TauSelectionCutGNTauScoreSigTrans::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:319
TauAnalysisTools::TauSelectionCutJetIDWP::TauSelectionCutJetIDWP
TauSelectionCutJetIDWP(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:340
TauAnalysisTools::JETIDNONE
@ JETIDNONE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:14
TauAnalysisTools::TauSelectionCutAbsEta::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:155
TauAnalysisTools::TauSelectionCutEleIDWP::TauSelectionCutEleIDWP
TauSelectionCutEleIDWP(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:494
TauAnalysisTools::ELEIDRNNLOOSE
@ ELEIDRNNLOOSE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:33
TauAnalysisTools::TauSelectionCutJetIDWP::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:368
xAOD::TauJetParameters::EleRNNTight
@ EleRNNTight
Definition: TauDefs.h:134
TauAnalysisTools::TauSelectionCutRNNJetScoreSigTrans::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:274
xAOD::TauJet_v3::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
TauAnalysisTools::TauSelectionCut::declareProperty
void declareProperty(const std::string &name, std::string &loc)
Definition: TauSelectionCuts.cxx:79
TauAnalysisTools::TauSelectionTool::m_vEleRNNRegion
std::vector< float > m_vEleRNNRegion
Definition: TauSelectionTool.h:134
TauAnalysisTools::TauSelectionCutAbsEta::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:167
TauAnalysisTools::TauSelectionCutRNNJetScoreSigTrans::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:280
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
asg::AcceptInfo
Definition: AcceptInfo.h:28
TauSelectionCuts.h
TauAnalysisTools::JETIDGNTAUVERYLOOSE
@ JETIDGNTAUVERYLOOSE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:23
TauAnalysisTools::TauSelectionTool::m_iEleIDWP
int m_iEleIDWP
Definition: TauSelectionTool.h:137
TauAnalysisTools::ELEIDNONE
@ ELEIDNONE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:32
TauAnalysisTools::TauSelectionCutGNTauScoreSigTrans::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:307
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TauAnalysisTools::TauSelectionCutMuonOLR::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:614
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
TauAnalysisTools::TauSelectionTool::m_vNTracks
std::vector< unsigned > m_vNTracks
Definition: TauSelectionTool.h:125
TauAnalysisTools::TauSelectionCut::m_hHistCutPre
TH1F * m_hHistCutPre
Definition: TauSelectionCuts.h:52
TauAnalysisTools::TauSelectionCutPt::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:118
TauAnalysisTools::TauSelectionCutEleIDWP::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:535
xAOD::TauJetParameters::EleRNNMedium
@ EleRNNMedium
Definition: TauDefs.h:133
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
TauAnalysisTools::TauSelectionCutGNTauScoreSigTrans::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:313
xAOD::TauJetParameters::JetRNNSigVeryLoose
@ JetRNNSigVeryLoose
Definition: TauDefs.h:145
TauAnalysisTools::ELEIDRNNMEDIUM
@ ELEIDRNNMEDIUM
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:34
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TauAnalysisTools::TauSelectionTool::m_vAbsCharges
std::vector< int > m_vAbsCharges
Definition: TauSelectionTool.h:123
xAOD::TauJetParameters::JetRNNSigTight
@ JetRNNSigTight
Definition: TauDefs.h:148
TauAnalysisTools::ELEIDRNNTIGHT
@ ELEIDRNNTIGHT
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
ReadHandle.h
Handle class for reading from StoreGate.
TauAnalysisTools::TauSelectionTool::m_bCreateControlPlots
bool m_bCreateControlPlots
Definition: TauSelectionTool.h:176
TauAnalysisTools::TauSelectionCutAbsCharge::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:194
TauAnalysisTools::TauSelectionTool::m_vAbsEtaRegion
std::vector< float > m_vAbsEtaRegion
Definition: TauSelectionTool.h:121
TauSelectionTool.h
TauAnalysisTools::TauSelectionCut::TauSelectionCut
TauSelectionCut(const std::string &sName, TauAnalysisTools::TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:20
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
MuonContainer.h
TauAnalysisTools::TauSelectionCut
Definition: TauSelectionCuts.h:28
xAOD::TauJetParameters::JetRNNSigMedium
@ JetRNNSigMedium
Definition: TauDefs.h:147
xAOD::TauJet_v3::isTau
bool isTau(TauJetParameters::IsTauFlag flag) const
Get Flag for tau acceptance based on predefined arbitrary criteria.
Definition: TauJet_v3.cxx:273
TauAnalysisTools::TauSelectionTool::m_muonContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonContainerKey
Definition: TauSelectionTool.h:162
TauAnalysisTools::TauSelectionCutAbsCharge::TauSelectionCutAbsCharge
TauSelectionCutAbsCharge(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:186
xAOD::TauJetParameters::EleRNNLoose
@ EleRNNLoose
Definition: TauDefs.h:132
TauAnalysisTools::TauSelectionCutRNNEleScore::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:469
asg::AcceptData::setCutResult
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition: AcceptData.h:134
TauAnalysisTools::TauSelectionCutPt::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:112
xAOD::TauJet_v3::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: TauJet_v3.cxx:97
TauAnalysisTools::TauSelectionCut::fillHistogramCutPre
void fillHistogramCutPre(const xAOD::TauJet &xTau)
Definition: TauSelectionCuts.cxx:57
xAOD::TauJet_v3::charge
float charge() const
AthCommonMsg::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
TauAnalysisTools::TauSelectionCutEleIDWP::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:517
TauAnalysisTools::TauSelectionTool::m_iJetIDWP
int m_iJetIDWP
Definition: TauSelectionTool.h:132
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
TauAnalysisTools::JETIDGNTAUTIGHT
@ JETIDGNTAUTIGHT
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:26
TauAnalysisTools::TauSelectionTool::m_iEleIDVersion
int m_iEleIDVersion
Definition: TauSelectionTool.h:138
TauAnalysisTools::TauSelectionCutNTracks::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:232
TauAnalysisTools::JETIDGNTAUMEDIUM
@ JETIDGNTAUMEDIUM
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:25
TauAnalysisTools::JETIDRNNVERYLOOSE
@ JETIDRNNVERYLOOSE
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:19
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
TauAnalysisTools::TauSelectionCutGNTauScoreSigTrans::TauSelectionCutGNTauScoreSigTrans
TauSelectionCutGNTauScoreSigTrans(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:300
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
TauAnalysisTools::TauSelectionCutMuonOLR::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:608
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
TauAnalysisTools::TauSelectionCut::m_hHistCut
TH1F * m_hHistCut
Definition: TauSelectionCuts.h:53
TauAnalysisTools::JETIDNONEUNCONFIGURED
@ JETIDNONEUNCONFIGURED
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h:13
TauAnalysisTools::TauSelectionCutRNNJetScoreSigTrans::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:269
asg::AcceptData
Definition: AcceptData.h:30
TauAnalysisTools::TauSelectionCutNTracks::setAcceptInfo
virtual void setAcceptInfo(asg::AcceptInfo &info) const override
Definition: TauSelectionCuts.cxx:238
TauAnalysisTools::TauSelectionCutEleIDWP::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:541
TauAnalysisTools::TauSelectionCut::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const =0
xAOD::TauJetParameters::JetRNNSigLoose
@ JetRNNSigLoose
Definition: TauDefs.h:146
TauAnalysisTools::TauSelectionCut::m_tTST
TauSelectionTool * m_tTST
Definition: TauSelectionCuts.h:55
TauAnalysisTools::TauSelectionCutNTracks::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:244
TauAnalysisTools::TauSelectionCutAbsCharge::accept
virtual bool accept(const xAOD::TauJet &xTau, asg::AcceptData &accept) override
Definition: TauSelectionCuts.cxx:206
TauAnalysisTools::TauSelectionCutAbsEta::TauSelectionCutAbsEta
TauSelectionCutAbsEta(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:147
TauAnalysisTools::TauSelectionTool::m_bMuonOLR
bool m_bMuonOLR
Definition: TauSelectionTool.h:140
TauAnalysisTools::TauSelectionCutPt::fillHistogram
virtual void fillHistogram(const xAOD::TauJet &xTau, TH1F &hHist) const override
Definition: TauSelectionCuts.cxx:106
TauAnalysisTools::TauSelectionCutRNNEleScore::TauSelectionCutRNNEleScore
TauSelectionCutRNNEleScore(TauSelectionTool *tTST)
Definition: TauSelectionCuts.cxx:444