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.2 by dkralph, Wed Sep 14 12:11:57 2011 UTC vs.
Revision 1.3 by dkralph, Thu Sep 22 18:01:19 2011 UTC

# Line 1 | Line 1
1   #include "Selection.h"
2   #include "PassHLT.h"
3   #include "HZZCiCElectronSelection.h"
4 + #include "HZZLikelihoodElectronSelection.h"
5   #include "RunLumiRangeMap.h"
6  
7   RunLumiRangeMap rlrm;
# Line 41 | Line 42 | unsigned fails_HZZ4L_selection(ControlFl
42                                 TClonesArray *muonArr,        // input muons
43                                 double eventweight,           // weight
44                                 TNtuple * passtuple,
45 <                               LabVectors * l ) {       // output ntuple
45 >                               LabVectors * l) {       // output ntuple
46  
47    unsigned evtfail = 0x0;
48  
# Line 93 | Line 94 | unsigned fails_HZZ4L_selection(ControlFl
94    vector<SimpleLepton> lepvec;
95    
96    //    
97 <  cout << "\tnMuons: " << muonArr->GetEntries() << endl;
97 >  if( ctrl.debug ) cout << "\tnMuons: " << muonArr->GetEntries() << endl;
98    //----------------------------------------------------
99    for(Int_t i=0; i<muonArr->GetEntries(); i++) {
100      const mithep::TMuon *mu = (mithep::TMuon*)((*muonArr)[i]);      
# Line 124 | Line 125 | unsigned fails_HZZ4L_selection(ControlFl
125      }
126    }
127    
127  //
128    if( ctrl.debug ) { cout << "\tnElectron: " << electronArr->GetEntries() << endl; }
129 +
130    //----------------------------------------------------
131    for(Int_t i=0; i<electronArr->GetEntries(); i++) {
132      const mithep::TElectron *ele = (mithep::TElectron*)((*electronArr)[i]);
# Line 135 | Line 136 | unsigned fails_HZZ4L_selection(ControlFl
136        TVector3 tmplep;
137        tmplep.SetPtEtaPhi(ele->pt, ele->eta, ele->phi);
138        if ( lepvec[k].type == 13 && lepvec[k].vec.Vect().DrEtaPhi(tmplep) < 0.1 ) {
139 <        cout << "-----> isMuonOverlap! " << endl;
139 >        if( ctrl.debug ) cout << "-----> isMuonOverlap! " << endl;
140          isMuonOverlap = kTRUE;
141          break;
142        }
143      }
144  
145 +    unsigned FAIL;
146      CICStruct tightcuts = getTightCuts();
147 <    unsigned failsCIC = failsCicSelection(ele, tightcuts);
147 >    unsigned  failsCIC  = failsCicSelection(ctrl, ele, tightcuts, ctrl.kinematics);
148 >    LikStruct likcuts = getLikCuts(ctrl.lik_cut);
149 >    unsigned  failsLike = failsLikelihoodSelection(ele, likcuts, ctrl.kinematics);
150 >
151 >    if ( ctrl.cic ) { FAIL = failsCIC;}
152 >    else            { FAIL = failsLike; }
153 >
154      if( ctrl.debug ){
155        cout << "CIC category: " << cicCategory(ele)
156 <           << "\tfailmask : 0x" << hex << failsCIC  << dec
156 >           << "\tlikelihood: " << ele->likelihood
157 >           << "\tFAIL:  0x"     << hex << FAIL      << dec
158 >           << "\tfailsCIC:  0x" << hex << failsCIC  << dec
159 >           << "\tfailsLike: 0x" << hex << failsLike << dec
160             << "\tscEt: " << ele->scEt
161 <           << "\tscEta: " << ele->scEta
161 >           << "\tscEta: " << ele->scEta
162 >           << "\tncluster: " << ele->ncluster
163             << endl;
164      }
165 <    if ( !failsCIC && !isMuonOverlap ) {
165 >    if ( !FAIL && !isMuonOverlap ) {
166        SimpleLepton tmplep;
167        tmplep.vec.SetPtEtaPhiM( ele->pt,
168                                 ele->eta,
# Line 214 | Line 226 | unsigned fails_HZZ4L_selection(ControlFl
226        }
227        
228        float tmpZ1Mass = (leptonPlus+leptonMinus).M();
229 <      cout << "Z1 selection, tmpZ1Mass: " << tmpZ1Mass << endl;
229 >      if( ctrl.debug ) cout << "Z1 selection, tmpZ1Mass: " << tmpZ1Mass << endl;
230        if( tmpZ1Mass > 60 ) {
231          if (fabs(tmpZ1Mass - 91.1876) < fabs(BestZ1Mass - 91.1876)) {
232            BestZ1Mass = tmpZ1Mass;
233 <          cout << "Z1 selection, new BestZ1Mass: " << BestZ1Mass
233 >          if( ctrl.debug ) cout << "Z1 selection, new BestZ1Mass: " << BestZ1Mass
234                 << "\tdM: " << fabs(BestZ1Mass - 91.1876)
235                 << endl;
236            if (lepvec[i].charge > 0) {
# Line 237 | Line 249 | unsigned fails_HZZ4L_selection(ControlFl
249      evtfail |= (1<<EVTFAIL_Z1);
250      return evtfail;
251    }
252 <  cout << "\tgot a Z1 ... run: " << info->runNum << "\tevt: " << info->evtNum  << endl;
253 <  cout << "\tZ1 plusindex: " << Z1LeptonPlusIndex << "\tminusindex: " << Z1LeptonMinusIndex << endl;
252 >  if( ctrl.debug ) cout << "\tgot a Z1 ... run: " << info->runNum << "\tevt: " << info->evtNum  << endl;
253 >  if( ctrl.debug ) cout << "\tZ1 plusindex: " << Z1LeptonPlusIndex << "\tminusindex: " << Z1LeptonMinusIndex << endl;
254    TLorentzVector Z1LeptonPlus  = lepvec[Z1LeptonPlusIndex].vec;
255    TLorentzVector Z1LeptonMinus = lepvec[Z1LeptonMinusIndex].vec;
256    TLorentzVector Z1Candidate   =  Z1LeptonPlus + Z1LeptonMinus;
# Line 262 | Line 274 | unsigned fails_HZZ4L_selection(ControlFl
274    Int_t Z2LeptonPlusIndex = -1;
275    Int_t Z2LeptonMinusIndex = -1;
276    Double_t BestZ2Mass = -1;
277 <  cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl;
277 >  if( ctrl.debug ) cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl;
278    for(int i = 0; i < lepvec.size(); ++i) {
279      for(int j = i+1; j < lepvec.size(); ++j) {
280        //            cout << "i: " << i << "\tj: " << j << endl;
# Line 298 | Line 310 | unsigned fails_HZZ4L_selection(ControlFl
310              TLorentzVector dilepton = leptonPlus+leptonMinus;
311              TLorentzVector fourLepton = Z1Candidate + dilepton;
312  
313 <            cout << "dilepton.M() : " << dilepton.M() << endl;
314 <            cout << "fourLepton.M() : " << fourLepton.M() << endl;
313 >            if( ctrl.debug ) cout << "dilepton.M() : " << dilepton.M() << endl;
314 >            if( ctrl.debug ) cout << "fourLepton.M() : " << fourLepton.M() << endl;
315  
316              if (!(dilepton.M() > 12.0)) continue;
317              if (!(fourLepton.M() > 100.0)) continue;
# Line 309 | Line 321 | unsigned fails_HZZ4L_selection(ControlFl
321              if (fabs(lepvec[i].type) == fabs(lepvec[Z1LeptonPlusIndex].type)) {
322                TLorentzVector pair1 = Z1LeptonPlus+leptonMinus;
323                TLorentzVector pair2 = Z1LeptonMinus+leptonPlus;
324 <              cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl;
324 >              if( ctrl.debug ) cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl;
325                if (!(pair1.M() > 12 || pair2.M() > 12)) continue;
326              }
327              
# Line 368 | Line 380 | unsigned fails_HZZ4L_selection(ControlFl
380            //      cout << "evtfail: " << hex << evtfail << dec << endl;
381            //      continue;
382          }
383 <        cout << "\tgot a Z2 ..." << endl;
384 <        cout << "\tZ2 plusindex: " << Z2LeptonPlusIndex << "\tminusindex: " << Z2LeptonMinusIndex << endl;
383 >        if( ctrl.debug ) cout << "\tgot a Z2 ..." << endl;
384 >        if( ctrl.debug ) cout << "\tZ2 plusindex: " << Z2LeptonPlusIndex
385 >                              << "\tminusindex: " << Z2LeptonMinusIndex << endl;
386          TLorentzVector  Z2LeptonPlus  = lepvec[Z2LeptonPlusIndex].vec;
387          TLorentzVector  Z2LeptonMinus = lepvec[Z2LeptonMinusIndex].vec;
388          TLorentzVector  Z2Candidate   = Z2LeptonPlus+Z2LeptonMinus;
# Line 480 | Line 493 | unsigned fails_HZZ4L_selection(ControlFl
493                  cout.flush();
494                }
495                if( comboIso > 0.35 ) {
496 <                cout << "combo failing for indices: " << i << "," << j << endl;
496 >                if( ctrl.debug ) cout << "combo failing for indices: " << i << "," << j << endl;
497                  failiso = true;
498                  //            break;
499                }
# Line 518 | Line 531 | unsigned fails_HZZ4L_selection(ControlFl
531          //***************************************************************
532          // remaining kinematic cuts
533          //***************************************************************
534 <        if ( Z1Candidate.M() > 120 ||
535 <             Z2Candidate.M() < 20  ||
536 <             Z2Candidate.M() > 120 ||
534 >        double Z2massCut=0;
535 >        if      ( ctrl.kinematics == "loose" ) Z2massCut = 12;
536 >        else if ( ctrl.kinematics == "tight" ) Z2massCut = 20;
537 >        else { cout <<  "error! kinematic tightness not defined!" << endl; assert(0); }
538 >
539 >        if ( Z1Candidate.M() > 120        ||
540 >             Z2Candidate.M() < Z2massCut  ||
541 >             Z2Candidate.M() > 120        ||
542               !(lepvec[Z1LeptonPlusIndex].vec.Pt() > 20.0 || lepvec[Z1LeptonMinusIndex].vec.Pt() > 20.0) ||
543               !(lepvec[Z1LeptonPlusIndex].vec.Pt() > 10.0 && lepvec[Z1LeptonMinusIndex].vec.Pt() > 10.0)
544               ) {
# Line 552 | Line 570 | unsigned fails_HZZ4L_selection(ControlFl
570                             eventweight);
571          }
572  
573 <        cout  << "run: " << info->runNum  
573 >        if( ctrl.debug ) cout  << "run: " << info->runNum  
574                << "\tevt: " << info->evtNum
575                << "\tZ1channel: " << lepvec[Z1LeptonMinusIndex].type
576                << "\tZ2channel: " << lepvec[Z2LeptonMinusIndex].type

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines