1 |
|
#define baseClass_cxx |
2 |
|
#include "baseClass.h" |
3 |
|
|
4 |
+ |
#include "TH1I.h" |
5 |
+ |
#include "TFile.h" |
6 |
+ |
|
7 |
|
baseClass::baseClass(string * inputList, string * cutFile, string * treeName, string * outputFileName, string * cutEfficFile) |
8 |
|
{ |
9 |
|
std::cout << "baseClass::baseClass(): begins " << std::endl; |
19 |
|
baseClass::~baseClass() |
20 |
|
{ |
21 |
|
std::cout << "baseClass::~baseClass(): begin " << std::endl; |
22 |
< |
if( !writeCutHistos() ) |
23 |
< |
{ |
24 |
< |
STDOUT("ERROR: writeCutHistos did not complete successfully."); |
25 |
< |
} |
26 |
< |
if( !writeCutEfficFile() ) |
27 |
< |
{ |
28 |
< |
STDOUT("ERROR: writeStatFile did not complete successfully."); |
29 |
< |
} |
22 |
> |
// the following lines are from the jet prompt thing... |
23 |
> |
// if( !writeCutHistos() ) |
24 |
> |
// { |
25 |
> |
// STDOUT("ERROR: writeCutHistos did not complete successfully."); |
26 |
> |
// } |
27 |
> |
// if( !writeCutEfficFile() ) |
28 |
> |
// { |
29 |
> |
// STDOUT("ERROR: writeStatFile did not complete successfully."); |
30 |
> |
// } |
31 |
|
output_root_->Close(); |
32 |
|
std::cout << "baseClass::~baseClass(): end " << std::endl; |
33 |
|
} |
40 |
|
return c; |
41 |
|
} |
42 |
|
|
43 |
+ |
void baseClass::scaleHisto(TH1D* histo, double factor) { |
44 |
+ |
int binnumber=histo->GetNbinsX(); |
45 |
+ |
for(int i=0;i<=binnumber+1;i++) { |
46 |
+ |
double bincontent=histo->GetBinContent(i); |
47 |
+ |
double newbincontent=bincontent*factor; |
48 |
+ |
histo->SetBinContent(i,newbincontent); |
49 |
+ |
double binerror=histo->GetBinError(i); |
50 |
+ |
double newbinerror=binerror*factor; |
51 |
+ |
histo->SetBinError(i,newbinerror); |
52 |
+ |
} |
53 |
+ |
} |
54 |
+ |
|
55 |
+ |
|
56 |
+ |
|
57 |
+ |
string baseClass::getFileName() { |
58 |
+ |
if(tree_ == NULL){ |
59 |
+ |
std::cout << "baseClass::init(): ERROR: tree_ = NULL " << std::endl; |
60 |
+ |
// return 'NIL'; |
61 |
+ |
} |
62 |
+ |
|
63 |
+ |
tree_->GetEntry(); |
64 |
+ |
TFile *f = tree_->GetCurrentFile(); |
65 |
+ |
// cout<<"-----------------------------"<<endl; |
66 |
+ |
// cout<<f->GetName()<<endl; |
67 |
+ |
string filename = f->GetName(); |
68 |
+ |
cout<<filename<<endl; |
69 |
+ |
return filename; |
70 |
+ |
} |
71 |
+ |
|
72 |
+ |
|
73 |
+ |
void baseClass::getHLTtable() { |
74 |
+ |
bool printTriggerTable=true; |
75 |
+ |
if(tree_ == NULL){ |
76 |
+ |
std::cout << "baseClass::init(): ERROR: tree_ = NULL " << std::endl; |
77 |
+ |
return; |
78 |
+ |
} |
79 |
+ |
|
80 |
+ |
tree_->GetEntry(); |
81 |
+ |
TFile *f = tree_->GetCurrentFile(); |
82 |
+ |
|
83 |
+ |
cout<<f->GetName()<<endl; |
84 |
+ |
TH1I *hlt_stats = (TH1I*)f->Get("analyze/HLTTriggerStats"); |
85 |
+ |
cout<<"here 3"<<endl; |
86 |
+ |
|
87 |
+ |
// clear the map |
88 |
+ |
if(!HLTmap.empty()) { |
89 |
+ |
HLTmap.erase(HLTmap.begin(),HLTmap.end()); |
90 |
+ |
} |
91 |
+ |
|
92 |
+ |
for( int i=0; i < hlt_stats->GetNbinsX(); i++ ){ |
93 |
+ |
if(printTriggerTable==true) cout<<i<<": "<<hlt_stats->GetXaxis()->GetBinLabel(i+1)<<endl; |
94 |
+ |
HLTmap[hlt_stats->GetXaxis()->GetBinLabel(i+1)] = i; |
95 |
+ |
} |
96 |
+ |
} |
97 |
+ |
|
98 |
+ |
int baseClass::getHLTtriggerBit(string triggerName) { |
99 |
+ |
if(HLTmap.empty()) { |
100 |
+ |
cerr<<"HLTtrigger: no HLTmap available!"<<endl; |
101 |
+ |
return -1; |
102 |
+ |
} |
103 |
+ |
map<string, int>::iterator iter = HLTmap.find(triggerName); |
104 |
+ |
//cout<<"HLT bit: "<<iter->second<<endl; // iter->second is the HLT trigger bit |
105 |
+ |
if(iter==HLTmap.end()) { |
106 |
+ |
cerr<<"HLTtrigger: trigger name "<<triggerName<< " not found!"<<endl; |
107 |
+ |
return -1; |
108 |
+ |
} |
109 |
+ |
else { |
110 |
+ |
return iter->second; |
111 |
+ |
} |
112 |
+ |
} |
113 |
+ |
|
114 |
|
bool baseClass::triggerBitSelection(int hlt[200], int l1phys[128], int l1tech[64]) |
115 |
|
{ |
116 |
|
bool passed=false; |
214 |
|
double EcalIso=electron.ecalIso[0]; |
215 |
|
double HcalIso=electron.hcalIso[0]; |
216 |
|
double missingHits=electron.numberOfMissingInnerHits[0]; |
217 |
+ |
|
218 |
+ |
|
219 |
|
// get the cuts |
220 |
|
double See_B=cuts[0]; |
221 |
|
double Dphi_B=cuts[1]; |
224 |
|
double TrkIso_B=cuts[4]; |
225 |
|
double EcalIso_B=cuts[5]; |
226 |
|
double HcalIso_B=cuts[6]; |
227 |
< |
double missingHits_B=cuts[7]; |
227 |
> |
double CombIso_B=cuts[7]; |
228 |
> |
double missingHits_B=cuts[16]; |
229 |
|
double See_E=cuts[8]; |
230 |
|
double Dphi_E=cuts[9]; |
231 |
|
double Deta_E=cuts[10]; |
233 |
|
double TrkIso_E=cuts[12]; |
234 |
|
double EcalIso_E=cuts[13]; |
235 |
|
double HcalIso_E=cuts[14]; |
236 |
< |
double missingHits_E=cuts[15]; |
236 |
> |
double CombIso_E=cuts[15]; |
237 |
> |
double missingHits_E=cuts[16]; |
238 |
> |
double dist=cuts[17]; |
239 |
> |
|
240 |
> |
|
241 |
> |
|
242 |
> |
|
243 |
> |
|
244 |
|
// get the cut which should NOT be made |
245 |
|
if(!strcmp(cut,"sigmaIetaIeta")) combination[0]=1; |
246 |
|
else if(!strcmp(cut,"deltaPhi")) combination[1]=1; |
261 |
|
TrkIso<TrkIso_B && |
262 |
|
EcalIso<EcalIso_B && |
263 |
|
HcalIso<HcalIso_B && |
264 |
< |
missingHits<missingHits_B) passed=true; |
264 |
> |
missingHits<=missingHits_B) passed=true; |
265 |
|
// delta phi |
266 |
|
else if(combination[1]==1 && |
267 |
|
See<See_B && |
270 |
|
TrkIso<TrkIso_B && |
271 |
|
EcalIso<EcalIso_B && |
272 |
|
HcalIso<HcalIso_B && |
273 |
< |
missingHits<missingHits_B) passed=true; |
273 |
> |
missingHits<=missingHits_B) passed=true; |
274 |
|
// delta eta |
275 |
|
else if(combination[2]==1 && |
276 |
|
See<See_B && |
279 |
|
TrkIso<TrkIso_B && |
280 |
|
EcalIso<EcalIso_B && |
281 |
|
HcalIso<HcalIso_B && |
282 |
< |
missingHits<missingHits_B) passed=true; |
282 |
> |
missingHits<=missingHits_B) passed=true; |
283 |
|
// H over E |
284 |
|
else if(combination[3]==1 && |
285 |
|
See<See_B && |
288 |
|
TrkIso<TrkIso_B && |
289 |
|
EcalIso<EcalIso_B && |
290 |
|
HcalIso<HcalIso_B && |
291 |
< |
missingHits<missingHits_B) passed=true; |
291 |
> |
missingHits<=missingHits_B) passed=true; |
292 |
|
// Track isolation |
293 |
|
else if(combination[4]==1 && |
294 |
|
See<See_B && |
297 |
|
HoE<HoE_B && |
298 |
|
EcalIso<EcalIso_B && |
299 |
|
HcalIso<HcalIso_B && |
300 |
< |
missingHits<missingHits_B) passed=true; |
300 |
> |
missingHits<=missingHits_B) passed=true; |
301 |
|
// ECAL isolation |
302 |
|
else if(combination[5]==1 && |
303 |
|
See<See_B && |
306 |
|
HoE<HoE_B && |
307 |
|
TrkIso<TrkIso_B && |
308 |
|
HcalIso<HcalIso_B && |
309 |
< |
missingHits<missingHits_B) passed=true; |
309 |
> |
missingHits<=missingHits_B) passed=true; |
310 |
|
// HCAL isolation |
311 |
|
else if(combination[6]==1 && |
312 |
|
See<See_B && |
315 |
|
HoE<HoE_B && |
316 |
|
TrkIso<TrkIso_B && |
317 |
|
EcalIso<EcalIso_B && |
318 |
< |
missingHits<missingHits_B) passed=true; |
318 |
> |
missingHits<=missingHits_B) passed=true; |
319 |
|
// Conversions |
320 |
|
else if(combination[7]==1 && |
321 |
|
See<See_B && |
337 |
|
TrkIso<TrkIso_E && |
338 |
|
EcalIso<EcalIso_E && |
339 |
|
HcalIso<HcalIso_E && |
340 |
< |
missingHits<missingHits_E) passed=true; |
340 |
> |
missingHits<=missingHits_E) passed=true; |
341 |
|
// delta phi |
342 |
|
else if(combination[1]==1 && |
343 |
|
See<See_E && |
346 |
|
TrkIso<TrkIso_E && |
347 |
|
EcalIso<EcalIso_E && |
348 |
|
HcalIso<HcalIso_E && |
349 |
< |
missingHits<missingHits_E) passed=true; |
349 |
> |
missingHits<=missingHits_E) passed=true; |
350 |
|
// delta eta |
351 |
|
else if(combination[2]==1 && |
352 |
|
See<See_E && |
355 |
|
TrkIso<TrkIso_E && |
356 |
|
EcalIso<EcalIso_E && |
357 |
|
HcalIso<HcalIso_E && |
358 |
< |
missingHits<missingHits_E) passed=true; |
358 |
> |
missingHits<=missingHits_E) passed=true; |
359 |
|
// H over E |
360 |
|
else if(combination[3]==1 && |
361 |
|
See<See_E && |
364 |
|
TrkIso<TrkIso_E && |
365 |
|
EcalIso<EcalIso_E && |
366 |
|
HcalIso<HcalIso_E && |
367 |
< |
missingHits<missingHits_E) passed=true; |
367 |
> |
missingHits<=missingHits_E) passed=true; |
368 |
|
// Track isolation |
369 |
|
else if(combination[4]==1 && |
370 |
|
See<See_E && |
373 |
|
HoE<HoE_E && |
374 |
|
EcalIso<EcalIso_E && |
375 |
|
HcalIso<HcalIso_E && |
376 |
< |
missingHits<missingHits_E) passed=true; |
376 |
> |
missingHits<=missingHits_E) passed=true; |
377 |
|
// ECAL isolation |
378 |
|
else if(combination[5]==1 && |
379 |
|
See<See_E && |
382 |
|
HoE<HoE_E && |
383 |
|
TrkIso<TrkIso_E && |
384 |
|
HcalIso<HcalIso_E && |
385 |
< |
missingHits<missingHits_E) passed=true; |
385 |
> |
missingHits<=missingHits_E) passed=true; |
386 |
|
// HCAL isolation |
387 |
|
else if(combination[6]==1 && |
388 |
|
See<See_E && |
391 |
|
HoE<HoE_E && |
392 |
|
TrkIso<TrkIso_E && |
393 |
|
EcalIso<EcalIso_E && |
394 |
< |
missingHits<missingHits_E) passed=true; |
394 |
> |
missingHits<=missingHits_E) passed=true; |
395 |
|
// Conversions |
396 |
|
else if(combination[7]==1 && |
397 |
|
See<See_E && |
410 |
|
return passed; |
411 |
|
} |
412 |
|
|
413 |
+ |
|
414 |
+ |
testEvent baseClass::fillTestEvent() { |
415 |
+ |
// fill the event struct |
416 |
+ |
testEvent event; |
417 |
+ |
for(int i=0; i<NEles;i++) { |
418 |
+ |
TLorentzVector vec; |
419 |
+ |
vec.SetPxPyPzE(ElPx[i],ElPy[i],ElPz[i],ElE[i]); |
420 |
+ |
event.fourMomentum.push_back(vec); |
421 |
+ |
} |
422 |
+ |
return event; |
423 |
+ |
} |
424 |
+ |
|
425 |
+ |
int baseClass::ElectronPreselection(int i) { |
426 |
+ |
// function to make electron preselection |
427 |
+ |
// 0: preselected electron |
428 |
+ |
// 1: not accepted in eta |
429 |
+ |
// 2: not accepted in pt |
430 |
+ |
// 3: not accepted in H/E |
431 |
+ |
// 4: not accepted in dphi |
432 |
+ |
// 5: not accepted in deta |
433 |
+ |
|
434 |
+ |
//double etaMax_B=1.44; |
435 |
+ |
double etaMax_E=2.5; |
436 |
+ |
double ptMin=10; |
437 |
+ |
double HoverEMin=0.15; |
438 |
+ |
double deltaPhiMax=0.15; |
439 |
+ |
double deltaEtaMax=0.02; |
440 |
+ |
|
441 |
+ |
bool cutOn_Eta = true; |
442 |
+ |
bool cutOn_Pt = true; |
443 |
+ |
bool cutOn_HoE = true; |
444 |
+ |
bool cutOn_dPhi= true; |
445 |
+ |
bool cutOn_dEta= true; |
446 |
+ |
|
447 |
+ |
double eta = ElSCEta[i]; |
448 |
+ |
// double eta = ElEta[i]; |
449 |
+ |
|
450 |
+ |
// double dPhiCorr=dphiCorrections(ElEta[i], ElPhi[i]); |
451 |
+ |
// double dEtaCorr=detaCorrections(ElEta[i], ElPhi[i]); |
452 |
+ |
double dPhiCorr=dphiCorrections(eta, ElPhi[i]); |
453 |
+ |
double dEtaCorr=detaCorrections(eta, ElPhi[i]); |
454 |
+ |
|
455 |
+ |
TVector3 track; |
456 |
+ |
track.SetXYZ(ElPx[i], ElPy[i], ElPz[i]); |
457 |
+ |
double trackEta=track.Eta(); |
458 |
+ |
// double pt=ElCaloEnergy[i]/cosh(trackEta); |
459 |
+ |
double pt = ElPt[i]; |
460 |
+ |
|
461 |
+ |
double hoe = ElHcalOverEcal[i]; |
462 |
+ |
double dphi = ElDeltaPhiSuperClusterAtVtx[i] - dPhiCorr; |
463 |
+ |
double deta = ElDeltaEtaSuperClusterAtVtx[i] - dEtaCorr; |
464 |
+ |
// double dphi = ElDeltaPhiSuperClusterAtVtx[i]; |
465 |
+ |
// double deta = ElDeltaEtaSuperClusterAtVtx[i]; |
466 |
+ |
|
467 |
+ |
if(cutOn_Eta) if(fabs(eta) > etaMax_E) return 1; |
468 |
+ |
if(cutOn_Pt) if(pt < ptMin) return 2; |
469 |
+ |
if(cutOn_HoE) if(hoe > HoverEMin) return 3; |
470 |
+ |
if(cutOn_dPhi) if(fabs(dphi) > deltaPhiMax) return 4; |
471 |
+ |
if(cutOn_dEta) if(fabs(deta) > deltaEtaMax) return 5; |
472 |
+ |
|
473 |
+ |
return 0; |
474 |
+ |
} |
475 |
+ |
|
476 |
+ |
int baseClass::ETHElectronID(int i, NminusOneCutLabel c) { |
477 |
+ |
// ETH ID |
478 |
+ |
// returns integer values corresponding |
479 |
+ |
// to the passed ID cuts |
480 |
+ |
// 0 fully IDed and isolated |
481 |
+ |
// 1 delta phi cut not passed |
482 |
+ |
// 2 delta eta cut not passed |
483 |
+ |
// 3 |1/E-1/p| cut not passed |
484 |
+ |
// 4 isolation not passed |
485 |
+ |
// 5 is electron from conversion |
486 |
+ |
|
487 |
+ |
double etaMax_B = 1.4442; |
488 |
+ |
double etaMin_E = 1.5660; |
489 |
+ |
double etaMax_E = 2.5000; |
490 |
+ |
double dPhiMax_B = 0.02; |
491 |
+ |
double dPhiMax_E = 0.02; |
492 |
+ |
double dEtaMax_B = 0.004; |
493 |
+ |
double dEtaMax_E = 0.006; |
494 |
+ |
double oEoPMax_B = 0.005; |
495 |
+ |
double oEoPMax_E = 0.007; |
496 |
+ |
double isoMax_B = 0.1; |
497 |
+ |
double isoMax_E = 0.1; |
498 |
+ |
|
499 |
+ |
bool cutOn_dPhi = true; |
500 |
+ |
bool cutOn_dEta = true; |
501 |
+ |
bool cutOn_oEoP = true; |
502 |
+ |
bool cutOn_iso = true; |
503 |
+ |
bool cutOn_conversion = true; |
504 |
+ |
|
505 |
+ |
double eta = ElSCEta[i]; |
506 |
+ |
//double pt = ElPt[i]; |
507 |
+ |
double dPhiCorr = dphiCorrections(eta, ElPhi[i]); |
508 |
+ |
double dEtaCorr = detaCorrections(eta, ElPhi[i]); |
509 |
+ |
double dPhi = fabs(ElDeltaPhiSuperClusterAtVtx[i]-dPhiCorr); |
510 |
+ |
double dEta = fabs(ElDeltaEtaSuperClusterAtVtx[i]-dEtaCorr); |
511 |
+ |
|
512 |
+ |
double p = ElTrkMomAtVtx[i]; |
513 |
+ |
double e = ElCaloEnergy[i]; |
514 |
+ |
double oEoP = fabs( 1/e - 1/p ); |
515 |
+ |
|
516 |
+ |
double trkIso = ElDR03TkSumPt[i]; |
517 |
+ |
double scEt = e * sin(ElTheta[i]); |
518 |
+ |
double iso = trkIso / scEt; |
519 |
+ |
|
520 |
+ |
int hits=1; |
521 |
+ |
double dist=0.02; |
522 |
+ |
double cot=0.02; |
523 |
+ |
bool isConversion; |
524 |
+ |
if((fabs(ElConvPartnerTrkDist[i])<dist && fabs(ElConvPartnerTrkDCot[i])<cot) /*|| ElNumberOfMissingInnerHits[i]>hits*/) isConversion=true; |
525 |
+ |
else isConversion=false; |
526 |
+ |
|
527 |
+ |
if(c==dphi) cutOn_dPhi = false; |
528 |
+ |
if(c==deta) cutOn_dEta = false; |
529 |
+ |
if(c==oeop) cutOn_oEoP = false; |
530 |
+ |
if(c==combiso) cutOn_iso = false; |
531 |
+ |
if(c==conversion) cutOn_conversion = false; |
532 |
+ |
|
533 |
+ |
if(fabs(eta)<=etaMax_B) { |
534 |
+ |
if(cutOn_dPhi) if(dPhi > dPhiMax_B) return 1; |
535 |
+ |
if(cutOn_dEta) if(dEta > dEtaMax_B) return 2; |
536 |
+ |
if(cutOn_oEoP) if(oEoP > oEoPMax_B) return 3; |
537 |
+ |
if(cutOn_iso) if(iso > isoMax_B) return 4; |
538 |
+ |
if(cutOn_conversion) if(isConversion==true) return 5; |
539 |
+ |
return 0; |
540 |
+ |
} |
541 |
+ |
if(fabs(eta)>etaMin_E && fabs(eta)<etaMax_E) { |
542 |
+ |
if(cutOn_dPhi) if(dPhi > dPhiMax_E) return 1; |
543 |
+ |
if(cutOn_dEta) if(dEta > dEtaMax_E) return 2; |
544 |
+ |
if(cutOn_oEoP) if(oEoP > oEoPMax_E) return 3; |
545 |
+ |
if(cutOn_iso) if(iso > isoMax_E) return 4; |
546 |
+ |
if(cutOn_conversion) if(isConversion==true) return 5; |
547 |
+ |
return 0; |
548 |
+ |
} |
549 |
+ |
else { |
550 |
+ |
cout<<"WPelectronID: electron not in ECAL acceptance region!!"<<endl; |
551 |
+ |
return -1; |
552 |
+ |
} |
553 |
+ |
|
554 |
+ |
} |
555 |
+ |
|
556 |
+ |
int baseClass::WPElectronID(int i, NminusOneCutLabel c, vector<double> cuts) { |
557 |
+ |
// function to ID and isolate electrons |
558 |
+ |
// return values (int): |
559 |
+ |
// 0 totally IDed & isolated electron |
560 |
+ |
// 1 See cut not passed |
561 |
+ |
// 2 dEta cut not passed |
562 |
+ |
// 3 dPhi |
563 |
+ |
// 4 HoE |
564 |
+ |
// 5 combIso |
565 |
+ |
// 6 conversion |
566 |
+ |
|
567 |
+ |
double etaMax_B=1.4442; |
568 |
+ |
double etaMin_E=1.5660; |
569 |
+ |
double etaMax_E=2.5000; |
570 |
+ |
double SeeMax_B=cuts[0]; |
571 |
+ |
double dPhiMax_B=cuts[1]; |
572 |
+ |
double dEtaMax_B=cuts[2]; |
573 |
+ |
double HoEMax_B=cuts[3]; |
574 |
+ |
double TrkIsoMax_B=cuts[4]; |
575 |
+ |
double EcalIsoMax_B=cuts[5]; |
576 |
+ |
double HcalIsoMax_B=cuts[6]; |
577 |
+ |
double combIsoMax_B=cuts[7]; |
578 |
+ |
double SeeMax_E=cuts[8]; |
579 |
+ |
double dPhiMax_E=cuts[9]; |
580 |
+ |
double dEtaMax_E=cuts[10]; |
581 |
+ |
double HoEMax_E=cuts[11]; |
582 |
+ |
double TrkIsoMax_E=cuts[12]; |
583 |
+ |
double EcalIsoMax_E=cuts[13]; |
584 |
+ |
double HcalIsoMax_E=cuts[14]; |
585 |
+ |
double combIsoMax_E=cuts[15]; |
586 |
+ |
int hits=cuts[16]; |
587 |
+ |
double dist=cuts[17]; |
588 |
+ |
double cot=dist; |
589 |
+ |
|
590 |
+ |
bool cutOn_See=true; |
591 |
+ |
bool cutOn_dPhi=true; |
592 |
+ |
bool cutOn_dEta=true; |
593 |
+ |
bool cutOn_HoE=true; |
594 |
+ |
bool cutOn_combIso=true; |
595 |
+ |
bool cutOn_conversion=true; |
596 |
+ |
|
597 |
+ |
// check geometrical acceptance |
598 |
+ |
// for the isolation use the SC eta instead |
599 |
+ |
// of the electron eta |
600 |
+ |
double eta = ElSCEta[i]; |
601 |
+ |
// double eta = ElEta[i]; |
602 |
+ |
|
603 |
+ |
double dPhiCorr=dphiCorrections(eta, ElPhi[i]); |
604 |
+ |
double dEtaCorr=detaCorrections(eta, ElPhi[i]); |
605 |
+ |
|
606 |
+ |
double See = ElSigmaIetaIeta[i]; |
607 |
+ |
// apply the correction for the endcaps |
608 |
+ |
double dPhi = fabs(ElDeltaPhiSuperClusterAtVtx[i]-dPhiCorr); |
609 |
+ |
double dEta = fabs(ElDeltaEtaSuperClusterAtVtx[i]-dEtaCorr); |
610 |
+ |
double HoE = ElHcalOverEcal[i]; |
611 |
+ |
double trkIso = ElDR03TkSumPt[i]; |
612 |
+ |
double ecalIso = ElDR03EcalRecHitSumEt[i]; |
613 |
+ |
double hcalIso = ElDR03HcalTowerSumEt[i]; |
614 |
+ |
double combIso_B = (trkIso + max(0., ecalIso - 1.) + hcalIso) / ElPt[i]; |
615 |
+ |
double combIso_E = (trkIso + ecalIso + hcalIso) / ElPt[i]; |
616 |
+ |
bool isConversion; |
617 |
+ |
if((fabs(ElConvPartnerTrkDist[i])<dist && fabs(ElConvPartnerTrkDCot[i])<cot) /*|| ElNumberOfMissingInnerHits[i]>hits*/) isConversion=true; |
618 |
+ |
else isConversion=false; |
619 |
+ |
|
620 |
+ |
if(c==see) cutOn_See = false; |
621 |
+ |
if(c==dphi) cutOn_dPhi = false; |
622 |
+ |
if(c==deta) cutOn_dEta = false; |
623 |
+ |
if(c==hoe) cutOn_HoE = false; |
624 |
+ |
if(c==combiso) cutOn_combIso = false; |
625 |
+ |
if(c==conversion) cutOn_conversion = false; |
626 |
+ |
|
627 |
+ |
if(fabs(eta)<=etaMax_B) { |
628 |
+ |
if(cutOn_See) if(See > SeeMax_B) return 1; |
629 |
+ |
if(cutOn_dPhi) if(dPhi > dPhiMax_B) return 2; |
630 |
+ |
if(cutOn_dEta) if(dEta > dEtaMax_B) return 3; |
631 |
+ |
if(cutOn_HoE) if(HoE > HoEMax_B) return 4; |
632 |
+ |
if(cutOn_combIso) if(combIso_B > combIsoMax_B) return 5; |
633 |
+ |
if(cutOn_conversion) if(isConversion==true) return 6; |
634 |
+ |
return 0; |
635 |
+ |
} |
636 |
+ |
if(fabs(eta)>etaMin_E && fabs(eta)<etaMax_E) { |
637 |
+ |
if(cutOn_See) if(See > SeeMax_E) return 1; |
638 |
+ |
if(cutOn_dPhi) if(dPhi > dPhiMax_E) return 2; |
639 |
+ |
if(cutOn_dEta) if(dEta > dEtaMax_E) return 3; |
640 |
+ |
if(cutOn_HoE) if(HoE > HoEMax_E) return 4; |
641 |
+ |
if(cutOn_combIso) if(combIso_E > combIsoMax_E) return 5; |
642 |
+ |
if(cutOn_conversion) if(isConversion==true) return 6; |
643 |
+ |
return 0; |
644 |
+ |
} |
645 |
+ |
else { |
646 |
+ |
// cout<<"WPelectronID: electron not in ECAL acceptance region!!"<<endl; |
647 |
+ |
return -1; |
648 |
+ |
} |
649 |
+ |
} |
650 |
+ |
|
651 |
+ |
double baseClass::detaCorrections(double etaEle,double phiEle) { |
652 |
+ |
// corrects for misalignement in the endcpas |
653 |
+ |
TF2 f12_fit2("f12_fit2","[0]+(TMath::TanH(y)/325.)*([1]-([2]*TMath::SinH(y)*TMath::Cos(x-[3])))",-TMath::Pi(),TMath::Pi(),-10.,10.); |
654 |
+ |
if (etaEle>1.479) |
655 |
+ |
{ |
656 |
+ |
f12_fit2.SetParameter(0,0.0013); |
657 |
+ |
f12_fit2.SetParameter(1,-0.06); |
658 |
+ |
f12_fit2.SetParameter(2,0.52); |
659 |
+ |
f12_fit2.SetParameter(3,2.17); |
660 |
+ |
} |
661 |
+ |
else if (etaEle<-1.479) |
662 |
+ |
{ |
663 |
+ |
f12_fit2.SetParameter(0,-0.0013); |
664 |
+ |
f12_fit2.SetParameter(1,-0.32); |
665 |
+ |
f12_fit2.SetParameter(2,0.45); |
666 |
+ |
f12_fit2.SetParameter(3,-1.58); |
667 |
+ |
} |
668 |
+ |
return f12_fit2.Eval(phiEle,etaEle); |
669 |
+ |
} |
670 |
+ |
|
671 |
+ |
double baseClass::dphiCorrections(double etaEle,double phiEle) { |
672 |
+ |
// corrects for misalignement in the endcpas |
673 |
+ |
TF2 f12_fit2("f12_fit2","[0]+[1]*(TMath::SinH(y)/325.)*(TMath::Sin([2]-x))",-TMath::Pi(),TMath::Pi(),-10.,10.); |
674 |
+ |
if (etaEle>1.479) |
675 |
+ |
{ |
676 |
+ |
f12_fit2.SetParameter(0,0.0); |
677 |
+ |
f12_fit2.SetParameter(1,0.52); |
678 |
+ |
f12_fit2.SetParameter(2,2.17); |
679 |
+ |
} |
680 |
+ |
else if (etaEle<-1.479) |
681 |
+ |
{ |
682 |
+ |
f12_fit2.SetParameter(0,0.0); |
683 |
+ |
f12_fit2.SetParameter(1,0.45); |
684 |
+ |
f12_fit2.SetParameter(2,-1.58); |
685 |
+ |
} |
686 |
+ |
return f12_fit2.Eval(phiEle,etaEle); |
687 |
+ |
} |
688 |
+ |
|
689 |
+ |
|
690 |
+ |
int baseClass::WSelection(int i, WNminusOneCutLabel c) { |
691 |
+ |
// idea: write cuts into a vector and give the vector to the function |
692 |
+ |
// double etaMax_B=1.44; |
693 |
+ |
double pre_metMin=20; |
694 |
+ |
double pre_ptMin=20; |
695 |
+ |
double metMin=30; |
696 |
+ |
double ptMin=25; |
697 |
+ |
double mtMin=60; |
698 |
+ |
|
699 |
+ |
bool cutOn_Preselection=true; |
700 |
+ |
bool cutOn_Met=true; |
701 |
+ |
bool cutOn_Pt=true; |
702 |
+ |
bool cutOn_Mt=true; |
703 |
+ |
|
704 |
+ |
double met=PFMET; |
705 |
+ |
double pt=ElPt[i]; |
706 |
+ |
double delPhiMet=deltaPhi(ElPhi[i], PFMETphi); |
707 |
+ |
double mt=transverseMass(pt, met, delPhiMet); |
708 |
+ |
// check geometrical acceptance |
709 |
+ |
// for the isolation use the SC eta instead |
710 |
+ |
// of the electron eta |
711 |
+ |
// double eta = ElSCEta[i]; |
712 |
+ |
// double eta = ElEta[i]; |
713 |
+ |
|
714 |
+ |
if(c==pre) cutOn_Preselection = false; |
715 |
+ |
if(c==misset) cutOn_Met = false; |
716 |
+ |
if(c==pt) cutOn_Pt = false; |
717 |
+ |
if(c==mt) cutOn_Mt = false; |
718 |
+ |
|
719 |
+ |
|
720 |
+ |
// if(fabs(eta)<=etaMax_B) { |
721 |
+ |
if(cutOn_Preselection) if(met<pre_metMin || pt<pre_ptMin) return 1; |
722 |
+ |
if(cutOn_Met) if(met<metMin) return 2; |
723 |
+ |
if(cutOn_Pt) if(pt<ptMin) return 3; |
724 |
+ |
if(cutOn_Mt) if(mt<mtMin) return 4; |
725 |
+ |
return 0; |
726 |
+ |
// } |
727 |
+ |
// if(fabs(eta)>etaMax_B) { |
728 |
+ |
// if(cutOn_Preselection) if(met<pre_metMin || pt<pre_ptMin) return 1; |
729 |
+ |
// if(cutOn_Met) if(met<metMin) return 2; |
730 |
+ |
// if(cutOn_Pt) if(pt<ptMin) return 3; |
731 |
+ |
// if(cutOn_Mt) if(mt<mtMin) return 4; |
732 |
+ |
// return 0; |
733 |
+ |
// } |
734 |
+ |
} |
735 |
+ |
|
736 |
+ |
|
737 |
+ |
|
738 |
+ |
// void initializeWP(vector<double>cuts) { |
739 |
+ |
// SeeMax_B=cuts[0]; |
740 |
+ |
// DphiMax_B=cuts[1]; |
741 |
+ |
// DetaMax_B=cuts[2]; |
742 |
+ |
// HoEMax_B=cuts[3]; |
743 |
+ |
// combIsoMax_B=cuts[4]; |
744 |
+ |
// // TrkIsoMax_B=cuts[4]; |
745 |
+ |
// // EcalIsoMax_B=cuts[5]; |
746 |
+ |
// // HcalIsoMax_B=cuts[6]; |
747 |
+ |
// SeeMax_E=cuts[8]; |
748 |
+ |
// DphiMax_E=cuts[9]; |
749 |
+ |
// DetaMax_E=cuts[10]; |
750 |
+ |
// HoEMax_E=cuts[11]; |
751 |
+ |
// // TrkIsoMax_E=cuts[12]; |
752 |
+ |
// // EcalIsoMax_E=cuts[13]; |
753 |
+ |
// // HcalIsoMax_E=cuts[14]; |
754 |
+ |
// combIsoMax_E=cuts[12]; |
755 |
+ |
|
756 |
+ |
// } |
757 |
+ |
|
758 |
|
bool baseClass::ethNminus1(int isECALdriven, double deltaPhi, double deltaEta, double e, double p, double eta, char *cut, bool iso) |
759 |
|
{ |
760 |
|
bool passed=false; |
888 |
|
|
889 |
|
tree_ = NULL; |
890 |
|
readInputList(); |
891 |
< |
readCutFile(); |
891 |
> |
// readCutFile(); // not using cut file, need dummy cut file as input... |
892 |
|
if(tree_ == NULL){ |
893 |
|
std::cout << "baseClass::init(): ERROR: tree_ = NULL " << std::endl; |
894 |
|
return; |
935 |
|
NBeforeSkim_ = NBeforeSkim_ + NBeforeSkim; |
936 |
|
STDOUT("Initial number of events: NBeforeSkim, NBeforeSkim_ = "<<NBeforeSkim<<", "<<NBeforeSkim_); |
937 |
|
} |
938 |
+ |
|
939 |
|
tree_ = chain; |
940 |
|
cout << "baseClass::readInputList: Finished reading list: " << *inputList_ << endl; |
941 |
|
} |