CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronIDMVA.cc
Go to the documentation of this file.
1 #include "TFile.h"
2 #include "TRandom3.h"
3 #include "TVector3.h"
4 #include "TMVA/Tools.h"
5 #include "TMVA/Reader.h"
6 
11 
12 using namespace HWWFunctions;
13 
14 //--------------------------------------------------------------------------------------------------
16  fMethodname("BDTG method"),
17  fIsInitialized(kFALSE)
18 {
19  // Constructor.
20  for(UInt_t i=0; i<6; ++i) {
21  fTMVAReader[i] = 0;
22  }
23 }
24 
25 
26 //--------------------------------------------------------------------------------------------------
28 {
29  for(UInt_t i=0; i<6; ++i) {
30  if (fTMVAReader[i]) delete fTMVAReader[i];
31  }
32 }
33 
34 //--------------------------------------------------------------------------------------------------
35 void ElectronIDMVA::Initialize( TString methodName, unsigned int version,
36  TString Subdet0Pt10To20Weights ,
37  TString Subdet1Pt10To20Weights ,
38  TString Subdet2Pt10To20Weights,
39  TString Subdet0Pt20ToInfWeights,
40  TString Subdet1Pt20ToInfWeights,
41  TString Subdet2Pt20ToInfWeights) {
42 
43  if (version != 1 && version != 2 && version != 3) {
44  edm::LogError("InvalidInput") << "[ElectronIDMVA::Initialize] Version must be 1 or 2 or 3. Aborting.";
45  return;
46  }
47 
48  version_ = version;
49 
50  fIsInitialized = kTRUE;
51  fMethodname = methodName;
52 
53  for(UInt_t i=0; i<6; ++i) {
54  if (fTMVAReader[i]) delete fTMVAReader[i];
55 
56  fTMVAReader[i] = new TMVA::Reader( "!Color:!Silent:Error" );
57  fTMVAReader[i]->SetVerbose(kTRUE);
58  // order matters!
59 
60  if (version == 1) {
61  fTMVAReader[i] = new TMVA::Reader( "!Color:!Silent:Error" );
62  fTMVAReader[i]->SetVerbose(kTRUE);
63  fTMVAReader[i]->AddVariable( "SigmaIEtaIEta", &fMVAVar_EleSigmaIEtaIEta );
64  fTMVAReader[i]->AddVariable( "DEtaIn", &fMVAVar_EleDEtaIn );
65  fTMVAReader[i]->AddVariable( "DPhiIn", &fMVAVar_EleDPhiIn );
66  fTMVAReader[i]->AddVariable( "FBrem", &fMVAVar_EleFBrem );
67  fTMVAReader[i]->AddVariable( "EOverP", &fMVAVar_EleEOverP );
68  fTMVAReader[i]->AddVariable( "ESeedClusterOverPout", &fMVAVar_EleESeedClusterOverPout );
69  fTMVAReader[i]->AddVariable( "SigmaIPhiIPhi", &fMVAVar_EleSigmaIPhiIPhi );
70  fTMVAReader[i]->AddVariable( "NBrem", &fMVAVar_EleNBrem );
71  fTMVAReader[i]->AddVariable( "OneOverEMinusOneOverP", &fMVAVar_EleOneOverEMinusOneOverP );
72  fTMVAReader[i]->AddVariable( "ESeedClusterOverPIn", &fMVAVar_EleESeedClusterOverPIn );
73  } else if (version == 2) {
74  fTMVAReader[i] = new TMVA::Reader( "!Color:!Silent:Error" );
75  fTMVAReader[i]->AddVariable( "SigmaIEtaIEta", &fMVAVar_EleSigmaIEtaIEta );
76  fTMVAReader[i]->AddVariable( "DEtaIn", &fMVAVar_EleDEtaIn );
77  fTMVAReader[i]->AddVariable( "DPhiIn", &fMVAVar_EleDPhiIn );
78  fTMVAReader[i]->AddVariable( "D0", &fMVAVar_EleD0 );
79  fTMVAReader[i]->AddVariable( "FBrem", &fMVAVar_EleFBrem );
80  fTMVAReader[i]->AddVariable( "EOverP", &fMVAVar_EleEOverP );
81  fTMVAReader[i]->AddVariable( "ESeedClusterOverPout", &fMVAVar_EleESeedClusterOverPout );
82  fTMVAReader[i]->AddVariable( "SigmaIPhiIPhi", &fMVAVar_EleSigmaIPhiIPhi );
83  fTMVAReader[i]->AddVariable( "NBrem", &fMVAVar_EleNBrem );
84  fTMVAReader[i]->AddVariable( "OneOverEMinusOneOverP", &fMVAVar_EleOneOverEMinusOneOverP );
85  fTMVAReader[i]->AddVariable( "ESeedClusterOverPIn", &fMVAVar_EleESeedClusterOverPIn );
86  fTMVAReader[i]->AddVariable( "IP3d", &fMVAVar_EleIP3d );
87  fTMVAReader[i]->AddVariable( "IP3dSig", &fMVAVar_EleIP3dSig );
88  } else if (version == 3) {
89  fTMVAReader[i]->AddVariable( "SigmaIEtaIEta", &fMVAVar_EleSigmaIEtaIEta );
90  fTMVAReader[i]->AddVariable( "DEtaIn", &fMVAVar_EleDEtaIn );
91  fTMVAReader[i]->AddVariable( "DPhiIn", &fMVAVar_EleDPhiIn );
92  //fTMVAReader[i]->AddVariable( "HoverE", &fMVAVar_EleHoverE );
93  fTMVAReader[i]->AddVariable( "D0", &fMVAVar_EleD0 );
94  fTMVAReader[i]->AddVariable( "FBrem", &fMVAVar_EleFBrem );
95  fTMVAReader[i]->AddVariable( "EOverP", &fMVAVar_EleEOverP );
96  fTMVAReader[i]->AddVariable( "ESeedClusterOverPout", &fMVAVar_EleESeedClusterOverPout );
97  fTMVAReader[i]->AddVariable( "SigmaIPhiIPhi", &fMVAVar_EleSigmaIPhiIPhi );
98  fTMVAReader[i]->AddVariable( "OneOverEMinusOneOverP", &fMVAVar_EleOneOverEMinusOneOverP );
99  fTMVAReader[i]->AddVariable( "ESeedClusterOverPIn", &fMVAVar_EleESeedClusterOverPIn );
100  fTMVAReader[i]->AddVariable( "IP3d", &fMVAVar_EleIP3d );
101  fTMVAReader[i]->AddVariable( "IP3dSig", &fMVAVar_EleIP3dSig );
102 
103  fTMVAReader[i]->AddVariable( "GsfTrackChi2OverNdof", &fMVAVar_EleGsfTrackChi2OverNdof );
104  fTMVAReader[i]->AddVariable( "dEtaCalo", &fMVAVar_EledEtaCalo );
105  fTMVAReader[i]->AddVariable( "dPhiCalo", &fMVAVar_EledPhiCalo );
106  fTMVAReader[i]->AddVariable( "R9", &fMVAVar_EleR9 );
107  fTMVAReader[i]->AddVariable( "SCEtaWidth", &fMVAVar_EleSCEtaWidth );
108  fTMVAReader[i]->AddVariable( "SCPhiWidth", &fMVAVar_EleSCPhiWidth );
109  fTMVAReader[i]->AddVariable( "CovIEtaIPhi", &fMVAVar_EleCovIEtaIPhi );
110  if (i == 2 || i == 5) {
111  fTMVAReader[i]->AddVariable( "PreShowerOverRaw", &fMVAVar_ElePreShowerOverRaw );
112  }
113  fTMVAReader[i]->AddVariable( "ChargedIso03", &fMVAVar_EleChargedIso03OverPt );
114  fTMVAReader[i]->AddVariable( "NeutralHadronIso03", &fMVAVar_EleNeutralHadronIso03OverPt );
115  fTMVAReader[i]->AddVariable( "GammaIso03", &fMVAVar_EleGammaIso03OverPt );
116  fTMVAReader[i]->AddVariable( "ChargedIso04", &fMVAVar_EleChargedIso04OverPt );
117  fTMVAReader[i]->AddVariable( "NeutralHadronIso04", &fMVAVar_EleNeutralHadronIso04OverPt );
118  fTMVAReader[i]->AddVariable( "GammaIso04", &fMVAVar_EleGammaIso04OverPt );
119  }
120 
121  if (i==0) fTMVAReader[i]->BookMVA(fMethodname , Subdet0Pt10To20Weights );
122  if (i==1) fTMVAReader[i]->BookMVA(fMethodname , Subdet1Pt10To20Weights );
123  if (i==2) fTMVAReader[i]->BookMVA(fMethodname , Subdet2Pt10To20Weights );
124  if (i==3) fTMVAReader[i]->BookMVA(fMethodname , Subdet0Pt20ToInfWeights );
125  if (i==4) fTMVAReader[i]->BookMVA(fMethodname , Subdet1Pt20ToInfWeights );
126  if (i==5) fTMVAReader[i]->BookMVA(fMethodname , Subdet2Pt20ToInfWeights );
127 
128  }
129 
130 }
131 
132 //--------------------------------------------------------------------------------------------------
133 Double_t ElectronIDMVA::MVAValue(HWW& hww, const unsigned int ele, const unsigned int vertex) {
134 
135  if (!fIsInitialized) {
136  edm::LogError("NotInitialized") << "Error: ElectronIDMVA not properly initialized.";
137  return -9999;
138  }
139 
140  Int_t subdet = 0;
141  if (fabs(hww.els_etaSC().at(ele)) < 1.0) subdet = 0;
142  else if (fabs(hww.els_etaSC().at(ele)) < 1.479) subdet = 1;
143  else subdet = 2;
144  Int_t ptBin = 0;
145  if (hww.els_p4().at(ele).Pt() > 20.0) ptBin = 1;
146 
147  //set all input variables
149  fMVAVar_EleDEtaIn = hww.els_dEtaIn().at(ele);
150  fMVAVar_EleDPhiIn = hww.els_dPhiIn().at(ele);
151  if (version_ == 3) fMVAVar_EleHoverE = hww.els_hOverE().at(ele); //this is new
152  fMVAVar_EleD0 = electron_d0PV_wwV1(hww, ele);
153  fMVAVar_EleDZ = electron_dzPV_wwV1(hww, ele);
154  fMVAVar_EleFBrem = hww.els_fbrem().at(ele);
155  fMVAVar_EleEOverP = hww.els_eOverPIn().at(ele);
158  fMVAVar_EleNBrem = hww.els_nSeed().at(ele);
159  TVector3 pIn(hww.els_trk_p4().at(ele).px(), hww.els_trk_p4().at(ele).py(), hww.els_trk_p4().at(ele).pz());
160  fMVAVar_EleOneOverEMinusOneOverP = 1./hww.els_eSC().at(ele) - 1./pIn.Mag();
162  const double gsfsign = ( (gsftrks_d0_pv(hww, hww.els_gsftrkidx().at(ele),0).first) >=0 ) ? 1. : -1.;
163  fMVAVar_EleIP3d = hww.els_ip3d().at(ele)*gsfsign;
164  if (hww.els_ip3derr().at(ele) == 0.0) fMVAVar_EleIP3dSig = 0.0;
165  else fMVAVar_EleIP3dSig = hww.els_ip3d().at(ele)*gsfsign / hww.els_ip3derr().at(ele);
166 
167  if (version_ == 3) { //these are new
168  Double_t ElePt = hww.els_p4().at(ele).pt();
169  Double_t EleEta = hww.els_etaSC().at(ele);
170  Double_t Rho = hww.evt_ww_rho_vor();
171  fMVAVar_EleGsfTrackChi2OverNdof = hww.els_chi2().at(ele) / hww.els_ndof().at(ele);
172  fMVAVar_EledEtaCalo = hww.els_dEtaOut().at(ele);
173  fMVAVar_EledPhiCalo = hww.els_dPhiOut().at(ele);
174  fMVAVar_EleR9 = hww.els_e3x3().at(ele) / hww.els_eSCRaw().at(ele);
175  fMVAVar_EleSCEtaWidth = hww.els_etaSCwidth().at(ele);
176  fMVAVar_EleSCPhiWidth = hww.els_phiSCwidth().at(ele);
177  fMVAVar_EleCovIEtaIPhi = hww.scs_sigmaIEtaIPhi().at(hww.els_scindex().at(ele))>0 ? pow(hww.scs_sigmaIEtaIPhi().at(hww.els_scindex().at(ele)),2) : -1.* pow(hww.scs_sigmaIEtaIPhi().at(hww.els_scindex().at(ele)),2);
178  fMVAVar_ElePreShowerOverRaw = hww.els_eSCPresh().at(ele) / hww.els_eSCRaw().at(ele);
180  = (hww.els_iso03_pf_ch().at(ele) //electronIsoValuePF(ele, vertex, 0.3, 99999., 0.1, 0.07, 0.025, -999., 0)*ElePt
181  - Rho * ElectronEffectiveArea(ElectronIDMVA::kEleChargedIso03, EleEta)) / ElePt;
183  = (hww.els_iso03_pf_nhad05().at(ele) //electronIsoValuePF(ele, vertex, 0.3, 0.5, 0.1, 0.07, 0.025, -999., 130)*ElePt
187  = (hww.els_iso03_pf_gamma05().at(ele) //electronIsoValuePF(ele, vertex, 0.3, 0.5, 0.1, 0.07, 0.025, -999., 22)*ElePt
191  = (hww.els_iso04_pf_ch().at(ele) //electronIsoValuePF(ele, vertex, 0.4, 99999., 0.1, 0.07, 0.025, -999., 0)*ElePt
192  - Rho * ElectronEffectiveArea(ElectronIDMVA::kEleChargedIso04, EleEta)) / ElePt;
194  = (hww.els_iso04_pf_nhad05().at(ele) //electronIsoValuePF(ele, vertex, 0.4, 0.5, 0.1, 0.07, 0.025, -999., 130)*ElePt
198  = (hww.els_iso04_pf_gamma05().at(ele) //electronIsoValuePF(ele, vertex, 0.4, 0.5, 0.1, 0.07, 0.025, -999., 22)*ElePt
201  }
202 
203  Double_t mva = -9999;
204  TMVA::Reader *reader = 0;
205  Int_t MVABin = -1;
206  if (subdet == 0 && ptBin == 0) MVABin = 0;
207  if (subdet == 1 && ptBin == 0) MVABin = 1;
208  if (subdet == 2 && ptBin == 0) MVABin = 2;
209  if (subdet == 0 && ptBin == 1) MVABin = 3;
210  if (subdet == 1 && ptBin == 1) MVABin = 4;
211  if (subdet == 2 && ptBin == 1) MVABin = 5;
212  assert(MVABin >= 0 && MVABin <= 5);
213  reader = fTMVAReader[MVABin];
214 
215  mva = reader->EvaluateMVA( fMethodname );
216 
217 
218  //DEBUG
219  if (0) {
220  LogDebug("ElectronIDMVA") << hww.evt_run() << " " << hww.evt_lumiBlock() << " " << hww.evt_event() << " " << hww.evt_ww_rho_vor()
221  << hww.els_p4().at(ele).pt() << " " << hww.els_etaSC().at(ele) << " --> MVABin " << MVABin << " : "
222  << fMVAVar_EleSigmaIEtaIEta << " "
223  << fMVAVar_EleDEtaIn << " "
224  << fMVAVar_EleDPhiIn << " "
225  << fMVAVar_EleHoverE << " "
226  << fMVAVar_EleD0 << " "
227  << fMVAVar_EleDZ << " "
228  << fMVAVar_EleFBrem << " "
229  << fMVAVar_EleEOverP << " "
231  << fMVAVar_EleSigmaIPhiIPhi << " "
232  << fMVAVar_EleNBrem << " "
233  << fMVAVar_EleOneOverEMinusOneOverP << " "
235  << fMVAVar_EleIP3d << " "
236  << fMVAVar_EleIP3dSig << " "
238  << fMVAVar_EledEtaCalo << " "
239  << fMVAVar_EledPhiCalo << " "
240  << fMVAVar_EleR9 << " "
241  << fMVAVar_EleSCEtaWidth << " "
242  << fMVAVar_EleSCPhiWidth << " "
243  << fMVAVar_EleCovIEtaIPhi << " "
251  << " === : === "
252  << mva;
253  }
254  return mva;
255 
256 }
257 
258 //--------------------------------------------------------------------------------------------------
259 Double_t ElectronIDMVA::MVAValue(Double_t ElePt , Double_t EleSCEta,
260  Double_t EleSigmaIEtaIEta,
261  Double_t EleDEtaIn,
262  Double_t EleDPhiIn,
263  Double_t EleD0,
264  Double_t EleDZ,
265  Double_t EleFBrem,
266  Double_t EleEOverP,
267  Double_t EleESeedClusterOverPout,
268  Double_t EleSigmaIPhiIPhi,
269  Double_t EleNBrem,
270  Double_t EleOneOverEMinusOneOverP,
271  Double_t EleESeedClusterOverPIn,
272  Double_t EleIP3d,
273  Double_t EleIP3dSig
274  ) {
275 
276  if (!fIsInitialized) {
277  edm::LogError("NotInitialized") << "Error: ElectronIDMVA not properly initialized.";
278  return -9999;
279  }
280 
281  Int_t subdet = 0;
282  if (fabs(EleSCEta) < 1.0) subdet = 0;
283  else if (fabs(EleSCEta) < 1.479) subdet = 1;
284  else subdet = 2;
285  Int_t ptBin = 0;
286  if (ElePt > 20.0) ptBin = 1;
287 
288  //set all input variables
289  fMVAVar_EleSigmaIEtaIEta = EleSigmaIEtaIEta;
290  fMVAVar_EleDEtaIn = EleDEtaIn;
291  fMVAVar_EleDPhiIn = EleDPhiIn;
292  fMVAVar_EleD0 = EleD0;
293  fMVAVar_EleDZ = EleDZ;
294  fMVAVar_EleFBrem = EleFBrem;
295  fMVAVar_EleEOverP = EleEOverP;
296  fMVAVar_EleESeedClusterOverPout = EleESeedClusterOverPout;
297  fMVAVar_EleSigmaIPhiIPhi = EleSigmaIPhiIPhi;
298  fMVAVar_EleNBrem = EleNBrem;
299  fMVAVar_EleOneOverEMinusOneOverP = EleOneOverEMinusOneOverP;
300  fMVAVar_EleESeedClusterOverPIn = EleESeedClusterOverPIn;
301  fMVAVar_EleIP3d = EleIP3d;
302  fMVAVar_EleIP3dSig = EleIP3dSig;
303 
304  Double_t mva = -9999;
305  TMVA::Reader *reader = 0;
306  Int_t MVABin = -1;
307  if (subdet == 0 && ptBin == 0) MVABin = 0;
308  if (subdet == 1 && ptBin == 0) MVABin = 1;
309  if (subdet == 2 && ptBin == 0) MVABin = 2;
310  if (subdet == 0 && ptBin == 1) MVABin = 3;
311  if (subdet == 1 && ptBin == 1) MVABin = 4;
312  if (subdet == 2 && ptBin == 1) MVABin = 5;
313  assert(MVABin >= 0 && MVABin <= 5);
314  reader = fTMVAReader[MVABin];
315 
316  mva = reader->EvaluateMVA( fMethodname );
317 
318  return mva;
319 }
320 //--------------------------------------------------------------------------------------------------
321 Double_t ElectronIDMVA::MVAValue(Double_t ElePt , Double_t EleEta, Double_t PileupEnergyDensity,
322  Double_t EleSigmaIEtaIEta,
323  Double_t EleDEtaIn,
324  Double_t EleDPhiIn,
325  Double_t EleHoverE,
326  Double_t EleD0,
327  Double_t EleDZ,
328  Double_t EleFBrem,
329  Double_t EleEOverP,
330  Double_t EleESeedClusterOverPout,
331  Double_t EleSigmaIPhiIPhi,
332  Double_t EleNBrem,
333  Double_t EleOneOverEMinusOneOverP,
334  Double_t EleESeedClusterOverPIn,
335  Double_t EleIP3d,
336  Double_t EleIP3dSig,
337  Double_t EleGsfTrackChi2OverNdof,
338  Double_t EledEtaCalo,
339  Double_t EledPhiCalo,
340  Double_t EleR9,
341  Double_t EleSCEtaWidth,
342  Double_t EleSCPhiWidth,
343  Double_t EleCovIEtaIPhi,
344  Double_t ElePreShowerOverRaw,
345  Double_t EleChargedIso03,
346  Double_t EleNeutralHadronIso03,
347  Double_t EleGammaIso03,
348  Double_t EleChargedIso04,
349  Double_t EleNeutralHadronIso04,
350  Double_t EleGammaIso04,
351  Bool_t printDebug
352  ) {
353 
354  if (!fIsInitialized) {
355  edm::LogError("NotInitialized") << "Error: ElectronIDMVA not properly initialized.";
356  return -9999;
357  }
358 
359  Double_t Rho = 0;
360  //jgran if (!(TMath::IsNaN(PileupEnergyDensity) || isinf(PileupEnergyDensity))) Rho = PileupEnergyDensity;
361  Rho = PileupEnergyDensity; //jgran
362 
363  Int_t subdet = 0;
364  if (fabs(EleEta) < 1.0) subdet = 0;
365  else if (fabs(EleEta) < 1.479) subdet = 1;
366  else subdet = 2;
367  Int_t ptBin = 0;
368  if (ElePt > 20.0) ptBin = 1;
369 
370  //set all input variables
371  fMVAVar_EleSigmaIEtaIEta = EleSigmaIEtaIEta;
372  fMVAVar_EleDEtaIn = EleDEtaIn;
373  fMVAVar_EleDPhiIn = EleDPhiIn;
374  fMVAVar_EleHoverE = EleHoverE;
375  fMVAVar_EleD0 = EleD0;
376  fMVAVar_EleDZ = EleDZ;
377  fMVAVar_EleFBrem = EleFBrem;
378  fMVAVar_EleEOverP = EleEOverP;
379  fMVAVar_EleESeedClusterOverPout = EleESeedClusterOverPout;
380  fMVAVar_EleSigmaIPhiIPhi = EleSigmaIPhiIPhi;
381  fMVAVar_EleNBrem = EleNBrem;
382  fMVAVar_EleOneOverEMinusOneOverP = EleOneOverEMinusOneOverP;
383  fMVAVar_EleESeedClusterOverPIn = EleESeedClusterOverPIn;
384  fMVAVar_EleIP3d = EleIP3d;
385  fMVAVar_EleIP3dSig = EleIP3dSig;
386  fMVAVar_EleGsfTrackChi2OverNdof = EleGsfTrackChi2OverNdof;
387  fMVAVar_EledEtaCalo = EledEtaCalo;
388  fMVAVar_EledPhiCalo = EledPhiCalo;
389  fMVAVar_EleR9 = EleR9;
390  fMVAVar_EleSCEtaWidth = EleSCEtaWidth;
391  fMVAVar_EleSCPhiWidth = EleSCPhiWidth;
392  fMVAVar_EleCovIEtaIPhi = EleCovIEtaIPhi;
393  fMVAVar_ElePreShowerOverRaw = ElePreShowerOverRaw;
395  = (EleChargedIso03
396  - Rho * ElectronEffectiveArea(ElectronIDMVA::kEleChargedIso03, EleEta)) / ElePt;
398  = (EleNeutralHadronIso03
402  = (EleGammaIso03
406  = (EleChargedIso04
409  = (EleNeutralHadronIso04
413  = (EleGammaIso04
416 
417  Double_t mva = -9999;
418  TMVA::Reader *reader = 0;
419  Int_t MVABin = -1;
420  if (subdet == 0 && ptBin == 0) MVABin = 0;
421  if (subdet == 1 && ptBin == 0) MVABin = 1;
422  if (subdet == 2 && ptBin == 0) MVABin = 2;
423  if (subdet == 0 && ptBin == 1) MVABin = 3;
424  if (subdet == 1 && ptBin == 1) MVABin = 4;
425  if (subdet == 2 && ptBin == 1) MVABin = 5;
426  assert(MVABin >= 0 && MVABin <= 5);
427  reader = fTMVAReader[MVABin];
428 
429  mva = reader->EvaluateMVA( fMethodname );
430 
431  if (printDebug == kTRUE) {
432  LogDebug("ElectronIDMVA") << ElePt << " " << EleEta << " " << " --> MVABin " << MVABin << " : "
433  << fMVAVar_EleSigmaIEtaIEta << " "
434  << fMVAVar_EleDEtaIn << " "
435  << fMVAVar_EleDPhiIn << " "
436  << fMVAVar_EleHoverE << " "
437  << fMVAVar_EleD0 << " "
438  << fMVAVar_EleDZ << " "
439  << fMVAVar_EleFBrem << " "
440  << fMVAVar_EleEOverP << " "
442  << fMVAVar_EleSigmaIPhiIPhi << " "
443  << fMVAVar_EleNBrem << " "
446  << fMVAVar_EleIP3d << " "
447  << fMVAVar_EleIP3dSig << " "
449  << fMVAVar_EledEtaCalo << " "
450  << fMVAVar_EledPhiCalo << " "
451  << fMVAVar_EleR9 << " "
452  << fMVAVar_EleSCEtaWidth << " "
453  << fMVAVar_EleSCPhiWidth << " "
454  << fMVAVar_EleCovIEtaIPhi << " "
462  << " === : === "
463  << mva;
464  }
465 
466  return mva;
467 }
468 
470 
471  Double_t EffectiveArea = 0;
472 
473  if (fabs(Eta) < 1.0) {
474  if (type == ElectronIDMVA::kEleChargedIso03) EffectiveArea = 0.000;
475  if (type == ElectronIDMVA::kEleNeutralHadronIso03) EffectiveArea = 0.017;
476  if (type == ElectronIDMVA::kEleGammaIso03) EffectiveArea = 0.045;
477  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.014;
478  if (type == ElectronIDMVA::kEleChargedIso04) EffectiveArea = 0.000;
479  if (type == ElectronIDMVA::kEleNeutralHadronIso04) EffectiveArea = 0.034;
480  if (type == ElectronIDMVA::kEleGammaIso04) EffectiveArea = 0.079;
481  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.014;
482  if (type == ElectronIDMVA::kEleNeutralHadronIso007) EffectiveArea = 0.000;
483  if (type == ElectronIDMVA::kEleHoverE) EffectiveArea = 0.00016;
484  if (type == ElectronIDMVA::kEleHcalDepth1OverEcal) EffectiveArea = 0.00016;
485  if (type == ElectronIDMVA::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;
486  } else if (fabs(Eta) >= 1.0 && fabs(Eta) < 1.479 ) {
487  if (type == ElectronIDMVA::kEleChargedIso03) EffectiveArea = 0.000;
488  if (type == ElectronIDMVA::kEleNeutralHadronIso03) EffectiveArea = 0.025;
489  if (type == ElectronIDMVA::kEleGammaIso03) EffectiveArea = 0.052;
490  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.030;
491  if (type == ElectronIDMVA::kEleChargedIso04) EffectiveArea = 0.000;
492  if (type == ElectronIDMVA::kEleNeutralHadronIso04) EffectiveArea = 0.050;
493  if (type == ElectronIDMVA::kEleGammaIso04) EffectiveArea = 0.073;
494  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.030;
495  if (type == ElectronIDMVA::kEleNeutralHadronIso007) EffectiveArea = 0.000;
496  if (type == ElectronIDMVA::kEleHoverE) EffectiveArea = 0.00022;
497  if (type == ElectronIDMVA::kEleHcalDepth1OverEcal) EffectiveArea = 0.00022;
498  if (type == ElectronIDMVA::kEleHcalDepth2OverEcal) EffectiveArea = 0.00000;
499  } else if (fabs(Eta) >= 1.479 && fabs(Eta) < 2.0 ) {
500  if (type == ElectronIDMVA::kEleChargedIso03) EffectiveArea = 0.000;
501  if (type == ElectronIDMVA::kEleNeutralHadronIso03) EffectiveArea = 0.030;
502  if (type == ElectronIDMVA::kEleGammaIso03) EffectiveArea = 0.170;
503  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.134;
504  if (type == ElectronIDMVA::kEleChargedIso04) EffectiveArea = 0.000;
505  if (type == ElectronIDMVA::kEleNeutralHadronIso04) EffectiveArea = 0.060;
506  if (type == ElectronIDMVA::kEleGammaIso04) EffectiveArea = 0.187;
507  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.134;
508  if (type == ElectronIDMVA::kEleNeutralHadronIso007) EffectiveArea = 0.000;
509  if (type == ElectronIDMVA::kEleHoverE) EffectiveArea = 0.00030;
510  if (type == ElectronIDMVA::kEleHcalDepth1OverEcal) EffectiveArea = 0.00026;
511  if (type == ElectronIDMVA::kEleHcalDepth2OverEcal) EffectiveArea = 0.00002;
512  } else if (fabs(Eta) >= 2.0 && fabs(Eta) < 2.25 ) {
513  if (type == ElectronIDMVA::kEleChargedIso03) EffectiveArea = 0.000;
514  if (type == ElectronIDMVA::kEleNeutralHadronIso03) EffectiveArea = 0.022;
515  if (type == ElectronIDMVA::kEleGammaIso03) EffectiveArea = 0.623;
516  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 0.516;
517  if (type == ElectronIDMVA::kEleChargedIso04) EffectiveArea = 0.000;
518  if (type == ElectronIDMVA::kEleNeutralHadronIso04) EffectiveArea = 0.055;
519  if (type == ElectronIDMVA::kEleGammaIso04) EffectiveArea = 0.659;
520  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 0.517;
521  if (type == ElectronIDMVA::kEleNeutralHadronIso007) EffectiveArea = 0.000;
522  if (type == ElectronIDMVA::kEleHoverE) EffectiveArea = 0.00054;
523  if (type == ElectronIDMVA::kEleHcalDepth1OverEcal) EffectiveArea = 0.00045;
524  if (type == ElectronIDMVA::kEleHcalDepth2OverEcal) EffectiveArea = 0.00003;
525  } else if (fabs(Eta) >= 2.25 && fabs(Eta) < 2.5 ) {
526  if (type == ElectronIDMVA::kEleChargedIso03) EffectiveArea = 0.000;
527  if (type == ElectronIDMVA::kEleNeutralHadronIso03) EffectiveArea = 0.018;
528  if (type == ElectronIDMVA::kEleGammaIso03) EffectiveArea = 1.198;
529  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip03) EffectiveArea = 1.049;
530  if (type == ElectronIDMVA::kEleChargedIso04) EffectiveArea = 0.000;
531  if (type == ElectronIDMVA::kEleNeutralHadronIso04) EffectiveArea = 0.073;
532  if (type == ElectronIDMVA::kEleGammaIso04) EffectiveArea = 1.258;
533  if (type == ElectronIDMVA::kEleGammaIsoVetoEtaStrip04) EffectiveArea = 1.051;
534  if (type == ElectronIDMVA::kEleNeutralHadronIso007) EffectiveArea = 0.000;
535  if (type == ElectronIDMVA::kEleHoverE) EffectiveArea = 0.00082;
536  if (type == ElectronIDMVA::kEleHcalDepth1OverEcal) EffectiveArea = 0.00066;
537  if (type == ElectronIDMVA::kEleHcalDepth2OverEcal) EffectiveArea = 0.00004;
538  }
539 
540  return EffectiveArea;
541 }
542 
#define LogDebug(id)
std::vector< float > & els_ip3derr()
Definition: HWW.cc:181
type
Definition: HCALResponse.h:21
std::vector< float > & els_iso04_pf_nhad05()
Definition: HWW.cc:233
int i
Definition: DBlmapReader.cc:9
Float_t fMVAVar_EleNBrem
Float_t fMVAVar_EleESeedClusterOverPIn
Float_t fMVAVar_ElePreShowerOverRaw
Float_t fMVAVar_EleIP3dSig
double electron_dzPV_wwV1(HWW &, unsigned int index)
Float_t fMVAVar_EleDEtaIn
Float_t fMVAVar_EleSigmaIPhiIPhi
Double_t MVAValue(HWW &, const unsigned int ele, const unsigned int vertex)
std::vector< float > & els_e3x3()
Definition: HWW.cc:249
std::vector< float > & els_ndof()
Definition: HWW.cc:189
Float_t fMVAVar_EleHoverE
Bool_t fIsInitialized
TString fMethodname
std::vector< float > & els_hOverE()
Definition: HWW.cc:133
Float_t fMVAVar_EleNeutralHadronIso03OverPt
std::vector< int > & els_nSeed()
Definition: HWW.cc:321
std::vector< float > & els_ip3d()
Definition: HWW.cc:177
std::vector< float > & els_fbrem()
Definition: HWW.cc:153
Float_t fMVAVar_EleSCEtaWidth
Float_t fMVAVar_EleR9
float & evt_ww_rho_vor()
Definition: HWW.cc:623
Float_t fMVAVar_EleD0
Float_t fMVAVar_EledPhiCalo
Float_t fMVAVar_EleChargedIso03OverPt
Float_t fMVAVar_EleFBrem
std::vector< int > & els_gsftrkidx()
Definition: HWW.cc:333
Float_t fMVAVar_EledEtaCalo
Float_t fMVAVar_EleIP3d
std::vector< float > & els_eOverPIn()
Definition: HWW.cc:157
std::vector< int > & els_scindex()
Definition: HWW.cc:325
std::vector< float > & els_iso03_pf_ch()
Definition: HWW.cc:217
std::vector< float > & els_iso03_pf_gamma05()
Definition: HWW.cc:225
Float_t fMVAVar_EleGammaIso03OverPt
Float_t fMVAVar_EleNeutralHadronIso04OverPt
edm::LuminosityBlockNumber_t & evt_lumiBlock()
Definition: HWW.cc:611
Float_t fMVAVar_EleSCPhiWidth
Float_t fMVAVar_EleCovIEtaIPhi
std::vector< float > & els_eSeedOverPOut()
Definition: HWW.cc:161
std::vector< float > & els_chi2()
Definition: HWW.cc:185
Float_t fMVAVar_EleGammaIso04OverPt
std::vector< float > & els_eSC()
Definition: HWW.cc:173
std::vector< float > & els_dEtaOut()
Definition: HWW.cc:193
double electron_d0PV_wwV1(HWW &, unsigned int index)
std::vector< float > & els_dPhiOut()
Definition: HWW.cc:197
bool first
Definition: L1TdeRCT.cc:75
std::vector< LorentzVector > & els_p4()
Definition: HWW.cc:101
std::vector< float > & els_etaSC()
Definition: HWW.cc:117
std::vector< float > & els_eSCPresh()
Definition: HWW.cc:213
Double_t ElectronEffectiveArea(EElectronEffectiveAreaType type, Double_t Eta)
Definition: HWW.h:12
std::vector< float > & els_iso03_pf_nhad05()
Definition: HWW.cc:221
std::vector< float > & els_iso04_pf_gamma05()
Definition: HWW.cc:237
Float_t fMVAVar_EleSigmaIEtaIEta
std::vector< float > & els_etaSCwidth()
Definition: HWW.cc:205
std::vector< float > & scs_sigmaIEtaIPhi()
Definition: HWW.cc:681
std::vector< float > & els_eSCRaw()
Definition: HWW.cc:201
Float_t fMVAVar_EleESeedClusterOverPout
std::vector< float > & els_dPhiIn()
Definition: HWW.cc:129
std::vector< float > & els_iso04_pf_ch()
Definition: HWW.cc:229
std::pair< double, double > gsftrks_d0_pv(HWW &, int itrk, int ipv)
Float_t fMVAVar_EleEOverP
std::vector< float > & els_dEtaIn()
Definition: HWW.cc:125
Float_t fMVAVar_EleDZ
TMVA::Reader * fTMVAReader[6]
unsigned int version_
std::vector< float > & els_phiSCwidth()
Definition: HWW.cc:209
std::vector< float > & els_eSeedOverPIn()
Definition: HWW.cc:165
Float_t fMVAVar_EleOneOverEMinusOneOverP
Float_t fMVAVar_EleDPhiIn
void Initialize(TString methodName, unsigned int version, TString Subdet0Pt10To20Weights, TString Subdet1Pt10To20Weights, TString Subdet2Pt10To20Weights, TString Subdet0Pt20ToInfWeights, TString Subdet1Pt20ToInfWeights, TString Subdet2Pt20ToInfWeights)
std::vector< float > & els_sigmaIEtaIEta()
Definition: HWW.cc:121
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Float_t fMVAVar_EleChargedIso04OverPt
std::vector< LorentzVector > & els_trk_p4()
Definition: HWW.cc:105
edm::RunNumber_t & evt_run()
Definition: HWW.cc:607
std::vector< float > & els_sigmaIPhiIPhi()
Definition: HWW.cc:169
edm::EventNumber_t & evt_event()
Definition: HWW.cc:615
Float_t fMVAVar_EleGsfTrackChi2OverNdof