00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00016
00017
00018
00019 #ifndef EGammaMvaEleEstimator_H
00020 #define EGammaMvaEleEstimator_H
00021
00022 #ifndef STANDALONE
00023 #include "DataFormats/PatCandidates/interface/Electron.h"
00024 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00025 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00026 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00027 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00028 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00029 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00030 #include "EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h"
00031 #endif
00032 #include <vector>
00033 #include <TROOT.h>
00034 #include "TMVA/Factory.h"
00035 #include "TMVA/Tools.h"
00036 #include "TMVA/Reader.h"
00037
00038 class EGammaMvaEleEstimator{
00039 public:
00040 EGammaMvaEleEstimator();
00041 ~EGammaMvaEleEstimator();
00042
00043 enum MVAType {
00044 kTrig = 0,
00045 kTrigNoIP = 1,
00046 kNonTrig = 2,
00047 kIsoRings,
00048 kTrigIDIsoCombined,
00049 kTrigIDIsoCombinedPUCorrected
00050 };
00051
00052 void initialize( std::string methodName,
00053 std::string weightsfile,
00054 EGammaMvaEleEstimator::MVAType type);
00055 void initialize( std::string methodName,
00056 EGammaMvaEleEstimator::MVAType type,
00057 Bool_t useBinnedVersion,
00058 std::vector<std::string> weightsfiles );
00059
00060 Bool_t isInitialized() const { return fisInitialized; }
00061 UInt_t GetMVABin(double eta,double pt ) const;
00062
00063 void bindVariables();
00064
00065 #ifndef STANDALONE
00066
00067 Double_t mvaValue(const reco::GsfElectron& ele,
00068 const reco::Vertex& vertex,
00069 const TransientTrackBuilder& transientTrackBuilder,
00070 EcalClusterLazyTools myEcalCluster,
00071 bool printDebug = kFALSE);
00072
00073
00074 Double_t mvaValue(const reco::GsfElectron& ele,
00075 const reco::Vertex& vertex,
00076 double rho,
00077
00078 EcalClusterLazyTools myEcalCluster,
00079 bool printDebug = kFALSE);
00080
00081 Double_t mvaValue(const pat::Electron& ele,
00082 double rho,
00083 bool printDebug = kFALSE);
00084
00085
00086 Double_t mvaValue(const pat::Electron& ele,
00087 const reco::Vertex& vertex,
00088 double rho,
00089 bool printDebug = kFALSE);
00090
00091 Double_t isoMvaValue(const reco::GsfElectron& ele,
00092 const reco::Vertex& vertex,
00093 const reco::PFCandidateCollection &PFCandidates,
00094 double Rho,
00095 ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget,
00096 const reco::GsfElectronCollection &IdentifiedElectrons,
00097 const reco::MuonCollection &IdentifiedMuons,
00098 bool printDebug = kFALSE);
00099
00100 Double_t IDIsoCombinedMvaValue(const reco::GsfElectron& ele,
00101 const reco::Vertex& vertex,
00102 const TransientTrackBuilder& transientTrackBuilder,
00103 EcalClusterLazyTools myEcalCluster,
00104 const reco::PFCandidateCollection &PFCandidates,
00105 double Rho,
00106 ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget,
00107 bool printDebug = kFALSE);
00108
00109 Double_t isoMvaValue(Double_t Pt,
00110 Double_t Eta,
00111 Double_t Rho,
00112 ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget,
00113 Double_t ChargedIso_DR0p0To0p1,
00114 Double_t ChargedIso_DR0p1To0p2,
00115 Double_t ChargedIso_DR0p2To0p3,
00116 Double_t ChargedIso_DR0p3To0p4,
00117 Double_t ChargedIso_DR0p4To0p5,
00118 Double_t GammaIso_DR0p0To0p1,
00119 Double_t GammaIso_DR0p1To0p2,
00120 Double_t GammaIso_DR0p2To0p3,
00121 Double_t GammaIso_DR0p3To0p4,
00122 Double_t GammaIso_DR0p4To0p5,
00123 Double_t NeutralHadronIso_DR0p0To0p1,
00124 Double_t NeutralHadronIso_DR0p1To0p2,
00125 Double_t NeutralHadronIso_DR0p2To0p3,
00126 Double_t NeutralHadronIso_DR0p3To0p4,
00127 Double_t NeutralHadronIso_DR0p4To0p5,
00128 Bool_t printDebug = kFALSE );
00129 #endif
00130
00131
00132 Double_t mvaValue(Double_t fbrem,
00133 Double_t kfchi2,
00134 Int_t kfhits,
00135 Double_t gsfchi2,
00136 Double_t deta,
00137 Double_t dphi,
00138 Double_t detacalo,
00139 Double_t see,
00140 Double_t spp,
00141 Double_t etawidth,
00142 Double_t phiwidth,
00143 Double_t e1x5e5x5,
00144 Double_t R9,
00145 Double_t HoE,
00146 Double_t EoP,
00147 Double_t IoEmIoP,
00148 Double_t eleEoPout,
00149 Double_t PreShowerOverRaw,
00150 Double_t d0,
00151 Double_t ip3d,
00152 Double_t eta,
00153 Double_t pt,
00154 Bool_t printDebug = kFALSE );
00155
00156
00157 Double_t mvaValue(Double_t fbrem,
00158 Double_t kfchi2,
00159 Int_t kfhits,
00160 Double_t gsfchi2,
00161 Double_t deta,
00162 Double_t dphi,
00163 Double_t detacalo,
00164 Double_t see,
00165 Double_t spp,
00166 Double_t etawidth,
00167 Double_t phiwidth,
00168 Double_t e1x5e5x5,
00169 Double_t R9,
00170 Double_t HoE,
00171 Double_t EoP,
00172 Double_t IoEmIoP,
00173 Double_t eleEoPout,
00174 Double_t rho,
00175 Double_t PreShowerOverRaw,
00176 Double_t eta,
00177 Double_t pt,
00178 Bool_t printDebug = kFALSE );
00179
00180
00181 Double_t mvaValue(Double_t fbrem,
00182 Double_t kfchi2,
00183 Int_t kfhits,
00184 Double_t gsfchi2,
00185 Double_t deta,
00186 Double_t dphi,
00187 Double_t detacalo,
00188 Double_t see,
00189 Double_t spp,
00190 Double_t etawidth,
00191 Double_t phiwidth,
00192 Double_t e1x5e5x5,
00193 Double_t R9,
00194 Double_t HoE,
00195 Double_t EoP,
00196 Double_t IoEmIoP,
00197 Double_t eleEoPout,
00198 Double_t PreShowerOverRaw,
00199 Double_t eta,
00200 Double_t pt,
00201 Bool_t printDebug = kFALSE );
00202
00203 Double_t IDIsoCombinedMvaValue(Double_t fbrem,
00204 Double_t kfchi2,
00205 Int_t kfhits,
00206 Double_t gsfchi2,
00207 Double_t deta,
00208 Double_t dphi,
00209 Double_t detacalo,
00210 Double_t see,
00211 Double_t spp,
00212 Double_t etawidth,
00213 Double_t phiwidth,
00214 Double_t OneMinusE1x5E5x5,
00215 Double_t R9,
00216 Double_t HoE,
00217 Double_t EoP,
00218 Double_t IoEmIoP,
00219 Double_t eleEoPout,
00220 Double_t PreShowerOverRaw,
00221 Double_t d0,
00222 Double_t ip3d,
00223 Double_t ChargedIso_DR0p0To0p1,
00224 Double_t ChargedIso_DR0p1To0p2,
00225 Double_t ChargedIso_DR0p2To0p3,
00226 Double_t ChargedIso_DR0p3To0p4,
00227 Double_t ChargedIso_DR0p4To0p5,
00228 Double_t GammaIso_DR0p0To0p1,
00229 Double_t GammaIso_DR0p1To0p2,
00230 Double_t GammaIso_DR0p2To0p3,
00231 Double_t GammaIso_DR0p3To0p4,
00232 Double_t GammaIso_DR0p4To0p5,
00233 Double_t NeutralHadronIso_DR0p0To0p1,
00234 Double_t NeutralHadronIso_DR0p1To0p2,
00235 Double_t NeutralHadronIso_DR0p2To0p3,
00236 Double_t NeutralHadronIso_DR0p3To0p4,
00237 Double_t NeutralHadronIso_DR0p4To0p5,
00238 Double_t Rho,
00239 Double_t eta,
00240 Double_t pt,
00241 Bool_t printDebug = kFALSE);
00242
00243
00244
00245 private:
00246
00247 std::vector<TMVA::Reader*> fTMVAReader;
00248 std::string fMethodname;
00249 Bool_t fisInitialized;
00250 MVAType fMVAType;
00251 Bool_t fUseBinnedVersion;
00252 UInt_t fNMVABins;
00253
00254 Float_t fMVAVar_fbrem;
00255 Float_t fMVAVar_kfchi2;
00256 Float_t fMVAVar_kfhits;
00257 Float_t fMVAVar_kfhitsall;
00258 Float_t fMVAVar_gsfchi2;
00259
00260 Float_t fMVAVar_deta;
00261 Float_t fMVAVar_dphi;
00262 Float_t fMVAVar_detacalo;
00263
00264 Float_t fMVAVar_see;
00265 Float_t fMVAVar_spp;
00266 Float_t fMVAVar_etawidth;
00267 Float_t fMVAVar_phiwidth;
00268 Float_t fMVAVar_OneMinusE1x5E5x5;
00269 Float_t fMVAVar_R9;
00270
00271 Float_t fMVAVar_HoE;
00272 Float_t fMVAVar_EoP;
00273 Float_t fMVAVar_IoEmIoP;
00274 Float_t fMVAVar_eleEoPout;
00275 Float_t fMVAVar_EoPout;
00276 Float_t fMVAVar_PreShowerOverRaw;
00277
00278 Float_t fMVAVar_d0;
00279 Float_t fMVAVar_ip3d;
00280 Float_t fMVAVar_ip3dSig;
00281
00282 Float_t fMVAVar_eta;
00283 Float_t fMVAVar_pt;
00284 Float_t fMVAVar_rho;
00285
00286 Float_t fMVAVar_ChargedIso_DR0p0To0p1;
00287 Float_t fMVAVar_ChargedIso_DR0p1To0p2;
00288 Float_t fMVAVar_ChargedIso_DR0p2To0p3;
00289 Float_t fMVAVar_ChargedIso_DR0p3To0p4;
00290 Float_t fMVAVar_ChargedIso_DR0p4To0p5;
00291 Float_t fMVAVar_GammaIso_DR0p0To0p1;
00292 Float_t fMVAVar_GammaIso_DR0p1To0p2;
00293 Float_t fMVAVar_GammaIso_DR0p2To0p3;
00294 Float_t fMVAVar_GammaIso_DR0p3To0p4;
00295 Float_t fMVAVar_GammaIso_DR0p4To0p5;
00296 Float_t fMVAVar_NeutralHadronIso_DR0p0To0p1;
00297 Float_t fMVAVar_NeutralHadronIso_DR0p1To0p2;
00298 Float_t fMVAVar_NeutralHadronIso_DR0p2To0p3;
00299 Float_t fMVAVar_NeutralHadronIso_DR0p3To0p4;
00300 Float_t fMVAVar_NeutralHadronIso_DR0p4To0p5;
00301
00302 };
00303
00304 #endif