CMS 3D CMS Logo

Public Member Functions | Private Attributes

GenParticleCustomSelector Class Reference

#include <GenParticleCustomSelector.h>

List of all members.

Public Member Functions

 GenParticleCustomSelector ()
 GenParticleCustomSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, bool chargedOnly, int status, std::vector< int > pdgId=std::vector< int >())
bool operator() (const reco::GenParticle &tp) const
 Operator() performs the selection: e.g. if (tPSelector(tp)) {...}.

Private Attributes

bool chargedOnly_
double lip_
double maxRapidity_
double minRapidity_
std::vector< int > pdgId_
double ptMin_
int status_
double tip_

Detailed Description

Definition at line 11 of file GenParticleCustomSelector.h.


Constructor & Destructor Documentation

GenParticleCustomSelector::GenParticleCustomSelector ( ) [inline]

Definition at line 14 of file GenParticleCustomSelector.h.

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

Definition at line 15 of file GenParticleCustomSelector.h.

                                                                 :
    ptMin_( ptMin ), minRapidity_( minRapidity ), maxRapidity_( maxRapidity ),
    tip_( tip ), lip_( lip ), chargedOnly_(chargedOnly), status_(status), pdgId_( pdgId ) { }

Member Function Documentation

bool GenParticleCustomSelector::operator() ( const reco::GenParticle tp) const [inline]

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

Definition at line 22 of file GenParticleCustomSelector.h.

References reco::LeafCandidate::charge(), chargedOnly_, reco::LeafCandidate::eta(), lip_, maxRapidity_, minRapidity_, reco::LeafCandidate::pdgId(), pdgId_, reco::LeafCandidate::pt(), ptMin_, mathSSE::sqrt(), reco::LeafCandidate::status(), status_, tip_, and reco::LeafCandidate::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;
    }

    return (
            tp.pt() >= ptMin_ && 
            tp.eta() >= minRapidity_ && tp.eta() <= maxRapidity_ && 
            sqrt(tp.vertex().perp2()) <= tip_ &&
            fabs(tp.vertex().z()) <= lip_ &&
            tp.status() == status_ &&
            testId 
            );
  }

Member Data Documentation

Definition at line 48 of file GenParticleCustomSelector.h.

Referenced by operator()().

Definition at line 47 of file GenParticleCustomSelector.h.

Referenced by operator()().

Definition at line 45 of file GenParticleCustomSelector.h.

Referenced by operator()().

Definition at line 44 of file GenParticleCustomSelector.h.

Referenced by operator()().

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

Definition at line 50 of file GenParticleCustomSelector.h.

Referenced by operator()().

Definition at line 43 of file GenParticleCustomSelector.h.

Referenced by operator()().

Definition at line 49 of file GenParticleCustomSelector.h.

Referenced by operator()().

Definition at line 46 of file GenParticleCustomSelector.h.

Referenced by operator()().