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.4 by dkralph, Wed Oct 12 17:25:15 2011 UTC

# Line 1 | Line 1
1   #include "Selection.h"
2   #include "PassHLT.h"
3   #include "HZZCiCElectronSelection.h"
4 + #include "HZZLikelihoodElectronSelection.h"
5 + #include "HZZBDTElectronSelection.h"
6   #include "RunLumiRangeMap.h"
7  
8   RunLumiRangeMap rlrm;
# Line 41 | Line 43 | unsigned fails_HZZ4L_selection(ControlFl
43                                 TClonesArray *muonArr,        // input muons
44                                 double eventweight,           // weight
45                                 TNtuple * passtuple,
46 <                               LabVectors * l ) {       // output ntuple
46 >                               LabVectors * l) {       // output ntuple
47  
48    unsigned evtfail = 0x0;
49  
# Line 93 | Line 95 | unsigned fails_HZZ4L_selection(ControlFl
95    vector<SimpleLepton> lepvec;
96    
97    //    
98 <  cout << "\tnMuons: " << muonArr->GetEntries() << endl;
98 >  if( ctrl.debug ) cout << "\tnMuons: " << muonArr->GetEntries() << endl;
99    //----------------------------------------------------
100    for(Int_t i=0; i<muonArr->GetEntries(); i++) {
101      const mithep::TMuon *mu = (mithep::TMuon*)((*muonArr)[i]);      
# Line 124 | Line 126 | unsigned fails_HZZ4L_selection(ControlFl
126      }
127    }
128    
127  //
129    if( ctrl.debug ) { cout << "\tnElectron: " << electronArr->GetEntries() << endl; }
130 +
131    //----------------------------------------------------
132    for(Int_t i=0; i<electronArr->GetEntries(); i++) {
133      const mithep::TElectron *ele = (mithep::TElectron*)((*electronArr)[i]);
# Line 135 | Line 137 | unsigned fails_HZZ4L_selection(ControlFl
137        TVector3 tmplep;
138        tmplep.SetPtEtaPhi(ele->pt, ele->eta, ele->phi);
139        if ( lepvec[k].type == 13 && lepvec[k].vec.Vect().DrEtaPhi(tmplep) < 0.1 ) {
140 <        cout << "-----> isMuonOverlap! " << endl;
140 >        if( ctrl.debug ) cout << "-----> isMuonOverlap! " << endl;
141          isMuonOverlap = kTRUE;
142          break;
143        }
144      }
145  
146 <    CICStruct tightcuts = getTightCuts();
147 <    unsigned failsCIC = failsCicSelection(ele, tightcuts);
146 >    unsigned FAIL=0;
147 >    CICStruct ciccuts = getCiCCuts(ctrl.eleSeleScheme);
148 >    unsigned  failsCIC=0;
149 >    if(ctrl.eleSele=="cic") {
150 >      failsCIC = failsCicSelection(ctrl, ele, ciccuts, ctrl.kinematics);
151 >      FAIL = failsCIC;
152 >    }
153 >    LikStruct likcuts;
154 >    unsigned failsLike=0;
155 >    if(ctrl.eleSele=="lik") {
156 >      likcuts = getLikCuts(ctrl.eleSeleScheme);
157 >      failsLike = failsLikelihoodSelection(ele, likcuts, ctrl.kinematics);
158 >      FAIL = failsLike;
159 >    }
160 >    unsigned  failsBDT=0;
161 >    if(ctrl.eleSele=="bdt") {
162 >      failsBDT = failsBDTSelection(ele,ctrl.kinematics,ctrl.eleSeleScheme);
163 >      FAIL = failsBDT;
164 >    }
165 >
166      if( ctrl.debug ){
167        cout << "CIC category: " << cicCategory(ele)
168 <           << "\tfailmask : 0x" << hex << failsCIC  << dec
168 >           << "\tlikelihood: " << ele->likelihood
169 >           << "\tFAIL:  0x"     << hex << FAIL      << dec
170 >           << "\tfailsCIC:  0x" << hex << failsCIC  << dec
171 >           << "\tfailsLike: 0x" << hex << failsLike << dec
172 >           << "\tfailsBDT:  0x" << hex << failsBDT << dec
173             << "\tscEt: " << ele->scEt
174 <           << "\tscEta: " << ele->scEta
174 >           << "\tscEta: " << ele->scEta
175 >           << "\tncluster: " << ele->ncluster
176             << endl;
177      }
178 <    if ( !failsCIC && !isMuonOverlap ) {
178 >    if ( !FAIL && !isMuonOverlap ) {
179        SimpleLepton tmplep;
180        tmplep.vec.SetPtEtaPhiM( ele->pt,
181                                 ele->eta,
# Line 214 | Line 239 | unsigned fails_HZZ4L_selection(ControlFl
239        }
240        
241        float tmpZ1Mass = (leptonPlus+leptonMinus).M();
242 <      cout << "Z1 selection, tmpZ1Mass: " << tmpZ1Mass << endl;
242 >      if( ctrl.debug ) cout << "Z1 selection, tmpZ1Mass: " << tmpZ1Mass << endl;
243        if( tmpZ1Mass > 60 ) {
244          if (fabs(tmpZ1Mass - 91.1876) < fabs(BestZ1Mass - 91.1876)) {
245            BestZ1Mass = tmpZ1Mass;
246 <          cout << "Z1 selection, new BestZ1Mass: " << BestZ1Mass
246 >          if( ctrl.debug ) cout << "Z1 selection, new BestZ1Mass: " << BestZ1Mass
247                 << "\tdM: " << fabs(BestZ1Mass - 91.1876)
248                 << endl;
249            if (lepvec[i].charge > 0) {
# Line 237 | Line 262 | unsigned fails_HZZ4L_selection(ControlFl
262      evtfail |= (1<<EVTFAIL_Z1);
263      return evtfail;
264    }
265 <  cout << "\tgot a Z1 ... run: " << info->runNum << "\tevt: " << info->evtNum  << endl;
266 <  cout << "\tZ1 plusindex: " << Z1LeptonPlusIndex << "\tminusindex: " << Z1LeptonMinusIndex << endl;
265 >  if( ctrl.debug ) cout << "\tgot a Z1 ... run: " << info->runNum << "\tevt: " << info->evtNum  << endl;
266 >  if( ctrl.debug ) cout << "\tZ1 plusindex: " << Z1LeptonPlusIndex << "\tminusindex: " << Z1LeptonMinusIndex << endl;
267    TLorentzVector Z1LeptonPlus  = lepvec[Z1LeptonPlusIndex].vec;
268    TLorentzVector Z1LeptonMinus = lepvec[Z1LeptonMinusIndex].vec;
269    TLorentzVector Z1Candidate   =  Z1LeptonPlus + Z1LeptonMinus;
# Line 262 | Line 287 | unsigned fails_HZZ4L_selection(ControlFl
287    Int_t Z2LeptonPlusIndex = -1;
288    Int_t Z2LeptonMinusIndex = -1;
289    Double_t BestZ2Mass = -1;
290 <  cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl;
290 >  if( ctrl.debug ) cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl;
291    for(int i = 0; i < lepvec.size(); ++i) {
292      for(int j = i+1; j < lepvec.size(); ++j) {
293        //            cout << "i: " << i << "\tj: " << j << endl;
# Line 298 | Line 323 | unsigned fails_HZZ4L_selection(ControlFl
323              TLorentzVector dilepton = leptonPlus+leptonMinus;
324              TLorentzVector fourLepton = Z1Candidate + dilepton;
325  
326 <            cout << "dilepton.M() : " << dilepton.M() << endl;
327 <            cout << "fourLepton.M() : " << fourLepton.M() << endl;
326 >            if( ctrl.debug ) cout << "dilepton.M() : " << dilepton.M() << endl;
327 >            if( ctrl.debug ) cout << "fourLepton.M() : " << fourLepton.M() << endl;
328  
329              if (!(dilepton.M() > 12.0)) continue;
330              if (!(fourLepton.M() > 100.0)) continue;
# Line 309 | Line 334 | unsigned fails_HZZ4L_selection(ControlFl
334              if (fabs(lepvec[i].type) == fabs(lepvec[Z1LeptonPlusIndex].type)) {
335                TLorentzVector pair1 = Z1LeptonPlus+leptonMinus;
336                TLorentzVector pair2 = Z1LeptonMinus+leptonPlus;
337 <              cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl;
337 >              if( ctrl.debug ) cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl;
338                if (!(pair1.M() > 12 || pair2.M() > 12)) continue;
339              }
340              
# Line 368 | Line 393 | unsigned fails_HZZ4L_selection(ControlFl
393            //      cout << "evtfail: " << hex << evtfail << dec << endl;
394            //      continue;
395          }
396 <        cout << "\tgot a Z2 ..." << endl;
397 <        cout << "\tZ2 plusindex: " << Z2LeptonPlusIndex << "\tminusindex: " << Z2LeptonMinusIndex << endl;
396 >        if( ctrl.debug ) cout << "\tgot a Z2 ..." << endl;
397 >        if( ctrl.debug ) cout << "\tZ2 plusindex: " << Z2LeptonPlusIndex
398 >                              << "\tminusindex: " << Z2LeptonMinusIndex << endl;
399          TLorentzVector  Z2LeptonPlus  = lepvec[Z2LeptonPlusIndex].vec;
400          TLorentzVector  Z2LeptonMinus = lepvec[Z2LeptonMinusIndex].vec;
401          TLorentzVector  Z2Candidate   = Z2LeptonPlus+Z2LeptonMinus;
# Line 480 | Line 506 | unsigned fails_HZZ4L_selection(ControlFl
506                  cout.flush();
507                }
508                if( comboIso > 0.35 ) {
509 <                cout << "combo failing for indices: " << i << "," << j << endl;
509 >                if( ctrl.debug ) cout << "combo failing for indices: " << i << "," << j << endl;
510                  failiso = true;
511                  //            break;
512                }
# Line 518 | Line 544 | unsigned fails_HZZ4L_selection(ControlFl
544          //***************************************************************
545          // remaining kinematic cuts
546          //***************************************************************
547 <        if ( Z1Candidate.M() > 120 ||
548 <             Z2Candidate.M() < 20  ||
549 <             Z2Candidate.M() > 120 ||
547 >        double Z2massCut=0;
548 >        if      ( ctrl.kinematics == "loose" ) Z2massCut = 12;
549 >        else if ( ctrl.kinematics == "tight" ) Z2massCut = 20;
550 >        else { cout <<  "error! kinematic tightness not defined!" << endl; assert(0); }
551 >
552 >        if ( Z1Candidate.M() > 120        ||
553 >             Z2Candidate.M() < Z2massCut  ||
554 >             Z2Candidate.M() > 120        ||
555               !(lepvec[Z1LeptonPlusIndex].vec.Pt() > 20.0 || lepvec[Z1LeptonMinusIndex].vec.Pt() > 20.0) ||
556               !(lepvec[Z1LeptonPlusIndex].vec.Pt() > 10.0 && lepvec[Z1LeptonMinusIndex].vec.Pt() > 10.0)
557               ) {
# Line 552 | Line 583 | unsigned fails_HZZ4L_selection(ControlFl
583                             eventweight);
584          }
585  
586 <        cout  << "run: " << info->runNum  
586 >        if( ctrl.debug ) cout  << "run: " << info->runNum  
587                << "\tevt: " << info->evtNum
588                << "\tZ1channel: " << lepvec[Z1LeptonMinusIndex].type
589                << "\tZ2channel: " << lepvec[Z2LeptonMinusIndex].type

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines