CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/RecoEgamma/EgammaIsolationAlgos/src/EgammaTrackSelector.cc

Go to the documentation of this file.
00001 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTrackSelector.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
00004 
00005 using namespace egammaisolation;
00006 using namespace reco;
00007 
00008 EgammaTrackSelector::result_type EgammaTrackSelector::operator()(const EgammaTrackSelector::input_type & tracks) const
00009 {
00010   static std::string metname = "EgammaIsolationAlgos|EgammaTrackSelector";
00011   result_type result;
00012   for (input_type::const_iterator it = tracks.begin(); it != tracks.end(); it++) {
00013 
00017 
00018     float tZ;
00019     switch(thePars.dzOption) {
00020         case dz : tZ = it->dz();                  break;
00021         case vz : tZ = it->vz();                  break;
00022         case bs : tZ = it->dz(thePars.beamPoint); break;
00023         default : tZ = it->vz();                  break;
00024     }
00025 
00026     float tPt = it->pt();
00027     //float tD0 = fabs(it->d0());  //currently not used.  
00028     float tD0Cor = fabs(it->dxy(thePars.beamPoint));
00029     float tEta = it->eta();
00030     float tPhi = it->phi();
00031     float tChi2Ndof = it->normalizedChi2();
00032   
00034 
00035     if ( !thePars.zRange.inside( tZ ) ) continue; 
00036     if ( tPt < thePars.ptMin ) continue;
00037     if ( !thePars.rRange.inside( tD0Cor) ) continue;
00038     if ( thePars.dir.deltaR( reco::isodeposit::Direction(tEta, tPhi) ) > thePars.drMax ) continue;
00039     if ( tChi2Ndof > thePars.chi2NdofMax ) continue;
00040 
00042     if (thePars.nHitsMin > 0 ){
00043       unsigned int tHits = it->numberOfValidHits();
00044       if ( tHits < thePars.nHitsMin ) continue;
00045     }
00046 
00048     if(thePars.chi2ProbMin > 0){
00049       float tChi2Prob = ChiSquaredProbability(it->chi2(), it->ndof());
00050       if ( tChi2Prob < thePars.chi2ProbMin ) continue;
00051     }
00052     result.push_back(&*it);
00053   } 
00054   return result;
00055 }