Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:56

0001 //--------------------------------------------------------------------------------------------------
0002 // $Id $
0003 //
0004 // EGammaMvaEleEstimatorCSA14
0005 //
0006 // Helper Class for applying MVA electron ID selection
0007 //
0008 // Authors: D.Benedetti, E.DiMaro, S.Xie
0009 //--------------------------------------------------------------------------------------------------
0010 
0011 #ifndef EGammaMvaEleEstimatorCSA14_H
0012 #define EGammaMvaEleEstimatorCSA14_H
0013 
0014 #include <vector>
0015 #include <TROOT.h>
0016 #include "TMVA/Factory.h"
0017 #include "TMVA/Tools.h"
0018 #include "TMVA/Reader.h"
0019 
0020 #include "DataFormats/TrackReco/interface/Track.h"
0021 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0022 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0023 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0024 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0025 #include "DataFormats/MuonReco/interface/Muon.h"
0026 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0027 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0028 #include "DataFormats/Common/interface/RefToPtr.h"
0029 #include "DataFormats/VertexReco/interface/Vertex.h"
0030 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
0031 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
0032 #include "TrackingTools/IPTools/interface/IPTools.h"
0033 #include "EgammaAnalysis/ElectronTools/interface/ElectronEffectiveArea.h"
0034 #include "DataFormats/Common/interface/RefToPtr.h"
0035 
0036 #include "DataFormats/PatCandidates/interface/Electron.h"
0037 
0038 class EGammaMvaEleEstimatorCSA14 {
0039 public:
0040   EGammaMvaEleEstimatorCSA14();
0041   ~EGammaMvaEleEstimatorCSA14();
0042 
0043   enum MVAType {
0044     kTrig = 0,           // MVA for triggering electrons
0045     kNonTrig = 1,        // MVA for non-triggering electrons
0046     kNonTrigPhys14 = 2,  // MVA for non-triggering electrons in Phys14
0047   };
0048 
0049   void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimatorCSA14::MVAType type);
0050   void initialize(std::string methodName,
0051                   EGammaMvaEleEstimatorCSA14::MVAType type,
0052                   Bool_t useBinnedVersion,
0053                   std::vector<std::string> weightsfiles);
0054 
0055   Bool_t isInitialized() const { return fisInitialized; }
0056   UInt_t GetMVABin(double eta, double pt) const;
0057 
0058   void bindVariables();
0059 
0060   // for kTrig and kNonTrig algorithm
0061   Double_t mvaValue(const reco::GsfElectron& ele,
0062                     const reco::Vertex& vertex,
0063                     const TransientTrackBuilder& transientTrackBuilder,
0064                     noZS::EcalClusterLazyTools myEcalCluster,
0065                     bool printDebug = kFALSE);
0066 
0067   Double_t mvaValue(const pat::Electron& ele, bool printDebug);
0068 
0069 private:
0070   std::vector<TMVA::Reader*> fTMVAReader;
0071   std::vector<TMVA::MethodBase*> fTMVAMethod;
0072   std::string fMethodname;
0073   Bool_t fisInitialized;
0074   MVAType fMVAType;
0075   Bool_t fUseBinnedVersion;
0076   UInt_t fNMVABins;
0077 
0078   Float_t fMVAVar_fbrem;
0079   Float_t fMVAVar_kfchi2;
0080   Float_t fMVAVar_kfhits;     //number of layers
0081   Float_t fMVAVar_kfhitsall;  //number of hits
0082   Float_t fMVAVar_gsfchi2;
0083 
0084   Float_t fMVAVar_deta;
0085   Float_t fMVAVar_dphi;
0086   Float_t fMVAVar_detacalo;
0087 
0088   Float_t fMVAVar_see;
0089   Float_t fMVAVar_spp;
0090   Float_t fMVAVar_etawidth;
0091   Float_t fMVAVar_phiwidth;
0092   Float_t fMVAVar_OneMinusE1x5E5x5;
0093   Float_t fMVAVar_R9;
0094 
0095   Float_t fMVAVar_HoE;
0096   Float_t fMVAVar_EoP;
0097   Float_t fMVAVar_IoEmIoP;
0098   Float_t fMVAVar_eleEoPout;
0099   Float_t fMVAVar_EoPout;
0100   Float_t fMVAVar_PreShowerOverRaw;
0101 
0102   Float_t fMVAVar_d0;
0103   Float_t fMVAVar_ip3d;
0104   Float_t fMVAVar_ip3dSig;
0105 
0106   Float_t fMVAVar_eta;
0107   Float_t fMVAVar_abseta;
0108   Float_t fMVAVar_pt;
0109   Float_t fMVAVar_rho;
0110   Float_t fMVAVar_isBarrel;
0111   Float_t fMVAVar_isEndcap;
0112   Float_t fMVAVar_SCeta;
0113 
0114   Float_t fMVAVar_ChargedIso_DR0p0To0p1;
0115   Float_t fMVAVar_ChargedIso_DR0p1To0p2;
0116   Float_t fMVAVar_ChargedIso_DR0p2To0p3;
0117   Float_t fMVAVar_ChargedIso_DR0p3To0p4;
0118   Float_t fMVAVar_ChargedIso_DR0p4To0p5;
0119   Float_t fMVAVar_GammaIso_DR0p0To0p1;
0120   Float_t fMVAVar_GammaIso_DR0p1To0p2;
0121   Float_t fMVAVar_GammaIso_DR0p2To0p3;
0122   Float_t fMVAVar_GammaIso_DR0p3To0p4;
0123   Float_t fMVAVar_GammaIso_DR0p4To0p5;
0124   Float_t fMVAVar_NeutralHadronIso_DR0p0To0p1;
0125   Float_t fMVAVar_NeutralHadronIso_DR0p1To0p2;
0126   Float_t fMVAVar_NeutralHadronIso_DR0p2To0p3;
0127   Float_t fMVAVar_NeutralHadronIso_DR0p3To0p4;
0128   Float_t fMVAVar_NeutralHadronIso_DR0p4To0p5;
0129 };
0130 
0131 #endif