ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/Selection.cc
(Generate patch)

Comparing UserCode/MitHzz4l/Selection/src/Selection.cc (file contents):
Revision 1.3 by dkralph, Thu Sep 22 18:01:19 2011 UTC vs.
Revision 1.9 by khahn, Fri Oct 14 11:38:10 2011 UTC

# Line 1 | Line 1
1   #include "Selection.h"
2   #include "PassHLT.h"
3 +
4 + #include "SiMVAElectronSelection.h"
5 +
6   #include "HZZCiCElectronSelection.h"
7   #include "HZZLikelihoodElectronSelection.h"
8 + #include "HZZBDTElectronSelection.h"
9   #include "RunLumiRangeMap.h"
10  
11   RunLumiRangeMap rlrm;
# Line 18 | Line 22 | unsigned fails_HZZ4L_selection(ControlFl
22                                 TClonesArray *electronArr,    // input electrons
23                                 TClonesArray *muonArr,        // input muons
24                                 double eventweight,           // weight
25 <                               TNtuple * passtuple ) {
25 >                               TTree * passtuple ) {
26  
27    fails_HZZ4L_selection( ctrl, info, electronArr, muonArr, eventweight, passtuple, NULL );
28  
# Line 41 | Line 45 | unsigned fails_HZZ4L_selection(ControlFl
45                                 TClonesArray *electronArr,    // input electrons
46                                 TClonesArray *muonArr,        // input muons
47                                 double eventweight,           // weight
48 <                               TNtuple * passtuple,
48 >                               TTree * passtuple,
49                                 LabVectors * l) {       // output ntuple
50  
51    unsigned evtfail = 0x0;
52  
53 +
54 +  if( ctrl.debug ) {
55 +    cout << "Run: " << info->runNum
56 +         << "\tEvt: " << info->evtNum
57 +         << "\tLumi: " << info->lumiSec
58 +         << endl;
59 +  }
60 +
61    if( !ctrl.mc ) {
62      // not accounting for overlap atm
63      RunLumiRangeMap::RunLumiPairType rl(info->runNum, info->lumiSec);      
64      if( !(rlrm.HasRunLumi(rl)) )  {
65 +      if( ctrl.debug ) cout << "\tfails JSON" << endl;
66        evtfail |= (1<<EVTFAIL_JSON);
67        return evtfail;
68      }
69    }
70    
71    
72 <  if( ctrl.debug ) {
60 <    cout << "Run: " << info->runNum
61 <         << "\tEvt: " << info->evtNum
62 <         << "\tLumi: " << info->lumiSec
63 <         << endl;
64 <  }
72 >
73    
74    
75    //********************************************************
# Line 117 | Line 125 | unsigned fails_HZZ4L_selection(ControlFl
125        tmplep.isoTrk  = mu->trkIso03;
126        tmplep.isoEcal = mu->emIso03;
127        tmplep.isoHcal = mu->hadIso03;
128 +      tmplep.isoPF04 = mu->pfIso04;
129        tmplep.ip3dSig = mu->ip3dSig;
130        tmplep.is4l    = false;
131        tmplep.isEB    = (fabs(mu->eta) < 1.479 ? 1 : 0 );
# Line 142 | Line 151 | unsigned fails_HZZ4L_selection(ControlFl
151        }
152      }
153  
154 <    unsigned FAIL;
155 <    CICStruct tightcuts = getTightCuts();
156 <    unsigned  failsCIC  = failsCicSelection(ctrl, ele, tightcuts, ctrl.kinematics);
157 <    LikStruct likcuts = getLikCuts(ctrl.lik_cut);
158 <    unsigned  failsLike = failsLikelihoodSelection(ele, likcuts, ctrl.kinematics);
154 >    unsigned FAIL=0;
155 >    CICStruct ciccuts = getCiCCuts(ctrl.eleSeleScheme);
156 >    unsigned  failsCIC=0;
157 >    if(ctrl.eleSele=="cic") {
158 >      failsCIC = failsCicSelection(ctrl, ele, ciccuts, ctrl.kinematics);
159 >      FAIL = failsCIC;
160 >    }
161 >    LikStruct likcuts;
162 >    unsigned failsLike=0;
163 >    if(ctrl.eleSele=="lik") {
164 >      likcuts = getLikCuts(ctrl.eleSeleScheme);
165 >      failsLike = failsLikelihoodSelection(ele, likcuts, ctrl.kinematics);
166 >      FAIL = failsLike;
167 >    }
168 >    unsigned  failsBDT=0;
169 >    if(ctrl.eleSele=="bdt") {
170 >      failsBDT = failsBDTSelection(ctrl,ele);
171 >      FAIL = failsBDT;
172 >    }
173 >    unsigned  failsSi=0;
174 >    if(ctrl.eleSele=="si") {
175 >      failsSi = failsSiMVAElectronSelection(ctrl, ele, 0.95, ctrl.kinematics);
176 >      FAIL = failsSi;
177 >    }
178 >
179 >
180  
151    if ( ctrl.cic ) { FAIL = failsCIC;}
152    else            { FAIL = failsLike; }
181  
182      if( ctrl.debug ){
183        cout << "CIC category: " << cicCategory(ele)
# Line 157 | Line 185 | unsigned fails_HZZ4L_selection(ControlFl
185             << "\tFAIL:  0x"     << hex << FAIL      << dec
186             << "\tfailsCIC:  0x" << hex << failsCIC  << dec
187             << "\tfailsLike: 0x" << hex << failsLike << dec
188 +           << "\tfailsBDT:  0x" << hex << failsBDT << dec
189             << "\tscEt: " << ele->scEt
190             << "\tscEta: " << ele->scEta
191             << "\tncluster: " << ele->ncluster
# Line 174 | Line 203 | unsigned fails_HZZ4L_selection(ControlFl
203        tmplep.isoTrk  = ele->trkIso03;
204        tmplep.isoEcal = ele->emIso03;
205        tmplep.isoHcal = ele->hadIso03;
206 +      tmplep.isoPF04 = ele->pfIso04;
207        tmplep.ip3dSig = ele->ip3dSig;
208        tmplep.is4l    = false;
209        tmplep.isEB    = ele->isEB;
# Line 403 | Line 433 | unsigned fails_HZZ4L_selection(ControlFl
433          //***************************************************************
434          bool failiso=false;
435  
436 <        /*
407 <        int i,j;
408 <        i=Z1LeptonPlusIndex;
409 <        j=Z1LeptonMinusIndex;
410 <        float RIso1 = (lepvec[i].isoTrk+lepvec[i].isoEcal+lepvec[i].isoHcal)/lepvec[i].vec.Pt();
411 <        float RIso2 = (lepvec[j].isoTrk+lepvec[j].isoEcal+lepvec[j].isoHcal)/lepvec[j].vec.Pt();
412 <        float comboIso12 = RIso1 + RIso2;
413 <        i=Z2LeptonPlusIndex;
414 <        j=Z2LeptonMinusIndex;
415 <        float RIso3 = (lepvec[i].isoTrk+lepvec[i].isoEcal+lepvec[i].isoHcal)/lepvec[i].vec.Pt();
416 <        float RIso4 = (lepvec[j].isoTrk+lepvec[j].isoEcal+lepvec[j].isoHcal)/lepvec[j].vec.Pt();
417 <        float comboIso34 = RIso3 + RIso4;
418 <        if( comboIso12 > 0.35 || comboIso34 > 0.35 ) {
419 <              failiso = true;
420 <        }
421 <        */
436 >        if( ctrl.isoScheme = "pf" ) {
437  
438 <        float rho = info->rho;
439 <        for( int i=0; i<lepvec.size(); i++ ) {
440 <          if( !(lepvec[i].is4l) ) continue;
438 >          for( int i=0; i<lepvec.size(); i++ ) {
439 >            if( !(lepvec[i].is4l) ) continue;
440 >            if( abs(lepvec[i].type) == 11 ) {
441 >              if( (lepvec[i].isEB && lepvec[i].isoPF04 >0.13) ||
442 >                  (!(lepvec[i].isEB) && lepvec[i].isoPF04 >0.09) ) {
443 >                failiso = true;
444 >                break;
445 >              }
446 >            }
447 >            if( abs(lepvec[i].type) == 13 ) {
448 >              if( lepvec[i].isEB && lepvec[i].vec.Pt() > 20 && lepvec[i].isoPF04 > 0.13 ) {
449 >                failiso = true;
450 >                break;
451 >              }
452 >              if( lepvec[i].isEB && lepvec[i].vec.Pt() < 20 && lepvec[i].isoPF04 > 0.06 ) {
453 >                failiso = true;
454 >                break;
455 >              }
456 >              if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() > 20 && lepvec[i].isoPF04 > 0.09 ) {
457 >                failiso = true;
458 >                break;
459 >              }
460 >              if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() < 20 && lepvec[i].isoPF04 > 0.05 ) {
461 >                failiso = true;
462 >                break;
463 >              }
464 >            }
465 >          }  
466 >        } else {
467 >          float rho = info->rho;
468 >          for( int i=0; i<lepvec.size(); i++ ) {
469 >            if( !(lepvec[i].is4l) ) continue;
470              float effArea_ecal_i, effArea_hcal_i;
471              if( lepvec[i].isEB ) {
472                if( lepvec[i].type == 11 ) {
# Line 498 | Line 542 | unsigned fails_HZZ4L_selection(ControlFl
542                  //            break;
543                }
544              }
545 +          }
546          }
547 +
548 +
549          if( failiso ) {
550            evtfail |= ( 1<<EVTFAIL_ISOLATION );
551            return evtfail;
# Line 557 | Line 604 | unsigned fails_HZZ4L_selection(ControlFl
604              (lepvec[Z1LeptonMinusIndex].type == 13 && lepvec[Z2LeptonMinusIndex].type == 11)) channel=2;
605          
606  
607 <        
607 >
608          if( passtuple != NULL ) {
609 <          passtuple->Fill( info->runNum,
610 <                           info->evtNum,
611 <                           info->lumiSec,
612 <                           channel,
613 <                           Z1Candidate.M(),
614 <                           Z2Candidate.M(),
615 <                           ZZSystem.M(),
616 <                           ZZSystem.Pt(),
617 <                           eventweight);
609 >          unsigned run   = info->runNum;
610 >          unsigned evt   = info->evtNum;
611 >          unsigned lumi  = info->lumiSec;
612 >          unsigned chan  = channel;
613 >          double   w     = eventweight;
614 >          float mZ1      = Z1Candidate.M() ;
615 >          float mZ2      = Z2Candidate.M() ;
616 >          float m4l      = ZZSystem.M() ;
617 >          float pt4l     = ZZSystem.Pt() ;
618 >          passtuple->SetBranchAddress("run",  &run);
619 >          passtuple->SetBranchAddress("evt",  &evt);
620 >          passtuple->SetBranchAddress("lumi", &lumi);
621 >          passtuple->SetBranchAddress("mZ1",  &mZ1);
622 >          passtuple->SetBranchAddress("mZ2",  &mZ2);
623 >          passtuple->SetBranchAddress("m4l",  &m4l);
624 >          passtuple->SetBranchAddress("pt4l", &pt4l);
625 >          passtuple->SetBranchAddress("w",    &w);
626 >          passtuple->Fill( );
627          }
628  
629          if( ctrl.debug ) cout  << "run: " << info->runNum  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines