CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RecoTrackSelectorBase Class Reference

#include <RecoTrackSelectorBase.h>

Inheritance diagram for RecoTrackSelectorBase:
RecoTrackRefSelector RecoTrackSelector RecoTrackViewRefSelector

Public Member Functions

void init (const edm::Event &event, const edm::EventSetup &es)
 
bool operator() (const reco::TrackRef &tref) const
 
bool operator() (const reco::Track &t) const
 
 RecoTrackSelectorBase ()
 
 RecoTrackSelectorBase (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 

Private Attributes

std::vector< reco::TrackBase::TrackAlgorithmalgorithm_
 
std::vector< reco::TrackBase::TrackAlgorithmalgorithmMask_
 
edm::EDGetTokenT< reco::BeamSpotbsSrcToken_
 
double lip_
 
double maxChi2_
 
double maxRapidity_
 
int min3DLayer_
 
int minHit_
 
int minLayer_
 
int minPixelHit_
 
double minRapidity_
 
std::vector< reco::TrackBase::TrackAlgorithmoriginalAlgorithm_
 
double ptMin_
 
std::vector< reco::TrackBase::TrackQualityquality_
 
double tip_
 
bool usePV_
 
reco::Track::Point vertex_
 
edm::EDGetTokenT< reco::VertexCollectionvertexToken_
 

Detailed Description

Definition at line 16 of file RecoTrackSelectorBase.h.

Constructor & Destructor Documentation

RecoTrackSelectorBase::RecoTrackSelectorBase ( )
inline

Definition at line 18 of file RecoTrackSelectorBase.h.

18 {}
RecoTrackSelectorBase::RecoTrackSelectorBase ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)
inline

Definition at line 19 of file RecoTrackSelectorBase.h.

References reco::TrackBase::algoByName(), electronCleaner_cfi::algorithm, algorithm_, algorithmMask_, edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), originalAlgorithm_, btvTracks_cfi::quality, quality_, reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, usePV_, and vertexToken_.

19  :
20  ptMin_(cfg.getParameter<double>("ptMin")),
21  minRapidity_(cfg.getParameter<double>("minRapidity")),
22  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
23  tip_(cfg.getParameter<double>("tip")),
24  lip_(cfg.getParameter<double>("lip")),
25  maxChi2_(cfg.getParameter<double>("maxChi2")),
26  minHit_(cfg.getParameter<int>("minHit")),
27  minPixelHit_(cfg.getParameter<int>("minPixelHit")),
28  minLayer_(cfg.getParameter<int>("minLayer")),
29  min3DLayer_(cfg.getParameter<int>("min3DLayer")),
30  usePV_(cfg.getParameter<bool>("usePV")),
32  if (usePV_)
34  for(const std::string& quality: cfg.getParameter<std::vector<std::string> >("quality"))
36  for(const std::string& algorithm: cfg.getParameter<std::vector<std::string> >("algorithm"))
38  for(const std::string& algorithm: cfg.getParameter<std::vector<std::string> >("originalAlgorithm"))
40  for(const std::string& algorithm: cfg.getParameter<std::vector<std::string> >("algorithmMaskContains"))
42  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< reco::TrackBase::TrackAlgorithm > algorithmMask_
std::vector< reco::TrackBase::TrackQuality > quality_
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:137
std::vector< reco::TrackBase::TrackAlgorithm > originalAlgorithm_

Member Function Documentation

void RecoTrackSelectorBase::init ( const edm::Event event,
const edm::EventSetup es 
)
inline

Definition at line 44 of file RecoTrackSelectorBase.h.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, bsSrcToken_, reco::BeamSpot::position(), usePV_, vertex_, and vertexToken_.

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

44  {
46  event.getByToken(bsSrcToken_,beamSpot);
47  vertex_ = beamSpot->position();
48  if (!usePV_) return;
50  event.getByToken(vertexToken_, hVtx);
51  if (hVtx->empty()) return;
52  vertex_ = (*hVtx)[0].position();
53  }
reco::Track::Point vertex_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
const Point & position() const
position
Definition: BeamSpot.h:62
bool RecoTrackSelectorBase::operator() ( const reco::TrackRef tref) const
inline

Definition at line 55 of file RecoTrackSelectorBase.h.

55  {
56  return (*this)(*tref);
57  }
bool RecoTrackSelectorBase::operator() ( const reco::Track t) const
inline

Definition at line 59 of file RecoTrackSelectorBase.h.

References patPFMETCorrections_cff::algo, reco::TrackBase::algo(), reco::TrackBase::algoMask(), algorithm_, algorithmMask_, reco::TrackBase::dsz(), reco::TrackBase::dxy(), reco::TrackBase::eta(), spr::find(), reco::TrackBase::hitPattern(), mps_fire::i, lip_, maxChi2_, maxRapidity_, min3DLayer_, minHit_, minLayer_, minPixelHit_, minRapidity_, reco::TrackBase::normalizedChi2(), reco::HitPattern::numberOfValidHits(), reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripLayersWithMonoAndStereo(), reco::TrackBase::originalAlgo(), originalAlgorithm_, reco::HitPattern::pixelLayersWithMeasurement(), reco::TrackBase::pt(), ptMin_, reco::TrackBase::quality(), quality_, tip_, reco::HitPattern::trackerLayersWithMeasurement(), and vertex_.

59  {
60  bool quality_ok = true;
61  if (quality_.size()!=0) {
62  quality_ok = false;
63  for (unsigned int i = 0; i<quality_.size();++i) {
64  if (t.quality(quality_[i])){
65  quality_ok = true;
66  break;
67  }
68  }
69  }
70 
71  bool algo_ok = true;
72  if (algorithm_.size()!=0) {
73  if (std::find(algorithm_.begin(),algorithm_.end(),t.algo())==algorithm_.end()) algo_ok = false;
74  }
75  if (!originalAlgorithm_.empty() && algo_ok) {
76  if (std::find(originalAlgorithm_.begin(), originalAlgorithm_.end(), t.originalAlgo()) == originalAlgorithm_.end()) algo_ok = false;
77  }
78  if(!algorithmMask_.empty() && algo_ok) {
79  if(std::find_if(algorithmMask_.begin(), algorithmMask_.end(), [&](reco::TrackBase::TrackAlgorithm algo) -> bool { // for some reason I have to either explicitly give the return type, or use static_cast<bool>()
80  return t.algoMask()[algo];
81  }) == algorithmMask_.end()) algo_ok = false;
82  }
83  return
84  (
85  (algo_ok & quality_ok) &&
91  fabs(t.pt()) >= ptMin_ &&
92  t.eta() >= minRapidity_ && t.eta() <= maxRapidity_ &&
93  fabs(t.dxy(vertex_)) <= tip_ &&
94  fabs(t.dsz(vertex_)) <= lip_ &&
96  );
97  }
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:556
int numberOfValidHits() const
Definition: HitPattern.h:823
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:493
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
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:598
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:512
TrackAlgorithm
track algorithm
Definition: TrackBase.h:99
reco::Track::Point vertex_
TrackAlgorithm algo() const
Definition: TrackBase.h:492
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:335
double pt() const
track transverse momentum
Definition: TrackBase.h:616
std::vector< reco::TrackBase::TrackAlgorithm > algorithmMask_
std::vector< reco::TrackBase::TrackQuality > quality_
TrackAlgorithm originalAlgo() const
Definition: TrackBase.h:496
AlgoMask algoMask() const
Definition: TrackBase.h:363
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:505
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
int numberOfValidPixelHits() const
Definition: HitPattern.h:838
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:586
std::vector< reco::TrackBase::TrackAlgorithm > originalAlgorithm_

Member Data Documentation

std::vector<reco::TrackBase::TrackAlgorithm> RecoTrackSelectorBase::algorithm_
private

Definition at line 117 of file RecoTrackSelectorBase.h.

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

std::vector<reco::TrackBase::TrackAlgorithm> RecoTrackSelectorBase::algorithmMask_
private

Definition at line 119 of file RecoTrackSelectorBase.h.

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

edm::EDGetTokenT<reco::BeamSpot> RecoTrackSelectorBase::bsSrcToken_
private

Definition at line 113 of file RecoTrackSelectorBase.h.

Referenced by init().

double RecoTrackSelectorBase::lip_
private

Definition at line 105 of file RecoTrackSelectorBase.h.

Referenced by operator()().

double RecoTrackSelectorBase::maxChi2_
private

Definition at line 106 of file RecoTrackSelectorBase.h.

Referenced by operator()().

double RecoTrackSelectorBase::maxRapidity_
private

Definition at line 103 of file RecoTrackSelectorBase.h.

Referenced by operator()().

int RecoTrackSelectorBase::min3DLayer_
private

Definition at line 110 of file RecoTrackSelectorBase.h.

Referenced by operator()().

int RecoTrackSelectorBase::minHit_
private

Definition at line 107 of file RecoTrackSelectorBase.h.

Referenced by operator()().

int RecoTrackSelectorBase::minLayer_
private

Definition at line 109 of file RecoTrackSelectorBase.h.

Referenced by operator()().

int RecoTrackSelectorBase::minPixelHit_
private

Definition at line 108 of file RecoTrackSelectorBase.h.

Referenced by operator()().

double RecoTrackSelectorBase::minRapidity_
private

Definition at line 102 of file RecoTrackSelectorBase.h.

Referenced by operator()().

std::vector<reco::TrackBase::TrackAlgorithm> RecoTrackSelectorBase::originalAlgorithm_
private

Definition at line 118 of file RecoTrackSelectorBase.h.

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

double RecoTrackSelectorBase::ptMin_
private

Definition at line 101 of file RecoTrackSelectorBase.h.

Referenced by operator()().

std::vector<reco::TrackBase::TrackQuality> RecoTrackSelectorBase::quality_
private

Definition at line 116 of file RecoTrackSelectorBase.h.

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

double RecoTrackSelectorBase::tip_
private

Definition at line 104 of file RecoTrackSelectorBase.h.

Referenced by operator()().

bool RecoTrackSelectorBase::usePV_
private

Definition at line 111 of file RecoTrackSelectorBase.h.

Referenced by init(), and RecoTrackSelectorBase().

reco::Track::Point RecoTrackSelectorBase::vertex_
private

Definition at line 121 of file RecoTrackSelectorBase.h.

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

edm::EDGetTokenT<reco::VertexCollection> RecoTrackSelectorBase::vertexToken_
private

Definition at line 114 of file RecoTrackSelectorBase.h.

Referenced by init(), and RecoTrackSelectorBase().