CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EGammaMvaEleEstimator.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------------------
2 // $Id $
3 //
4 // EGammaMvaEleEstimator
5 //
6 // Helper Class for applying MVA electron ID selection
7 //
8 // Authors: D.Benedetti, E.DiMaro, S.Xie
9 //--------------------------------------------------------------------------------------------------
10 
11 
16 
17 //#define STANDALONE // <---- this line
18 
19 #ifndef EGammaMvaEleEstimator_H
20 #define EGammaMvaEleEstimator_H
21 
22 #ifndef STANDALONE
31 #endif
32 #include <vector>
33 #include <TROOT.h>
34 #include "TMVA/Factory.h"
35 #include "TMVA/Tools.h"
36 #include "TMVA/Reader.h"
37 #include "TMVA/MethodBase.h"
38 
40  public:
43 
44  enum MVAType {
45  kTrig = 0, // MVA for triggering electrons
46  kTrigNoIP = 1, // MVA for triggering electrons without IP info
47  kNonTrig = 2, // MVA for non-triggering electrons
48  kIsoRings, // Isolation MVA for non-trigger electrons
49  kTrigIDIsoCombined, // ID+Iso Combined MVA for triggering electrons
50  kTrigIDIsoCombinedPUCorrected // ID+Iso Combined MVA for triggering electrons
51  };
52 
53  void initialize( std::string methodName,
54  std::string weightsfile,
56  void initialize( std::string methodName,
58  Bool_t useBinnedVersion,
59  std::vector<std::string> weightsfiles );
60 
61  Bool_t isInitialized() const { return fisInitialized; }
62  UInt_t GetMVABin(double eta,double pt ) const;
63 
64  void bindVariables();
65 
66 #ifndef STANDALONE
67  // for kTrig and kNonTrig algorithm
68  Double_t mvaValue(const reco::GsfElectron& ele,
69  const reco::Vertex& vertex,
70  const TransientTrackBuilder& transientTrackBuilder,
71  EcalClusterLazyTools myEcalCluster,
72  bool printDebug = kFALSE);
73 
74  // for kTrigNoIP algorithm
75  Double_t mvaValue(const reco::GsfElectron& ele,
76  const reco::Vertex& vertex,
77  double rho,
78  //const TransientTrackBuilder& transientTrackBuilder,
79  EcalClusterLazyTools myEcalCluster,
80  bool printDebug = kFALSE);
81 
82  Double_t mvaValue(const pat::Electron& ele,
83  double rho,
84  bool printDebug = kFALSE);
85 
86  // for kTrig, kNonTrig and kTrigNoIP algorithm
87  Double_t mvaValue(const pat::Electron& ele,
88  const reco::Vertex& vertex,
89  double rho,
90  bool useFull5x5 = kFALSE,
91  bool printDebug = kFALSE);
92 
93  Double_t isoMvaValue(const reco::GsfElectron& ele,
94  const reco::Vertex& vertex,
96  double Rho,
98  const reco::GsfElectronCollection &IdentifiedElectrons,
99  const reco::MuonCollection &IdentifiedMuons,
100  bool printDebug = kFALSE);
101 
102  Double_t IDIsoCombinedMvaValue(const reco::GsfElectron& ele,
103  const reco::Vertex& vertex,
104  const TransientTrackBuilder& transientTrackBuilder,
105  EcalClusterLazyTools myEcalCluster,
107  double Rho,
109  bool printDebug = kFALSE);
110 
111  Double_t isoMvaValue(Double_t Pt,
112  Double_t Eta,
113  Double_t Rho,
115  Double_t ChargedIso_DR0p0To0p1,
116  Double_t ChargedIso_DR0p1To0p2,
117  Double_t ChargedIso_DR0p2To0p3,
118  Double_t ChargedIso_DR0p3To0p4,
119  Double_t ChargedIso_DR0p4To0p5,
120  Double_t GammaIso_DR0p0To0p1,
121  Double_t GammaIso_DR0p1To0p2,
122  Double_t GammaIso_DR0p2To0p3,
123  Double_t GammaIso_DR0p3To0p4,
124  Double_t GammaIso_DR0p4To0p5,
125  Double_t NeutralHadronIso_DR0p0To0p1,
126  Double_t NeutralHadronIso_DR0p1To0p2,
127  Double_t NeutralHadronIso_DR0p2To0p3,
128  Double_t NeutralHadronIso_DR0p3To0p4,
129  Double_t NeutralHadronIso_DR0p4To0p5,
130  Bool_t printDebug = kFALSE );
131 #endif
132 
133  // for kTrig algo
134  Double_t mvaValue(Double_t fbrem,
135  Double_t kfchi2,
136  Int_t kfhits,
137  Double_t gsfchi2,
138  Double_t deta,
139  Double_t dphi,
140  Double_t detacalo,
141  Double_t see,
142  Double_t spp,
143  Double_t etawidth,
144  Double_t phiwidth,
145  Double_t e1x5e5x5,
146  Double_t R9,
147  Double_t HoE,
148  Double_t EoP,
149  Double_t IoEmIoP,
150  Double_t eleEoPout,
151  Double_t PreShowerOverRaw,
152  Double_t d0,
153  Double_t ip3d,
154  Double_t eta,
155  Double_t pt,
156  Bool_t printDebug = kFALSE );
157 
158  // for kTrigNoIP algo
159  Double_t mvaValue(Double_t fbrem,
160  Double_t kfchi2,
161  Int_t kfhits,
162  Double_t gsfchi2,
163  Double_t deta,
164  Double_t dphi,
165  Double_t detacalo,
166  Double_t see,
167  Double_t spp,
168  Double_t etawidth,
169  Double_t phiwidth,
170  Double_t e1x5e5x5,
171  Double_t R9,
172  Double_t HoE,
173  Double_t EoP,
174  Double_t IoEmIoP,
175  Double_t eleEoPout,
176  Double_t rho,
177  Double_t PreShowerOverRaw,
178  Double_t eta,
179  Double_t pt,
180  Bool_t printDebug = kFALSE );
181 
182  // for kNonTrig algo
183  Double_t mvaValue(Double_t fbrem,
184  Double_t kfchi2,
185  Int_t kfhits,
186  Double_t gsfchi2,
187  Double_t deta,
188  Double_t dphi,
189  Double_t detacalo,
190  Double_t see,
191  Double_t spp,
192  Double_t etawidth,
193  Double_t phiwidth,
194  Double_t e1x5e5x5,
195  Double_t R9,
196  Double_t HoE,
197  Double_t EoP,
198  Double_t IoEmIoP,
199  Double_t eleEoPout,
200  Double_t PreShowerOverRaw,
201  Double_t eta,
202  Double_t pt,
203  Bool_t printDebug = kFALSE );
204 
205  Double_t IDIsoCombinedMvaValue(Double_t fbrem,
206  Double_t kfchi2,
207  Int_t kfhits,
208  Double_t gsfchi2,
209  Double_t deta,
210  Double_t dphi,
211  Double_t detacalo,
212  Double_t see,
213  Double_t spp,
214  Double_t etawidth,
215  Double_t phiwidth,
216  Double_t OneMinusE1x5E5x5,
217  Double_t R9,
218  Double_t HoE,
219  Double_t EoP,
220  Double_t IoEmIoP,
221  Double_t eleEoPout,
222  Double_t PreShowerOverRaw,
223  Double_t d0,
224  Double_t ip3d,
225  Double_t ChargedIso_DR0p0To0p1,
226  Double_t ChargedIso_DR0p1To0p2,
227  Double_t ChargedIso_DR0p2To0p3,
228  Double_t ChargedIso_DR0p3To0p4,
229  Double_t ChargedIso_DR0p4To0p5,
230  Double_t GammaIso_DR0p0To0p1,
231  Double_t GammaIso_DR0p1To0p2,
232  Double_t GammaIso_DR0p2To0p3,
233  Double_t GammaIso_DR0p3To0p4,
234  Double_t GammaIso_DR0p4To0p5,
235  Double_t NeutralHadronIso_DR0p0To0p1,
236  Double_t NeutralHadronIso_DR0p1To0p2,
237  Double_t NeutralHadronIso_DR0p2To0p3,
238  Double_t NeutralHadronIso_DR0p3To0p4,
239  Double_t NeutralHadronIso_DR0p4To0p5,
240  Double_t Rho,
241  Double_t eta,
242  Double_t pt,
243  Bool_t printDebug = kFALSE);
244 
245 
246 
247  private:
248 
249  std::vector<TMVA::Reader*> fTMVAReader;
250  std::vector<TMVA::MethodBase*> fTMVAMethod;
255  UInt_t fNMVABins;
256 
257  Float_t fMVAVar_fbrem;
258  Float_t fMVAVar_kfchi2;
259  Float_t fMVAVar_kfhits; //number of layers
260  Float_t fMVAVar_kfhitsall; //number of hits
262 
263  Float_t fMVAVar_deta;
264  Float_t fMVAVar_dphi;
266 
267  Float_t fMVAVar_see;
268  Float_t fMVAVar_spp;
272  Float_t fMVAVar_R9;
273 
274  Float_t fMVAVar_HoE;
275  Float_t fMVAVar_EoP;
278  Float_t fMVAVar_EoPout;
280 
281  Float_t fMVAVar_d0;
282  Float_t fMVAVar_ip3d;
284 
285  Float_t fMVAVar_eta;
286  Float_t fMVAVar_pt;
287  Float_t fMVAVar_rho;
288 
304 
305 };
306 
307 #endif
type
Definition: HCALResponse.h:21
Double_t isoMvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const reco::PFCandidateCollection &PFCandidates, double Rho, ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget, const reco::GsfElectronCollection &IdentifiedElectrons, const reco::MuonCollection &IdentifiedMuons, bool printDebug=kFALSE)
UInt_t GetMVABin(double eta, double pt) const
std::vector< TMVA::Reader * > fTMVAReader
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
Double_t IDIsoCombinedMvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, EcalClusterLazyTools myEcalCluster, const reco::PFCandidateCollection &PFCandidates, double Rho, ElectronEffectiveArea::ElectronEffectiveAreaTarget EATarget, bool printDebug=kFALSE)
void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimator::MVAType type)
Double_t mvaValue(const reco::GsfElectron &ele, const reco::Vertex &vertex, const TransientTrackBuilder &transientTrackBuilder, EcalClusterLazyTools myEcalCluster, bool printDebug=kFALSE)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Analysis-level electron class.
Definition: Electron.h:52
std::vector< TMVA::MethodBase * > fTMVAMethod
tuple PFCandidates