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.7 by khahn, Fri Oct 14 11:20:25 2011 UTC vs.
Revision 1.11 by khahn, Mon Oct 17 16:23:43 2011 UTC

# Line 12 | Line 12 | RunLumiRangeMap rlrm;
12  
13   void initRunLumiRangeMap() {
14    rlrm.AddJSONFile(std::string("./data/Cert_136033-149442_7TeV_Apr21ReReco_Collisions10_JSON.txt"));
15 <  rlrm.AddJSONFile(std::string("./data/Cert_160404-173244_7TeV_PromptReco_Collisions11_JSON_v2.txt"));
15 >  //  rlrm.AddJSONFile(std::string("./data/Cert_160404-173244_7TeV_PromptReco_Collisions11_JSON_v2.txt"));
16 >  rlrm.AddJSONFile(std::string("./data/Cert_160404-178078_7TeV_PromptReco_Collisions11_JSON.txt"));
17    rlrm.AddJSONFile(std::string("./data/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt"));  
18    rlrm.AddJSONFile(std::string("./data/Cert_170249-172619_7TeV_ReReco5Aug_Collisions11_JSON.txt"));  
19   };
# Line 106 | Line 107 | unsigned fails_HZZ4L_selection(ControlFl
107    //----------------------------------------------------
108    for(Int_t i=0; i<muonArr->GetEntries(); i++) {
109      const mithep::TMuon *mu = (mithep::TMuon*)((*muonArr)[i]);      
110 <    unsigned muonfail = passMuonSelectionZZ(mu);
110 >    unsigned muonfail;
111 >    if( ctrl.muSele == "ksWW" )
112 >      muonfail = passMuonSelection(mu);
113 >    else
114 >      muonfail = passMuonSelectionZZ(mu);
115      if( ctrl.debug ) {
116        cout << "muon:: pt: " << mu->pt
117             << "\teta: " << mu->eta
# Line 125 | Line 130 | unsigned fails_HZZ4L_selection(ControlFl
130        tmplep.isoTrk  = mu->trkIso03;
131        tmplep.isoEcal = mu->emIso03;
132        tmplep.isoHcal = mu->hadIso03;
133 +      tmplep.isoPF03 = mu->pfIso03;
134 +      tmplep.isoPF04 = mu->pfIso04;
135        tmplep.ip3dSig = mu->ip3dSig;
136        tmplep.is4l    = false;
137        tmplep.isEB    = (fabs(mu->eta) < 1.479 ? 1 : 0 );
# Line 150 | Line 157 | unsigned fails_HZZ4L_selection(ControlFl
157        }
158      }
159  
160 <    unsigned FAIL=0;
161 <    CICStruct ciccuts = getCiCCuts(ctrl.eleSeleScheme);
160 >    unsigned FAIL=0, isEleTight=0;
161 >
162      unsigned  failsCIC=0;
163 +    CICStruct ciccuts_tight, ciccuts_medium, ciccuts_loose;
164      if(ctrl.eleSele=="cic") {
165 <      failsCIC = failsCicSelection(ctrl, ele, ciccuts, ctrl.kinematics);
165 >      if( ctrl.eleSeleScheme == "mediumloose" ) {
166 >        ciccuts_medium = getCiCCuts("medium");
167 >        unsigned failsCICMedium = failsCicSelection(ctrl, ele, ciccuts_medium, ctrl.kinematics);
168 >        ciccuts_loose = getCiCCuts("loose");
169 >        unsigned failsCICLoose = failsCicSelection(ctrl, ele, ciccuts_loose, ctrl.kinematics);
170 >        failsCIC = ( failsCICLoose | failsCICMedium );
171 >        if( !failsCICMedium ) isEleTight=1;
172 >      }
173 >      else {
174 >        ciccuts_tight = getCiCCuts(ctrl.eleSeleScheme);
175 >        failsCIC = failsCicSelection(ctrl, ele, ciccuts_tight, ctrl.kinematics);
176 >        if( !failsCIC ) isEleTight=1;
177 >      }
178        FAIL = failsCIC;
179      }
180 +
181      LikStruct likcuts;
182      unsigned failsLike=0;
183      if(ctrl.eleSele=="lik") {
# Line 164 | Line 185 | unsigned fails_HZZ4L_selection(ControlFl
185        failsLike = failsLikelihoodSelection(ele, likcuts, ctrl.kinematics);
186        FAIL = failsLike;
187      }
188 <    unsigned  failsBDT=0;
188 >    unsigned failsBDT=0;
189      if(ctrl.eleSele=="bdt") {
190 <      failsBDT = failsBDTSelection(ctrl,ele);
190 >      if( ctrl.eleSeleScheme == "mediumloose" ) {
191 >        unsigned failsBDTMedium = failsBDTSelection(ctrl,"medium",ele);
192 >        unsigned failsBDTLoose  = failsBDTSelection(ctrl,"loose",ele);
193 >        failsBDT = ( failsBDTLoose | failsBDTMedium );
194 >        if( !failsBDTMedium ) isEleTight=1;
195 >      } else {
196 >        failsBDT = failsBDTSelection(ctrl,"tight",ele);
197 >        if( !failsBDT ) isEleTight=1;
198 >      }
199        FAIL = failsBDT;
200      }
201      unsigned  failsSi=0;
# Line 202 | Line 231 | unsigned fails_HZZ4L_selection(ControlFl
231        tmplep.isoTrk  = ele->trkIso03;
232        tmplep.isoEcal = ele->emIso03;
233        tmplep.isoHcal = ele->hadIso03;
234 +      tmplep.isoPF03 = ele->pfIso03;
235 +      tmplep.isoPF04 = ele->pfIso04;
236        tmplep.ip3dSig = ele->ip3dSig;
237        tmplep.is4l    = false;
238 +      tmplep.isTight = isEleTight;
239        tmplep.isEB    = ele->isEB;
240        lepvec.push_back(tmplep);
241        if( ctrl.debug ) { cout << "\telectron passes ... " << endl; }
# Line 304 | Line 336 | unsigned fails_HZZ4L_selection(ControlFl
336    Double_t BestZ2Mass = -1;
337    if( ctrl.debug ) cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl;
338    for(int i = 0; i < lepvec.size(); ++i) {
339 +    if( abs(lepvec[i].type) == 11 &&
340 +        ctrl.eleSeleScheme == "mediumloose" &&
341 +        !(lepvec[i].isTight) ) continue;
342 +
343      for(int j = i+1; j < lepvec.size(); ++j) {
344 +      if( abs(lepvec[j].type) == 11 &&
345 +          ctrl.eleSeleScheme == "mediumloose" &&
346 +          !(lepvec[j].isTight) ) continue;
347 +
348        //            cout << "i: " << i << "\tj: " << j << endl;
349        if (i == Z1LeptonPlusIndex || i == Z1LeptonMinusIndex) {
350          //            cout << "\ti matches a Z1 index, skipping ..." << endl;
# Line 344 | Line 384 | unsigned fails_HZZ4L_selection(ControlFl
384              if (!(dilepton.M() > 12.0)) continue;
385              if (!(fourLepton.M() > 100.0)) continue;
386  
387 <            
387 >            /*
388              //for 4e and 4mu, require at least 1 of the other opp sign lepton pairs have mass > 12
389              if (fabs(lepvec[i].type) == fabs(lepvec[Z1LeptonPlusIndex].type)) {
390                TLorentzVector pair1 = Z1LeptonPlus+leptonMinus;
# Line 352 | Line 392 | unsigned fails_HZZ4L_selection(ControlFl
392                if( ctrl.debug ) cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl;
393                if (!(pair1.M() > 12 || pair2.M() > 12)) continue;
394              }
395 <            
395 >            */
396 >
397              //Disambiguiation is done by choosing the pair with the largest ptMax and largest ptMin
398              if (Z2LeptonPlusIndex < 0) {
399                if (lepvec[i].charge > 0) {
# Line 431 | Line 472 | unsigned fails_HZZ4L_selection(ControlFl
472          //***************************************************************
473          bool failiso=false;
474  
475 <        /*
435 <        int i,j;
436 <        i=Z1LeptonPlusIndex;
437 <        j=Z1LeptonMinusIndex;
438 <        float RIso1 = (lepvec[i].isoTrk+lepvec[i].isoEcal+lepvec[i].isoHcal)/lepvec[i].vec.Pt();
439 <        float RIso2 = (lepvec[j].isoTrk+lepvec[j].isoEcal+lepvec[j].isoHcal)/lepvec[j].vec.Pt();
440 <        float comboIso12 = RIso1 + RIso2;
441 <        i=Z2LeptonPlusIndex;
442 <        j=Z2LeptonMinusIndex;
443 <        float RIso3 = (lepvec[i].isoTrk+lepvec[i].isoEcal+lepvec[i].isoHcal)/lepvec[i].vec.Pt();
444 <        float RIso4 = (lepvec[j].isoTrk+lepvec[j].isoEcal+lepvec[j].isoHcal)/lepvec[j].vec.Pt();
445 <        float comboIso34 = RIso3 + RIso4;
446 <        if( comboIso12 > 0.35 || comboIso34 > 0.35 ) {
447 <              failiso = true;
448 <        }
449 <        */
475 >        if( ctrl.isoScheme == "pf" ) {
476  
477 <        float rho = info->rho;
478 <        for( int i=0; i<lepvec.size(); i++ ) {
479 <          if( !(lepvec[i].is4l) ) continue;
477 >          for( int i=0; i<lepvec.size(); i++ ) {
478 >
479 >            if( !(lepvec[i].is4l) ) continue;
480 >
481 >            if( abs(lepvec[i].type) == 11 ) {
482 >              float reliso = lepvec[i].isoPF04/lepvec[i].vec.Pt();
483 >              if( lepvec[i].isEB && lepvec[i].vec.Pt() > 20 && reliso > PFISO_ELE_LOOSE_EB_HIGHPT ) {
484 >                failiso = true;
485 >                break;
486 >              }
487 >              if( lepvec[i].isEB && lepvec[i].vec.Pt() < 20 && reliso > PFISO_ELE_LOOSE_EB_LOWPT ) {
488 >                failiso = true;
489 >                break;
490 >              }
491 >              if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() > 20 && reliso > PFISO_ELE_LOOSE_EE_HIGHPT ) {
492 >                failiso = true;
493 >                break;
494 >              }
495 >              if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() < 20 && reliso > PFISO_ELE_LOOSE_EE_LOWPT ) {
496 >                failiso = true;
497 >                break;
498 >              }
499 >            }
500 >
501 >            if( abs(lepvec[i].type) == 13 ) {
502 >
503 >              float reliso = lepvec[i].isoPF03/lepvec[i].vec.Pt();
504 >              if( lepvec[i].isEB && lepvec[i].vec.Pt() > 20 && reliso > PFISO_MU_TIGHT_EB_HIGHPT ) {  //0.13
505 >                failiso = true;
506 >                break;
507 >              }
508 >              if( lepvec[i].isEB && lepvec[i].vec.Pt() < 20 && reliso > PFISO_MU_TIGHT_EB_LOWPT ) { //0.06
509 >                failiso = true;
510 >                break;
511 >              }
512 >              if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() > 20 && reliso > PFISO_MU_TIGHT_EE_HIGHPT ) { //0.09
513 >                failiso = true;
514 >                break;
515 >              }
516 >              if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() < 20 && reliso > PFISO_MU_TIGHT_EE_LOWPT ) { //0.05
517 >                failiso = true;
518 >                break;
519 >              }
520 >            }
521 >          }  
522 >        } else if ( ctrl.isoScheme == "pairwise" ) {
523 >          float rho = info->rho;
524 >          for( int i=0; i<lepvec.size(); i++ ) {
525 >            if( !(lepvec[i].is4l) ) continue;
526              float effArea_ecal_i, effArea_hcal_i;
527              if( lepvec[i].isEB ) {
528                if( lepvec[i].type == 11 ) {
# Line 526 | Line 598 | unsigned fails_HZZ4L_selection(ControlFl
598                  //            break;
599                }
600              }
601 +          }
602          }
603 +
604 +
605          if( failiso ) {
606            evtfail |= ( 1<<EVTFAIL_ISOLATION );
607            return evtfail;
# Line 596 | Line 671 | unsigned fails_HZZ4L_selection(ControlFl
671            float mZ2      = Z2Candidate.M() ;
672            float m4l      = ZZSystem.M() ;
673            float pt4l     = ZZSystem.Pt() ;
674 +          unsigned tZ1   = abs(lepvec[Z1LeptonMinusIndex].type);
675 +          unsigned tZ2   = abs(lepvec[Z2LeptonMinusIndex].type);
676            passtuple->SetBranchAddress("run",  &run);
677            passtuple->SetBranchAddress("evt",  &evt);
678            passtuple->SetBranchAddress("lumi", &lumi);
679            passtuple->SetBranchAddress("mZ1",  &mZ1);
680            passtuple->SetBranchAddress("mZ2",  &mZ2);
681 +          passtuple->SetBranchAddress("tZ1",  &tZ1);
682 +          passtuple->SetBranchAddress("tZ2",  &tZ2);
683            passtuple->SetBranchAddress("m4l",  &m4l);
684            passtuple->SetBranchAddress("pt4l", &pt4l);
685            passtuple->SetBranchAddress("w",    &w);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines