ATLAS Offline Software
Loading...
Searching...
No Matches
TauSelectionTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Local include(s):
8
9// Framework include(s):
11
12// ROOT include(s)
13#include "TEnv.h"
14#include "THashList.h"
15
16using namespace TauAnalysisTools;
17
18//=================================PUBLIC-PART==================================
19//______________________________________________________________________________
20TauSelectionTool::TauSelectionTool( const std::string& name )
21 : asg::AsgMetadataTool( name )
22 , m_sJetIDWP("JETIDNONE")
23 , m_sEleIDWP("ELEIDNONE")
24 , m_fOutFile(nullptr)
25 , m_aAccept( "TauSelection" )
26{}
27
28//______________________________________________________________________________
33
34//______________________________________________________________________________
36{
37
38 m_vPtRegion = m_vecPtRegion.value();
41 m_vNTracks = m_vecNTracks.value();
45
46 bool bConfigViaConfigFile = !m_sConfigPath.empty();
47 bool bConfigViaProperties = false;
48 if (!bConfigViaProperties and !m_vPtRegion.empty()) bConfigViaProperties = true;
49 if (!bConfigViaProperties and !std::isnan(m_dPtMin.value())) bConfigViaProperties = true;
50 if (!bConfigViaProperties and !std::isnan(m_dPtMax.value())) bConfigViaProperties = true;
51 if (!bConfigViaProperties and !m_vAbsEtaRegion.empty()) bConfigViaProperties = true;
52 if (!bConfigViaProperties and !std::isnan(m_dAbsEtaMin.value())) bConfigViaProperties = true;
53 if (!bConfigViaProperties and !std::isnan(m_dAbsEtaMax.value())) bConfigViaProperties = true;
54 if (!bConfigViaProperties and !m_vAbsCharges.empty()) bConfigViaProperties = true;
55 if (!bConfigViaProperties and !std::isnan(m_iAbsCharge.value())) bConfigViaProperties = true;
56 if (!bConfigViaProperties and !m_vNTracks.empty()) bConfigViaProperties = true;
57 if (!bConfigViaProperties and !std::isnan(m_iNTrack.value())) bConfigViaProperties = true;
58 if (!bConfigViaProperties and !m_vJetRNNSigTransRegion.empty()) bConfigViaProperties = true;
59 if (!bConfigViaProperties and !std::isnan(m_dJetRNNSigTransMin.value())) bConfigViaProperties = true;
60 if (!bConfigViaProperties and !std::isnan(m_dJetRNNSigTransMax.value())) bConfigViaProperties = true;
61 if (!bConfigViaProperties and !m_vGNTauSigTransRegion.empty()) bConfigViaProperties = true;
62 if (!bConfigViaProperties and !std::isnan(m_dGNTauSigTransMin.value())) bConfigViaProperties = true;
63 if (!bConfigViaProperties and !std::isnan(m_dGNTauSigTransMax.value())) bConfigViaProperties = true;
64 if (!bConfigViaProperties and m_iJetIDWP != TauAnalysisTools::JetID::JETIDNONE) bConfigViaProperties = true;
65 if (!bConfigViaProperties and !m_vEleRNNSigTransRegion.empty()) bConfigViaProperties = true;
66 if (!bConfigViaProperties and !std::isnan(m_dEleRNNSigTransMin.value())) bConfigViaProperties = true;
67 if (!bConfigViaProperties and !std::isnan(m_dEleRNNSigTransMax.value())) bConfigViaProperties = true;
68 if (!bConfigViaProperties and m_iEleIDWP != 0) bConfigViaProperties = true;
69 if (!bConfigViaProperties and m_bMuonOLR) bConfigViaProperties = true;
70
71 if (bConfigViaConfigFile and bConfigViaProperties)
72 {
73 ATH_MSG_ERROR("Configured tool via setProperty and configuration file, which may lead to unexpected configuration. Please setup the TauSelectionTool using only one of the two methods. For further details please refer to the documentation https://gitlab.cern.ch/atlas/athena/blob/main/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSelectionTool.rst or contact the TauCP group.");
74 return StatusCode::FAILURE;
75 }
76 if (!bConfigViaConfigFile and !bConfigViaProperties)
77 {
78 ATH_MSG_WARNING("No cut configuration provided, the tool will not do anything. For further details please refer to the documentation:");
79 ATH_MSG_WARNING("https://gitlab.cern.ch/atlas/athena/blob/main/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauSelectionTool.rst");
80 return StatusCode::SUCCESS;
81 }
82
83 if (bConfigViaConfigFile)
84 {
85 TEnv rEnv;
86 std::string sInputFilePath = PathResolverFindCalibFile(m_sConfigPath);
87
88 if (!testFileForEOFContainsCharacters(sInputFilePath))
89 ATH_MSG_WARNING("Config file for TauSelectionTool with path "<<sInputFilePath<<" does not contain an empty last line. The tool might not be properly configured!");
90
91 rEnv.ReadFile(sInputFilePath.c_str(),
92 kEnvAll);
93
94 std::vector<std::string> vCuts;
95 // if Cuts are specified in the config file take these ones, if not take all
96 // specified in the config
97 if (rEnv.Defined("SelectionCuts"))
98 TauAnalysisTools::split(rEnv, "SelectionCuts", ' ', vCuts);
99 else
100 {
101 auto lList = rEnv.GetTable();
102 for( Int_t i = 0; i < lList->GetEntries(); ++i )
103 {
104 vCuts.push_back( lList->At( i )->GetName() );
105 }
106 }
107
108 int iSelectionCuts = 0;
109
110 for (const std::string& sCut : vCuts)
111 {
112 if (sCut == "PtRegion")
113 {
114 iSelectionCuts = iSelectionCuts | CutPt;
115 if (m_vPtRegion.empty())
116 TauAnalysisTools::split(rEnv,"PtRegion", ';', m_vPtRegion);
117 }
118 else if (sCut == "PtMin")
119 {
120 iSelectionCuts = iSelectionCuts | CutPt;
121 if (std::isnan(m_dPtMin.value()))
122 m_dPtMin = rEnv.GetValue("PtMin",NAN);
123 }
124 else if (sCut == "PtMax")
125 {
126 iSelectionCuts = iSelectionCuts | CutPt;
127 if (std::isnan(m_dPtMax.value()))
128 m_dPtMax = rEnv.GetValue("PtMax",NAN);
129 }
130 else if (sCut == "AbsEtaRegion")
131 {
132 iSelectionCuts = iSelectionCuts | CutAbsEta;
133 if (m_vAbsEtaRegion.empty())
134 TauAnalysisTools::split(rEnv,"AbsEtaRegion", ';', m_vAbsEtaRegion);
135 }
136 else if (sCut == "AbsEtaMin")
137 {
138 iSelectionCuts = iSelectionCuts | CutAbsEta;
139 if (std::isnan(m_dAbsEtaMin.value()))
140 m_dAbsEtaMin = rEnv.GetValue("AbsEtaMin",NAN);
141 }
142 else if (sCut == "AbsEtaMax")
143 {
144 iSelectionCuts = iSelectionCuts | CutAbsEta;
145 if (std::isnan(m_dAbsEtaMax.value()))
146 m_dAbsEtaMax = rEnv.GetValue("AbsEtaMax",NAN);
147 }
148 else if (sCut == "AbsCharges")
149 {
150 iSelectionCuts = iSelectionCuts | CutAbsCharge;
151 if (m_vAbsCharges.empty())
152 TauAnalysisTools::split(rEnv,"AbsCharges", ';', m_vAbsCharges);
153 }
154 else if (sCut == "AbsCharge")
155 {
156 iSelectionCuts = iSelectionCuts | CutAbsCharge;
157 if (std::isnan(m_iAbsCharge.value()))
158 m_iAbsCharge = rEnv.GetValue("AbsCharge",NAN);
159 }
160 else if (sCut == "NTracks")
161 {
162 iSelectionCuts = iSelectionCuts | CutNTrack;
163 if (m_vNTracks.empty())
164 TauAnalysisTools::split(rEnv,"NTracks", ';', m_vNTracks);
165 }
166 else if (sCut == "NTrack")
167 {
168 iSelectionCuts = iSelectionCuts | CutNTrack;
169 if (std::isnan(m_iNTrack.value()))
170 m_iNTrack = rEnv.GetValue("NTrack",NAN);
171 }
172 else if (sCut == "JetRNNSigTransRegion")
173 {
174 iSelectionCuts = iSelectionCuts | CutJetRNNScoreSigTrans;
175 if (m_vJetRNNSigTransRegion.empty())
176 TauAnalysisTools::split(rEnv,"JetRNNSigTransRegion", ';', m_vJetRNNSigTransRegion);
177 }
178 else if (sCut == "JetRNNSigTransMin")
179 {
180 iSelectionCuts = iSelectionCuts | CutJetRNNScoreSigTrans;
181 if (std::isnan(m_dJetRNNSigTransMin.value()))
182 m_dJetRNNSigTransMin = rEnv.GetValue("JetRNNSigTransMin",NAN);
183 }
184 else if (sCut == "JetRNNSigTransMax")
185 {
186 iSelectionCuts = iSelectionCuts | CutJetRNNScoreSigTrans;
187 if (std::isnan(m_dJetRNNSigTransMax.value()))
188 m_dJetRNNSigTransMax = rEnv.GetValue("JetRNNSigTransMax",NAN);
189 }
190 else if (sCut == "GNTauSigTransRegion")
191 {
192 iSelectionCuts = iSelectionCuts | CutGNTauScoreSigTrans;
193 if (m_vGNTauSigTransRegion.empty())
194 TauAnalysisTools::split(rEnv,"GNTauSigTransRegion", ';', m_vGNTauSigTransRegion);
195
196 // check if using GNTau
197 m_useGNTau = true;
198 }
199 else if (sCut == "GNTauSigTransMin")
200 {
201 iSelectionCuts = iSelectionCuts | CutGNTauScoreSigTrans;
202 if (std::isnan(m_dGNTauSigTransMin.value()))
203 m_dGNTauSigTransMin = rEnv.GetValue("GNTauSigTransMin",NAN);
204
205 // check if using GNTau
206 m_useGNTau = true;
207 }
208 else if (sCut == "GNTauSigTransMax")
209 {
210 iSelectionCuts = iSelectionCuts | CutGNTauScoreSigTrans;
211 if (std::isnan(m_dGNTauSigTransMax.value()))
212 m_dGNTauSigTransMax = rEnv.GetValue("GNTauSigTransMax",NAN);
213
214 // check if using GNTau
215 m_useGNTau = true;
216 }
217 else if (sCut == "EleRNNSigTransRegion")
218 {
219 iSelectionCuts = iSelectionCuts | CutEleRNNScoreSigTrans;
220 if (m_vEleRNNSigTransRegion.empty())
221 TauAnalysisTools::split(rEnv,"EleRNNRegion", ';', m_vEleRNNSigTransRegion);
222 }
223 else if (sCut == "EleRNNSigTransMin")
224 {
225 iSelectionCuts = iSelectionCuts | CutEleRNNScoreSigTrans;
226 if (std::isnan(m_dEleRNNSigTransMin.value()))
227 m_dEleRNNSigTransMin = rEnv.GetValue("EleRNNSigTransMin",NAN);
228 }
229 else if (sCut == "EleRNNSigTransMax")
230 {
231 iSelectionCuts = iSelectionCuts | CutEleRNNScoreSigTrans;
232 if (std::isnan(m_dEleRNNSigTransMax.value()))
233 m_dEleRNNSigTransMax = rEnv.GetValue("EleRNNSigTransMax",NAN);
234 }
235 else if (sCut == "JetIDWP")
236 {
237 iSelectionCuts = iSelectionCuts | CutJetIDWP;
238 if (m_iJetIDWP == JETIDNONE){
239 m_iJetIDWP = convertStrToJetIDWP(rEnv.GetValue("JetIDWP","JETIDNONE"));
240 }
241 // check for possible mis-config in Tau selection
242 for (const std::string& checkCut : vCuts){
243 if (checkCut.find("SigTrans") != std::string::npos) {
244 ATH_MSG_ERROR("Misconfig due to JetIDWP and SigTrans cuts both present in the config file. Please CHECK carefully config file again");
245 return StatusCode::FAILURE;
246 }
247 }
248 }
249 else if (sCut == "EleIDWP")
250 {
251 iSelectionCuts = iSelectionCuts | CutEleIDWP;
253 m_iEleIDWP = convertStrToEleIDWP(rEnv.GetValue("EleIDWP","ELEIDNONE"));
254 }
255 else if (sCut == "MuonOLR")
256 {
257 iSelectionCuts = iSelectionCuts | CutMuonOLR;
258 if (!m_bMuonOLR)
259 m_bMuonOLR = rEnv.GetValue("MuonOLR",false);
260 }
261 else ATH_MSG_WARNING("Cut " << sCut << " is not available");
262 }
263
264 if (m_iSelectionCuts == NoCut)
265 m_iSelectionCuts = iSelectionCuts;
266 }
267
270
271 // check if using GNTau
272 if(m_sJetIDWP.find("GNTAU") != std::string::npos)
273 m_useGNTau = true;
274
275 // initialise the ReadHandleKey of the muon container when the muon veto is applied
277
278 ATH_CHECK( m_tauContainerKey.initialize() );
279
280 // initialise the ReadDecorHandleKey if GNTau is applied
281 if (m_useGNTau) {
282 ATH_CHECK( m_GNTauDecorKey.assign(m_tauContainerKey.key()+".GNTauScoreSigTrans_v0prune"));
283 }
284 ATH_CHECK( m_GNTauDecorKey.initialize( m_useGNTau ) );
285
286 // initialise the ReadDecorHandleKey if eVeto is applied
288 ATH_CHECK( m_eVetoDecorKey.assign(m_tauContainerKey.key()+".RNNEleScoreSigTrans_v"+std::to_string(m_iEleIDVersion)) );
289 }
291
292 // specify all available cut descriptions
293 using map_type = std::map<SelectionCuts, std::unique_ptr<TauAnalysisTools::TauSelectionCut>>;
294 using pair_type = map_type::value_type;
295
296 pair_type elements[] =
297 {
298 {CutPt, std::make_unique<TauAnalysisTools::TauSelectionCutPt>(this)},
299 {CutAbsEta, std::make_unique<TauAnalysisTools::TauSelectionCutAbsEta>(this)},
300 {CutAbsCharge, std::make_unique<TauAnalysisTools::TauSelectionCutAbsCharge>(this)},
301 {CutNTrack, std::make_unique<TauAnalysisTools::TauSelectionCutNTracks>(this)},
302 {CutJetRNNScoreSigTrans, std::make_unique<TauAnalysisTools::TauSelectionCutRNNJetScoreSigTrans>(this)},
303 {CutGNTauScoreSigTrans, std::make_unique<TauAnalysisTools::TauSelectionCutGNTauScoreSigTrans>(this)},
304 {CutJetIDWP, std::make_unique<TauAnalysisTools::TauSelectionCutJetIDWP>(this)},
305 {CutEleRNNScoreSigTrans, std::make_unique<TauAnalysisTools::TauSelectionCutRNNEleScoreSigTrans>(this)},
306 {CutEleIDWP, std::make_unique<TauAnalysisTools::TauSelectionCutEleIDWP>(this)},
307 {CutMuonOLR, std::make_unique<TauAnalysisTools::TauSelectionCutMuonOLR>(this)}
308 };
309
310 m_cMap = { std::make_move_iterator( begin(elements) ), std::make_move_iterator( end(elements) ) };
311
312 ATH_MSG_INFO( "Initializing TauSelectionTool" );
320
323 PrintConfigValue ("AbsCharge", m_vAbsCharges);
324 PrintConfigValue ("NTrack", m_vNTracks);
325 PrintConfigRegion ("RNNJetScoreSigTrans", m_vJetRNNSigTransRegion);
326 PrintConfigRegion ("GNTauScoreSigTrans", m_vGNTauSigTransRegion);
327 PrintConfigRegion ("RNNEleScoreSigTrans", m_vEleRNNSigTransRegion);
328 PrintConfigValue ("JetIDWP", m_sJetIDWP);
329 PrintConfigValue ("JetIDWP ENUM",m_iJetIDWP);
330 PrintConfigValue ("EleIDWP", m_sEleIDWP);
331 PrintConfigValue ("EleIDWP ENUM",m_iEleIDWP);
332 PrintConfigValue ("EleIDVersion",m_iEleIDVersion);
333 PrintConfigValue ("MuonOLR", m_bMuonOLR);
334
335 std::string sCuts = "";
336 if (m_iSelectionCuts & CutPt) sCuts += "Pt ";
337 if (m_iSelectionCuts & CutAbsEta) sCuts += "AbsEta ";
338 if (m_iSelectionCuts & CutAbsCharge) sCuts += "AbsCharge ";
339 if (m_iSelectionCuts & CutNTrack) sCuts += "NTrack ";
340 if (m_iSelectionCuts & CutJetRNNScoreSigTrans) sCuts += "JetRNNScoreSigTrans ";
341 if (m_iSelectionCuts & CutGNTauScoreSigTrans) sCuts += "GNTauScoreSigTrans ";
342 if (m_iSelectionCuts & CutJetIDWP) sCuts += "JetIDWP ";
343 if (m_iSelectionCuts & CutEleRNNScoreSigTrans) sCuts += "EleRNNScoreSigTrans ";
344 if (m_iSelectionCuts & CutEleIDWP) sCuts += "EleIDWP ";
345 if (m_iSelectionCuts & CutMuonOLR) sCuts += "MuonOLR ";
346
347 ATH_MSG_DEBUG( "cuts: " << sCuts);
348
351
352 for ( const auto& entry : m_cMap ) {
353 if ( m_iSelectionCuts &entry.first ) {
354 entry.second->setAcceptInfo(m_aAccept);
355 }
356 }
357
358 return StatusCode::SUCCESS;
359}
360
361
362//______________________________________________________________________________
364{
365 return StatusCode::SUCCESS;
366}
367
368//______________________________________________________________________________
370{
371 return m_aAccept;
372}
373
374//______________________________________________________________________________
376{
377 // Check if this is a tau:
378 if( xP->type() != xAOD::Type::Tau )
379 {
380 ATH_MSG_ERROR( "accept(...) Function received a non-tau" );
381 return asg::AcceptData (&m_aAccept);
382 }
383
384 // Cast it to a tau:
385 const xAOD::TauJet* xTau = dynamic_cast< const xAOD::TauJet* >( xP );
386 if( ! xTau )
387 {
388 ATH_MSG_FATAL( "accept(...) Failed to cast particle to tau" );
389 return asg::AcceptData (&m_aAccept);
390 }
391
392 // Let the specific function do the work:
393 return accept( *xTau );
394}
395
396//______________________________________________________________________________
398{
399 asg::AcceptData acceptData (&m_aAccept);
400
401 int iNBin = 0;
402
404 {
405 // fill cutflow 'All' bin
406 m_hCutFlow->Fill(iNBin);
407 // fill main distributions before all cuts
408 for (const auto& entry : m_cMap)
409 entry.second->fillHistogramCutPre(xTau);
410 }
411 try
412 {
413 for (const auto& entry : m_cMap)
414 {
415 if (m_iSelectionCuts & entry.first)
416 {
417 if (!entry.second->accept(xTau, acceptData))
418 return acceptData;
419 else
420 {
422 {
423 // fill cutflow after each passed cut
424 iNBin++;
425 m_hCutFlow->Fill(iNBin);
426 }
427 }
428 }
429 }
430 }
431 catch (const std::runtime_error& error)
432 {
433 // LEGACY: In practical terms this should probably just throw, not
434 // print a warning/error and then continue on. However, I leave
435 // that to the experts who probably had a reason not to let the
436 // exception escape. For now I just downgraded it from error to
437 // warning and limited the number of warnings (04 Jan 22).
438 static std::atomic<uint64_t> warning_count (0u);
439 auto mycount = ++ warning_count;
440 if (mycount < 10u)
441 {
442 ATH_MSG_WARNING(error.what());
443 if (mycount == 9u)
444 ATH_MSG_WARNING ("this is your last warning");
445 }
446 }
447
448 // fill main distributions after all cuts
450 {
451 for (const auto& entry : m_cMap)
452 entry.second->fillHistogramCut(xTau);
453 }
454
455 // // Return the result:
456 return acceptData;
457}
458
459//______________________________________________________________________________
460void TauSelectionTool::setOutFile( TFile* fOutFile )
461{
462 m_fOutFile = fOutFile;
463}
464
465//______________________________________________________________________________
467{
469 ATH_MSG_WARNING("CreateControlPlots was set to true, but no valid file pointer was provided");
471 {
473 m_fOutFile->mkdir((this->name()+"_control").c_str());
474 m_fOutFile->cd((this->name()+"_control").c_str());
476 m_hCutFlow->Write();
477
478 for (const auto& entry : m_cMap)
479 entry.second->writeControlHistograms();
480 }
481}
482
483
484//=================================PRIVATE-PART=================================
486{
487 // count number of cuts
488 int iNBins = 0;
489 for (const auto& entry : m_cMap)
490 if (m_iSelectionCuts & entry.first)
491 iNBins++;
492 // create cutflow histogram with iNBins+1 bins, where first bin is 'All' bin
493 m_hCutFlow = std::make_shared<TH1F>("hCutFlow","CutFlow;; events",iNBins+1,0,iNBins+1);
494 m_hCutFlow->GetXaxis()->SetBinLabel(1,"All");
495
496 // reusing this variable to reduce overhead
497 iNBins = 2;
498 // set bin labels
499 for (const auto& entry : m_cMap)
500 if (m_iSelectionCuts & entry.first)
501 {
502 m_hCutFlow->GetXaxis()->SetBinLabel(iNBins, entry.second->getName().c_str());
503 iNBins++;
504 }
505}
506
507//______________________________________________________________________________
508template<typename T, typename U>
509void TauSelectionTool::FillRegionVector(std::vector<T>& vRegion, U tMin, U tMax) const
510{
511 if (!vRegion.empty())
512 return;
513 if (tMin == tMin) // if tMin is NAN, then this assumption fails and -inf is added to the vector
514 vRegion.push_back(tMin);
515 else
516 vRegion.push_back(-std::numeric_limits<T>::infinity());
517
518 if (tMax == tMax) // if tMax is NAN, then this assumption fails and inf is added to the vector
519 vRegion.push_back(tMax);
520 else
521 vRegion.push_back(std::numeric_limits<T>::infinity());
522}
523
524//______________________________________________________________________________
525template<typename T, typename U>
526void TauSelectionTool::FillValueVector(std::vector<T>& vRegion, U tVal) const
527{
528 if (!vRegion.empty())
529 return;
530 if (tVal == tVal) // if tMax is NAN, then this assumption fails and nothing is added to the vector
531 vRegion.push_back(tVal);
532}
533
534//______________________________________________________________________________
535template<typename T>
536void TauSelectionTool::PrintConfigRegion(const std::string& sCutName, std::vector<T>& vRegion) const
537{
538 unsigned int iNumRegion = vRegion.size()/2;
539 for( unsigned int iRegion = 0; iRegion < iNumRegion; iRegion++ )
540 {
541 ATH_MSG_DEBUG( sCutName<<": " << vRegion.at(iRegion*2) << " to " << vRegion.at(iRegion*2+1) );
542 }
543}
544
545//______________________________________________________________________________
546template<typename T>
547void TauSelectionTool::PrintConfigValue(const std::string& sCutName, std::vector<T>& vRegion) const
548{
549 for (auto tVal : vRegion)
550 ATH_MSG_DEBUG( sCutName<<": " << tVal );
551}
552
553//______________________________________________________________________________
554template<typename T>
555void TauSelectionTool::PrintConfigValue(const std::string& sCutName, T& tVal) const
556{
557 ATH_MSG_DEBUG( sCutName<<": " << tVal );
558}
559
560//______________________________________________________________________________
561int TauSelectionTool::convertStrToJetIDWP(const std::string& sJetIDWP) const
562{
563 if (sJetIDWP == "JETIDNONE") return int(JETIDNONE);
564 else if (sJetIDWP == "JETIDRNNVERYLOOSE") return int(JETIDRNNVERYLOOSE);
565 else if (sJetIDWP == "JETIDRNNLOOSE") return int(JETIDRNNLOOSE);
566 else if (sJetIDWP == "JETIDRNNMEDIUM") return int(JETIDRNNMEDIUM);
567 else if (sJetIDWP == "JETIDRNNTIGHT") return int(JETIDRNNTIGHT);
568 else if (sJetIDWP == "JETIDGNTAUVERYLOOSE") return int(JETIDGNTAUVERYLOOSE);
569 else if (sJetIDWP == "JETIDGNTAULOOSE") return int(JETIDGNTAULOOSE);
570 else if (sJetIDWP == "JETIDGNTAUMEDIUM") return int(JETIDGNTAUMEDIUM);
571 else if (sJetIDWP == "JETIDGNTAUTIGHT") return int(JETIDGNTAUTIGHT);
572
573 ATH_MSG_ERROR( "jet ID working point "<<sJetIDWP<<" is unknown, the JetIDWP cut will not accept any tau!" );
574 return -1;
575}
576
577//______________________________________________________________________________
578int TauSelectionTool::convertStrToEleIDWP(const std::string& sEleIDWP) const
579{
580 if (sEleIDWP == "ELEIDNONE") return int(ELEIDNONE);
581 else if (sEleIDWP == "ELEIDRNNLOOSE") return int(ELEIDRNNLOOSE);
582 else if (sEleIDWP == "ELEIDRNNMEDIUM") return int(ELEIDRNNMEDIUM);
583 else if (sEleIDWP == "ELEIDRNNTIGHT") return int(ELEIDRNNTIGHT);
584
585 ATH_MSG_ERROR( "electron ID working point " << sEleIDWP << " is unknown, the EleIDWP cut will not accept any tau!" );
586 return -1;
587}
588
589//______________________________________________________________________________
590std::string TauSelectionTool::convertJetIDWPToStr(int iJetIDWP) const
591{
592 switch (iJetIDWP)
593 {
594 case JETIDNONE:
595 return "JETIDNONE";
597 return "JETIDRNNVERYLOOSE";
598 case JETIDRNNLOOSE:
599 return "JETIDRNNLOOSE";
600 case JETIDRNNMEDIUM:
601 return "JETIDRNNMEDIUM";
602 case JETIDRNNTIGHT:
603 return "JETIDRNNTIGHT";
605 return "JETIDGNTAUVERYLOOSE";
606 case JETIDGNTAULOOSE:
607 return "JETIDGNTAULOOSE";
608 case JETIDGNTAUMEDIUM:
609 return "JETIDGNTAUMEDIUM";
610 case JETIDGNTAUTIGHT:
611 return "JETIDGNTAUTIGHT";
612
613 default:
614 ATH_MSG_WARNING( "JetID working point with enum " << iJetIDWP << " is unknown, the JetIDWP cut will not accept any tau!" );
615 return "";
616 }
617}
618
619//______________________________________________________________________________
620std::string TauSelectionTool::convertEleIDWPToStr(int iEleIDWP) const
621{
622 switch (iEleIDWP)
623 {
625 return "ELEIDNONE";
626 case ELEIDNONE:
627 return "ELEIDNONE";
628 case ELEIDRNNLOOSE:
629 return "ELEIDRNNLOOSE";
630 case ELEIDRNNMEDIUM:
631 return "ELEIDRNNMEDIUM";
632 case ELEIDRNNTIGHT:
633 return "ELEIDRNNTIGHT";
634 default:
635 ATH_MSG_WARNING( "EleID working point with enum " << iEleIDWP << " is unknown, the EleIDWP cut will not accept any tau!" );
636 return "";
637 }
638}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< float > m_dJetRNNSigTransMax
Gaudi::Property< float > m_dPtMax
void FillValueVector(std::vector< T > &vRegion, U tVal) const
virtual StatusCode beginEvent() override
Function called when a new events is loaded.
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_GNTauDecorKey
Gaudi::Property< float > m_dAbsEtaMax
std::vector< float > m_vJetRNNSigTransRegion
void FillRegionVector(std::vector< T > &vRegion, U tMin, U tMax) const
Gaudi::Property< float > m_dGNTauSigTransMax
Gaudi::Property< std::string > m_sConfigPath
Gaudi::Property< std::vector< float > > m_vecAbsEtaRegion
Gaudi::Property< float > m_iNTrack
Gaudi::Property< int > m_iEleIDVersion
void PrintConfigRegion(const std::string &sCutName, std::vector< T > &vRegion) const
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_eVetoDecorKey
Gaudi::Property< float > m_dEleRNNSigTransMin
int convertStrToJetIDWP(const std::string &sJetIDWP) const
Gaudi::Property< std::vector< float > > m_vecJetRNNSigTransRegion
Gaudi::Property< std::vector< float > > m_vecGNTauSigTransRegion
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauContainerKey
virtual void setOutFile(TFile *fOutFile) override
Set output file for control histograms.
Gaudi::Property< std::vector< unsigned > > m_vecNTracks
asg::AcceptInfo m_aAccept
Object used to store selection information.
std::string convertEleIDWPToStr(int iEleIDWP) const
Gaudi::Property< float > m_dEleRNNSigTransMax
Gaudi::Property< float > m_dAbsEtaMin
SG::ReadHandleKey< xAOD::MuonContainer > m_muonContainerKey
Gaudi::Property< float > m_dPtMin
std::vector< float > m_vEleRNNSigTransRegion
std::map< SelectionCuts, std::unique_ptr< TauAnalysisTools::TauSelectionCut > > m_cMap
virtual StatusCode initialize() override
Function initialising the tool.
TauSelectionTool(const std::string &name)
Constructor for standalone usage.
int convertStrToEleIDWP(const std::string &sEleIDWP) const
Gaudi::Property< std::vector< float > > m_vecEleRNNSigTransRegion
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get an object describing the "selection steps" of the tool.
virtual void writeControlHistograms() override
Write control histograms to output file.
Gaudi::Property< bool > m_bCreateControlPlots
virtual asg::AcceptData accept(const xAOD::IParticle *p) const override
Get the decision using a generic IParticle pointer.
Gaudi::Property< int > m_iSelectionCuts
std::vector< float > m_vGNTauSigTransRegion
Gaudi::Property< float > m_dGNTauSigTransMin
Gaudi::Property< std::vector< int > > m_vecAbsCharges
void PrintConfigValue(const std::string &sCutName, std::vector< T > &vRegion) const
Gaudi::Property< float > m_dJetRNNSigTransMin
Gaudi::Property< std::vector< float > > m_vecPtRegion
Gaudi::Property< float > m_iAbsCharge
std::string convertJetIDWPToStr(int iJetIDWP) const
AsgMetadataTool(const std::string &name)
Normal ASG tool constructor with a name.
Class providing the definition of the 4-vector interface.
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
void split(const std::string &sInput, const char cDelim, std::vector< std::string > &vOut)
bool testFileForEOFContainsCharacters(const std::string &sFileName)
returns true if last line in file is empty or the line starts with the number sign
@ Tau
The object is a tau (jet)
Definition ObjectType.h:49
TauJet_v3 TauJet
Definition of the current "tau version".