CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Attributes

RecoTrackSelector Class Reference

#include <RecoTrackSelector.h>

Inheritance diagram for RecoTrackSelector:
RecoTrackRefSelector

List of all members.

Public Types

typedef reco::TrackCollection collection
typedef container::const_iterator const_iterator
typedef std::vector< const
reco::Track * > 
container

Public Member Functions

const_iterator begin () const
const_iterator end () const
bool operator() (const reco::Track &t, const reco::BeamSpot *bs)
 Operator() performs the selection: e.g. if (recoTrackSelector(track)) {...}.
 RecoTrackSelector (const edm::ParameterSet &cfg)
 RecoTrackSelector ()
 Constructors.
 RecoTrackSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, int minHit, int min3DHit, double maxChi2, std::vector< std::string > quality, std::vector< std::string > algorithm)
void select (const edm::Handle< collection > &c, const edm::Event &event, const edm::EventSetup &)
size_t size () const

Protected Attributes

std::vector
< reco::TrackBase::TrackAlgorithm
algorithm_
edm::InputTag bsSrc_
double lip_
double maxChi2_
double maxRapidity_
int min3DHit_
int minHit_
double minRapidity_
double ptMin_
std::vector
< reco::TrackBase::TrackQuality
quality_
container selected_
double tip_

Detailed Description

Definition at line 16 of file RecoTrackSelector.h.


Member Typedef Documentation

Definition at line 18 of file RecoTrackSelector.h.

typedef container::const_iterator RecoTrackSelector::const_iterator

Definition at line 20 of file RecoTrackSelector.h.

typedef std::vector<const reco::Track *> RecoTrackSelector::container

Definition at line 19 of file RecoTrackSelector.h.


Constructor & Destructor Documentation

RecoTrackSelector::RecoTrackSelector ( ) [inline]

Constructors.

Definition at line 23 of file RecoTrackSelector.h.

{}
RecoTrackSelector::RecoTrackSelector ( const edm::ParameterSet cfg) [inline]

Definition at line 24 of file RecoTrackSelector.h.

References reco::TrackBase::algoByName(), algorithm(), algorithm_, edm::ParameterSet::getParameter(), j, quality_, and reco::TrackBase::qualityByName().

                                                    :
    ptMin_(cfg.getParameter<double>("ptMin")),
    minRapidity_(cfg.getParameter<double>("minRapidity")),
    maxRapidity_(cfg.getParameter<double>("maxRapidity")),
    tip_(cfg.getParameter<double>("tip")),
    lip_(cfg.getParameter<double>("lip")),
    minHit_(cfg.getParameter<int>("minHit")),
    min3DHit_(cfg.getParameter<int>("min3DHit")),
    maxChi2_(cfg.getParameter<double>("maxChi2")),
    bsSrc_(cfg.getParameter<edm::InputTag>("beamSpot")) 
    {
      std::vector<std::string> quality = cfg.getParameter<std::vector<std::string> >("quality");
      for (unsigned int j=0;j<quality.size();j++) quality_.push_back(reco::TrackBase::qualityByName(quality[j]));
      std::vector<std::string> algorithm = cfg.getParameter<std::vector<std::string> >("algorithm");
      for (unsigned int j=0;j<algorithm.size();j++) algorithm_.push_back(reco::TrackBase::algoByName(algorithm[j]));
    }
RecoTrackSelector::RecoTrackSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
int  minHit,
int  min3DHit,
double  maxChi2,
std::vector< std::string >  quality,
std::vector< std::string >  algorithm 
) [inline]

Definition at line 41 of file RecoTrackSelector.h.

References reco::TrackBase::algoByName(), algorithm_, j, quality_, and reco::TrackBase::qualityByName().

                                                                                      :
    ptMin_( ptMin ), minRapidity_( minRapidity ), maxRapidity_( maxRapidity ),
    tip_( tip ), lip_( lip ), minHit_( minHit ), min3DHit_( min3DHit), maxChi2_( maxChi2 ) 
    { 
      for (unsigned int j=0;j<quality.size();j++) quality_.push_back(reco::TrackBase::qualityByName(quality[j]));
      for (unsigned int j=0;j<algorithm.size();j++) algorithm_.push_back(reco::TrackBase::algoByName(algorithm[j]));
    }

Member Function Documentation

const_iterator RecoTrackSelector::begin ( void  ) const [inline]

Reimplemented in RecoTrackRefSelector.

Definition at line 51 of file RecoTrackSelector.h.

References selected_.

{ return selected_.begin(); }
const_iterator RecoTrackSelector::end ( void  ) const [inline]

Reimplemented in RecoTrackRefSelector.

Definition at line 52 of file RecoTrackSelector.h.

References selected_.

{ return selected_.end(); }
bool RecoTrackSelector::operator() ( const reco::Track t,
const reco::BeamSpot bs 
) [inline]

Operator() performs the selection: e.g. if (recoTrackSelector(track)) {...}.

Definition at line 66 of file RecoTrackSelector.h.

References reco::TrackBase::algo(), algorithm_, reco::TrackBase::dsz(), reco::TrackBase::dxy(), reco::TrackBase::eta(), spr::find(), reco::TrackBase::hitPattern(), i, lip_, maxChi2_, maxRapidity_, min3DHit_, minHit_, minRapidity_, reco::TrackBase::normalizedChi2(), reco::BeamSpot::position(), reco::TrackBase::pt(), ptMin_, reco::TrackBase::quality(), quality_, and tip_.

                                                                {
    bool quality_ok = true;
    if (quality_.size()!=0) {
      quality_ok = false;
      for (unsigned int i = 0; i<quality_.size();++i) {
        if (t.quality(quality_[i])){
          quality_ok = true;
          break;          
        }
      }
    }
    bool algo_ok = true;
    if (algorithm_.size()!=0) {
      if (std::find(algorithm_.begin(),algorithm_.end(),t.algo())==algorithm_.end()) algo_ok = false;
    }
    return
      (t.hitPattern().trackerLayersWithMeasurement() >= minHit_ &&
       t.hitPattern().pixelLayersWithMeasurement() +
       t.hitPattern().numberOfValidStripLayersWithMonoAndStereo() >= min3DHit_ &&
       fabs(t.pt()) >= ptMin_ &&
       t.eta() >= minRapidity_ && t.eta() <= maxRapidity_ &&
       fabs(t.dxy(bs->position())) <= tip_ &&
       fabs(t.dsz(bs->position())) <= lip_  &&
       t.normalizedChi2()<=maxChi2_ &&
       quality_ok &&
       algo_ok);
  }
void RecoTrackSelector::select ( const edm::Handle< collection > &  c,
const edm::Event event,
const edm::EventSetup  
) [inline]

Reimplemented in RecoTrackRefSelector.

Definition at line 54 of file RecoTrackSelector.h.

References SiPixelRawToDigiRegional_cfi::beamSpot, bsSrc_, edm::Handle< T >::product(), and selected_.

                                                                                             {
    selected_.clear();
    edm::Handle<reco::BeamSpot> beamSpot;
    event.getByLabel(bsSrc_,beamSpot); 
    for( reco::TrackCollection::const_iterator trk = c->begin(); 
         trk != c->end(); ++ trk )
      if ( operator()(*trk,beamSpot.product()) ) {
        selected_.push_back( & * trk );
      }
  }
size_t RecoTrackSelector::size ( void  ) const [inline]

Reimplemented in RecoTrackRefSelector.

Definition at line 94 of file RecoTrackSelector.h.

References selected_.

{ return selected_.size(); }

Member Data Documentation

Definition at line 106 of file RecoTrackSelector.h.

Referenced by operator()(), and RecoTrackSelector().

Definition at line 107 of file RecoTrackSelector.h.

Referenced by RecoTrackRefSelector::select(), and select().

double RecoTrackSelector::lip_ [protected]

Definition at line 101 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::maxChi2_ [protected]

Definition at line 104 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::maxRapidity_ [protected]

Definition at line 99 of file RecoTrackSelector.h.

Referenced by operator()().

Definition at line 103 of file RecoTrackSelector.h.

Referenced by operator()().

int RecoTrackSelector::minHit_ [protected]

Definition at line 102 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::minRapidity_ [protected]

Definition at line 98 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::ptMin_ [protected]

Definition at line 97 of file RecoTrackSelector.h.

Referenced by operator()().

Definition at line 105 of file RecoTrackSelector.h.

Referenced by operator()(), and RecoTrackSelector().

Definition at line 108 of file RecoTrackSelector.h.

Referenced by begin(), end(), select(), and size().

double RecoTrackSelector::tip_ [protected]

Definition at line 100 of file RecoTrackSelector.h.

Referenced by operator()().