CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EGammaMvaEleEstimator.cc
Go to the documentation of this file.
1 #include <TFile.h>
3 #include <cmath>
4 #include <vector>
5 using namespace std;
6 
7 #ifndef STANDALONE
23 using namespace reco;
24 #endif
25 
26 //--------------------------------------------------------------------------------------------------
28 fMethodname("BDTG method"),
29 fisInitialized(kFALSE),
30 fMVAType(kTrig),
31 fUseBinnedVersion(kTRUE),
32 fNMVABins(0)
33 {
34  // Constructor.
35 }
36 
37 //--------------------------------------------------------------------------------------------------
39 {
40  for (unsigned int i=0;i<fTMVAReader.size(); ++i) {
41  if (fTMVAReader[i]) delete fTMVAReader[i];
42  }
43 }
44 
45 //--------------------------------------------------------------------------------------------------
46 void EGammaMvaEleEstimator::initialize( std::string methodName,
47  std::string weightsfile,
49 {
50 
51  std::vector<std::string> tempWeightFileVector;
52  tempWeightFileVector.push_back(weightsfile);
53  initialize(methodName,type,kFALSE,tempWeightFileVector);
54 }
55 
56 
57 //--------------------------------------------------------------------------------------------------
58 void EGammaMvaEleEstimator::initialize( std::string methodName,
60  Bool_t useBinnedVersion,
61  std::vector<std::string> weightsfiles
62  ) {
63 
64  //clean up first
65  for (unsigned int i=0;i<fTMVAReader.size(); ++i) {
66  if (fTMVAReader[i]) delete fTMVAReader[i];
67  }
68  fTMVAReader.clear();
69 
70  //initialize
71  fisInitialized = kTRUE;
72  fMVAType = type;
73  fMethodname = methodName;
74  fUseBinnedVersion = useBinnedVersion;
75 
76  //Define expected number of bins
77  UInt_t ExpectedNBins = 0;
78  if (!fUseBinnedVersion) {
79  ExpectedNBins = 1;
80  } else if (type == kTrig) {
81  ExpectedNBins = 6;
82  }else if (type == kTrigNoIP) {
83  ExpectedNBins = 6;
84  } else if (type == kNonTrig) {
85  ExpectedNBins = 6;
86  } else if (type == kIsoRings) {
87  ExpectedNBins = 4;
88  } else if (type == kTrigIDIsoCombined) {
89  ExpectedNBins = 6;
90  } else if (type == kTrigIDIsoCombinedPUCorrected) {
91  ExpectedNBins = 6;
92  }
93 
94  fNMVABins = ExpectedNBins;
95 
96  //Check number of weight files given
97  if (fNMVABins != weightsfiles.size() ) {
98  std::cout << "Error: Expected Number of bins = " << fNMVABins << " does not equal to weightsfiles.size() = "
99  << weightsfiles.size() << std::endl;
100 
101  #ifndef STANDALONE
102  assert(fNMVABins == weightsfiles.size());
103  #endif
104  }
105 
106  //Loop over all bins
107  for (unsigned int i=0;i<fNMVABins; ++i) {
108 
109  TMVA::Reader *tmpTMVAReader = new TMVA::Reader( "!Color:!Silent:Error" );
110  tmpTMVAReader->SetVerbose(kTRUE);
111 
112  if (type == kTrig) {
113  // Pure tracking variables
114  tmpTMVAReader->AddVariable("fbrem", &fMVAVar_fbrem);
115  tmpTMVAReader->AddVariable("kfchi2", &fMVAVar_kfchi2);
116  tmpTMVAReader->AddVariable("kfhits", &fMVAVar_kfhits);
117  tmpTMVAReader->AddVariable("gsfchi2", &fMVAVar_gsfchi2);
118 
119  // Geometrical matchings
120  tmpTMVAReader->AddVariable("deta", &fMVAVar_deta);
121  tmpTMVAReader->AddVariable("dphi", &fMVAVar_dphi);
122  tmpTMVAReader->AddVariable("detacalo", &fMVAVar_detacalo);
123 
124  // Pure ECAL -> shower shapes
125  tmpTMVAReader->AddVariable("see", &fMVAVar_see);
126  tmpTMVAReader->AddVariable("spp", &fMVAVar_spp);
127  tmpTMVAReader->AddVariable("etawidth", &fMVAVar_etawidth);
128  tmpTMVAReader->AddVariable("phiwidth", &fMVAVar_phiwidth);
129  tmpTMVAReader->AddVariable("e1x5e5x5", &fMVAVar_OneMinusE1x5E5x5);
130  tmpTMVAReader->AddVariable("R9", &fMVAVar_R9);
131 
132  // Energy matching
133  tmpTMVAReader->AddVariable("HoE", &fMVAVar_HoE);
134  tmpTMVAReader->AddVariable("EoP", &fMVAVar_EoP);
135  tmpTMVAReader->AddVariable("IoEmIoP", &fMVAVar_IoEmIoP);
136  tmpTMVAReader->AddVariable("eleEoPout", &fMVAVar_eleEoPout);
137  if(i == 2 || i == 5)
138  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
139 
140  if(!fUseBinnedVersion)
141  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
142 
143  // IP
144  tmpTMVAReader->AddVariable("d0", &fMVAVar_d0);
145  tmpTMVAReader->AddVariable("ip3d", &fMVAVar_ip3d);
146 
147  tmpTMVAReader->AddSpectator("eta", &fMVAVar_eta);
148  tmpTMVAReader->AddSpectator("pt", &fMVAVar_pt);
149  }
150 
151  if (type == kTrigNoIP) {
152 
153 
154  // Pure tracking variables
155  tmpTMVAReader->AddVariable("fbrem", &fMVAVar_fbrem);
156  tmpTMVAReader->AddVariable("kfchi2", &fMVAVar_kfchi2);
157  tmpTMVAReader->AddVariable("kfhits", &fMVAVar_kfhits);
158  tmpTMVAReader->AddVariable("gsfchi2", &fMVAVar_gsfchi2);
159 
160  // Geometrical matchings
161  tmpTMVAReader->AddVariable("deta", &fMVAVar_deta);
162  tmpTMVAReader->AddVariable("dphi", &fMVAVar_dphi);
163  tmpTMVAReader->AddVariable("detacalo", &fMVAVar_detacalo);
164 
165  // Pure ECAL -> shower shapes
166  tmpTMVAReader->AddVariable("see", &fMVAVar_see);
167  tmpTMVAReader->AddVariable("spp", &fMVAVar_spp);
168  tmpTMVAReader->AddVariable("etawidth", &fMVAVar_etawidth);
169  tmpTMVAReader->AddVariable("phiwidth", &fMVAVar_phiwidth);
170  tmpTMVAReader->AddVariable("e1x5e5x5", &fMVAVar_OneMinusE1x5E5x5);
171  tmpTMVAReader->AddVariable("R9", &fMVAVar_R9);
172 
173  // Energy matching
174  tmpTMVAReader->AddVariable("HoE", &fMVAVar_HoE);
175  tmpTMVAReader->AddVariable("EoP", &fMVAVar_EoP);
176  tmpTMVAReader->AddVariable("IoEmIoP", &fMVAVar_IoEmIoP);
177  tmpTMVAReader->AddVariable("eleEoPout", &fMVAVar_eleEoPout);
178  tmpTMVAReader->AddVariable("rho", &fMVAVar_rho);
179 
180  if(i == 2 || i == 5)
181  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
182 
183  if(!fUseBinnedVersion)
184  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
185 
186  tmpTMVAReader->AddSpectator("eta", &fMVAVar_eta);
187  tmpTMVAReader->AddSpectator("pt", &fMVAVar_pt);
188 
189  }
190 
191  if (type == kNonTrig) {
192 
193  // Pure tracking variables
194  tmpTMVAReader->AddVariable("fbrem", &fMVAVar_fbrem);
195  tmpTMVAReader->AddVariable("kfchi2", &fMVAVar_kfchi2);
196  tmpTMVAReader->AddVariable("kfhits", &fMVAVar_kfhits);
197  tmpTMVAReader->AddVariable("gsfchi2", &fMVAVar_gsfchi2);
198 
199  // Geometrical matchings
200  tmpTMVAReader->AddVariable("deta", &fMVAVar_deta);
201  tmpTMVAReader->AddVariable("dphi", &fMVAVar_dphi);
202  tmpTMVAReader->AddVariable("detacalo", &fMVAVar_detacalo);
203 
204  // Pure ECAL -> shower shapes
205  tmpTMVAReader->AddVariable("see", &fMVAVar_see);
206  tmpTMVAReader->AddVariable("spp", &fMVAVar_spp);
207  tmpTMVAReader->AddVariable("etawidth", &fMVAVar_etawidth);
208  tmpTMVAReader->AddVariable("phiwidth", &fMVAVar_phiwidth);
209  tmpTMVAReader->AddVariable("e1x5e5x5", &fMVAVar_OneMinusE1x5E5x5);
210  tmpTMVAReader->AddVariable("R9", &fMVAVar_R9);
211 
212  // Energy matching
213  tmpTMVAReader->AddVariable("HoE", &fMVAVar_HoE);
214  tmpTMVAReader->AddVariable("EoP", &fMVAVar_EoP);
215  tmpTMVAReader->AddVariable("IoEmIoP", &fMVAVar_IoEmIoP);
216  tmpTMVAReader->AddVariable("eleEoPout", &fMVAVar_eleEoPout);
217  if(i == 2 || i == 5)
218  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
219 
220  if(!fUseBinnedVersion)
221  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
222 
223  tmpTMVAReader->AddSpectator("eta", &fMVAVar_eta);
224  tmpTMVAReader->AddSpectator("pt", &fMVAVar_pt);
225 
226  }
227 
228  if (type == kIsoRings) {
229  tmpTMVAReader->AddVariable( "ChargedIso_DR0p0To0p1", &fMVAVar_ChargedIso_DR0p0To0p1 );
230  tmpTMVAReader->AddVariable( "ChargedIso_DR0p1To0p2", &fMVAVar_ChargedIso_DR0p1To0p2 );
231  tmpTMVAReader->AddVariable( "ChargedIso_DR0p2To0p3", &fMVAVar_ChargedIso_DR0p2To0p3 );
232  tmpTMVAReader->AddVariable( "ChargedIso_DR0p3To0p4", &fMVAVar_ChargedIso_DR0p3To0p4 );
233  tmpTMVAReader->AddVariable( "ChargedIso_DR0p4To0p5", &fMVAVar_ChargedIso_DR0p4To0p5 );
234  tmpTMVAReader->AddVariable( "GammaIso_DR0p0To0p1", &fMVAVar_GammaIso_DR0p0To0p1 );
235  tmpTMVAReader->AddVariable( "GammaIso_DR0p1To0p2", &fMVAVar_GammaIso_DR0p1To0p2 );
236  tmpTMVAReader->AddVariable( "GammaIso_DR0p2To0p3", &fMVAVar_GammaIso_DR0p2To0p3 );
237  tmpTMVAReader->AddVariable( "GammaIso_DR0p3To0p4", &fMVAVar_GammaIso_DR0p3To0p4 );
238  tmpTMVAReader->AddVariable( "GammaIso_DR0p4To0p5", &fMVAVar_GammaIso_DR0p4To0p5 );
239  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p0To0p1", &fMVAVar_NeutralHadronIso_DR0p0To0p1 );
240  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p1To0p2", &fMVAVar_NeutralHadronIso_DR0p1To0p2 );
241  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p2To0p3", &fMVAVar_NeutralHadronIso_DR0p2To0p3 );
242  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p3To0p4", &fMVAVar_NeutralHadronIso_DR0p3To0p4 );
243  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p4To0p5", &fMVAVar_NeutralHadronIso_DR0p4To0p5 );
244  tmpTMVAReader->AddSpectator("eta", &fMVAVar_eta);
245  tmpTMVAReader->AddSpectator("pt", &fMVAVar_pt);
246  }
247 
248 
249  if (type == kTrigIDIsoCombinedPUCorrected) {
250 
251  // Pure tracking variables
252  tmpTMVAReader->AddVariable("fbrem", &fMVAVar_fbrem);
253  tmpTMVAReader->AddVariable("kfchi2", &fMVAVar_kfchi2);
254  tmpTMVAReader->AddVariable("kflayers", &fMVAVar_kfhits);
255  tmpTMVAReader->AddVariable("gsfchi2", &fMVAVar_gsfchi2);
256 
257  // Geometrical matchings
258  tmpTMVAReader->AddVariable("deta", &fMVAVar_deta);
259  tmpTMVAReader->AddVariable("dphi", &fMVAVar_dphi);
260  tmpTMVAReader->AddVariable("detacalo", &fMVAVar_detacalo);
261 
262  // Pure ECAL -> shower shapes
263  tmpTMVAReader->AddVariable("see", &fMVAVar_see);
264  tmpTMVAReader->AddVariable("spp", &fMVAVar_spp);
265  tmpTMVAReader->AddVariable("etawidth", &fMVAVar_etawidth);
266  tmpTMVAReader->AddVariable("phiwidth", &fMVAVar_phiwidth);
267  tmpTMVAReader->AddVariable("OneMinusSeedE1x5OverE5x5", &fMVAVar_OneMinusE1x5E5x5);
268  tmpTMVAReader->AddVariable("R9", &fMVAVar_R9);
269 
270  // Energy matching
271  tmpTMVAReader->AddVariable("HoE", &fMVAVar_HoE);
272  tmpTMVAReader->AddVariable("EoP", &fMVAVar_EoP);
273  tmpTMVAReader->AddVariable("IoEmIoP", &fMVAVar_IoEmIoP);
274  tmpTMVAReader->AddVariable("EEleoPout", &fMVAVar_eleEoPout);
275  if(i == 2 || i == 5) {
276  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
277  }
278  if(!fUseBinnedVersion) {
279  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
280  }
281 
282  // IP
283  tmpTMVAReader->AddVariable("d0", &fMVAVar_d0);
284  tmpTMVAReader->AddVariable("ip3d", &fMVAVar_ip3d);
285 
286  //isolation variables
287  tmpTMVAReader->AddVariable( "ChargedIso_DR0p0To0p1", &fMVAVar_ChargedIso_DR0p0To0p1 );
288  tmpTMVAReader->AddVariable( "ChargedIso_DR0p1To0p2", &fMVAVar_ChargedIso_DR0p1To0p2 );
289  tmpTMVAReader->AddVariable( "ChargedIso_DR0p2To0p3", &fMVAVar_ChargedIso_DR0p2To0p3 );
290  tmpTMVAReader->AddVariable( "ChargedIso_DR0p3To0p4", &fMVAVar_ChargedIso_DR0p3To0p4 );
291  tmpTMVAReader->AddVariable( "ChargedIso_DR0p4To0p5", &fMVAVar_ChargedIso_DR0p4To0p5 );
292  tmpTMVAReader->AddVariable( "GammaIso_DR0p0To0p1", &fMVAVar_GammaIso_DR0p0To0p1 );
293  tmpTMVAReader->AddVariable( "GammaIso_DR0p1To0p2", &fMVAVar_GammaIso_DR0p1To0p2 );
294  tmpTMVAReader->AddVariable( "GammaIso_DR0p2To0p3", &fMVAVar_GammaIso_DR0p2To0p3 );
295  tmpTMVAReader->AddVariable( "GammaIso_DR0p3To0p4", &fMVAVar_GammaIso_DR0p3To0p4 );
296  tmpTMVAReader->AddVariable( "GammaIso_DR0p4To0p5", &fMVAVar_GammaIso_DR0p4To0p5 );
297  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p0To0p1", &fMVAVar_NeutralHadronIso_DR0p0To0p1 );
298  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p1To0p2", &fMVAVar_NeutralHadronIso_DR0p1To0p2 );
299  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p2To0p3", &fMVAVar_NeutralHadronIso_DR0p2To0p3 );
300  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p3To0p4", &fMVAVar_NeutralHadronIso_DR0p3To0p4 );
301  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p4To0p5", &fMVAVar_NeutralHadronIso_DR0p4To0p5 );
302 
303  //spectators
304  tmpTMVAReader->AddSpectator("eta", &fMVAVar_eta);
305  tmpTMVAReader->AddSpectator("pt", &fMVAVar_pt);
306 
307  }
308 
309  if (type == kTrigIDIsoCombined) {
310 
311  // Pure tracking variables
312  tmpTMVAReader->AddVariable("fbrem", &fMVAVar_fbrem);
313  tmpTMVAReader->AddVariable("kfchi2", &fMVAVar_kfchi2);
314  tmpTMVAReader->AddVariable("kflayers", &fMVAVar_kfhits);
315  tmpTMVAReader->AddVariable("gsfchi2", &fMVAVar_gsfchi2);
316 
317  // Geometrical matchings
318  tmpTMVAReader->AddVariable("deta", &fMVAVar_deta);
319  tmpTMVAReader->AddVariable("dphi", &fMVAVar_dphi);
320  tmpTMVAReader->AddVariable("detacalo", &fMVAVar_detacalo);
321 
322  // Pure ECAL -> shower shapes
323  tmpTMVAReader->AddVariable("see", &fMVAVar_see);
324  tmpTMVAReader->AddVariable("spp", &fMVAVar_spp);
325  tmpTMVAReader->AddVariable("etawidth", &fMVAVar_etawidth);
326  tmpTMVAReader->AddVariable("phiwidth", &fMVAVar_phiwidth);
327  tmpTMVAReader->AddVariable("OneMinusSeedE1x5OverE5x5", &fMVAVar_OneMinusE1x5E5x5);
328  tmpTMVAReader->AddVariable("R9", &fMVAVar_R9);
329 
330  // Energy matching
331  tmpTMVAReader->AddVariable("HoE", &fMVAVar_HoE);
332  tmpTMVAReader->AddVariable("EoP", &fMVAVar_EoP);
333  tmpTMVAReader->AddVariable("IoEmIoP", &fMVAVar_IoEmIoP);
334  tmpTMVAReader->AddVariable("EEleoPout", &fMVAVar_eleEoPout);
335  if(i == 2 || i == 5) {
336  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
337  }
338  if(!fUseBinnedVersion) {
339  tmpTMVAReader->AddVariable("PreShowerOverRaw",&fMVAVar_PreShowerOverRaw);
340  }
341 
342  // IP
343  tmpTMVAReader->AddVariable("d0", &fMVAVar_d0);
344  tmpTMVAReader->AddVariable("ip3d", &fMVAVar_ip3d);
345 
346  //isolation variables
347  tmpTMVAReader->AddVariable( "ChargedIso_DR0p0To0p1", &fMVAVar_ChargedIso_DR0p0To0p1 );
348  tmpTMVAReader->AddVariable( "ChargedIso_DR0p1To0p2", &fMVAVar_ChargedIso_DR0p1To0p2 );
349  tmpTMVAReader->AddVariable( "ChargedIso_DR0p2To0p3", &fMVAVar_ChargedIso_DR0p2To0p3 );
350  tmpTMVAReader->AddVariable( "ChargedIso_DR0p3To0p4", &fMVAVar_ChargedIso_DR0p3To0p4 );
351  tmpTMVAReader->AddVariable( "ChargedIso_DR0p4To0p5", &fMVAVar_ChargedIso_DR0p4To0p5 );
352  tmpTMVAReader->AddVariable( "GammaIso_DR0p0To0p1", &fMVAVar_GammaIso_DR0p0To0p1 );
353  tmpTMVAReader->AddVariable( "GammaIso_DR0p1To0p2", &fMVAVar_GammaIso_DR0p1To0p2 );
354  tmpTMVAReader->AddVariable( "GammaIso_DR0p2To0p3", &fMVAVar_GammaIso_DR0p2To0p3 );
355  tmpTMVAReader->AddVariable( "GammaIso_DR0p3To0p4", &fMVAVar_GammaIso_DR0p3To0p4 );
356  tmpTMVAReader->AddVariable( "GammaIso_DR0p4To0p5", &fMVAVar_GammaIso_DR0p4To0p5 );
357  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p0To0p1", &fMVAVar_NeutralHadronIso_DR0p0To0p1 );
358  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p1To0p2", &fMVAVar_NeutralHadronIso_DR0p1To0p2 );
359  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p2To0p3", &fMVAVar_NeutralHadronIso_DR0p2To0p3 );
360  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p3To0p4", &fMVAVar_NeutralHadronIso_DR0p3To0p4 );
361  tmpTMVAReader->AddVariable( "NeutralHadronIso_DR0p4To0p5", &fMVAVar_NeutralHadronIso_DR0p4To0p5 );
362  tmpTMVAReader->AddVariable( "rho", &fMVAVar_rho );
363 
364  //spectators
365  tmpTMVAReader->AddSpectator("eta", &fMVAVar_eta);
366  tmpTMVAReader->AddSpectator("pt", &fMVAVar_pt);
367 
368  }
369 
370 
371 
372  tmpTMVAReader->BookMVA(fMethodname , weightsfiles[i]);
373  std::cout << "MVABin " << i << " : MethodName = " << fMethodname
374  << " , type == " << type << " , "
375  << "Load weights file : " << weightsfiles[i]
376  << std::endl;
377  fTMVAReader.push_back(tmpTMVAReader);
378  }
379  std::cout << "Electron ID MVA Completed\n";
380 
381 }
382 
383 
384 //--------------------------------------------------------------------------------------------------
385 UInt_t EGammaMvaEleEstimator::GetMVABin( double eta, double pt) const {
386 
387  //Default is to return the first bin
388  unsigned int bin = 0;
389 
391  if (pt < 10 && fabs(eta) < 1.479) bin = 0;
392  if (pt < 10 && fabs(eta) >= 1.479) bin = 1;
393  if (pt >= 10 && fabs(eta) < 1.479) bin = 2;
394  if (pt >= 10 && fabs(eta) >= 1.479) bin = 3;
395  }
396 
398  bin = 0;
399  if (pt < 10 && fabs(eta) < 0.8) bin = 0;
400  if (pt < 10 && fabs(eta) >= 0.8 && fabs(eta) < 1.479 ) bin = 1;
401  if (pt < 10 && fabs(eta) >= 1.479) bin = 2;
402  if (pt >= 10 && fabs(eta) < 0.8) bin = 3;
403  if (pt >= 10 && fabs(eta) >= 0.8 && fabs(eta) < 1.479 ) bin = 4;
404  if (pt >= 10 && fabs(eta) >= 1.479) bin = 5;
405  }
406 
407 
412  ) {
413  bin = 0;
414  if (pt < 20 && fabs(eta) < 0.8) bin = 0;
415  if (pt < 20 && fabs(eta) >= 0.8 && fabs(eta) < 1.479 ) bin = 1;
416  if (pt < 20 && fabs(eta) >= 1.479) bin = 2;
417  if (pt >= 20 && fabs(eta) < 0.8) bin = 3;
418  if (pt >= 20 && fabs(eta) >= 0.8 && fabs(eta) < 1.479 ) bin = 4;
419  if (pt >= 20 && fabs(eta) >= 1.479) bin = 5;
420  }
421 
422 
423 
424  return bin;
425 }
426 
427 
428 //--------------------------------------------------------------------------------------------------
429 // for kTrig algorithm
430 Double_t EGammaMvaEleEstimator::mvaValue(Double_t fbrem,
431  Double_t kfchi2,
432  Int_t kfhits,
433  Double_t gsfchi2,
434  Double_t deta,
435  Double_t dphi,
436  Double_t detacalo,
437  //Double_t dphicalo,
438  Double_t see,
439  Double_t spp,
440  Double_t etawidth,
441  Double_t phiwidth,
442  Double_t OneMinusE1x5E5x5,
443  Double_t R9,
444  //Int_t nbrems,
445  Double_t HoE,
446  Double_t EoP,
447  Double_t IoEmIoP,
448  Double_t eleEoPout,
449  Double_t PreShowerOverRaw,
450  //Double_t EoPout,
451  Double_t d0,
452  Double_t ip3d,
453  Double_t eta,
454  Double_t pt,
455  Bool_t printDebug) {
456 
457  if (!fisInitialized) {
458  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
459  return -9999;
460  }
461 
463  std::cout << "Error: This method should be called for kTrig MVA only" << endl;
464  return -9999;
465  }
466 
467  fMVAVar_fbrem = fbrem;
468  fMVAVar_kfchi2 = kfchi2;
469  fMVAVar_kfhits = float(kfhits); // BTD does not support int variables
470  fMVAVar_gsfchi2 = gsfchi2;
471 
472  fMVAVar_deta = deta;
473  fMVAVar_dphi = dphi;
474  fMVAVar_detacalo = detacalo;
475 
476 
477  fMVAVar_see = see;
478  fMVAVar_spp = spp;
479  fMVAVar_etawidth = etawidth;
480  fMVAVar_phiwidth = phiwidth;
481  fMVAVar_OneMinusE1x5E5x5 = OneMinusE1x5E5x5;
482  fMVAVar_R9 = R9;
483 
484 
485  fMVAVar_HoE = HoE;
486  fMVAVar_EoP = EoP;
487  fMVAVar_IoEmIoP = IoEmIoP;
488  fMVAVar_eleEoPout = eleEoPout;
489  fMVAVar_PreShowerOverRaw= PreShowerOverRaw;
490 
491  fMVAVar_d0 = d0;
492  fMVAVar_ip3d = ip3d;
493  fMVAVar_eta = eta;
494  fMVAVar_pt = pt;
495 
496 
497  bindVariables();
498  Double_t mva = -9999;
499  if (fUseBinnedVersion) {
501  } else {
502  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
503  }
504 
505  if(printDebug) {
506  cout << " *** Inside the class fMethodname " << fMethodname << endl;
507  cout << " fbrem " << fMVAVar_fbrem
508  << " kfchi2 " << fMVAVar_kfchi2
509  << " mykfhits " << fMVAVar_kfhits
510  << " gsfchi2 " << fMVAVar_gsfchi2
511  << " deta " << fMVAVar_deta
512  << " dphi " << fMVAVar_dphi
513  << " detacalo " << fMVAVar_detacalo
514  << " see " << fMVAVar_see
515  << " spp " << fMVAVar_spp
516  << " etawidth " << fMVAVar_etawidth
517  << " phiwidth " << fMVAVar_phiwidth
518  << " OneMinusE1x5E5x5 " << fMVAVar_OneMinusE1x5E5x5
519  << " R9 " << fMVAVar_R9
520  << " HoE " << fMVAVar_HoE
521  << " EoP " << fMVAVar_EoP
522  << " IoEmIoP " << fMVAVar_IoEmIoP
523  << " eleEoPout " << fMVAVar_eleEoPout
524  << " PreShowerOverRaw " << fMVAVar_PreShowerOverRaw
525  << " d0 " << fMVAVar_d0
526  << " ip3d " << fMVAVar_ip3d
527  << " eta " << fMVAVar_eta
528  << " pt " << fMVAVar_pt << endl;
529  cout << " ### MVA " << mva << endl;
530  }
531 
532 
533  return mva;
534 }
535 
536 //--------------------------------------------------------------------------------------------------------
537 // for kTrigNoIP algorithm
538 Double_t EGammaMvaEleEstimator::mvaValue(Double_t fbrem,
539  Double_t kfchi2,
540  Int_t kfhits,
541  Double_t gsfchi2,
542  Double_t deta,
543  Double_t dphi,
544  Double_t detacalo,
545  Double_t see,
546  Double_t spp,
547  Double_t etawidth,
548  Double_t phiwidth,
549  Double_t e1x5e5x5,
550  Double_t R9,
551  Double_t HoE,
552  Double_t EoP,
553  Double_t IoEmIoP,
554  Double_t eleEoPout,
555  Double_t rho,
556  Double_t PreShowerOverRaw,
557  Double_t eta,
558  Double_t pt,
559  Bool_t printDebug) {
560 
561  if (!fisInitialized) {
562  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
563  return -9999;
564  }
565 
567  std::cout << "Error: This method should be called for kTrigNoIP MVA only" << endl;
568  return -9999;
569  }
570 
571  fMVAVar_fbrem = fbrem;
572  fMVAVar_kfchi2 = kfchi2;
573  fMVAVar_kfhits = float(kfhits); // BTD does not support int variables
574  fMVAVar_gsfchi2 = gsfchi2;
575 
576  fMVAVar_deta = deta;
577  fMVAVar_dphi = dphi;
578  fMVAVar_detacalo = detacalo;
579 
580  fMVAVar_see = see;
581  fMVAVar_spp = spp;
582  fMVAVar_etawidth = etawidth;
583  fMVAVar_phiwidth = phiwidth;
584  fMVAVar_OneMinusE1x5E5x5 = e1x5e5x5;
585  fMVAVar_R9 = R9;
586 
587  fMVAVar_HoE = HoE;
588  fMVAVar_EoP = EoP;
589  fMVAVar_IoEmIoP = IoEmIoP;
590  fMVAVar_eleEoPout = eleEoPout;
591  fMVAVar_rho = rho;
592  fMVAVar_PreShowerOverRaw= PreShowerOverRaw;
593 
594 
595  fMVAVar_eta = eta;
596  fMVAVar_pt = pt;
597 
598 
599  bindVariables();
600  Double_t mva = -9999;
601  if (fUseBinnedVersion) {
603  } else {
604  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
605  }
606 
607  if(printDebug) {
608  cout << " *** Inside the class fMethodname " << fMethodname << endl;
609  cout << " fbrem " << fMVAVar_fbrem
610  << " kfchi2 " << fMVAVar_kfchi2
611  << " mykfhits " << fMVAVar_kfhits
612  << " gsfchi2 " << fMVAVar_gsfchi2
613  << " deta " << fMVAVar_deta
614  << " dphi " << fMVAVar_dphi
615  << " detacalo " << fMVAVar_detacalo
616  << " see " << fMVAVar_see
617  << " spp " << fMVAVar_spp
618  << " etawidth " << fMVAVar_etawidth
619  << " phiwidth " << fMVAVar_phiwidth
620  << " e1x5e5x5 " << fMVAVar_OneMinusE1x5E5x5
621  << " R9 " << fMVAVar_R9
622  << " HoE " << fMVAVar_HoE
623  << " EoP " << fMVAVar_EoP
624  << " IoEmIoP " << fMVAVar_IoEmIoP
625  << " eleEoPout " << fMVAVar_eleEoPout
626  << " rho " << fMVAVar_rho
627  << " PreShowerOverRaw " << fMVAVar_PreShowerOverRaw
628  << " eta " << fMVAVar_eta
629  << " pt " << fMVAVar_pt << endl;
630  cout << " ### MVA " << mva << endl;
631  }
632 
633 
634  return mva;
635 }
636 
637 //--------------------------------------------------------------------------------------------------
638 // for kNonTrig algorithm
639 Double_t EGammaMvaEleEstimator::mvaValue(Double_t fbrem,
640  Double_t kfchi2,
641  Int_t kfhits,
642  Double_t gsfchi2,
643  Double_t deta,
644  Double_t dphi,
645  Double_t detacalo,
646  //Double_t dphicalo,
647  Double_t see,
648  Double_t spp,
649  Double_t etawidth,
650  Double_t phiwidth,
651  Double_t OneMinusE1x5E5x5,
652  Double_t R9,
653  //Int_t nbrems,
654  Double_t HoE,
655  Double_t EoP,
656  Double_t IoEmIoP,
657  Double_t eleEoPout,
658  Double_t PreShowerOverRaw,
659  //Double_t EoPout,
660  Double_t eta,
661  Double_t pt,
662  Bool_t printDebug) {
663 
664  if (!fisInitialized) {
665  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
666  return -9999;
667  }
668 
670  std::cout << "Error: This method should be called for kNonTrig MVA only" << endl;
671  return -9999;
672  }
673 
674  fMVAVar_fbrem = fbrem;
675  fMVAVar_kfchi2 = kfchi2;
676  fMVAVar_kfhits = float(kfhits); // BTD does not support int variables
677  fMVAVar_gsfchi2 = gsfchi2;
678 
679  fMVAVar_deta = deta;
680  fMVAVar_dphi = dphi;
681  fMVAVar_detacalo = detacalo;
682 
683 
684  fMVAVar_see = see;
685  fMVAVar_spp = spp;
686  fMVAVar_etawidth = etawidth;
687  fMVAVar_phiwidth = phiwidth;
688  fMVAVar_OneMinusE1x5E5x5 = OneMinusE1x5E5x5;
689  fMVAVar_R9 = R9;
690 
691 
692  fMVAVar_HoE = HoE;
693  fMVAVar_EoP = EoP;
694  fMVAVar_IoEmIoP = IoEmIoP;
695  fMVAVar_eleEoPout = eleEoPout;
696  fMVAVar_PreShowerOverRaw= PreShowerOverRaw;
697 
698  fMVAVar_eta = eta;
699  fMVAVar_pt = pt;
700 
701 
702  bindVariables();
703  Double_t mva = -9999;
704  if (fUseBinnedVersion) {
706  } else {
707  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
708  }
709 
710 
711 
712  if(printDebug) {
713  cout << " *** Inside the class fMethodname " << fMethodname << endl;
714  cout << " fbrem " << fMVAVar_fbrem
715  << " kfchi2 " << fMVAVar_kfchi2
716  << " mykfhits " << fMVAVar_kfhits
717  << " gsfchi2 " << fMVAVar_gsfchi2
718  << " deta " << fMVAVar_deta
719  << " dphi " << fMVAVar_dphi
720  << " detacalo " << fMVAVar_detacalo
721  << " see " << fMVAVar_see
722  << " spp " << fMVAVar_spp
723  << " etawidth " << fMVAVar_etawidth
724  << " phiwidth " << fMVAVar_phiwidth
725  << " OneMinusE1x5E5x5 " << fMVAVar_OneMinusE1x5E5x5
726  << " R9 " << fMVAVar_R9
727  << " HoE " << fMVAVar_HoE
728  << " EoP " << fMVAVar_EoP
729  << " IoEmIoP " << fMVAVar_IoEmIoP
730  << " eleEoPout " << fMVAVar_eleEoPout
731  << " PreShowerOverRaw " << fMVAVar_PreShowerOverRaw
732  << " eta " << fMVAVar_eta
733  << " pt " << fMVAVar_pt << endl;
734  cout << " ### MVA " << mva << endl;
735  }
736 
737 
738  return mva;
739 }
740 
741 
742 
743 //--------------------------------------------------------------------------------------------------
745  Double_t kfchi2,
746  Int_t kfhits,
747  Double_t gsfchi2,
748  Double_t deta,
749  Double_t dphi,
750  Double_t detacalo,
751  Double_t see,
752  Double_t spp,
753  Double_t etawidth,
754  Double_t phiwidth,
755  Double_t OneMinusE1x5E5x5,
756  Double_t R9,
757  Double_t HoE,
758  Double_t EoP,
759  Double_t IoEmIoP,
760  Double_t eleEoPout,
761  Double_t PreShowerOverRaw,
762  Double_t d0,
763  Double_t ip3d,
764  Double_t ChargedIso_DR0p0To0p1,
765  Double_t ChargedIso_DR0p1To0p2,
766  Double_t ChargedIso_DR0p2To0p3,
767  Double_t ChargedIso_DR0p3To0p4,
768  Double_t ChargedIso_DR0p4To0p5,
769  Double_t GammaIso_DR0p0To0p1,
770  Double_t GammaIso_DR0p1To0p2,
771  Double_t GammaIso_DR0p2To0p3,
772  Double_t GammaIso_DR0p3To0p4,
773  Double_t GammaIso_DR0p4To0p5,
774  Double_t NeutralHadronIso_DR0p0To0p1,
775  Double_t NeutralHadronIso_DR0p1To0p2,
776  Double_t NeutralHadronIso_DR0p2To0p3,
777  Double_t NeutralHadronIso_DR0p3To0p4,
778  Double_t NeutralHadronIso_DR0p4To0p5,
779  Double_t Rho,
780  Double_t eta,
781  Double_t pt,
782  Bool_t printDebug) {
783 
784  if (!fisInitialized) {
785  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
786  return -9999;
787  }
788 
789  fMVAVar_fbrem = ( fbrem < -1.0 ) ? -1.0 : fbrem;
790  fMVAVar_kfchi2 = ( kfchi2 > 10 ) ? 10 : kfchi2;
791  fMVAVar_kfhits = float(kfhits); // BTD does not support int variables
792  fMVAVar_gsfchi2 = ( gsfchi2 > 200 ) ? 200 : gsfchi2;
793  fMVAVar_deta = ( fabs(deta) > 0.06 ) ? 0.06 : fabs(deta);
794  fMVAVar_dphi = dphi;
795  fMVAVar_detacalo = detacalo;
796 
797  fMVAVar_see = see;
798  fMVAVar_spp = spp;
799  fMVAVar_etawidth = etawidth;
800  fMVAVar_phiwidth = phiwidth;
801  fMVAVar_OneMinusE1x5E5x5= max(min(double(OneMinusE1x5E5x5),2.0),-1.0);
802  fMVAVar_R9 = (R9 > 5) ? 5: R9;
803 
804  fMVAVar_HoE = HoE;
805  fMVAVar_EoP = (EoP > 20) ? 20 : EoP;
806  fMVAVar_IoEmIoP = IoEmIoP;
807  fMVAVar_eleEoPout = (eleEoPout > 20) ? 20 : eleEoPout;
808  fMVAVar_PreShowerOverRaw= PreShowerOverRaw;
809 
810  fMVAVar_d0 = d0;
811  fMVAVar_ip3d = ip3d;
812 
813  fMVAVar_ChargedIso_DR0p0To0p1 = ChargedIso_DR0p0To0p1;
814  fMVAVar_ChargedIso_DR0p1To0p2 = ChargedIso_DR0p1To0p2;
815  fMVAVar_ChargedIso_DR0p2To0p3 = ChargedIso_DR0p2To0p3;
816  fMVAVar_ChargedIso_DR0p3To0p4 = ChargedIso_DR0p3To0p4;
817  fMVAVar_ChargedIso_DR0p4To0p5 = ChargedIso_DR0p4To0p5;
818  fMVAVar_GammaIso_DR0p0To0p1 = GammaIso_DR0p0To0p1;
819  fMVAVar_GammaIso_DR0p1To0p2 = GammaIso_DR0p1To0p2;
820  fMVAVar_GammaIso_DR0p2To0p3 = GammaIso_DR0p2To0p3;
821  fMVAVar_GammaIso_DR0p3To0p4 = GammaIso_DR0p3To0p4;
822  fMVAVar_GammaIso_DR0p4To0p5 = GammaIso_DR0p4To0p5;
823  fMVAVar_NeutralHadronIso_DR0p0To0p1 = NeutralHadronIso_DR0p0To0p1;
824  fMVAVar_NeutralHadronIso_DR0p1To0p2 = NeutralHadronIso_DR0p1To0p2;
825  fMVAVar_NeutralHadronIso_DR0p2To0p3 = NeutralHadronIso_DR0p2To0p3;
826  fMVAVar_NeutralHadronIso_DR0p3To0p4 = NeutralHadronIso_DR0p3To0p4;
827  fMVAVar_NeutralHadronIso_DR0p4To0p5 = NeutralHadronIso_DR0p4To0p5;
828 
829  fMVAVar_rho = Rho;
830  fMVAVar_eta = eta;
831  fMVAVar_pt = pt;
832 
833  Double_t mva = -9999;
834  if (fUseBinnedVersion) {
836  } else {
837  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
838  }
839 
840  if(printDebug) {
841  cout << " *** Inside the class fMethodname " << fMethodname << endl;
842  cout << " fbrem " << fMVAVar_fbrem
843  << " kfchi2 " << fMVAVar_kfchi2
844  << " mykfhits " << fMVAVar_kfhits
845  << " gsfchi2 " << fMVAVar_gsfchi2
846  << " deta " << fMVAVar_deta
847  << " dphi " << fMVAVar_dphi
848  << " detacalo " << fMVAVar_detacalo
849  << " see " << fMVAVar_see
850  << " spp " << fMVAVar_spp
851  << " etawidth " << fMVAVar_etawidth
852  << " phiwidth " << fMVAVar_phiwidth
853  << " OneMinusE1x5E5x5 " << fMVAVar_OneMinusE1x5E5x5
854  << " R9 " << fMVAVar_R9
855  << " HoE " << fMVAVar_HoE
856  << " EoP " << fMVAVar_EoP
857  << " IoEmIoP " << fMVAVar_IoEmIoP
858  << " eleEoPout " << fMVAVar_eleEoPout
859  << " PreShowerOverRaw " << fMVAVar_PreShowerOverRaw
860  << " d0 " << fMVAVar_d0
861  << " ip3d " << fMVAVar_ip3d
862  << " ChargedIso_DR0p0To0p1 " << ChargedIso_DR0p0To0p1
863  << " ChargedIso_DR0p1To0p2 " << ChargedIso_DR0p1To0p2
864  << " ChargedIso_DR0p2To0p3 " << ChargedIso_DR0p2To0p3
865  << " ChargedIso_DR0p3To0p4 " << ChargedIso_DR0p3To0p4
866  << " ChargedIso_DR0p4To0p5 " << ChargedIso_DR0p4To0p5
867  << " GammaIso_DR0p0To0p1 " << GammaIso_DR0p0To0p1
868  << " GammaIso_DR0p1To0p2 " << GammaIso_DR0p1To0p2
869  << " GammaIso_DR0p2To0p3 " << GammaIso_DR0p2To0p3
870  << " GammaIso_DR0p3To0p4 " << GammaIso_DR0p3To0p4
871  << " GammaIso_DR0p4To0p5 " << GammaIso_DR0p4To0p5
872  << " NeutralHadronIso_DR0p0To0p1 " << NeutralHadronIso_DR0p0To0p1
873  << " NeutralHadronIso_DR0p1To0p2 " << NeutralHadronIso_DR0p1To0p2
874  << " NeutralHadronIso_DR0p2To0p3 " << NeutralHadronIso_DR0p2To0p3
875  << " NeutralHadronIso_DR0p3To0p4 " << NeutralHadronIso_DR0p3To0p4
876  << " NeutralHadronIso_DR0p4To0p5 " << NeutralHadronIso_DR0p4To0p5
877  << " Rho " << Rho
878  << " eta " << fMVAVar_eta
879  << " pt " << fMVAVar_pt << endl;
880  cout << " ### MVA " << mva << endl;
881  }
882 
883  return mva;
884 }
885 
886 
887 
888 
889 
890 #ifndef STANDALONE
892  Double_t Eta,
893  Double_t Rho,
895  Double_t ChargedIso_DR0p0To0p1,
896  Double_t ChargedIso_DR0p1To0p2,
897  Double_t ChargedIso_DR0p2To0p3,
898  Double_t ChargedIso_DR0p3To0p4,
899  Double_t ChargedIso_DR0p4To0p5,
900  Double_t GammaIso_DR0p0To0p1,
901  Double_t GammaIso_DR0p1To0p2,
902  Double_t GammaIso_DR0p2To0p3,
903  Double_t GammaIso_DR0p3To0p4,
904  Double_t GammaIso_DR0p4To0p5,
905  Double_t NeutralHadronIso_DR0p0To0p1,
906  Double_t NeutralHadronIso_DR0p1To0p2,
907  Double_t NeutralHadronIso_DR0p2To0p3,
908  Double_t NeutralHadronIso_DR0p3To0p4,
909  Double_t NeutralHadronIso_DR0p4To0p5,
910  Bool_t printDebug) {
911 
912  if (!fisInitialized) {
913  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
914  return -9999;
915  }
916 
917  fMVAVar_ChargedIso_DR0p0To0p1 = TMath::Min((ChargedIso_DR0p0To0p1)/Pt, 2.5);
918  fMVAVar_ChargedIso_DR0p1To0p2 = TMath::Min((ChargedIso_DR0p1To0p2)/Pt, 2.5);
919  fMVAVar_ChargedIso_DR0p2To0p3 = TMath::Min((ChargedIso_DR0p2To0p3)/Pt, 2.5);
920  fMVAVar_ChargedIso_DR0p3To0p4 = TMath::Min((ChargedIso_DR0p3To0p4)/Pt, 2.5);
921  fMVAVar_ChargedIso_DR0p4To0p5 = TMath::Min((ChargedIso_DR0p4To0p5)/Pt, 2.5);
932 
933  // evaluate
934  Double_t mva = fTMVAReader[GetMVABin(Eta,Pt)]->EvaluateMVA(fMethodname);
935 
936  if(printDebug) {
937  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
938  cout << "ChargedIso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
944  cout << "PF Gamma Iso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
949  << fMVAVar_GammaIso_DR0p4To0p5 << endl;
950  cout << "PF Neutral Hadron Iso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
956  << endl;
957  cout << " ### MVA " << mva << endl;
958  }
959 
960  return mva;
961 
962 }
963 
964 
965 //--------------------------------------------------------------------------------------------------
966 
967 // for kTrig and kNonTrig algorithm
969  const reco::Vertex& vertex,
970  const TransientTrackBuilder& transientTrackBuilder,
971  EcalClusterLazyTools myEcalCluster,
972  bool printDebug) {
973 
974  if (!fisInitialized) {
975  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
976  return -9999;
977  }
978 
980  std::cout << "Error: This method should be called for kTrig or kNonTrig MVA only" << endl;
981  return -9999;
982  }
983 
984  bool validKF= false;
985  reco::TrackRef myTrackRef = ele.closestCtfTrackRef();
986  validKF = (myTrackRef.isAvailable());
987  validKF = (myTrackRef.isNonnull());
988 
989  // Pure tracking variables
990  fMVAVar_fbrem = ele.fbrem();
991  fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
992  fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
993  fMVAVar_kfhitsall = (validKF) ? myTrackRef->numberOfValidHits() : -1. ; // save also this in your ntuple as possible alternative
994  fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2();
995 
996 
997  // Geometrical matchings
1001 
1002 
1003  // Pure ECAL -> shower shapes
1004  fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta
1005  std::vector<float> vCov = myEcalCluster.localCovariances(*(ele.superCluster()->seed())) ;
1006  if (!isnan(vCov[2])) fMVAVar_spp = sqrt (vCov[2]); //EleSigmaIPhiIPhi
1007  else fMVAVar_spp = 0.;
1008 
1009  fMVAVar_etawidth = ele.superCluster()->etaWidth();
1010  fMVAVar_phiwidth = ele.superCluster()->phiWidth();
1011  fMVAVar_OneMinusE1x5E5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ;
1012  fMVAVar_R9 = myEcalCluster.e3x3(*(ele.superCluster()->seed())) / ele.superCluster()->rawEnergy();
1013 
1014  // Energy matching
1015  fMVAVar_HoE = ele.hadronicOverEm();
1017  fMVAVar_IoEmIoP = (1.0/ele.ecalEnergy()) - (1.0 / ele.p()); // in the future to be changed with ele.gsfTrack()->p()
1019  fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy();
1020 
1021 
1022  // Spectators
1023  fMVAVar_eta = ele.superCluster()->eta();
1024  fMVAVar_pt = ele.pt();
1025 
1026 
1027 
1028  // for triggering electrons get the impact parameteres
1029  if(fMVAType == kTrig) {
1030  //d0
1031  if (ele.gsfTrack().isNonnull()) {
1032  fMVAVar_d0 = (-1.0)*ele.gsfTrack()->dxy(vertex.position());
1033  } else if (ele.closestCtfTrackRef().isNonnull()) {
1034  fMVAVar_d0 = (-1.0)*ele.closestCtfTrackRef()->dxy(vertex.position());
1035  } else {
1036  fMVAVar_d0 = -9999.0;
1037  }
1038 
1039  //default values for IP3D
1040  fMVAVar_ip3d = -999.0;
1041  fMVAVar_ip3dSig = 0.0;
1042  if (ele.gsfTrack().isNonnull()) {
1043  const double gsfsign = ( (-ele.gsfTrack()->dxy(vertex.position())) >=0 ) ? 1. : -1.;
1044 
1045  const reco::TransientTrack &tt = transientTrackBuilder.build(ele.gsfTrack());
1046  const std::pair<bool,Measurement1D> &ip3dpv = IPTools::absoluteImpactParameter3D(tt,vertex);
1047  if (ip3dpv.first) {
1048  double ip3d = gsfsign*ip3dpv.second.value();
1049  double ip3derr = ip3dpv.second.error();
1050  fMVAVar_ip3d = ip3d;
1051  fMVAVar_ip3dSig = ip3d/ip3derr;
1052  }
1053  }
1054  }
1055 
1056 
1057  // evaluate
1058  bindVariables();
1059  Double_t mva = -9999;
1060  if (fUseBinnedVersion) {
1061  mva = fTMVAReader[GetMVABin(fMVAVar_eta,fMVAVar_pt)]->EvaluateMVA(fMethodname);
1062  } else {
1063  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1064  }
1065 
1066 
1067 
1068  if(printDebug) {
1069  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
1070  cout << " fbrem " << fMVAVar_fbrem
1071  << " kfchi2 " << fMVAVar_kfchi2
1072  << " mykfhits " << fMVAVar_kfhits
1073  << " gsfchi2 " << fMVAVar_gsfchi2
1074  << " deta " << fMVAVar_deta
1075  << " dphi " << fMVAVar_dphi
1076  << " detacalo " << fMVAVar_detacalo
1077  << " see " << fMVAVar_see
1078  << " spp " << fMVAVar_spp
1079  << " etawidth " << fMVAVar_etawidth
1080  << " phiwidth " << fMVAVar_phiwidth
1081  << " OneMinusE1x5E5x5 " << fMVAVar_OneMinusE1x5E5x5
1082  << " R9 " << fMVAVar_R9
1083  << " HoE " << fMVAVar_HoE
1084  << " EoP " << fMVAVar_EoP
1085  << " IoEmIoP " << fMVAVar_IoEmIoP
1086  << " eleEoPout " << fMVAVar_eleEoPout
1087  << " d0 " << fMVAVar_d0
1088  << " ip3d " << fMVAVar_ip3d
1089  << " eta " << fMVAVar_eta
1090  << " pt " << fMVAVar_pt << endl;
1091  cout << " ### MVA " << mva << endl;
1092  }
1093 
1094 
1095 
1096  return mva;
1097 }
1098 
1099 
1100 // for kTrigNoIP algorithm
1102  const reco::Vertex& vertex,
1103  double rho,
1104  //const TransientTrackBuilder& transientTrackBuilder,
1105  EcalClusterLazyTools myEcalCluster,
1106  bool printDebug) {
1107 
1108  if (!fisInitialized) {
1109  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
1110  return -9999;
1111  }
1112 
1114  std::cout << "Error: This method should be called for kTrigNoIP MVA only" << endl;
1115  return -9999;
1116  }
1117 
1118  bool validKF= false;
1119  reco::TrackRef myTrackRef = ele.closestCtfTrackRef();
1120  validKF = (myTrackRef.isAvailable());
1121  validKF = (myTrackRef.isNonnull());
1122 
1123  // Pure tracking variables
1124  fMVAVar_fbrem = ele.fbrem();
1125  fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
1126  fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
1127  fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2();
1128 
1129 
1130  // Geometrical matchings
1134 
1135 
1136  // Pure ECAL -> shower shapes
1137  fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta
1138  std::vector<float> vCov = myEcalCluster.localCovariances(*(ele.superCluster()->seed())) ;
1139  if (!isnan(vCov[2])) fMVAVar_spp = sqrt (vCov[2]); //EleSigmaIPhiIPhi
1140  else fMVAVar_spp = 0.;
1141 
1142 
1143  fMVAVar_etawidth = ele.superCluster()->etaWidth();
1144  fMVAVar_phiwidth = ele.superCluster()->phiWidth();
1145  fMVAVar_OneMinusE1x5E5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ;
1146  fMVAVar_R9 = myEcalCluster.e3x3(*(ele.superCluster()->seed())) / ele.superCluster()->rawEnergy();
1147 
1148 
1149  // Energy matching
1150  fMVAVar_HoE = ele.hadronicOverEm();
1152  fMVAVar_IoEmIoP = (1.0/ele.superCluster()->energy()) - (1.0 / ele.gsfTrack()->p()); // in the future to be changed with ele.gsfTrack()->p()
1154  fMVAVar_rho = rho;
1155  fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy();
1156 
1157 
1158  // Spectators
1159  fMVAVar_eta = ele.superCluster()->eta();
1160  fMVAVar_pt = ele.pt();
1161 
1162 
1163 
1164 
1165 
1166  // evaluate
1167  bindVariables();
1168  Double_t mva = -9999;
1169  if (fUseBinnedVersion) {
1170  mva = fTMVAReader[GetMVABin(fMVAVar_eta,fMVAVar_pt)]->EvaluateMVA(fMethodname);
1171  } else {
1172  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1173  }
1174 
1175 
1176 
1177  if(printDebug) {
1178  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
1179  cout << " fbrem " << fMVAVar_fbrem
1180  << " kfchi2 " << fMVAVar_kfchi2
1181  << " mykfhits " << fMVAVar_kfhits
1182  << " gsfchi2 " << fMVAVar_gsfchi2
1183  << " deta " << fMVAVar_deta
1184  << " dphi " << fMVAVar_dphi
1185  << " detacalo " << fMVAVar_detacalo
1186  // << " dphicalo " << fMVAVar_dphicalo
1187  << " see " << fMVAVar_see
1188  << " spp " << fMVAVar_spp
1189  << " etawidth " << fMVAVar_etawidth
1190  << " phiwidth " << fMVAVar_phiwidth
1191  << " e1x5e5x5 " << fMVAVar_OneMinusE1x5E5x5
1192  << " R9 " << fMVAVar_R9
1193  // << " mynbrems " << fMVAVar_nbrems
1194  << " HoE " << fMVAVar_HoE
1195  << " EoP " << fMVAVar_EoP
1196  << " IoEmIoP " << fMVAVar_IoEmIoP
1197  << " eleEoPout " << fMVAVar_eleEoPout
1198  << " rho " << fMVAVar_rho
1199  // << " EoPout " << fMVAVar_EoPout
1200  << " eta " << fMVAVar_eta
1201  << " pt " << fMVAVar_pt << endl;
1202  cout << " ### MVA " << mva << endl;
1203  }
1204 
1205 
1206 
1207  return mva;
1208 }
1209 
1210 // for kTrig, kNonTrig and kTrigNoIP algorithm
1212  const reco::Vertex& vertex,
1213  double rho,
1214  bool printDebug) {
1215 
1216  if (!fisInitialized) {
1217  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
1218  return -9999;
1219  }
1220 
1221  bool validKF= false;
1222  reco::TrackRef myTrackRef = ele.closestCtfTrackRef();
1223  validKF = (myTrackRef.isAvailable());
1224  validKF = (myTrackRef.isNonnull());
1225 
1226  // Pure tracking variables
1227  fMVAVar_fbrem = ele.fbrem();
1228  fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
1229  fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
1230  fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2();
1231 
1232 
1233  // Geometrical matchings
1237 
1238  // Pure ECAL -> shower shapes
1239  fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta
1240 
1241  fMVAVar_spp = ele.sigmaIphiIphi();
1242 
1243  fMVAVar_etawidth = ele.superCluster()->etaWidth();
1244  fMVAVar_phiwidth = ele.superCluster()->phiWidth();
1245  fMVAVar_OneMinusE1x5E5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ;
1246  fMVAVar_R9 = ele.r9();
1247 
1248  // Energy matching
1249  fMVAVar_HoE = ele.hadronicOverEm();
1251 
1252  // unify this in the future?
1253  if( fMVAType == kTrig || fMVAType == kNonTrig){
1254  fMVAVar_IoEmIoP = (1.0/ele.ecalEnergy()) - (1.0 / ele.p()); // in the future to be changed with ele.gsfTrack()->p()
1255  }else{
1256  fMVAVar_IoEmIoP = (1.0/ele.superCluster()->energy()) - (1.0 / ele.gsfTrack()->p()); // in the future to be changed with ele.gsfTrack()->p()
1257  }
1259  fMVAVar_rho = rho;
1260  fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy();
1261 
1262  // for triggering electrons get the impact parameteres
1263  if(fMVAType == kTrig) {
1264  //d0
1265  if (ele.gsfTrack().isNonnull()) {
1266  fMVAVar_d0 = (-1.0)*ele.gsfTrack()->dxy(vertex.position());
1267  } else if (ele.closestCtfTrackRef().isNonnull()) {
1268  fMVAVar_d0 = (-1.0)*ele.closestCtfTrackRef()->dxy(vertex.position());
1269  } else {
1270  fMVAVar_d0 = -9999.0;
1271  }
1272 
1273  //default values for IP3D
1274  fMVAVar_ip3d = -999.0;
1275  fMVAVar_ip3dSig = 0.0;
1276  if (ele.gsfTrack().isNonnull()) {
1277  const double gsfsign = ( (-ele.gsfTrack()->dxy(vertex.position())) >=0 ) ? 1. : -1.;
1278 
1279  std::cout << "Warning : if usePV = false when pat-electrons were produced, dB() was calculated with respect to beamspot while original mva uses primary vertex" << std::endl;
1280  double ip3d = gsfsign*ele.dB();
1281  double ip3derr = ele.edB();
1282  fMVAVar_ip3d = ip3d;
1283  fMVAVar_ip3dSig = ip3d/ip3derr;
1284  }
1285  }
1286 
1287  // Spectators
1288  fMVAVar_eta = ele.superCluster()->eta();
1289  fMVAVar_pt = ele.pt();
1290 
1291  // evaluate
1292  bindVariables();
1293  Double_t mva = -9999;
1294  if (fUseBinnedVersion) {
1295  mva = fTMVAReader[GetMVABin(fMVAVar_eta,fMVAVar_pt)]->EvaluateMVA(fMethodname);
1296  } else {
1297  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1298  }
1299 
1300  if(printDebug) {
1301  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
1302  cout << " fbrem " << fMVAVar_fbrem
1303  << " kfchi2 " << fMVAVar_kfchi2
1304  << " mykfhits " << fMVAVar_kfhits
1305  << " gsfchi2 " << fMVAVar_gsfchi2
1306  << " deta " << fMVAVar_deta
1307  << " dphi " << fMVAVar_dphi
1308  << " detacalo " << fMVAVar_detacalo
1309  // << " dphicalo " << fMVAVar_dphicalo
1310  << " see " << fMVAVar_see
1311  << " spp " << fMVAVar_spp
1312  << " etawidth " << fMVAVar_etawidth
1313  << " phiwidth " << fMVAVar_phiwidth
1314  << " e1x5e5x5 " << fMVAVar_OneMinusE1x5E5x5
1315  << " R9 " << fMVAVar_R9
1316  // << " mynbrems " << fMVAVar_nbrems
1317  << " HoE " << fMVAVar_HoE
1318  << " EoP " << fMVAVar_EoP
1319  << " IoEmIoP " << fMVAVar_IoEmIoP
1320  << " eleEoPout " << fMVAVar_eleEoPout
1321  << " rho " << fMVAVar_rho
1322  // << " EoPout " << fMVAVar_EoPout
1323  << " d0 " << fMVAVar_d0
1324  << " ip3d " << fMVAVar_ip3d
1325  << " eta " << fMVAVar_eta
1326  << " pt " << fMVAVar_pt << endl;
1327  cout << " ### MVA " << mva << endl;
1328  }
1329 
1330  return mva;
1331 }
1332 
1333 
1334 // for kTrigNoIP algorithm only.
1336  double rho,
1337  bool printDebug) {
1338 
1339  if (!fisInitialized) {
1340  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
1341  return -9999;
1342  }
1343 
1345  std::cout << "Error: This method should be called for kTrigNoIP mva only" << endl;
1346  return -9999;
1347  }
1348 
1349 
1350  bool validKF= false;
1351  reco::TrackRef myTrackRef = ele.closestCtfTrackRef();
1352  validKF = (myTrackRef.isAvailable());
1353  validKF = (myTrackRef.isNonnull());
1354 
1355  // Pure tracking variables
1356  fMVAVar_fbrem = ele.fbrem();
1357  fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
1358  fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
1359  fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2();
1360 
1361 
1362  // Geometrical matchings
1366 
1367 
1368  // Pure ECAL -> shower shapes
1369  fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta
1370 
1371  fMVAVar_spp = ele.sigmaIphiIphi();
1372 
1373  fMVAVar_etawidth = ele.superCluster()->etaWidth();
1374  fMVAVar_phiwidth = ele.superCluster()->phiWidth();
1375  fMVAVar_OneMinusE1x5E5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ;
1376  fMVAVar_R9 = ele.r9();
1377 
1378  // Energy matching
1379  fMVAVar_HoE = ele.hadronicOverEm();
1381  fMVAVar_IoEmIoP = (1.0/ele.superCluster()->energy()) - (1.0 / ele.gsfTrack()->p()); // in the future to be changed with ele.gsfTrack()->p()
1383  fMVAVar_rho = rho;
1384  fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy();
1385 
1386 
1387  // Spectators
1388  fMVAVar_eta = ele.superCluster()->eta();
1389  fMVAVar_pt = ele.pt();
1390 
1391 
1392 
1393 
1394 
1395  // evaluate
1396  bindVariables();
1397  Double_t mva = -9999;
1398  if (fUseBinnedVersion) {
1399  mva = fTMVAReader[GetMVABin(fMVAVar_eta,fMVAVar_pt)]->EvaluateMVA(fMethodname);
1400  } else {
1401  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1402  }
1403 
1404 
1405 
1406  if(printDebug) {
1407  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
1408  cout << " fbrem " << fMVAVar_fbrem
1409  << " kfchi2 " << fMVAVar_kfchi2
1410  << " mykfhits " << fMVAVar_kfhits
1411  << " gsfchi2 " << fMVAVar_gsfchi2
1412  << " deta " << fMVAVar_deta
1413  << " dphi " << fMVAVar_dphi
1414  << " detacalo " << fMVAVar_detacalo
1415  // << " dphicalo " << fMVAVar_dphicalo
1416  << " see " << fMVAVar_see
1417  << " spp " << fMVAVar_spp
1418  << " etawidth " << fMVAVar_etawidth
1419  << " phiwidth " << fMVAVar_phiwidth
1420  << " e1x5e5x5 " << fMVAVar_OneMinusE1x5E5x5
1421  << " R9 " << fMVAVar_R9
1422  // << " mynbrems " << fMVAVar_nbrems
1423  << " HoE " << fMVAVar_HoE
1424  << " EoP " << fMVAVar_EoP
1425  << " IoEmIoP " << fMVAVar_IoEmIoP
1426  << " eleEoPout " << fMVAVar_eleEoPout
1427  << " rho " << fMVAVar_rho
1428  // << " EoPout " << fMVAVar_EoPout
1429  << " eta " << fMVAVar_eta
1430  << " pt " << fMVAVar_pt << endl;
1431  cout << " ### MVA " << mva << endl;
1432  }
1433 
1434 
1435 
1436  return mva;
1437 }
1438 
1439 
1440 
1441 
1442 
1443 
1444 
1445 
1446 
1448  const reco::Vertex& vertex,
1450  double Rho,
1452  const reco::GsfElectronCollection &IdentifiedElectrons,
1453  const reco::MuonCollection &IdentifiedMuons,
1454  bool printDebug) {
1455 
1456  if (!fisInitialized) {
1457  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
1458  return -9999;
1459  }
1460 
1461  // Spectators
1462  fMVAVar_eta = ele.superCluster()->eta();
1463  fMVAVar_pt = ele.pt();
1464 
1465  //**********************************************************
1466  //Isolation variables
1467  //**********************************************************
1468  Double_t tmpChargedIso_DR0p0To0p1 = 0;
1469  Double_t tmpChargedIso_DR0p1To0p2 = 0;
1470  Double_t tmpChargedIso_DR0p2To0p3 = 0;
1471  Double_t tmpChargedIso_DR0p3To0p4 = 0;
1472  Double_t tmpChargedIso_DR0p4To0p5 = 0;
1473  Double_t tmpGammaIso_DR0p0To0p1 = 0;
1474  Double_t tmpGammaIso_DR0p1To0p2 = 0;
1475  Double_t tmpGammaIso_DR0p2To0p3 = 0;
1476  Double_t tmpGammaIso_DR0p3To0p4 = 0;
1477  Double_t tmpGammaIso_DR0p4To0p5 = 0;
1478  Double_t tmpNeutralHadronIso_DR0p0To0p1 = 0;
1479  Double_t tmpNeutralHadronIso_DR0p1To0p2 = 0;
1480  Double_t tmpNeutralHadronIso_DR0p2To0p3 = 0;
1481  Double_t tmpNeutralHadronIso_DR0p3To0p4 = 0;
1482  Double_t tmpNeutralHadronIso_DR0p4To0p5 = 0;
1483 
1484  double electronTrackZ = 0;
1485  if (ele.gsfTrack().isNonnull()) {
1486  electronTrackZ = ele.gsfTrack()->dz(vertex.position());
1487  } else if (ele.closestCtfTrackRef().isNonnull()) {
1488  electronTrackZ = ele.closestCtfTrackRef()->dz(vertex.position());
1489  }
1490 
1491  for (reco::PFCandidateCollection::const_iterator iP = PFCandidates.begin();
1492  iP != PFCandidates.end(); ++iP) {
1493 
1494  //exclude the electron itself
1495  if(iP->gsfTrackRef().isNonnull() && ele.gsfTrack().isNonnull() &&
1496  refToPtr(iP->gsfTrackRef()) == refToPtr(ele.gsfTrack())) continue;
1497  if(iP->trackRef().isNonnull() && ele.closestCtfTrackRef().isNonnull() &&
1498  refToPtr(iP->trackRef()) == refToPtr(ele.closestCtfTrackRef())) continue;
1499 
1500  //************************************************************
1501  // New Isolation Calculations
1502  //************************************************************
1503  double dr = sqrt(pow(iP->eta() - ele.eta(),2) + pow(acos(cos(iP->phi() - ele.phi())),2));
1504  //Double_t deta = (iP->eta() - ele.eta());
1505 
1506  if (dr < 1.0) {
1507  Bool_t IsLeptonFootprint = kFALSE;
1508  //************************************************************
1509  // Lepton Footprint Removal
1510  //************************************************************
1511  for (reco::GsfElectronCollection::const_iterator iE = IdentifiedElectrons.begin();
1512  iE != IdentifiedElectrons.end(); ++iE) {
1513  //if pf candidate matches an electron passing ID cuts, then veto it
1514  if(iP->gsfTrackRef().isNonnull() && iE->gsfTrack().isNonnull() &&
1515  refToPtr(iP->gsfTrackRef()) == refToPtr(iE->gsfTrack())) IsLeptonFootprint = kTRUE;
1516  if(iP->trackRef().isNonnull() && iE->closestCtfTrackRef().isNonnull() &&
1517  refToPtr(iP->trackRef()) == refToPtr(iE->closestCtfTrackRef())) IsLeptonFootprint = kTRUE;
1518 
1519  //if pf candidate lies in veto regions of electron passing ID cuts, then veto it
1520  double tmpDR = sqrt(pow(iP->eta() - iE->eta(),2) + pow(acos(cos(iP->phi() - iE->phi())),2));
1521  if(iP->trackRef().isNonnull() && fabs(iE->superCluster()->eta()) >= 1.479
1522  && tmpDR < 0.015) IsLeptonFootprint = kTRUE;
1523  if(iP->particleId() == reco::PFCandidate::gamma && fabs(iE->superCluster()->eta()) >= 1.479
1524  && tmpDR < 0.08) IsLeptonFootprint = kTRUE;
1525  }
1526  for (reco::MuonCollection::const_iterator iM = IdentifiedMuons.begin();
1527  iM != IdentifiedMuons.end(); ++iM) {
1528  //if pf candidate matches an muon passing ID cuts, then veto it
1529  if(iP->trackRef().isNonnull() && iM->innerTrack().isNonnull() &&
1530  refToPtr(iP->trackRef()) == refToPtr(iM->innerTrack())) IsLeptonFootprint = kTRUE;
1531 
1532  //if pf candidate lies in veto regions of muon passing ID cuts, then veto it
1533  double tmpDR = sqrt(pow(iP->eta() - iM->eta(),2) + pow(acos(cos(iP->phi() - iM->phi())),2));
1534  if(iP->trackRef().isNonnull() && tmpDR < 0.01) IsLeptonFootprint = kTRUE;
1535  }
1536 
1537  if (!IsLeptonFootprint) {
1538  Bool_t passVeto = kTRUE;
1539  //Charged
1540  if(iP->trackRef().isNonnull()) {
1541  if (!(fabs(iP->trackRef()->dz(vertex.position()) - electronTrackZ) < 0.2)) passVeto = kFALSE;
1542  //************************************************************
1543  // Veto any PFmuon, or PFEle
1544  if (iP->particleId() == reco::PFCandidate::e || iP->particleId() == reco::PFCandidate::mu) passVeto = kFALSE;
1545  //************************************************************
1546  //************************************************************
1547  // Footprint Veto
1548  if (fabs(fMVAVar_eta) > 1.479 && dr < 0.015) passVeto = kFALSE;
1549  //************************************************************
1550  if (passVeto) {
1551  if (dr < 0.1) tmpChargedIso_DR0p0To0p1 += iP->pt();
1552  if (dr >= 0.1 && dr < 0.2) tmpChargedIso_DR0p1To0p2 += iP->pt();
1553  if (dr >= 0.2 && dr < 0.3) tmpChargedIso_DR0p2To0p3 += iP->pt();
1554  if (dr >= 0.3 && dr < 0.4) tmpChargedIso_DR0p3To0p4 += iP->pt();
1555  if (dr >= 0.4 && dr < 0.5) tmpChargedIso_DR0p4To0p5 += iP->pt();
1556  } //pass veto
1557  }
1558  //Gamma
1559  else if (iP->particleId() == reco::PFCandidate::gamma) {
1560  //************************************************************
1561  // Footprint Veto
1562  if (fabs(fMVAVar_eta) > 1.479 && dr < 0.08) passVeto = kFALSE;
1563  //************************************************************
1564  if (passVeto) {
1565  if (dr < 0.1) tmpGammaIso_DR0p0To0p1 += iP->pt();
1566  if (dr >= 0.1 && dr < 0.2) tmpGammaIso_DR0p1To0p2 += iP->pt();
1567  if (dr >= 0.2 && dr < 0.3) tmpGammaIso_DR0p2To0p3 += iP->pt();
1568  if (dr >= 0.3 && dr < 0.4) tmpGammaIso_DR0p3To0p4 += iP->pt();
1569  if (dr >= 0.4 && dr < 0.5) tmpGammaIso_DR0p4To0p5 += iP->pt();
1570  }
1571  }
1572  //NeutralHadron
1573  else {
1574  if (dr < 0.1) tmpNeutralHadronIso_DR0p0To0p1 += iP->pt();
1575  if (dr >= 0.1 && dr < 0.2) tmpNeutralHadronIso_DR0p1To0p2 += iP->pt();
1576  if (dr >= 0.2 && dr < 0.3) tmpNeutralHadronIso_DR0p2To0p3 += iP->pt();
1577  if (dr >= 0.3 && dr < 0.4) tmpNeutralHadronIso_DR0p3To0p4 += iP->pt();
1578  if (dr >= 0.4 && dr < 0.5) tmpNeutralHadronIso_DR0p4To0p5 += iP->pt();
1579  }
1580  } //not lepton footprint
1581  } //in 1.0 dr cone
1582  } //loop over PF candidates
1583 
1584  fMVAVar_ChargedIso_DR0p0To0p1 = TMath::Min((tmpChargedIso_DR0p0To0p1)/ele.pt(), 2.5);
1585  fMVAVar_ChargedIso_DR0p1To0p2 = TMath::Min((tmpChargedIso_DR0p1To0p2)/ele.pt(), 2.5);
1586  fMVAVar_ChargedIso_DR0p2To0p3 = TMath::Min((tmpChargedIso_DR0p2To0p3)/ele.pt(), 2.5);
1587  fMVAVar_ChargedIso_DR0p3To0p4 = TMath::Min((tmpChargedIso_DR0p3To0p4)/ele.pt(), 2.5);
1588  fMVAVar_ChargedIso_DR0p4To0p5 = TMath::Min((tmpChargedIso_DR0p4To0p5)/ele.pt(), 2.5);
1599 
1600  if (printDebug) {
1601  cout << "UseBinnedVersion=" << fUseBinnedVersion << " -> BIN: " << fMVAVar_eta << " " << fMVAVar_pt << " : " << GetMVABin(fMVAVar_eta,fMVAVar_pt) << endl;
1602  }
1603 
1604  // evaluate
1605  bindVariables();
1606  Double_t mva = -9999;
1607 
1608 // mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1609  if (fUseBinnedVersion) {
1610  mva = fTMVAReader[GetMVABin(fMVAVar_eta,fMVAVar_pt)]->EvaluateMVA(fMethodname);
1611  } else {
1612  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1613  }
1614 
1615 
1616  if(printDebug) {
1617  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
1618  cout << "ChargedIso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
1623  << fMVAVar_ChargedIso_DR0p4To0p5 << endl;
1624  cout << "PF Gamma Iso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
1625  << fMVAVar_GammaIso_DR0p0To0p1 << " "
1626  << fMVAVar_GammaIso_DR0p1To0p2 << " "
1627  << fMVAVar_GammaIso_DR0p2To0p3 << " "
1628  << fMVAVar_GammaIso_DR0p3To0p4 << " "
1629  << fMVAVar_GammaIso_DR0p4To0p5 << endl;
1630  cout << "PF Neutral Hadron Iso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
1636  << endl;
1637  cout << " ### MVA " << mva << endl;
1638  }
1639 
1640 
1641  return mva;
1642 }
1643 
1644 
1645 //--------------------------------------------------------------------------------------------------
1646 
1648  const reco::Vertex& vertex,
1649  const TransientTrackBuilder& transientTrackBuilder,
1650  EcalClusterLazyTools myEcalCluster,
1652  double Rho,
1654  bool printDebug) {
1655 
1656  if (!fisInitialized) {
1657  std::cout << "Error: EGammaMvaEleEstimator not properly initialized.\n";
1658  return -9999;
1659  }
1660 
1661  bool validKF= false;
1662  reco::TrackRef myTrackRef = ele.closestCtfTrackRef();
1663  validKF = (myTrackRef.isAvailable());
1664  validKF = (myTrackRef.isNonnull());
1665 
1666  // Pure tracking variables
1667  fMVAVar_fbrem = (ele.fbrem() < -1. ) ? -1. : ele.fbrem();
1668  fMVAVar_kfchi2 = (validKF) ? myTrackRef->normalizedChi2() : 0 ;
1669  if (fMVAVar_kfchi2 > 10) fMVAVar_kfchi2 = 10;
1670  fMVAVar_kfhits = (validKF) ? myTrackRef->hitPattern().trackerLayersWithMeasurement() : -1. ;
1671  fMVAVar_kfhitsall = (validKF) ? myTrackRef->numberOfValidHits() : -1. ; // save also this in your ntuple as possible alternative
1672  fMVAVar_gsfchi2 = ele.gsfTrack()->normalizedChi2();
1673  if (fMVAVar_gsfchi2 > 200) fMVAVar_gsfchi2 = 200;
1674 
1675 
1676  // Geometrical matchings
1677  fMVAVar_deta = ( fabs(ele.deltaEtaSuperClusterTrackAtVtx()) > 0.06 ) ? 0.06 : fabs(ele.deltaEtaSuperClusterTrackAtVtx());
1680 
1681 
1682  // Pure ECAL -> shower shapes
1683  fMVAVar_see = ele.sigmaIetaIeta(); //EleSigmaIEtaIEta
1684  std::vector<float> vCov = myEcalCluster.localCovariances(*(ele.superCluster()->seed())) ;
1685  if (!isnan(vCov[2])) fMVAVar_spp = sqrt (vCov[2]); //EleSigmaIPhiIPhi
1686  else fMVAVar_spp = 0.;
1687 
1688  fMVAVar_etawidth = ele.superCluster()->etaWidth();
1689  fMVAVar_phiwidth = ele.superCluster()->phiWidth();
1690  fMVAVar_OneMinusE1x5E5x5 = (ele.e5x5()) !=0. ? 1.-(ele.e1x5()/ele.e5x5()) : -1. ;
1692  fMVAVar_R9 = myEcalCluster.e3x3(*(ele.superCluster()->seed())) / ele.superCluster()->rawEnergy();
1693  if (fMVAVar_R9 > 5) fMVAVar_R9 = 5;
1694 
1695  // Energy matching
1696  fMVAVar_HoE = ele.hadronicOverEm();
1697  fMVAVar_EoP = ( ele.eSuperClusterOverP() > 20 ) ? 20 : ele.eSuperClusterOverP();
1698  fMVAVar_IoEmIoP = (1.0/ele.superCluster()->energy()) - (1.0 / ele.trackMomentumAtVtx().R()); //this is the proper variable
1699  fMVAVar_eleEoPout = ( ele.eEleClusterOverPout() > 20 ) ? 20 : ele.eEleClusterOverPout();
1700  fMVAVar_PreShowerOverRaw= ele.superCluster()->preshowerEnergy() / ele.superCluster()->rawEnergy();
1701 
1702  // Spectators
1703  fMVAVar_eta = ele.superCluster()->eta();
1704  fMVAVar_pt = ele.pt();
1705 
1706 
1707 
1708  // for triggering electrons get the impact parameteres
1709  if(fMVAType == kTrig) {
1710  //d0
1711  if (ele.gsfTrack().isNonnull()) {
1712  fMVAVar_d0 = (-1.0)*ele.gsfTrack()->dxy(vertex.position());
1713  } else if (ele.closestCtfTrackRef().isNonnull()) {
1714  fMVAVar_d0 = (-1.0)*ele.closestCtfTrackRef()->dxy(vertex.position());
1715  } else {
1716  fMVAVar_d0 = -9999.0;
1717  }
1718 
1719  //default values for IP3D
1720  fMVAVar_ip3d = -999.0;
1721  fMVAVar_ip3dSig = 0.0;
1722  if (ele.gsfTrack().isNonnull()) {
1723  const double gsfsign = ( (-ele.gsfTrack()->dxy(vertex.position())) >=0 ) ? 1. : -1.;
1724 
1725  const reco::TransientTrack &tt = transientTrackBuilder.build(ele.gsfTrack());
1726  const std::pair<bool,Measurement1D> &ip3dpv = IPTools::absoluteImpactParameter3D(tt,vertex);
1727  if (ip3dpv.first) {
1728  double ip3d = gsfsign*ip3dpv.second.value();
1729  double ip3derr = ip3dpv.second.error();
1730  fMVAVar_ip3d = ip3d;
1731  fMVAVar_ip3dSig = ip3d/ip3derr;
1732  }
1733  }
1734  }
1735 
1736  //**********************************************************
1737  //Isolation variables
1738  //**********************************************************
1739  Double_t tmpChargedIso_DR0p0To0p1 = 0;
1740  Double_t tmpChargedIso_DR0p1To0p2 = 0;
1741  Double_t tmpChargedIso_DR0p2To0p3 = 0;
1742  Double_t tmpChargedIso_DR0p3To0p4 = 0;
1743  Double_t tmpChargedIso_DR0p4To0p5 = 0;
1744  Double_t tmpGammaIso_DR0p0To0p1 = 0;
1745  Double_t tmpGammaIso_DR0p1To0p2 = 0;
1746  Double_t tmpGammaIso_DR0p2To0p3 = 0;
1747  Double_t tmpGammaIso_DR0p3To0p4 = 0;
1748  Double_t tmpGammaIso_DR0p4To0p5 = 0;
1749  Double_t tmpNeutralHadronIso_DR0p0To0p1 = 0;
1750  Double_t tmpNeutralHadronIso_DR0p1To0p2 = 0;
1751  Double_t tmpNeutralHadronIso_DR0p2To0p3 = 0;
1752  Double_t tmpNeutralHadronIso_DR0p3To0p4 = 0;
1753  Double_t tmpNeutralHadronIso_DR0p4To0p5 = 0;
1754 
1755  for (reco::PFCandidateCollection::const_iterator iP = PFCandidates.begin();
1756  iP != PFCandidates.end(); ++iP) {
1757 
1758  double dr = sqrt(pow(iP->eta() - ele.eta(),2) + pow(acos(cos(iP->phi() - ele.phi())),2));
1759 
1760  Bool_t passVeto = kTRUE;
1761  //Charged
1762  if(iP->trackRef().isNonnull()) {
1763 
1764  //make sure charged pf candidates pass the PFNoPU condition (assumed)
1765 
1766  //************************************************************
1767  // Veto any PFmuon, or PFEle
1768  if (iP->particleId() == reco::PFCandidate::e || iP->particleId() == reco::PFCandidate::mu) passVeto = kFALSE;
1769  //************************************************************
1770  //************************************************************
1771  // Footprint Veto
1772  if (fabs(fMVAVar_eta) > 1.479 && dr < 0.015) passVeto = kFALSE;
1773  //************************************************************
1774  if (passVeto) {
1775  if (dr < 0.1) tmpChargedIso_DR0p0To0p1 += iP->pt();
1776  if (dr >= 0.1 && dr < 0.2) tmpChargedIso_DR0p1To0p2 += iP->pt();
1777  if (dr >= 0.2 && dr < 0.3) tmpChargedIso_DR0p2To0p3 += iP->pt();
1778  if (dr >= 0.3 && dr < 0.4) tmpChargedIso_DR0p3To0p4 += iP->pt();
1779  if (dr >= 0.4 && dr < 0.5) tmpChargedIso_DR0p4To0p5 += iP->pt();
1780  } //pass veto
1781  }
1782  //Gamma
1783  else if (iP->particleId() == reco::PFCandidate::gamma) {
1784  //************************************************************
1785  // Footprint Veto
1786  if (fabs(fMVAVar_eta) > 1.479 && dr < 0.08) passVeto = kFALSE;
1787  //************************************************************
1788  if (passVeto) {
1789  if (dr < 0.1) tmpGammaIso_DR0p0To0p1 += iP->pt();
1790  if (dr >= 0.1 && dr < 0.2) tmpGammaIso_DR0p1To0p2 += iP->pt();
1791  if (dr >= 0.2 && dr < 0.3) tmpGammaIso_DR0p2To0p3 += iP->pt();
1792  if (dr >= 0.3 && dr < 0.4) tmpGammaIso_DR0p3To0p4 += iP->pt();
1793  if (dr >= 0.4 && dr < 0.5) tmpGammaIso_DR0p4To0p5 += iP->pt();
1794  }
1795  }
1796  //NeutralHadron
1797  else {
1798  if (dr < 0.1) tmpNeutralHadronIso_DR0p0To0p1 += iP->pt();
1799  if (dr >= 0.1 && dr < 0.2) tmpNeutralHadronIso_DR0p1To0p2 += iP->pt();
1800  if (dr >= 0.2 && dr < 0.3) tmpNeutralHadronIso_DR0p2To0p3 += iP->pt();
1801  if (dr >= 0.3 && dr < 0.4) tmpNeutralHadronIso_DR0p3To0p4 += iP->pt();
1802  if (dr >= 0.4 && dr < 0.5) tmpNeutralHadronIso_DR0p4To0p5 += iP->pt();
1803  }
1804  } //loop over PF candidates
1805 
1807  fMVAVar_ChargedIso_DR0p0To0p1 = TMath::Min((tmpChargedIso_DR0p0To0p1)/ele.pt(), 2.5);
1808  fMVAVar_ChargedIso_DR0p1To0p2 = TMath::Min((tmpChargedIso_DR0p1To0p2)/ele.pt(), 2.5);
1809  fMVAVar_ChargedIso_DR0p2To0p3 = TMath::Min((tmpChargedIso_DR0p2To0p3)/ele.pt(), 2.5);
1810  fMVAVar_ChargedIso_DR0p3To0p4 = TMath::Min((tmpChargedIso_DR0p3To0p4)/ele.pt(), 2.5);
1811  fMVAVar_ChargedIso_DR0p4To0p5 = TMath::Min((tmpChargedIso_DR0p4To0p5)/ele.pt(), 2.5);
1822  } else if (fMVAType == kTrigIDIsoCombined) {
1823  fMVAVar_ChargedIso_DR0p0To0p1 = TMath::Min((tmpChargedIso_DR0p0To0p1)/ele.pt(), 2.5);
1824  fMVAVar_ChargedIso_DR0p1To0p2 = TMath::Min((tmpChargedIso_DR0p1To0p2)/ele.pt(), 2.5);
1825  fMVAVar_ChargedIso_DR0p2To0p3 = TMath::Min((tmpChargedIso_DR0p2To0p3)/ele.pt(), 2.5);
1826  fMVAVar_ChargedIso_DR0p3To0p4 = TMath::Min((tmpChargedIso_DR0p3To0p4)/ele.pt(), 2.5);
1827  fMVAVar_ChargedIso_DR0p4To0p5 = TMath::Min((tmpChargedIso_DR0p4To0p5)/ele.pt(), 2.5);
1828  fMVAVar_GammaIso_DR0p0To0p1 = TMath::Max(TMath::Min((tmpGammaIso_DR0p0To0p1)/ele.pt(), 2.5), 0.0);
1829  fMVAVar_GammaIso_DR0p1To0p2 = TMath::Max(TMath::Min((tmpGammaIso_DR0p1To0p2)/ele.pt(), 2.5), 0.0);
1830  fMVAVar_GammaIso_DR0p2To0p3 = TMath::Max(TMath::Min((tmpGammaIso_DR0p2To0p3)/ele.pt(), 2.5), 0.0);
1831  fMVAVar_GammaIso_DR0p3To0p4 = TMath::Max(TMath::Min((tmpGammaIso_DR0p3To0p4)/ele.pt(), 2.5), 0.0);
1832  fMVAVar_GammaIso_DR0p4To0p5 = TMath::Max(TMath::Min((tmpGammaIso_DR0p4To0p5)/ele.pt(), 2.5), 0.0);
1833  fMVAVar_NeutralHadronIso_DR0p0To0p1 = TMath::Max(TMath::Min((tmpNeutralHadronIso_DR0p0To0p1)/ele.pt(), 2.5), 0.0);
1834  fMVAVar_NeutralHadronIso_DR0p1To0p2 = TMath::Max(TMath::Min((tmpNeutralHadronIso_DR0p1To0p2)/ele.pt(), 2.5), 0.0);
1835  fMVAVar_NeutralHadronIso_DR0p2To0p3 = TMath::Max(TMath::Min((tmpNeutralHadronIso_DR0p2To0p3)/ele.pt(), 2.5), 0.0);
1836  fMVAVar_NeutralHadronIso_DR0p3To0p4 = TMath::Max(TMath::Min((tmpNeutralHadronIso_DR0p3To0p4)/ele.pt(), 2.5), 0.0);
1837  fMVAVar_NeutralHadronIso_DR0p4To0p5 = TMath::Max(TMath::Min((tmpNeutralHadronIso_DR0p4To0p5)/ele.pt(), 2.5), 0.0);
1838  fMVAVar_rho = Rho;
1839  } else {
1840  cout << "Warning: Type " << fMVAType << " is not supported.\n";
1841  }
1842 
1843  // evaluate
1844  Double_t mva = -9999;
1845  if (fUseBinnedVersion) {
1846  mva = fTMVAReader[GetMVABin(fMVAVar_eta,fMVAVar_pt)]->EvaluateMVA(fMethodname);
1847  } else {
1848  mva = fTMVAReader[0]->EvaluateMVA(fMethodname);
1849  }
1850 
1851 
1852 
1853  if(printDebug) {
1854  cout << " *** Inside the class fMethodname " << fMethodname << " fMVAType " << fMVAType << endl;
1855  cout << " fbrem " << fMVAVar_fbrem
1856  << " kfchi2 " << fMVAVar_kfchi2
1857  << " mykfhits " << fMVAVar_kfhits
1858  << " gsfchi2 " << fMVAVar_gsfchi2
1859  << " deta " << fMVAVar_deta
1860  << " dphi " << fMVAVar_dphi
1861  << " detacalo " << fMVAVar_detacalo
1862  << " see " << fMVAVar_see
1863  << " spp " << fMVAVar_spp
1864  << " etawidth " << fMVAVar_etawidth
1865  << " phiwidth " << fMVAVar_phiwidth
1866  << " OneMinusE1x5E5x5 " << fMVAVar_OneMinusE1x5E5x5
1867  << " R9 " << fMVAVar_R9
1868  << " HoE " << fMVAVar_HoE
1869  << " EoP " << fMVAVar_EoP
1870  << " IoEmIoP " << fMVAVar_IoEmIoP
1871  << " eleEoPout " << fMVAVar_eleEoPout
1872  << " d0 " << fMVAVar_d0
1873  << " ip3d " << fMVAVar_ip3d
1874  << " eta " << fMVAVar_eta
1875  << " pt " << fMVAVar_pt << endl;
1876  cout << "ChargedIso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
1881  << fMVAVar_ChargedIso_DR0p4To0p5 << endl;
1882  cout << "PF Gamma Iso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
1883  << fMVAVar_GammaIso_DR0p0To0p1 << " "
1884  << fMVAVar_GammaIso_DR0p1To0p2 << " "
1885  << fMVAVar_GammaIso_DR0p2To0p3 << " "
1886  << fMVAVar_GammaIso_DR0p3To0p4 << " "
1887  << fMVAVar_GammaIso_DR0p4To0p5 << endl;
1888  cout << "PF Neutral Hadron Iso ( 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 ): "
1894  << endl;
1895  cout << "Rho : " << Rho << endl;
1896  cout << " ### MVA " << mva << endl;
1897  }
1898 
1899 
1900 
1901  return mva;
1902 }
1903 
1904 
1905 
1906 
1907 #endif
1908 
1910 
1911  // this binding is needed for variables that sometime diverge.
1912 
1913 
1914  if(fMVAVar_fbrem < -1.)
1915  fMVAVar_fbrem = -1.;
1916 
1917  fMVAVar_deta = fabs(fMVAVar_deta);
1918  if(fMVAVar_deta > 0.06)
1919  fMVAVar_deta = 0.06;
1920 
1921 
1922  fMVAVar_dphi = fabs(fMVAVar_dphi);
1923  if(fMVAVar_dphi > 0.6)
1924  fMVAVar_dphi = 0.6;
1925 
1926 
1927  if(fMVAVar_EoP > 20.)
1928  fMVAVar_EoP = 20.;
1929 
1930  if(fMVAVar_eleEoPout > 20.)
1931  fMVAVar_eleEoPout = 20.;
1932 
1933 
1935  if(fMVAVar_detacalo > 0.2)
1936  fMVAVar_detacalo = 0.2;
1937 
1938  if(fMVAVar_OneMinusE1x5E5x5 < -1.)
1940 
1941  if(fMVAVar_OneMinusE1x5E5x5 > 2.)
1943 
1944 
1945 
1946  if(fMVAVar_R9 > 5)
1947  fMVAVar_R9 = 5;
1948 
1949  if(fMVAVar_gsfchi2 > 200.)
1950  fMVAVar_gsfchi2 = 200;
1951 
1952 
1953  if(fMVAVar_kfchi2 > 10.)
1954  fMVAVar_kfchi2 = 10.;
1955 
1956 
1957  // Needed for a bug in CMSSW_420, fixed in more recent CMSSW versions
1958  if(std::isnan(fMVAVar_spp))
1959  fMVAVar_spp = 0.;
1960 
1961 
1962  return;
1963 }
1964 
1965 
1966 
1967 
1968 
1969 
1970 
1971 
double edB(IpType type=None) const
Uncertainty on the corresponding impact parameter.
Definition: Electron.cc:405
std::vector< float > localCovariances(const reco::BasicCluster &cluster, float w0=4.7)
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
virtual double p() const
magnitude of momentum vector
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
reco::TrackRef closestCtfTrackRef() const
override the reco::GsfElectron::closestCtfTrackRef method, to access the internal storage of the trac...
Definition: Electron.cc:177
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Definition: Electron.cc:150
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:272
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)
static Double_t GetElectronEffectiveArea(ElectronEffectiveAreaType type, Double_t SCEta, ElectronEffectiveAreaTarget EffectiveAreaTarget=kEleEAData2011)
reco::TransientTrack build(const reco::Track *p) const
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:37
float e3x3(const reco::BasicCluster &cluster)
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
Definition: Electron.cc:131
#define min(a, b)
Definition: mlp_lapack.h:161
float fbrem() const
Definition: GsfElectron.h:639
bool isAvailable() const
Definition: Ref.h:276
T eta() const
UInt_t GetMVABin(double eta, double pt) const
std::vector< TMVA::Reader * > fTMVAReader
const Point & position() const
position
Definition: Vertex.h:93
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual double eta() const
momentum pseudorapidity
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:185
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)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
float hadronicOverEm() const
Definition: GsfElectron.h:403
const T & max(const T &a, const T &b)
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:46
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void initialize(std::string methodName, std::string weightsfile, EGammaMvaEleEstimator::MVAType type)
float eEleClusterOverPout() const
Definition: GsfElectron.h:232
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
double r9() const
Definition: Electron.h:195
virtual double pt() const
transverse momentum
float e1x5() const
Definition: GsfElectron.h:384
double sigmaIphiIphi() const
sigmaIPhiPhi
Definition: Electron.h:197
Analysis-level electron class.
Definition: Electron.h:52
float ecalEnergy() const
Definition: GsfElectron.h:724
float e5x5() const
Definition: GsfElectron.h:386
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:234
tuple cout
Definition: gather_cfg.py:121
virtual double phi() const
momentum azimuthal angle
double dB(IpType type=None) const
Impact parameter wrt primary vertex or beamspot.
Definition: Electron.cc:378
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
tuple PFCandidates