00001
00002 #ifndef TAUANALYSISTOOLS_TAUSELECTIONTOOL_H
00003 #define TAUANALYSISTOOLS_TAUSELECTIONTOOL_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "AsgTools/AsgMetadataTool.h"
00017 #include "AsgTools/AnaToolHandle.h"
00018 #include "PATCore/IAsgSelectionTool.h"
00019
00020
00021 #include "TauAnalysisTools/ITauSelectionTool.h"
00022 #include "TauAnalysisTools/Enums.h"
00023 #include "TauAnalysisTools/HelperFunctions.h"
00024
00025 #include "TauAnalysisTools/TauOverlappingElectronLLHDecorator.h"
00026
00027
00028 #include "TH1F.h"
00029
00030 namespace TauAnalysisTools
00031 {
00032
00034 class SelectionCut;
00035 class SelectionCutPt;
00036 class SelectionCutAbsEta;
00037 class SelectionCutAbsCharge;
00038 class SelectionCutNTracks;
00039 class SelectionCutBDTJetScore;
00040 class SelectionCutJetIDWP;
00041 class SelectionCutBDTEleScore;
00042 class SelectionCutEleBDTWP;
00043 class SelectionCutEleOLR;
00044 class SelectionCutMuonVeto;
00045 class SelectionCutMuonOLR;
00046
00047 enum SelectionCuts
00048 {
00049 NoCut = 0,
00050 CutPt = 1,
00051 CutAbsEta = 1<<1,
00052 CutPhi = 1<<2,
00053 CutNTrack = 1<<3,
00054 CutAbsCharge = 1<<4,
00055 CutJetBDTScore = 1<<5,
00056 CutJetIDWP = 1<<6,
00057 CutEleBDTScore = 1<<7,
00058 CutEleBDTWP = 1<<8,
00059 CutMuonVeto = 1<<9,
00060 CutEleOLR = 1<<10,
00061 CutMuonOLR = 1<<11
00062 };
00063
00064 class TauSelectionTool : public virtual IAsgSelectionTool,
00065 public virtual ITauSelectionTool,
00066 public asg::AsgMetadataTool
00067 {
00070 friend class SelectionCut;
00071 friend class SelectionCutPt;
00072 friend class SelectionCutAbsEta;
00073 friend class SelectionCutAbsCharge;
00074 friend class SelectionCutNTracks;
00075 friend class SelectionCutBDTJetScore;
00076 friend class SelectionCutJetIDWP;
00077 friend class SelectionCutBDTEleScore;
00078 friend class SelectionCutEleBDTWP;
00079 friend class SelectionCutEleOLR;
00080 friend class SelectionCutMuonVeto;
00081 friend class SelectionCutMuonOLR;
00082
00084 ASG_TOOL_CLASS2( TauSelectionTool,
00085 IAsgSelectionTool,
00086 TauAnalysisTools::ITauSelectionTool )
00087
00088
00089 friend class TauEfficiencyCorrectionsTool;
00090
00091 public:
00093 TauSelectionTool( const std::string& name );
00094
00095 virtual ~TauSelectionTool();
00096
00098 virtual StatusCode initialize();
00099
00101 virtual StatusCode initializeEvent() __attribute__ ((deprecated("This function is deprecated. Please remove it from your code.\nFor further information please refer to the README:\nhttps:
00102
00104 virtual const Root::TAccept& getTAccept() const;
00105
00107 virtual const Root::TAccept& accept( const xAOD::IParticle* p ) const;
00108
00110 virtual const Root::TAccept& accept( const xAOD::TauJet& tau ) const;
00111
00113 void setOutFile( TFile* fOutFile );
00114
00116 void writeControlHistograms();
00117
00118 private:
00119
00120
00121 virtual StatusCode beginInputFile();
00122
00123 virtual StatusCode beginEvent();
00124
00125 template<typename T, typename U>
00126 void FillRegionVector(std::vector<T>& vRegion, U tMin, U tMax);
00127 template<typename T, typename U>
00128 void FillValueVector(std::vector<T>& vRegion, U tVal);
00129 template<typename T>
00130 void PrintConfigRegion(std::string sCutName, std::vector<T>& vRegion);
00131 template<typename T>
00132 void PrintConfigValue(std::string sCutName, std::vector<T>& vRegion);
00133 template<typename T>
00134 void PrintConfigValue(std::string sCutName, T& sVal);
00135
00136
00137 int m_iSelectionCuts;
00138
00139 std::vector<float> m_vPtRegion;
00140
00141 std::vector<float> m_vAbsEtaRegion;
00142
00143 std::vector<int> m_vAbsCharges;
00144
00145 std::vector<size_t> m_vNTracks;
00146
00147 std::vector<float> m_vJetBDTRegion;
00148
00149 std::string m_sJetIDWP;
00150 int m_iJetIDWP;
00151
00152 std::vector<float> m_vEleBDTRegion;
00153
00154 std::string m_sEleBDTWP;
00155 int m_iEleBDTWP;
00156
00157 bool m_bEleOLR;
00158
00159 bool m_bMuonVeto;
00160
00161 bool m_bMuonOLR;
00162
00163 bool m_bIgnoreAODFixCheck;
00164 bool m_bRecalcEleOLR;
00165
00166 float m_dPtMin;
00167 float m_dPtMax;
00168 float m_dAbsEtaMin;
00169 float m_dAbsEtaMax;
00170 float m_iAbsCharge;
00171 float m_iNTrack;
00172 float m_dJetBDTMin;
00173 float m_dJetBDTMax;
00174 float m_dEleBDTMin;
00175 float m_dEleBDTMax;
00176
00177 protected:
00178 TFile* m_fOutFile;
00179 std::shared_ptr<TH1F> m_hCutFlow;
00180
00181 private:
00182 std::string m_sConfigPath;
00183 std::string m_sEleOLRFilePath;
00184 std::string m_sElectronContainerName;
00185 std::string m_sMuonContainerName;
00186
00187 asg::AnaToolHandle<TauAnalysisTools::ITauOverlappingElectronLLHDecorator> m_tTOELLHDecorator;
00188
00189 std::map<SelectionCuts, TauAnalysisTools::SelectionCut*> m_cMap;
00190
00191 void setupCutFlowHistogram();
00192 int convertStrToJetIDWP(std::string sJetIDWP);
00193 int convertStrToEleBDTWP(std::string sEleBDTWP);
00194 std::string convertJetIDWPToStr(int iJetIDWP);
00195 std::string convertEleBDTWPToStr(int iEleBDTWP);
00196
00197 protected:
00198 bool m_bCreateControlPlots;
00199
00201 mutable Root::TAccept m_aAccept;
00202
00203
00204
00205 };
00206
00207 }
00208
00209 #endif // TAUANALYSISTOOLS_TAUSELECTIONTOOL_H