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 
39  public:
42 
43  enum MVAType {
44  kTrig = 0, // MVA for triggering electrons
45  kTrigNoIP = 1, // MVA for triggering electrons without IP info
46  kNonTrig = 2, // MVA for non-triggering electrons
47  kIsoRings, // Isolation MVA for non-trigger electrons
48  kTrigIDIsoCombined, // ID+Iso Combined MVA for triggering electrons
49  kTrigIDIsoCombinedPUCorrected // ID+Iso Combined MVA for triggering electrons
50  };
51 
52  void initialize( std::string methodName,
53  std::string weightsfile,
55  void initialize( std::string methodName,
57  Bool_t useBinnedVersion,
58  std::vector<std::string> weightsfiles );
59 
60  Bool_t isInitialized() const { return fisInitialized; }
61  UInt_t GetMVABin(double eta,double pt ) const;
62 
63  void bindVariables();
64 
65 #ifndef STANDALONE
66  // for kTrig and kNonTrig algorithm
67  Double_t mvaValue(const reco::GsfElectron& ele,
68  const reco::Vertex& vertex,
69  const TransientTrackBuilder& transientTrackBuilder,
70  EcalClusterLazyTools myEcalCluster,
71  bool printDebug = kFALSE);
72 
73  // for kTrigNoIP algorithm
74  Double_t mvaValue(const reco::GsfElectron& ele,
75  const reco::Vertex& vertex,
76  double rho,
77  //const TransientTrackBuilder& transientTrackBuilder,
78  EcalClusterLazyTools myEcalCluster,
79  bool printDebug = kFALSE);
80 
81  Double_t mvaValue(const pat::Electron& ele,
82  double rho,
83  bool printDebug = kFALSE);
84 
85  // for kTrig, kNonTrig and kTrigNoIP algorithm
86  Double_t mvaValue(const pat::Electron& ele,
87  const reco::Vertex& vertex,
88  double rho,
89  bool printDebug = kFALSE);
90 
91  Double_t isoMvaValue(const reco::GsfElectron& ele,
92  const reco::Vertex& vertex,
94  double Rho,
96  const reco::GsfElectronCollection &IdentifiedElectrons,
97  const reco::MuonCollection &IdentifiedMuons,
98  bool printDebug = kFALSE);
99 
100  Double_t IDIsoCombinedMvaValue(const reco::GsfElectron& ele,
101  const reco::Vertex& vertex,
102  const TransientTrackBuilder& transientTrackBuilder,
103  EcalClusterLazyTools myEcalCluster,
105  double Rho,
107  bool printDebug = kFALSE);
108 
109  Double_t isoMvaValue(Double_t Pt,
110  Double_t Eta,
111  Double_t Rho,
113  Double_t ChargedIso_DR0p0To0p1,
114  Double_t ChargedIso_DR0p1To0p2,
115  Double_t ChargedIso_DR0p2To0p3,
116  Double_t ChargedIso_DR0p3To0p4,
117  Double_t ChargedIso_DR0p4To0p5,
118  Double_t GammaIso_DR0p0To0p1,
119  Double_t GammaIso_DR0p1To0p2,
120  Double_t GammaIso_DR0p2To0p3,
121  Double_t GammaIso_DR0p3To0p4,
122  Double_t GammaIso_DR0p4To0p5,
123  Double_t NeutralHadronIso_DR0p0To0p1,
124  Double_t NeutralHadronIso_DR0p1To0p2,
125  Double_t NeutralHadronIso_DR0p2To0p3,
126  Double_t NeutralHadronIso_DR0p3To0p4,
127  Double_t NeutralHadronIso_DR0p4To0p5,
128  Bool_t printDebug = kFALSE );
129 #endif
130 
131  // for kTrig algo
132  Double_t mvaValue(Double_t fbrem,
133  Double_t kfchi2,
134  Int_t kfhits,
135  Double_t gsfchi2,
136  Double_t deta,
137  Double_t dphi,
138  Double_t detacalo,
139  Double_t see,
140  Double_t spp,
141  Double_t etawidth,
142  Double_t phiwidth,
143  Double_t e1x5e5x5,
144  Double_t R9,
145  Double_t HoE,
146  Double_t EoP,
147  Double_t IoEmIoP,
148  Double_t eleEoPout,
149  Double_t PreShowerOverRaw,
150  Double_t d0,
151  Double_t ip3d,
152  Double_t eta,
153  Double_t pt,
154  Bool_t printDebug = kFALSE );
155 
156  // for kTrigNoIP algo
157  Double_t mvaValue(Double_t fbrem,
158  Double_t kfchi2,
159  Int_t kfhits,
160  Double_t gsfchi2,
161  Double_t deta,
162  Double_t dphi,
163  Double_t detacalo,
164  Double_t see,
165  Double_t spp,
166  Double_t etawidth,
167  Double_t phiwidth,
168  Double_t e1x5e5x5,
169  Double_t R9,
170  Double_t HoE,
171  Double_t EoP,
172  Double_t IoEmIoP,
173  Double_t eleEoPout,
174  Double_t rho,
175  Double_t PreShowerOverRaw,
176  Double_t eta,
177  Double_t pt,
178  Bool_t printDebug = kFALSE );
179 
180  // for kNonTrig algo
181  Double_t mvaValue(Double_t fbrem,
182  Double_t kfchi2,
183  Int_t kfhits,
184  Double_t gsfchi2,
185  Double_t deta,
186  Double_t dphi,
187  Double_t detacalo,
188  Double_t see,
189  Double_t spp,
190  Double_t etawidth,
191  Double_t phiwidth,
192  Double_t e1x5e5x5,
193  Double_t R9,
194  Double_t HoE,
195  Double_t EoP,
196  Double_t IoEmIoP,
197  Double_t eleEoPout,
198  Double_t PreShowerOverRaw,
199  Double_t eta,
200  Double_t pt,
201  Bool_t printDebug = kFALSE );
202 
203  Double_t IDIsoCombinedMvaValue(Double_t fbrem,
204  Double_t kfchi2,
205  Int_t kfhits,
206  Double_t gsfchi2,
207  Double_t deta,
208  Double_t dphi,
209  Double_t detacalo,
210  Double_t see,
211  Double_t spp,
212  Double_t etawidth,
213  Double_t phiwidth,
214  Double_t OneMinusE1x5E5x5,
215  Double_t R9,
216  Double_t HoE,
217  Double_t EoP,
218  Double_t IoEmIoP,
219  Double_t eleEoPout,
220  Double_t PreShowerOverRaw,
221  Double_t d0,
222  Double_t ip3d,
223  Double_t ChargedIso_DR0p0To0p1,
224  Double_t ChargedIso_DR0p1To0p2,
225  Double_t ChargedIso_DR0p2To0p3,
226  Double_t ChargedIso_DR0p3To0p4,
227  Double_t ChargedIso_DR0p4To0p5,
228  Double_t GammaIso_DR0p0To0p1,
229  Double_t GammaIso_DR0p1To0p2,
230  Double_t GammaIso_DR0p2To0p3,
231  Double_t GammaIso_DR0p3To0p4,
232  Double_t GammaIso_DR0p4To0p5,
233  Double_t NeutralHadronIso_DR0p0To0p1,
234  Double_t NeutralHadronIso_DR0p1To0p2,
235  Double_t NeutralHadronIso_DR0p2To0p3,
236  Double_t NeutralHadronIso_DR0p3To0p4,
237  Double_t NeutralHadronIso_DR0p4To0p5,
238  Double_t Rho,
239  Double_t eta,
240  Double_t pt,
241  Bool_t printDebug = kFALSE);
242 
243 
244 
245  private:
246 
247  std::vector<TMVA::Reader*> fTMVAReader;
248  std::string fMethodname;
253 
254  Float_t fMVAVar_fbrem;
255  Float_t fMVAVar_kfchi2;
256  Float_t fMVAVar_kfhits; //number of layers
257  Float_t fMVAVar_kfhitsall; //number of hits
259 
260  Float_t fMVAVar_deta;
261  Float_t fMVAVar_dphi;
263 
264  Float_t fMVAVar_see;
265  Float_t fMVAVar_spp;
269  Float_t fMVAVar_R9;
270 
271  Float_t fMVAVar_HoE;
272  Float_t fMVAVar_EoP;
275  Float_t fMVAVar_EoPout;
277 
278  Float_t fMVAVar_d0;
279  Float_t fMVAVar_ip3d;
281 
282  Float_t fMVAVar_eta;
283  Float_t fMVAVar_pt;
284  Float_t fMVAVar_rho;
285 
301 
302 };
303 
304 #endif
type
Definition: HCALResponse.h:22
Definition: DDAxes.h:10
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)
T eta() const
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)
unsigned int UInt_t
Definition: FUTypes.h:12
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Analysis-level electron class.
Definition: Electron.h:52
tuple PFCandidates