ATLAS Offline Software
TauSelectionTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TAUANALYSISTOOLS_TAUSELECTIONTOOL_H
6 #define TAUANALYSISTOOLS_TAUSELECTIONTOOL_H
7 
8 /*
9  author: Dirk Duschinger
10  mail: dirk.duschinger@cern.ch
11 */
12 
13 // Framework include(s):
15 #include "AsgTools/AnaToolHandle.h"
19 
20 // Local include(s):
22 #include "TauAnalysisTools/Enums.h"
24 
25 // EDM include(s):
26 #include "xAODMuon/MuonContainer.h"
28 
29 // ROOT include(s):
30 #include "TH1F.h"
31 #include "TFile.h"
32 
33 namespace TauAnalysisTools
34 {
35 
37 class TauSelectionCut;
38 class TauSelectionCutPt;
39 class TauSelectionCutAbsEta;
40 class TauSelectionCutAbsCharge;
41 class TauSelectionCutNTracks;
42 class TauSelectionCutJetIDWP;
43 class TauSelectionCutRNNJetScoreSigTrans;
44 class TauSelectionCutGNTauScoreSigTrans;
45 class TauSelectionCutRNNEleScore;
46 class TauSelectionCutEleIDWP;
47 class TauSelectionCutMuonOLR;
48 
49 
50 class TauSelectionTool : public virtual IAsgSelectionTool,
51  public virtual ITauSelectionTool,
53 {
56  friend class TauSelectionCut;
57  friend class TauSelectionCutPt;
58  friend class TauSelectionCutAbsEta;
60  friend class TauSelectionCutNTracks;
61  friend class TauSelectionCutJetIDWP;
65  friend class TauSelectionCutEleIDWP;
66  friend class TauSelectionCutMuonOLR;
67 
72 
73  // declaration of classes as friends to access private member variables
74  friend class TauEfficiencyCorrectionsTool;
75 
76 public:
78  TauSelectionTool( const std::string& name );
79 
80  virtual ~TauSelectionTool();
81 
83  virtual StatusCode initialize() override;
84 
86  virtual const asg::AcceptInfo& getAcceptInfo() const override;
87 
89  virtual asg::AcceptData accept( const xAOD::IParticle* p ) const override;
90 
92  virtual asg::AcceptData accept( const xAOD::TauJet& tau ) const override;
93 
95  virtual void setOutFile( TFile* fOutFile ) override;
96 
98  virtual void writeControlHistograms() override;
99 
100 private:
101 
102  // Execute at each event
103  virtual StatusCode beginEvent() override;
104 
105  template<typename T, typename U>
106  void FillRegionVector(std::vector<T>& vRegion, U tMin, U tMax) const;
107  template<typename T, typename U>
108  void FillValueVector(std::vector<T>& vRegion, U tVal) const;
109  template<typename T>
110  void PrintConfigRegion(const std::string& sCutName, std::vector<T>& vRegion) const;
111  template<typename T>
112  void PrintConfigValue(const std::string& sCutName, std::vector<T>& vRegion) const;
113  template<typename T>
114  void PrintConfigValue(const std::string& sCutName, T& sVal) const;
115 
116  // bitmask of tau selection cuts
118  // vector of transverse momentum cut regions
119  std::vector<float> m_vPtRegion;
120  // vector of absolute eta cut regions
121  std::vector<float> m_vAbsEtaRegion;
122  // vector of absolute charge requirements
123  std::vector<int> m_vAbsCharges;
124  // vector of number of track requirements
125  std::vector<unsigned> m_vNTracks;
126  // vector of JetRNNSigTrans cut regions
127  std::vector<float> m_vJetRNNSigTransRegion;
128  // vector of GNTauSigTrans cut regions
129  std::vector<float> m_vGNTauSigTransRegion;
130  // JetID working point
131  std::string m_sJetIDWP;
133  // vector of EleRNN cut regions
134  std::vector<float> m_vEleRNNRegion;
135  // EleID working point
136  std::string m_sEleIDWP;
139  // do muon OLR
141 
142  float m_dPtMin;
143  float m_dPtMax;
147  float m_iNTrack;
154 
155 protected:
156  TFile* m_fOutFile;
157  std::shared_ptr<TH1F> m_hCutFlow;
158 
159 private:
160  std::string m_sConfigPath;
161 
162  SG::ReadHandleKey<xAOD::MuonContainer> m_muonContainerKey {this, "MuonContainerName", "Muons", "Muon container name"};
163  SG::ReadHandleKey<xAOD::TauJetContainer> m_tauContainerKey {this, "TauContainerName", "TauJets", "Tau container name"};
164  SG::ReadDecorHandleKey<xAOD::TauJetContainer> m_eVetoDecorKey {this, "eVetoDecorName", "", "Name of eVeto decoration"};
165  SG::ReadDecorHandleKey<xAOD::TauJetContainer> m_GNTauDecorKey {this, "GNTauDecorName", "", "Name of GnTauID decoration"};
166 
167  std::map<SelectionCuts, std::unique_ptr<TauAnalysisTools::TauSelectionCut>> m_cMap;
168 
169  void setupCutFlowHistogram();
170  int convertStrToJetIDWP(const std::string& sJetIDWP) const;
171  int convertStrToEleIDWP(const std::string& sEleIDWP) const;
172  std::string convertJetIDWPToStr(int iJetIDWP) const;
173  std::string convertEleIDWPToStr(int iEleIDWP) const;
174 
175 protected:
177 
180 
181 
182 }; // class TauSelectionTool
183 
184 } // namespace TauAnalysisTools
185 
186 #endif // TAUANALYSISTOOLS_TAUSELECTIONTOOL_H
TauAnalysisTools::TauSelectionTool::m_vPtRegion
std::vector< float > m_vPtRegion
Definition: TauSelectionTool.h:119
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
TauAnalysisTools::TauSelectionTool::convertStrToEleIDWP
int convertStrToEleIDWP(const std::string &sEleIDWP) const
Definition: TauSelectionTool.cxx:595
TauAnalysisTools::TauSelectionTool::m_dAbsEtaMax
float m_dAbsEtaMax
Definition: TauSelectionTool.h:145
Enums.h
TauAnalysisTools::TauSelectionTool::m_dEleRNNMin
float m_dEleRNNMin
Definition: TauSelectionTool.h:152
TauAnalysisTools::TauSelectionTool::ASG_TOOL_CLASS2
ASG_TOOL_CLASS2(TauSelectionTool, IAsgSelectionTool, TauAnalysisTools::ITauSelectionTool) friend class TauEfficiencyCorrectionsTool
Create a proper constructor for Athena.
TauAnalysisTools::TauSelectionTool::setupCutFlowHistogram
void setupCutFlowHistogram()
Definition: TauSelectionTool.cxx:502
TauAnalysisTools::TauSelectionTool::m_sJetIDWP
std::string m_sJetIDWP
Definition: TauSelectionTool.h:131
TauAnalysisTools::TauSelectionCutRNNEleScore
Definition: TauSelectionCuts.h:151
TauAnalysisTools::TauSelectionTool
Definition: TauSelectionTool.h:53
TauAnalysisTools::TauSelectionTool::m_hCutFlow
std::shared_ptr< TH1F > m_hCutFlow
Definition: TauSelectionTool.h:157
TauAnalysisTools::TauSelectionTool::m_dPtMin
float m_dPtMin
Definition: TauSelectionTool.h:142
TauAnalysisTools::TauSelectionTool::FillRegionVector
void FillRegionVector(std::vector< T > &vRegion, U tMin, U tMax) const
Definition: TauSelectionTool.cxx:526
TauAnalysisTools::TauSelectionTool::m_vJetRNNSigTransRegion
std::vector< float > m_vJetRNNSigTransRegion
Definition: TauSelectionTool.h:127
TauAnalysisTools::TauSelectionTool::m_sConfigPath
std::string m_sConfigPath
Definition: TauSelectionTool.h:160
TauAnalysisTools::TauSelectionTool::m_vGNTauSigTransRegion
std::vector< float > m_vGNTauSigTransRegion
Definition: TauSelectionTool.h:129
TauAnalysisTools::TauSelectionTool::setOutFile
virtual void setOutFile(TFile *fOutFile) override
Set output file for control histograms.
Definition: TauSelectionTool.cxx:477
TauAnalysisTools::TauSelectionTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: TauSelectionTool.cxx:72
ITauSelectionTool.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
IAsgSelectionTool
Definition: IAsgSelectionTool.h:28
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
IAsgSelectionTool.h
TauAnalysisTools::ITauSelectionTool
Interface for tau selector tool.
Definition: ITauSelectionTool.h:33
TauAnalysisTools::TauSelectionTool::m_dJetRNNSigTransMax
float m_dJetRNNSigTransMax
Definition: TauSelectionTool.h:149
TauAnalysisTools::TauSelectionCutEleIDWP
Definition: TauSelectionCuts.h:163
TauAnalysisTools::TauSelectionTool::PrintConfigValue
void PrintConfigValue(const std::string &sCutName, std::vector< T > &vRegion) const
Definition: TauSelectionTool.cxx:564
TauAnalysisTools::TauSelectionTool::m_cMap
std::map< SelectionCuts, std::unique_ptr< TauAnalysisTools::TauSelectionCut > > m_cMap
Definition: TauSelectionTool.h:167
TauAnalysisTools::TauSelectionTool::~TauSelectionTool
virtual ~TauSelectionTool()
Definition: TauSelectionTool.cxx:66
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
TauAnalysisTools::TauSelectionTool::FillValueVector
void FillValueVector(std::vector< T > &vRegion, U tVal) const
Definition: TauSelectionTool.cxx:543
TauAnalysisTools::TauSelectionCutAbsEta
Definition: TauSelectionCuts.h:79
TauAnalysisTools::TauSelectionTool::m_vEleRNNRegion
std::vector< float > m_vEleRNNRegion
Definition: TauSelectionTool.h:134
TauAnalysisTools::TauSelectionTool::m_dGNTauSigTransMin
float m_dGNTauSigTransMin
Definition: TauSelectionTool.h:150
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
asg::AcceptInfo
Definition: AcceptInfo.h:28
TauAnalysisTools::TauSelectionTool::m_iEleIDWP
int m_iEleIDWP
Definition: TauSelectionTool.h:137
TauAnalysisTools::TauSelectionTool::m_dEleRNNMax
float m_dEleRNNMax
Definition: TauSelectionTool.h:153
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauAnalysisTools::TauEfficiencyCorrectionsTool
Definition: TauEfficiencyCorrectionsTool.h:34
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TauAnalysisTools::TauSelectionTool::convertEleIDWPToStr
std::string convertEleIDWPToStr(int iEleIDWP) const
Definition: TauSelectionTool.cxx:639
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::TauSelectionTool::m_fOutFile
TFile * m_fOutFile
Definition: TauSelectionTool.h:156
TauAnalysisTools::TauSelectionTool::beginEvent
virtual StatusCode beginEvent() override
Function called when a new events is loaded.
Definition: TauSelectionTool.cxx:380
TauAnalysisTools::TauSelectionTool::PrintConfigRegion
void PrintConfigRegion(const std::string &sCutName, std::vector< T > &vRegion) const
Definition: TauSelectionTool.cxx:553
TauAnalysisTools::TauSelectionTool::writeControlHistograms
virtual void writeControlHistograms() override
Write control histograms to output file.
Definition: TauSelectionTool.cxx:483
TauAnalysisTools::TauSelectionTool::m_sEleIDWP
std::string m_sEleIDWP
Definition: TauSelectionTool.h:136
TauJetContainer.h
AnaToolHandle.h
TauAnalysisTools::TauSelectionCutMuonOLR
Definition: TauSelectionCuts.h:177
TauAnalysisTools::TauSelectionTool::m_dGNTauSigTransMax
float m_dGNTauSigTransMax
Definition: TauSelectionTool.h:151
TauAnalysisTools::TauSelectionTool::m_dAbsEtaMin
float m_dAbsEtaMin
Definition: TauSelectionTool.h:144
TauAnalysisTools::TauSelectionTool::m_vAbsCharges
std::vector< int > m_vAbsCharges
Definition: TauSelectionTool.h:123
TauAnalysisTools::TauSelectionTool::m_iSelectionCuts
int m_iSelectionCuts
Definition: TauSelectionTool.h:117
TauAnalysisTools::TauSelectionTool::m_eVetoDecorKey
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_eVetoDecorKey
Definition: TauSelectionTool.h:164
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TauAnalysisTools::TauSelectionTool::m_bCreateControlPlots
bool m_bCreateControlPlots
Definition: TauSelectionTool.h:176
TauAnalysisTools::TauSelectionTool::accept
virtual asg::AcceptData accept(const xAOD::IParticle *p) const override
Get the decision using a generic IParticle pointer.
Definition: TauSelectionTool.cxx:392
TauAnalysisTools::TauSelectionTool::m_vAbsEtaRegion
std::vector< float > m_vAbsEtaRegion
Definition: TauSelectionTool.h:121
TauAnalysisTools::TauSelectionTool::convertStrToJetIDWP
int convertStrToJetIDWP(const std::string &sJetIDWP) const
Definition: TauSelectionTool.cxx:578
TauAnalysisTools::TauSelectionCutAbsCharge
Definition: TauSelectionCuts.h:91
MuonContainer.h
TauAnalysisTools::TauSelectionCut
Definition: TauSelectionCuts.h:28
TauAnalysisTools::TauSelectionTool::getAcceptInfo
virtual const asg::AcceptInfo & getAcceptInfo() const override
Get an object describing the "selection steps" of the tool.
Definition: TauSelectionTool.cxx:386
TauAnalysisTools::TauSelectionCutRNNJetScoreSigTrans
Definition: TauSelectionCuts.h:115
TauAnalysisTools::TauSelectionTool::m_muonContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonContainerKey
Definition: TauSelectionTool.h:162
TauAnalysisTools::TauSelectionTool::m_GNTauDecorKey
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_GNTauDecorKey
Definition: TauSelectionTool.h:165
asg::AsgMetadataTool
Base class for dual-use tools that provide file metadata access.
Definition: AsgMetadataTool.h:48
TauAnalysisTools::TauSelectionTool::TauSelectionTool
TauSelectionTool(const std::string &name)
Constructor for standalone usage.
Definition: TauSelectionTool.cxx:24
AsgMetadataTool.h
TauAnalysisTools::TauSelectionCutJetIDWP
Definition: TauSelectionCuts.h:139
TauAnalysisTools::TauSelectionTool::m_tauContainerKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauContainerKey
Definition: TauSelectionTool.h:163
TauAnalysisTools::TauSelectionTool::m_aAccept
asg::AcceptInfo m_aAccept
Object used to store selection information.
Definition: TauSelectionTool.h:179
TauAnalysisTools::TauSelectionTool::m_iJetIDWP
int m_iJetIDWP
Definition: TauSelectionTool.h:132
TauAnalysisTools::TauSelectionTool::m_iEleIDVersion
int m_iEleIDVersion
Definition: TauSelectionTool.h:138
TauAnalysisTools::TauSelectionTool::m_dJetRNNSigTransMin
float m_dJetRNNSigTransMin
Definition: TauSelectionTool.h:148
TauAnalysisTools::TauSelectionTool::m_iAbsCharge
float m_iAbsCharge
Definition: TauSelectionTool.h:146
TauAnalysisTools::TauSelectionCutNTracks
Definition: TauSelectionCuts.h:103
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
asg::AcceptData
Definition: AcceptData.h:30
TauAnalysisTools::TauSelectionTool::m_dPtMax
float m_dPtMax
Definition: TauSelectionTool.h:143
TauAnalysisTools::TauSelectionTool::convertJetIDWPToStr
std::string convertJetIDWPToStr(int iJetIDWP) const
Definition: TauSelectionTool.cxx:607
HelperFunctions.h
TauAnalysisTools::TauSelectionCutGNTauScoreSigTrans
Definition: TauSelectionCuts.h:127
TauAnalysisTools::TauSelectionTool::m_iNTrack
float m_iNTrack
Definition: TauSelectionTool.h:147
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
TauAnalysisTools::TauSelectionTool::m_bMuonOLR
bool m_bMuonOLR
Definition: TauSelectionTool.h:140
TauAnalysisTools::TauSelectionCutPt
Definition: TauSelectionCuts.h:67