File indexing completed on 2024-04-06 12:10:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef EGammaMvaEleEstimator_H
0019 #define EGammaMvaEleEstimator_H
0020
0021 #ifndef STANDALONE
0022 #include "DataFormats/PatCandidates/interface/Electron.h"
0023 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
0024 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0025 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0026 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0027 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
0028 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0029 #include "EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h"
0030 #endif
0031 #include <vector>
0032 #include <TROOT.h>
0033 #include "TMVA/Factory.h"
0034 #include "TMVA/Tools.h"
0035 #include "TMVA/Reader.h"
0036 #include "TMVA/MethodBase.h"
0037
0038 class EGammaMvaEleEstimator {
0039 public:
0040 EGammaMvaEleEstimator();
0041 ~EGammaMvaEleEstimator();
0042
0043 enum MVAType {
0044 kTrig = 0,
0045 kTrigNoIP = 1,
0046 kNonTrig = 2,
0047 kIsoRings,
0048 kTrigIDIsoCombined,
0049 kTrigIDIsoCombinedPUCorrected
0050 };
0051
0052 void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimator::MVAType type);
0053 void initialize(std::string methodName,
0054 EGammaMvaEleEstimator::MVAType type,
0055 Bool_t useBinnedVersion,
0056 std::vector<std::string> weightsfiles);
0057
0058 Bool_t isInitialized() const { return fisInitialized; }
0059 UInt_t GetMVABin(double eta, double pt) const;
0060
0061 void bindVariables();
0062
0063 #ifndef STANDALONE
0064
0065 Double_t mvaValue(const reco::GsfElectron& ele,
0066 const reco::Vertex& vertex,
0067 const TransientTrackBuilder& transientTrackBuilder,
0068 EcalClusterLazyTools const& myEcalCluster,
0069 bool printDebug = kFALSE);
0070
0071
0072 Double_t mvaValue(const reco::GsfElectron& ele,
0073 const reco::Vertex& vertex,
0074 double rho,
0075
0076 EcalClusterLazyTools const& myEcalCluster,
0077 bool printDebug = kFALSE);
0078
0079 Double_t mvaValue(const pat::Electron& ele, double rho, bool printDebug = kFALSE);
0080
0081
0082 Double_t mvaValue(const pat::Electron& ele,
0083 const reco::Vertex& vertex,
0084 double rho,
0085 bool useFull5x5 = kFALSE,
0086 bool printDebug = kFALSE);
0087
0088 Double_t isoMvaValue(const reco::GsfElectron& ele,
0089 const reco::Vertex& vertex,
0090 const reco::PFCandidateCollection& PFCandidates,
0091 double Rho,
0092 ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget,
0093 const reco::GsfElectronCollection& IdentifiedElectrons,
0094 const reco::MuonCollection& IdentifiedMuons,
0095 bool printDebug = kFALSE);
0096
0097 Double_t IDIsoCombinedMvaValue(const reco::GsfElectron& ele,
0098 const reco::Vertex& vertex,
0099 const TransientTrackBuilder& transientTrackBuilder,
0100 EcalClusterLazyTools const& myEcalCluster,
0101 const reco::PFCandidateCollection& PFCandidates,
0102 double Rho,
0103 ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget,
0104 bool printDebug = kFALSE);
0105
0106 Double_t isoMvaValue(Double_t Pt,
0107 Double_t Eta,
0108 Double_t Rho,
0109 ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget,
0110 Double_t ChargedIso_DR0p0To0p1,
0111 Double_t ChargedIso_DR0p1To0p2,
0112 Double_t ChargedIso_DR0p2To0p3,
0113 Double_t ChargedIso_DR0p3To0p4,
0114 Double_t ChargedIso_DR0p4To0p5,
0115 Double_t GammaIso_DR0p0To0p1,
0116 Double_t GammaIso_DR0p1To0p2,
0117 Double_t GammaIso_DR0p2To0p3,
0118 Double_t GammaIso_DR0p3To0p4,
0119 Double_t GammaIso_DR0p4To0p5,
0120 Double_t NeutralHadronIso_DR0p0To0p1,
0121 Double_t NeutralHadronIso_DR0p1To0p2,
0122 Double_t NeutralHadronIso_DR0p2To0p3,
0123 Double_t NeutralHadronIso_DR0p3To0p4,
0124 Double_t NeutralHadronIso_DR0p4To0p5,
0125 Bool_t printDebug = kFALSE);
0126 #endif
0127
0128
0129 Double_t mvaValue(Double_t fbrem,
0130 Double_t kfchi2,
0131 Int_t kfhits,
0132 Double_t gsfchi2,
0133 Double_t deta,
0134 Double_t dphi,
0135 Double_t detacalo,
0136 Double_t see,
0137 Double_t spp,
0138 Double_t etawidth,
0139 Double_t phiwidth,
0140 Double_t e1x5e5x5,
0141 Double_t R9,
0142 Double_t HoE,
0143 Double_t EoP,
0144 Double_t IoEmIoP,
0145 Double_t eleEoPout,
0146 Double_t PreShowerOverRaw,
0147 Double_t d0,
0148 Double_t ip3d,
0149 Double_t eta,
0150 Double_t pt,
0151 Bool_t printDebug = kFALSE);
0152
0153
0154 Double_t mvaValue(Double_t fbrem,
0155 Double_t kfchi2,
0156 Int_t kfhits,
0157 Double_t gsfchi2,
0158 Double_t deta,
0159 Double_t dphi,
0160 Double_t detacalo,
0161 Double_t see,
0162 Double_t spp,
0163 Double_t etawidth,
0164 Double_t phiwidth,
0165 Double_t e1x5e5x5,
0166 Double_t R9,
0167 Double_t HoE,
0168 Double_t EoP,
0169 Double_t IoEmIoP,
0170 Double_t eleEoPout,
0171 Double_t rho,
0172 Double_t PreShowerOverRaw,
0173 Double_t eta,
0174 Double_t pt,
0175 Bool_t printDebug = kFALSE);
0176
0177
0178 Double_t mvaValue(Double_t fbrem,
0179 Double_t kfchi2,
0180 Int_t kfhits,
0181 Double_t gsfchi2,
0182 Double_t deta,
0183 Double_t dphi,
0184 Double_t detacalo,
0185 Double_t see,
0186 Double_t spp,
0187 Double_t etawidth,
0188 Double_t phiwidth,
0189 Double_t e1x5e5x5,
0190 Double_t R9,
0191 Double_t HoE,
0192 Double_t EoP,
0193 Double_t IoEmIoP,
0194 Double_t eleEoPout,
0195 Double_t PreShowerOverRaw,
0196 Double_t eta,
0197 Double_t pt,
0198 Bool_t printDebug = kFALSE);
0199
0200 Double_t IDIsoCombinedMvaValue(Double_t fbrem,
0201 Double_t kfchi2,
0202 Int_t kfhits,
0203 Double_t gsfchi2,
0204 Double_t deta,
0205 Double_t dphi,
0206 Double_t detacalo,
0207 Double_t see,
0208 Double_t spp,
0209 Double_t etawidth,
0210 Double_t phiwidth,
0211 Double_t OneMinusE1x5E5x5,
0212 Double_t R9,
0213 Double_t HoE,
0214 Double_t EoP,
0215 Double_t IoEmIoP,
0216 Double_t eleEoPout,
0217 Double_t PreShowerOverRaw,
0218 Double_t d0,
0219 Double_t ip3d,
0220 Double_t ChargedIso_DR0p0To0p1,
0221 Double_t ChargedIso_DR0p1To0p2,
0222 Double_t ChargedIso_DR0p2To0p3,
0223 Double_t ChargedIso_DR0p3To0p4,
0224 Double_t ChargedIso_DR0p4To0p5,
0225 Double_t GammaIso_DR0p0To0p1,
0226 Double_t GammaIso_DR0p1To0p2,
0227 Double_t GammaIso_DR0p2To0p3,
0228 Double_t GammaIso_DR0p3To0p4,
0229 Double_t GammaIso_DR0p4To0p5,
0230 Double_t NeutralHadronIso_DR0p0To0p1,
0231 Double_t NeutralHadronIso_DR0p1To0p2,
0232 Double_t NeutralHadronIso_DR0p2To0p3,
0233 Double_t NeutralHadronIso_DR0p3To0p4,
0234 Double_t NeutralHadronIso_DR0p4To0p5,
0235 Double_t Rho,
0236 Double_t eta,
0237 Double_t pt,
0238 Bool_t printDebug = kFALSE);
0239
0240 private:
0241 std::vector<TMVA::Reader*> fTMVAReader;
0242 std::vector<TMVA::MethodBase*> fTMVAMethod;
0243 std::string fMethodname;
0244 Bool_t fisInitialized;
0245 MVAType fMVAType;
0246 Bool_t fUseBinnedVersion;
0247 UInt_t fNMVABins;
0248
0249 Float_t fMVAVar_fbrem;
0250 Float_t fMVAVar_kfchi2;
0251 Float_t fMVAVar_kfhits;
0252 Float_t fMVAVar_kfhitsall;
0253 Float_t fMVAVar_gsfchi2;
0254
0255 Float_t fMVAVar_deta;
0256 Float_t fMVAVar_dphi;
0257 Float_t fMVAVar_detacalo;
0258
0259 Float_t fMVAVar_see;
0260 Float_t fMVAVar_spp;
0261 Float_t fMVAVar_etawidth;
0262 Float_t fMVAVar_phiwidth;
0263 Float_t fMVAVar_OneMinusE1x5E5x5;
0264 Float_t fMVAVar_R9;
0265
0266 Float_t fMVAVar_HoE;
0267 Float_t fMVAVar_EoP;
0268 Float_t fMVAVar_IoEmIoP;
0269 Float_t fMVAVar_eleEoPout;
0270 Float_t fMVAVar_EoPout;
0271 Float_t fMVAVar_PreShowerOverRaw;
0272
0273 Float_t fMVAVar_d0;
0274 Float_t fMVAVar_ip3d;
0275 Float_t fMVAVar_ip3dSig;
0276
0277 Float_t fMVAVar_eta;
0278 Float_t fMVAVar_pt;
0279 Float_t fMVAVar_rho;
0280
0281 Float_t fMVAVar_ChargedIso_DR0p0To0p1;
0282 Float_t fMVAVar_ChargedIso_DR0p1To0p2;
0283 Float_t fMVAVar_ChargedIso_DR0p2To0p3;
0284 Float_t fMVAVar_ChargedIso_DR0p3To0p4;
0285 Float_t fMVAVar_ChargedIso_DR0p4To0p5;
0286 Float_t fMVAVar_GammaIso_DR0p0To0p1;
0287 Float_t fMVAVar_GammaIso_DR0p1To0p2;
0288 Float_t fMVAVar_GammaIso_DR0p2To0p3;
0289 Float_t fMVAVar_GammaIso_DR0p3To0p4;
0290 Float_t fMVAVar_GammaIso_DR0p4To0p5;
0291 Float_t fMVAVar_NeutralHadronIso_DR0p0To0p1;
0292 Float_t fMVAVar_NeutralHadronIso_DR0p1To0p2;
0293 Float_t fMVAVar_NeutralHadronIso_DR0p2To0p3;
0294 Float_t fMVAVar_NeutralHadronIso_DR0p3To0p4;
0295 Float_t fMVAVar_NeutralHadronIso_DR0p4To0p5;
0296 };
0297
0298 #endif