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

Comparing UserCode/LJMet/Utils/src/CutFlow.cc (file contents):
Revision 1.2 by kukartse, Sat Oct 10 05:26:18 2009 UTC vs.
Revision 1.3 by kukartse, Mon Oct 12 22:45:48 2009 UTC

# Line 63 | Line 63 | void
63   CutFlow::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
64   {
65    c_total->count();
66 +  //
67 +  //_____ mu+jets cut flow
68 +  //
69 +  /*
70    while(1){
71      if ( is_trigger("HLT_Mu9", iEvent) ){
72      }
# Line 110 | Line 114 | CutFlow::analyze(const edm::Event& iEven
114      cout << "Cut Flow: passed stage 5 " << endl;
115      break;
116    }
117 +  */
118 +  //
119 +  //_____ e+jets cut flow
120 +  //
121 +  while(1){
122 +    if ( is_trigger("HLT_Ele15_LW_L1R", iEvent) ){
123 +    }
124 +    else break;
125 +    if ( has_electron("selectedLayer1Electrons", iEvent) ){
126 +      c_1->count();
127 +    }
128 +    else break;
129 +    if ( is_electron("selectedLayer1Electrons",
130 +                     20.0,
131 +                     2.1,
132 +                     0.02,
133 +                     0.1,
134 +                     iEvent) ){
135 +      c_2->count();
136 +    }
137 +    else break;
138 +    if ( is_jets("selectedLayer1Jets",
139 +                 30.0,
140 +                 2.4,
141 +                 iEvent) ){
142 +      c_3->count();
143 +    }
144 +    else break;
145 +    if ( no_loose_muon("selectedLayer1Muons",
146 +                       2.5,
147 +                       10.0,
148 +                       0.2,
149 +                       iEvent) ){
150 +      c_4->count();
151 +    }
152 +    else break;
153 +    if ( no_loose_electron("selectedLayer1Electrons",
154 +                           2.5,
155 +                           15.0,
156 +                           0.2,
157 +                           iEvent) ){
158 +      c_5->count();
159 +    }
160 +    else break;
161 +    cout << "Cut Flow: passed stage 5 " << endl;
162 +    break;
163 +  }
164   }
165  
166  
# Line 162 | Line 213 | bool CutFlow::has_global_muon(std::strin
213      }
214    }
215    result = passed_muons.getCount()>0;
216 +  cout << endl;
217    return result;
218   }
219    
# Line 331 | Line 383 | bool CutFlow::no_loose_muon(std::string
383          _index != muon_index
384          ){
385        passed_muons.count();
334      cout << "DEBUG: found a loose muon!!!!!" << endl;
335      cout << "DEBUG: index = " << _index << endl;
336      cout << "DEBUG: abseta = " << _abseta << endl;
337      cout << "DEBUG: pt = " << _pt << endl;
338      cout << "DEBUG: reliso = " << _reliso << endl << endl;
386      }
387    }
388    result = passed_muons.getCount()==0;
389 +  cout << endl;
390    return result;
391   }
392  
# Line 368 | Line 416 | bool CutFlow::no_loose_electron(std::str
416      _caloiso = e->dr03IsolationVariables().ecalRecHitSumEt + e->dr03IsolationVariables().hcalDepth1TowerSumEt + e->dr03IsolationVariables().hcalDepth2TowerSumEt;
417      _reliso = (_trackiso + _caloiso)/_pt;
418      int _index = (int)(e - electrons->begin());
371    //cout << "DEBUG: " << _index << endl;
372    //cout << "DEBUG: " << _abseta << endl;
373    //cout << "DEBUG: " << _pt << endl;
374    //cout << "DEBUG: " << _reliso << endl << endl;
419      if (_pt > mPt &&
420          _abseta < mEta &&
421          _reliso < mRelIso &&
422          _index != electron_index
423          ){
424        passed_electrons.count();
381      cout << "DEBUG: found a loose electron!!!!!" << endl;
382      cout << "DEBUG: index = " << _index << endl;
383      cout << "DEBUG: abseta = " << _abseta << endl;
384      cout << "DEBUG: pt = " << _pt << endl;
385      cout << "DEBUG: reliso = " << _reliso << endl << endl;
425      }
426    }
427    result = passed_electrons.getCount()==0;
428 +  cout << endl;
429 +  return result;
430 + }
431 +
432 +
433 + bool CutFlow::has_electron(std::string mLabel,
434 +                           const edm::Event& iEvent){
435 +  bool result = false;
436 +  Handle< vector< pat::Electron > >     electrons;
437 +  iEvent . getByLabel( mLabel, electrons );
438 +  result = electrons->size()>0;
439    return result;
440   }
441  
442  
443 + bool CutFlow::is_electron(std::string mLabel,
444 +                      double mPt,
445 +                      double mEta,
446 +                      double mD0,
447 +                      double mRelIso,
448 +                      const edm::Event& iEvent){
449 +  bool result = false;
450 +  cout << "Cut Flow: passed stage 1: ";
451 +  Handle< vector< pat::Electron > >     electrons;
452 +  iEvent . getByLabel( "selectedLayer1Electrons", electrons );
453 +  Handle< reco::BeamSpot >          beamSpotHandle;
454 +  iEvent . getByLabel( "offlineBeamSpot", beamSpotHandle);
455 +  //
456 +  //_____ Beam spot _____________________________________________________
457 +  //
458 +  reco::BeamSpot beamSpot;
459 +  if ( beamSpotHandle.isValid() ){
460 +    beamSpot = *beamSpotHandle;
461 +  }
462 +  else{
463 +    edm::LogInfo("TtLJetsAnalyzer")
464 +      << "No beam spot available from EventSetup \n";
465 +  }
466 +  const reco::BeamSpot::Point _bs(beamSpot.x0(), beamSpot.y0(),beamSpot.z0());
467 +  //
468 +  //_____ loop over electrons _______________________________________________
469 +  //
470 +  double _pt = 0.0;
471 +  double _abseta = 0.0;
472 +  int _nhits = 0;
473 +  double _d0 = 0.0;
474 +  double _chi2ndof = 0.0;
475 +  double _emveto = 10000.0;
476 +  double _hadveto = 10000.0;
477 +  double _trackiso = 10000.0;
478 +  double _caloiso = 10000.0;
479 +  double _reliso = 10000.0;
480 +  MeanCounter passed_electrons("");
481 +  for ( vector<pat::Electron>::const_iterator e = electrons -> begin(); e != electrons -> end(); e++){
482 +    //_____ check that the electron is global
483 +    if( !(e->isGlobalElectron()) ) continue;
484 +    _pt = e->pt();
485 +    _abseta = fabs(e->eta());
486 +    //_d0 = e->dB(); // global track
487 +    _d0 = -(e->innerTrack()->dxy(_bs));
488 +    _chi2ndof = e->normChi2();
489 +    _nhits = e->numberOfValidHits();
490 +    reco::TrackRef _track = e->track();
491 +    //_____ check that there is a track
492 +    if(_track.isNull()) continue;
493 +    //_nhits = _track->numberOfValidHits();
494 +    //_d0 = -(_track->dxy(_bs));
495 +    //_chi2ndof = _track->normalizedChi2();
496 +    //_chi2ndof = (_track->chi2())/(_track->ndof());
497 +    //_____ check that isolation is valid
498 +    if ( !(e->isIsolationValid()) ) continue;
499 +    _emveto = e->isolationR03().emVetoEt;
500 +    _hadveto = e->isolationR03().hadVetoEt;
501 +    _trackiso = e->isolationR03().sumPt;
502 +    _caloiso = e->isolationR03().emEt + e->isolationR03().hadEt;
503 +    _reliso = (_trackiso + _caloiso)/_pt;
504 +    if (_pt > mPt &&
505 +        _abseta < mEta &&
506 +        _nhits >= mNHits &&
507 +        fabs(_d0) < mD0 &&
508 +        _chi2ndof < mChi2Ndof &&
509 +        fabs(_emveto) < mEmVeto &&
510 +        fabs(_hadveto) < mHadVeto &&
511 +        fabs(_reliso) < mRelIso
512 +        ){
513 +      passed_electrons.count();
514 +      electron_index = (int)(e - electrons->begin());
515 +      if (passed_electrons.getCount()==1){
516 +        cout << _pt << ", ";
517 +        cout << _abseta << ", ";
518 +        cout << _nhits << ", ";
519 +        cout << _d0 << ", ";
520 +        cout << _chi2ndof << ", ";
521 +        cout << _emveto << ", ";
522 +        cout << _hadveto << ", ";
523 +        cout << _trackiso << ", ";
524 +        cout << _caloiso << ", ";
525 +        cout << _reliso << ", ";
526 +        cout << endl;
527 +      }
528 +    }
529 +  }
530 +  result = passed_electrons.getCount()==1;
531 +  return result;
532 + }
533 +  
534 +
535 +
536   //define this as a plug-in
537   DEFINE_FWK_MODULE(CutFlow);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines