CMS 3D CMS Logo

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 
15 
16 //#define STANDALONE // <---- this line
17 
18 #ifndef EGammaMvaEleEstimator_H
19 #define EGammaMvaEleEstimator_H
20 
21 #ifndef STANDALONE
30 #endif
31 #include <vector>
32 #include <TROOT.h>
33 #include "TMVA/Factory.h"
34 #include "TMVA/Tools.h"
35 #include "TMVA/Reader.h"
36 #include "TMVA/MethodBase.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 
53  void initialize(std::string methodName,
55  Bool_t useBinnedVersion,
56  std::vector<std::string> weightsfiles);
57 
58  Bool_t isInitialized() const { return fisInitialized; }
59  UInt_t GetMVABin(double eta, double pt) const;
60 
61  void bindVariables();
62 
63 #ifndef STANDALONE
64  // for kTrig and kNonTrig algorithm
65  Double_t mvaValue(const reco::GsfElectron& ele,
66  const reco::Vertex& vertex,
67  const TransientTrackBuilder& transientTrackBuilder,
68  EcalClusterLazyTools myEcalCluster,
69  bool printDebug = kFALSE);
70 
71  // for kTrigNoIP algorithm
72  Double_t mvaValue(const reco::GsfElectron& ele,
73  const reco::Vertex& vertex,
74  double rho,
75  //const TransientTrackBuilder& transientTrackBuilder,
76  EcalClusterLazyTools myEcalCluster,
77  bool printDebug = kFALSE);
78 
79  Double_t mvaValue(const pat::Electron& ele, double rho, bool printDebug = kFALSE);
80 
81  // for kTrig, kNonTrig and kTrigNoIP algorithm
82  Double_t mvaValue(const pat::Electron& ele,
83  const reco::Vertex& vertex,
84  double rho,
85  bool useFull5x5 = kFALSE,
86  bool printDebug = kFALSE);
87 
88  Double_t isoMvaValue(const reco::GsfElectron& ele,
89  const reco::Vertex& vertex,
91  double Rho,
93  const reco::GsfElectronCollection& IdentifiedElectrons,
94  const reco::MuonCollection& IdentifiedMuons,
95  bool printDebug = kFALSE);
96 
97  Double_t IDIsoCombinedMvaValue(const reco::GsfElectron& ele,
98  const reco::Vertex& vertex,
99  const TransientTrackBuilder& transientTrackBuilder,
100  EcalClusterLazyTools myEcalCluster,
101  const reco::PFCandidateCollection& PFCandidates,
102  double Rho,
104  bool printDebug = kFALSE);
105 
106  Double_t isoMvaValue(Double_t Pt,
107  Double_t Eta,
108  Double_t Rho,
110  Double_t ChargedIso_DR0p0To0p1,
111  Double_t ChargedIso_DR0p1To0p2,
112  Double_t ChargedIso_DR0p2To0p3,
113  Double_t ChargedIso_DR0p3To0p4,
114  Double_t ChargedIso_DR0p4To0p5,
115  Double_t GammaIso_DR0p0To0p1,
116  Double_t GammaIso_DR0p1To0p2,
117  Double_t GammaIso_DR0p2To0p3,
118  Double_t GammaIso_DR0p3To0p4,
119  Double_t GammaIso_DR0p4To0p5,
120  Double_t NeutralHadronIso_DR0p0To0p1,
121  Double_t NeutralHadronIso_DR0p1To0p2,
122  Double_t NeutralHadronIso_DR0p2To0p3,
123  Double_t NeutralHadronIso_DR0p3To0p4,
124  Double_t NeutralHadronIso_DR0p4To0p5,
125  Bool_t printDebug = kFALSE);
126 #endif
127 
128  // for kTrig algo
129  Double_t mvaValue(Double_t fbrem,
130  Double_t kfchi2,
131  Int_t kfhits,
132  Double_t gsfchi2,
133  Double_t deta,
134  Double_t dphi,
135  Double_t detacalo,
136  Double_t see,
137  Double_t spp,
138  Double_t etawidth,
139  Double_t phiwidth,
140  Double_t e1x5e5x5,
141  Double_t R9,
142  Double_t HoE,
143  Double_t EoP,
144  Double_t IoEmIoP,
145  Double_t eleEoPout,
146  Double_t PreShowerOverRaw,
147  Double_t d0,
148  Double_t ip3d,
149  Double_t eta,
150  Double_t pt,
151  Bool_t printDebug = kFALSE);
152 
153  // for kTrigNoIP algo
154  Double_t mvaValue(Double_t fbrem,
155  Double_t kfchi2,
156  Int_t kfhits,
157  Double_t gsfchi2,
158  Double_t deta,
159  Double_t dphi,
160  Double_t detacalo,
161  Double_t see,
162  Double_t spp,
163  Double_t etawidth,
164  Double_t phiwidth,
165  Double_t e1x5e5x5,
166  Double_t R9,
167  Double_t HoE,
168  Double_t EoP,
169  Double_t IoEmIoP,
170  Double_t eleEoPout,
171  Double_t rho,
172  Double_t PreShowerOverRaw,
173  Double_t eta,
174  Double_t pt,
175  Bool_t printDebug = kFALSE);
176 
177  // for kNonTrig algo
178  Double_t mvaValue(Double_t fbrem,
179  Double_t kfchi2,
180  Int_t kfhits,
181  Double_t gsfchi2,
182  Double_t deta,
183  Double_t dphi,
184  Double_t detacalo,
185  Double_t see,
186  Double_t spp,
187  Double_t etawidth,
188  Double_t phiwidth,
189  Double_t e1x5e5x5,
190  Double_t R9,
191  Double_t HoE,
192  Double_t EoP,
193  Double_t IoEmIoP,
194  Double_t eleEoPout,
195  Double_t PreShowerOverRaw,
196  Double_t eta,
197  Double_t pt,
198  Bool_t printDebug = kFALSE);
199 
200  Double_t IDIsoCombinedMvaValue(Double_t fbrem,
201  Double_t kfchi2,
202  Int_t kfhits,
203  Double_t gsfchi2,
204  Double_t deta,
205  Double_t dphi,
206  Double_t detacalo,
207  Double_t see,
208  Double_t spp,
209  Double_t etawidth,
210  Double_t phiwidth,
211  Double_t OneMinusE1x5E5x5,
212  Double_t R9,
213  Double_t HoE,
214  Double_t EoP,
215  Double_t IoEmIoP,
216  Double_t eleEoPout,
217  Double_t PreShowerOverRaw,
218  Double_t d0,
219  Double_t ip3d,
220  Double_t ChargedIso_DR0p0To0p1,
221  Double_t ChargedIso_DR0p1To0p2,
222  Double_t ChargedIso_DR0p2To0p3,
223  Double_t ChargedIso_DR0p3To0p4,
224  Double_t ChargedIso_DR0p4To0p5,
225  Double_t GammaIso_DR0p0To0p1,
226  Double_t GammaIso_DR0p1To0p2,
227  Double_t GammaIso_DR0p2To0p3,
228  Double_t GammaIso_DR0p3To0p4,
229  Double_t GammaIso_DR0p4To0p5,
230  Double_t NeutralHadronIso_DR0p0To0p1,
231  Double_t NeutralHadronIso_DR0p1To0p2,
232  Double_t NeutralHadronIso_DR0p2To0p3,
233  Double_t NeutralHadronIso_DR0p3To0p4,
234  Double_t NeutralHadronIso_DR0p4To0p5,
235  Double_t Rho,
236  Double_t eta,
237  Double_t pt,
238  Bool_t printDebug = kFALSE);
239 
240 private:
241  std::vector<TMVA::Reader*> fTMVAReader;
242  std::vector<TMVA::MethodBase*> fTMVAMethod;
247  UInt_t fNMVABins;
248 
249  Float_t fMVAVar_fbrem;
250  Float_t fMVAVar_kfchi2;
251  Float_t fMVAVar_kfhits; //number of layers
252  Float_t fMVAVar_kfhitsall; //number of hits
254 
255  Float_t fMVAVar_deta;
256  Float_t fMVAVar_dphi;
258 
259  Float_t fMVAVar_see;
260  Float_t fMVAVar_spp;
264  Float_t fMVAVar_R9;
265 
266  Float_t fMVAVar_HoE;
267  Float_t fMVAVar_EoP;
270  Float_t fMVAVar_EoPout;
272 
273  Float_t fMVAVar_d0;
274  Float_t fMVAVar_ip3d;
276 
277  Float_t fMVAVar_eta;
278  Float_t fMVAVar_pt;
279  Float_t fMVAVar_rho;
280 
296 };
297 
298 #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:51
std::vector< TMVA::MethodBase * > fTMVAMethod