ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/rootEWKanalyzer/src/baseClass.C
(Generate patch)

Comparing UserCode/rootEWKanalyzer/src/baseClass.C (file contents):
Revision 1.2 by jueugste, Tue Jul 20 15:32:43 2010 UTC vs.
Revision 1.4 by jueugste, Tue Sep 21 13:12:50 2010 UTC

# Line 40 | Line 40 | double baseClass::multiply(double a, dou
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){
# Line 50 | Line 80 | void baseClass::getHLTtable() {
80    tree_->GetEntry();
81    TFile *f = tree_->GetCurrentFile();
82  
83 <  cout<<f->GetName()<<endl;;
83 >  cout<<f->GetName()<<endl;
84    TH1I *hlt_stats = (TH1I*)f->Get("analyze/HLTTriggerStats");
85    cout<<"here 3"<<endl;
86  
# Line 403 | Line 433 | int baseClass::ElectronPreselection(int
433  
434    //double etaMax_B=1.44;
435    double etaMax_E=2.5;
436 <  double ptMin=20;
436 >  double ptMin=10;
437    double HoverEMin=0.15;
438    double deltaPhiMax=0.15;
439    double deltaEtaMax=0.02;
# Line 443 | Line 473 | int baseClass::ElectronPreselection(int
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):
# Line 454 | Line 564 | int baseClass::WPElectronID(int i, Nminu
564    // 5 combIso
565    // 6 conversion
566    
567 <  double etaMax_B=1.44;
568 <  double etaMin_E=1.56;
569 <  double etaMax_E=2.5;
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];
# Line 504 | Line 614 | int baseClass::WPElectronID(int i, Nminu
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;
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;
# Line 514 | Line 624 | int baseClass::WPElectronID(int i, Nminu
624    if(c==combiso)    cutOn_combIso    = false;
625    if(c==conversion) cutOn_conversion = false;
626  
517
518 //   if(Event==27837545 || Event==73939173 || Event==15512525 || Event==191815699 || Event==29377895 || Event==29377895 || Event==74868952 || Event==76643965 || Event==62016483 || Event==4352136) {
519 //     cout<<eta<<endl;
520 //     cout<<combIso_B<<"/"<<combIso_E<<endl;
521 //     cout<<combIsoMax_B<<"/"<<combIsoMax_E<<endl;
522 //     cout<<"See: "<<See<<endl;
523 //     cout<<"dPhi: "<<dPhi<<endl;
524 //     cout<<"dEta: "<<dEta<<endl;
525 //     cout<<"HoE: "<<HoE<<endl;
526 //     cout<<"pt: "<<ElPt[i]<<endl;
527 //   }
528
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;
# Line 545 | Line 643 | int baseClass::WPElectronID(int i, Nminu
643      return 0;
644    }
645    else {
646 <    cout<<"WPelectronID: electron not in ECAL acceptance region!!"<<endl;
646 > //     cout<<"WPelectronID: electron not in ECAL acceptance region!!"<<endl;
647      return -1;
648    }
649   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines