CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Attributes
RecoTrackSelector Class Reference

#include <RecoTrackSelector.h>

Inheritance diagram for RecoTrackSelector:
RecoTrackRefSelector

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, edm::Event &event)
 Operator() performs the selection: e.g. if (recoTrackSelector(track)) {...}. More...
 
bool operator() (const reco::Track &t, const reco::BeamSpot *bs_)
 
bool operator() (const reco::Track &t)
 
 RecoTrackSelector ()
 Constructors. More...
 
 RecoTrackSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
 RecoTrackSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 
 RecoTrackSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, int minHit, int min3DHit, double maxChi2, const std::vector< std::string > &quality, const 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_
 
const reco::BeamSpotbs
 
edm::EDGetTokenT< reco::BeamSpotbsSrcToken_
 
double lip_
 
double maxChi2_
 
double maxRapidity_
 
int min3DHit_
 
int minHit_
 
double minRapidity_
 
edm::EventID previousEvent
 
double ptMin_
 
std::vector
< reco::TrackBase::TrackQuality
quality_
 
container selected_
 
double tip_
 

Detailed Description

Definition at line 17 of file RecoTrackSelector.h.

Member Typedef Documentation

Definition at line 19 of file RecoTrackSelector.h.

typedef container::const_iterator RecoTrackSelector::const_iterator

Definition at line 21 of file RecoTrackSelector.h.

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

Definition at line 20 of file RecoTrackSelector.h.

Constructor & Destructor Documentation

RecoTrackSelector::RecoTrackSelector ( )
inline

Constructors.

Definition at line 24 of file RecoTrackSelector.h.

24 {}
RecoTrackSelector::RecoTrackSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 25 of file RecoTrackSelector.h.

25  :
26  RecoTrackSelector( cfg, iC ) {}
RecoTrackSelector()
Constructors.
RecoTrackSelector::RecoTrackSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)
inline

Definition at line 27 of file RecoTrackSelector.h.

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

27  :
28  ptMin_(cfg.getParameter<double>("ptMin")),
29  minRapidity_(cfg.getParameter<double>("minRapidity")),
30  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
31  tip_(cfg.getParameter<double>("tip")),
32  lip_(cfg.getParameter<double>("lip")),
33  minHit_(cfg.getParameter<int>("minHit")),
34  min3DHit_(cfg.getParameter<int>("min3DHit")),
35  maxChi2_(cfg.getParameter<double>("maxChi2")),
37  bs(0)
38  {
39  std::vector<std::string> quality = cfg.getParameter<std::vector<std::string> >("quality");
40  for (unsigned int j=0;j<quality.size();j++) quality_.push_back(reco::TrackBase::qualityByName(quality[j]));
41  std::vector<std::string> algorithm = cfg.getParameter<std::vector<std::string> >("algorithm");
42  for (unsigned int j=0;j<algorithm.size();j++) algorithm_.push_back(reco::TrackBase::algoByName(algorithm[j]));
43  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< reco::TrackBase::TrackQuality > quality_
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
int j
Definition: DBlmapReader.cc:9
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:114
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
const reco::BeamSpot * bs
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:126
RecoTrackSelector::RecoTrackSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
int  minHit,
int  min3DHit,
double  maxChi2,
const std::vector< std::string > &  quality,
const std::vector< std::string > &  algorithm 
)
inline

Definition at line 45 of file RecoTrackSelector.h.

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

47  :
50  {
51  for (unsigned int j=0;j<quality.size();j++) quality_.push_back(reco::TrackBase::qualityByName(quality[j]));
52  for (unsigned int j=0;j<algorithm.size();j++) algorithm_.push_back(reco::TrackBase::algoByName(algorithm[j]));
53  }
std::vector< reco::TrackBase::TrackQuality > quality_
int j
Definition: DBlmapReader.cc:9
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:114
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
const reco::BeamSpot * bs
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:126

Member Function Documentation

const_iterator RecoTrackSelector::begin ( void  ) const
inline

Definition at line 55 of file RecoTrackSelector.h.

References selected_.

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

Definition at line 56 of file RecoTrackSelector.h.

References selected_.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

56 { return selected_.end(); }
bool RecoTrackSelector::operator() ( const reco::Track t,
edm::Event event 
)
inline

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

Definition at line 71 of file RecoTrackSelector.h.

References SiPixelRawToDigiRegional_cfi::beamSpot, bs, bsSrcToken_, edm::EventBase::id(), previousEvent, and edm::Handle< T >::product().

Referenced by operator()().

71  {
72 
73  if ((bs==0)|| (previousEvent != event.id())) {
75  event.getByToken(bsSrcToken_,beamSpot);
76  bs = beamSpot.product();
77  previousEvent = event.id();
78  }
79  return operator()(t);
80  }
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
edm::EventID previousEvent
bool operator()(const reco::Track &t, edm::Event &event)
Operator() performs the selection: e.g. if (recoTrackSelector(track)) {...}.
T const * product() const
Definition: Handle.h:81
edm::EventID id() const
Definition: EventBase.h:60
const reco::BeamSpot * bs
bool RecoTrackSelector::operator() ( const reco::Track t,
const reco::BeamSpot bs_ 
)
inline

Definition at line 82 of file RecoTrackSelector.h.

References bs, and operator()().

82  {
83  bs = bs_;
84  return operator()(t);
85  }
bool operator()(const reco::Track &t, edm::Event &event)
Operator() performs the selection: e.g. if (recoTrackSelector(track)) {...}.
const reco::BeamSpot * bs
bool RecoTrackSelector::operator() ( const reco::Track t)
inline

Definition at line 87 of file RecoTrackSelector.h.

References reco::TrackBase::algo(), algorithm_, bs, 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::HitPattern::numberOfValidStripLayersWithMonoAndStereo(), reco::HitPattern::pixelLayersWithMeasurement(), reco::BeamSpot::position(), reco::TrackBase::pt(), ptMin_, reco::TrackBase::quality(), quality_, tip_, and reco::HitPattern::trackerLayersWithMeasurement().

87  {
88  bool quality_ok = true;
89  if (quality_.size()!=0) {
90  quality_ok = false;
91  for (unsigned int i = 0; i<quality_.size();++i) {
92  if (t.quality(quality_[i])){
93  quality_ok = true;
94  break;
95  }
96  }
97  }
98  bool algo_ok = true;
99  if (algorithm_.size()!=0) {
100  if (std::find(algorithm_.begin(),algorithm_.end(),t.algo())==algorithm_.end()) algo_ok = false;
101  }
102  return
106  fabs(t.pt()) >= ptMin_ &&
107  t.eta() >= minRapidity_ && t.eta() <= maxRapidity_ &&
108  fabs(t.dxy(bs->position())) <= tip_ &&
109  fabs(t.dsz(bs->position())) <= lip_ &&
110  t.normalizedChi2()<=maxChi2_ &&
111  quality_ok &&
112  algo_ok);
113  }
int i
Definition: DBlmapReader.cc:9
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:514
std::vector< reco::TrackBase::TrackQuality > quality_
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
double dsz() const
dsz parameter (THIS IS NOT the SZ impact parameter to (0,0,0) if refPoint is far from (0...
Definition: TrackBase.h:556
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
TrackAlgorithm algo() const
Definition: TrackBase.h:450
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:300
double pt() const
track transverse momentum
Definition: TrackBase.h:574
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:411
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:463
const reco::BeamSpot * bs
const Point & position() const
position
Definition: BeamSpot.h:62
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:544
void RecoTrackSelector::select ( const edm::Handle< collection > &  c,
const edm::Event event,
const edm::EventSetup  
)
inline
size_t RecoTrackSelector::size ( void  ) const
inline

Definition at line 115 of file RecoTrackSelector.h.

References selected_.

115 { return selected_.size(); }

Member Data Documentation

std::vector<reco::TrackBase::TrackAlgorithm> RecoTrackSelector::algorithm_
protected

Definition at line 127 of file RecoTrackSelector.h.

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

const reco::BeamSpot* RecoTrackSelector::bs
protected

Definition at line 129 of file RecoTrackSelector.h.

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

edm::EDGetTokenT<reco::BeamSpot> RecoTrackSelector::bsSrcToken_
protected

Definition at line 128 of file RecoTrackSelector.h.

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

double RecoTrackSelector::lip_
protected

Definition at line 122 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::maxChi2_
protected

Definition at line 125 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::maxRapidity_
protected

Definition at line 120 of file RecoTrackSelector.h.

Referenced by operator()().

int RecoTrackSelector::min3DHit_
protected

Definition at line 124 of file RecoTrackSelector.h.

Referenced by operator()().

int RecoTrackSelector::minHit_
protected

Definition at line 123 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::minRapidity_
protected

Definition at line 119 of file RecoTrackSelector.h.

Referenced by operator()().

edm::EventID RecoTrackSelector::previousEvent
protected

Definition at line 131 of file RecoTrackSelector.h.

Referenced by operator()().

double RecoTrackSelector::ptMin_
protected

Definition at line 118 of file RecoTrackSelector.h.

Referenced by operator()().

std::vector<reco::TrackBase::TrackQuality> RecoTrackSelector::quality_
protected

Definition at line 126 of file RecoTrackSelector.h.

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

container RecoTrackSelector::selected_
protected

Definition at line 130 of file RecoTrackSelector.h.

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

double RecoTrackSelector::tip_
protected

Definition at line 121 of file RecoTrackSelector.h.

Referenced by operator()().