CMS 3D CMS Logo

Public Member Functions | Private Attributes

TrackingParticleSelector Class Reference

#include <TrackingParticleSelector.h>

List of all members.

Public Member Functions

bool operator() (const TrackingParticle &tp) const
 Operator() performs the selection: e.g. if (tPSelector(tp)) {...}.
 TrackingParticleSelector ()
 TrackingParticleSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, int minHit, bool signalOnly, bool chargedOnly, bool stableOnly, std::vector< int > pdgId=std::vector< int >())

Private Attributes

bool chargedOnly_
double lip_
double maxRapidity_
int minHit_
double minRapidity_
std::vector< int > pdgId_
double ptMin_
bool signalOnly_
bool stableOnly_
double tip_

Detailed Description

Definition at line 13 of file TrackingParticleSelector.h.


Constructor & Destructor Documentation

TrackingParticleSelector::TrackingParticleSelector ( ) [inline]

Definition at line 16 of file TrackingParticleSelector.h.

{}
TrackingParticleSelector::TrackingParticleSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
int  minHit,
bool  signalOnly,
bool  chargedOnly,
bool  stableOnly,
std::vector< int >  pdgId = std::vector<int>() 
) [inline]

Definition at line 17 of file TrackingParticleSelector.h.

                                                                      :
    ptMin_( ptMin ), minRapidity_( minRapidity ), maxRapidity_( maxRapidity ),
    tip_( tip ), lip_( lip ), minHit_( minHit ), signalOnly_(signalOnly), chargedOnly_(chargedOnly), stableOnly_(stableOnly), pdgId_( pdgId ) { }

Member Function Documentation

bool TrackingParticleSelector::operator() ( const TrackingParticle tp) const [inline]

Operator() performs the selection: e.g. if (tPSelector(tp)) {...}.

Definition at line 24 of file TrackingParticleSelector.h.

References EncodedEventId::bunchCrossing(), ParticleBase::charge(), chargedOnly_, EncodedEventId::event(), TrackingParticle::eventId(), configurableAnalysis::GenParticle, TrackingParticle::genParticle_begin(), TrackingParticle::genParticle_end(), j, lip_, TrackingParticle::matchedHit(), maxRapidity_, minHit_, minRapidity_, ParticleBase::momentum(), L1TEmulatorMonitor_cff::p, TrackingParticle::pdgId(), pdgId_, ptMin_, signalOnly_, mathSSE::sqrt(), TopDecayID::stable, stableOnly_, ParticleBase::status(), tip_, and ParticleBase::vertex().

                                                       { 
    if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
    bool testId = false;
    unsigned int idSize = pdgId_.size();
    if (idSize==0) testId = true;
    else for (unsigned int it=0;it!=idSize;++it){
      if (tp.pdgId()==pdgId_[it]) testId = true;
    }
    bool signal = true;
    if (signalOnly_) signal = (tp.eventId().bunchCrossing()== 0 && tp.eventId().event() == 0);
    //quickly reject if it is from pile-up
    //    if (signalOnly_ && !(tp.eventId().bunchCrossing()==0 && tp.eventId().event()==0) )return false;
    // select only stable particles
    bool stable = 1;
    if (stableOnly_) {
       for( TrackingParticle::genp_iterator j = tp.genParticle_begin(); j != tp.genParticle_end(); ++ j ) {
          const HepMC::GenParticle * p = j->get();
             if (p->status() != 1) {
                stable = 0; break;
             }
       }
       // test for remaining unstabled due to lack of genparticle pointer
       if(stable == 1 && tp.status() == -99 && 
          (fabs(tp.pdgId()) != 11 && fabs(tp.pdgId()) != 13 && fabs(tp.pdgId()) != 211 &&
           fabs(tp.pdgId()) != 321 && fabs(tp.pdgId()) != 2212 && fabs(tp.pdgId()) != 3112 &&
           fabs(tp.pdgId()) != 3222 && fabs(tp.pdgId()) != 3312 && fabs(tp.pdgId()) != 3334)) stable = 0;
    }
    return (
            tp.matchedHit() >= minHit_ &&
            sqrt(tp.momentum().perp2()) >= ptMin_ && 
            tp.momentum().eta() >= minRapidity_ && tp.momentum().eta() <= maxRapidity_ && 
            sqrt(tp.vertex().perp2()) <= tip_ &&
            fabs(tp.vertex().z()) <= lip_ &&
            testId &&
            signal &&
            stable
            );
  }

Member Data Documentation

Definition at line 71 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 68 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 66 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 69 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 65 of file TrackingParticleSelector.h.

Referenced by operator()().

std::vector<int> TrackingParticleSelector::pdgId_ [private]

Definition at line 73 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 64 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 70 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 72 of file TrackingParticleSelector.h.

Referenced by operator()().

Definition at line 67 of file TrackingParticleSelector.h.

Referenced by operator()().