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::Track &t) const
 
bool operator() (const reco::Track &t, const reco::Track::Point &vertex) const
 
bool operator() (const reco::TrackRef &tref) const
 
 RecoTrackSelectorBase ()
 
 RecoTrackSelectorBase (const edm::ParameterSet &cfg)
 
 RecoTrackSelectorBase (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 

Private Attributes

std::vector< reco::TrackBase::TrackAlgorithmalgorithm_
 
std::vector< reco::TrackBase::TrackAlgorithmalgorithmMask_
 
edm::EDGetTokenT< reco::BeamSpotbsSrcToken_
 
bool invertRapidityCut_
 
double lip_
 
double maxChi2_
 
double maxRapidity_
 
double meanPhi_
 
int min3DLayer_
 
int minHit_
 
int minLayer_
 
int minPixelHit_
 
double minRapidity_
 
std::vector< reco::TrackBase::TrackAlgorithmoriginalAlgorithm_
 
double ptMin_
 
std::vector< reco::TrackBase::TrackQualityquality_
 
double rangePhi_
 
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() [1/3]

RecoTrackSelectorBase::RecoTrackSelectorBase ( )
inline

Definition at line 18 of file RecoTrackSelectorBase.h.

18 {}

◆ RecoTrackSelectorBase() [2/3]

RecoTrackSelectorBase::RecoTrackSelectorBase ( const edm::ParameterSet cfg)
inline

Definition at line 19 of file RecoTrackSelectorBase.h.

20  : ptMin_(cfg.getParameter<double>("ptMin")),
21  minRapidity_(cfg.getParameter<double>("minRapidity")),
22  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
23  meanPhi_((cfg.getParameter<double>("minPhi") + cfg.getParameter<double>("maxPhi")) / 2.),
24  rangePhi_((cfg.getParameter<double>("maxPhi") - cfg.getParameter<double>("minPhi")) / 2.),
25  tip_(cfg.getParameter<double>("tip")),
26  lip_(cfg.getParameter<double>("lip")),
27  maxChi2_(cfg.getParameter<double>("maxChi2")),
28  minHit_(cfg.getParameter<int>("minHit")),
29  minPixelHit_(cfg.getParameter<int>("minPixelHit")),
30  minLayer_(cfg.getParameter<int>("minLayer")),
31  min3DLayer_(cfg.getParameter<int>("min3DLayer")),
32  usePV_(false),
33  invertRapidityCut_(cfg.getParameter<bool>("invertRapidityCut")) {
34  const auto minPhi = cfg.getParameter<double>("minPhi");
35  const auto maxPhi = cfg.getParameter<double>("maxPhi");
36  if (minPhi >= maxPhi) {
37  throw cms::Exception("Configuration")
38  << "RecoTrackSelectorPhase: minPhi (" << minPhi << ") must be smaller than maxPhi (" << maxPhi
39  << "). The range is constructed from minPhi to maxPhi around their average.";
40  }
41  if (minPhi >= M_PI) {
42  throw cms::Exception("Configuration")
43  << "RecoTrackSelectorPhase: minPhi (" << minPhi
44  << ") must be smaller than PI. The range is constructed from minPhi to maxPhi around their average.";
45  }
46  if (maxPhi <= -M_PI) {
47  throw cms::Exception("Configuration")
48  << "RecoTrackSelectorPhase: maxPhi (" << maxPhi
49  << ") must be larger than -PI. The range is constructed from minPhi to maxPhi around their average.";
50  }
51 
52  for (const std::string& quality : cfg.getParameter<std::vector<std::string> >("quality"))
54  for (const std::string& algorithm : cfg.getParameter<std::vector<std::string> >("algorithm"))
56  for (const std::string& algorithm : cfg.getParameter<std::vector<std::string> >("originalAlgorithm"))
58  for (const std::string& algorithm : cfg.getParameter<std::vector<std::string> >("algorithmMaskContains"))
60  }

References reco::TrackBase::algoByName(), qcdUeDQM_cfi::algorithm, algorithm_, algorithmMask_, looper::cfg, Exception, M_PI, HLT_FULL_cff::maxPhi, HLT_FULL_cff::minPhi, originalAlgorithm_, quality, quality_, reco::TrackBase::qualityByName(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ RecoTrackSelectorBase() [3/3]

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

Definition at line 62 of file RecoTrackSelectorBase.h.

63  usePV_ = cfg.getParameter<bool>("usePV");
64  bsSrcToken_ = iC.consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpot"));
65  if (usePV_)
66  vertexToken_ = iC.consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vertexTag"));
67  }

References bsSrcToken_, looper::cfg, edm::ConsumesCollector::consumes(), usePV_, and vertexToken_.

Member Function Documentation

◆ init()

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

Definition at line 69 of file RecoTrackSelectorBase.h.

69  {
71  event.getByToken(bsSrcToken_, beamSpot);
72  vertex_ = beamSpot->position();
73  if (!usePV_)
74  return;
76  event.getByToken(vertexToken_, hVtx);
77  if (hVtx->empty())
78  return;
79  vertex_ = (*hVtx)[0].position();
80  }

References pwdgSkimBPark_cfi::beamSpot, bsSrcToken_, usePV_, vertex_, and vertexToken_.

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

◆ operator()() [1/3]

bool RecoTrackSelectorBase::operator() ( const reco::Track t) const
inline

Definition at line 84 of file RecoTrackSelectorBase.h.

84 { return (*this)(t, vertex_); }

References submitPVValidationJobs::t, and vertex_.

◆ operator()() [2/3]

bool RecoTrackSelectorBase::operator() ( const reco::Track t,
const reco::Track::Point vertex 
) const
inline

Definition at line 86 of file RecoTrackSelectorBase.h.

86  {
87  bool quality_ok = true;
88  if (!quality_.empty()) {
89  quality_ok = false;
90  for (unsigned int i = 0; i < quality_.size(); ++i) {
91  if (t.quality(quality_[i])) {
92  quality_ok = true;
93  break;
94  }
95  }
96  }
97 
98  bool algo_ok = true;
99  if (!algorithm_.empty()) {
100  if (std::find(algorithm_.begin(), algorithm_.end(), t.algo()) == algorithm_.end())
101  algo_ok = false;
102  }
103  if (!originalAlgorithm_.empty() && algo_ok) {
104  if (std::find(originalAlgorithm_.begin(), originalAlgorithm_.end(), t.originalAlgo()) == originalAlgorithm_.end())
105  algo_ok = false;
106  }
107  if (!algorithmMask_.empty() && algo_ok) {
108  if (std::find_if(algorithmMask_.begin(),
109  algorithmMask_.end(),
110  // for some reason I have to either explicitly give the return type, or use static_cast<bool>()
111  [&](reco::TrackBase::TrackAlgorithm algo) -> bool { return t.algoMask()[algo]; }) ==
112  algorithmMask_.end())
113  algo_ok = false;
114  }
115 
116  const auto dphi = deltaPhi(t.phi(), meanPhi_);
117 
118  auto etaOk = [&](const reco::Track& p) -> bool {
119  float eta = p.eta();
120  if (!invertRapidityCut_)
121  return (eta >= minRapidity_) && (eta <= maxRapidity_);
122  else
123  return (eta < minRapidity_ || eta > maxRapidity_);
124  };
125 
126  return ((algo_ok & quality_ok) && t.hitPattern().numberOfValidHits() >= minHit_ &&
127  t.hitPattern().numberOfValidPixelHits() >= minPixelHit_ &&
128  t.hitPattern().trackerLayersWithMeasurement() >= minLayer_ &&
129  t.hitPattern().pixelLayersWithMeasurement() + t.hitPattern().numberOfValidStripLayersWithMonoAndStereo() >=
130  min3DLayer_ &&
131  fabs(t.pt()) >= ptMin_ && etaOk(t) && dphi >= -rangePhi_ && dphi <= rangePhi_ &&
132  fabs(t.dxy(vertex)) <= tip_ && fabs(t.dsz(vertex)) <= lip_ && t.normalizedChi2() <= maxChi2_);
133  }

References algorithm_, algorithmMask_, SiPixelRawToDigiRegional_cfi::deltaPhi, PVValHelper::eta, spr::find(), mps_fire::i, invertRapidityCut_, lip_, maxChi2_, maxRapidity_, meanPhi_, min3DLayer_, minHit_, minLayer_, minPixelHit_, minRapidity_, originalAlgorithm_, AlCaHLTBitMon_ParallelJobs::p, ptMin_, quality_, rangePhi_, submitPVValidationJobs::t, tip_, and bphysicsOniaDQM_cfi::vertex.

◆ operator()() [3/3]

bool RecoTrackSelectorBase::operator() ( const reco::TrackRef tref) const
inline

Definition at line 82 of file RecoTrackSelectorBase.h.

82 { return (*this)(*tref); }

Member Data Documentation

◆ algorithm_

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

Definition at line 155 of file RecoTrackSelectorBase.h.

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

◆ algorithmMask_

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

Definition at line 157 of file RecoTrackSelectorBase.h.

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

◆ bsSrcToken_

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

Definition at line 151 of file RecoTrackSelectorBase.h.

Referenced by init(), and RecoTrackSelectorBase().

◆ invertRapidityCut_

bool RecoTrackSelectorBase::invertRapidityCut_
private

Definition at line 149 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ lip_

double RecoTrackSelectorBase::lip_
private

Definition at line 142 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ maxChi2_

double RecoTrackSelectorBase::maxChi2_
private

Definition at line 143 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ maxRapidity_

double RecoTrackSelectorBase::maxRapidity_
private

Definition at line 138 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ meanPhi_

double RecoTrackSelectorBase::meanPhi_
private

Definition at line 139 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ min3DLayer_

int RecoTrackSelectorBase::min3DLayer_
private

Definition at line 147 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ minHit_

int RecoTrackSelectorBase::minHit_
private

Definition at line 144 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ minLayer_

int RecoTrackSelectorBase::minLayer_
private

Definition at line 146 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ minPixelHit_

int RecoTrackSelectorBase::minPixelHit_
private

Definition at line 145 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ minRapidity_

double RecoTrackSelectorBase::minRapidity_
private

Definition at line 137 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ originalAlgorithm_

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

Definition at line 156 of file RecoTrackSelectorBase.h.

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

◆ ptMin_

double RecoTrackSelectorBase::ptMin_
private

Definition at line 136 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ quality_

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

Definition at line 154 of file RecoTrackSelectorBase.h.

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

◆ rangePhi_

double RecoTrackSelectorBase::rangePhi_
private

Definition at line 140 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ tip_

double RecoTrackSelectorBase::tip_
private

Definition at line 141 of file RecoTrackSelectorBase.h.

Referenced by operator()().

◆ usePV_

bool RecoTrackSelectorBase::usePV_
private

Definition at line 148 of file RecoTrackSelectorBase.h.

Referenced by init(), and RecoTrackSelectorBase().

◆ vertex_

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

Definition at line 159 of file RecoTrackSelectorBase.h.

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

◆ vertexToken_

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

Definition at line 152 of file RecoTrackSelectorBase.h.

Referenced by init(), and RecoTrackSelectorBase().

RecoTrackSelectorBase::algorithm_
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
Definition: RecoTrackSelectorBase.h:155
mps_fire.i
i
Definition: mps_fire.py:428
RecoTrackSelectorBase::invertRapidityCut_
bool invertRapidityCut_
Definition: RecoTrackSelectorBase.h:149
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
RecoTrackSelectorBase::vertexToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: RecoTrackSelectorBase.h:152
RecoTrackSelectorBase::bsSrcToken_
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
Definition: RecoTrackSelectorBase.h:151
RecoTrackSelectorBase::quality_
std::vector< reco::TrackBase::TrackQuality > quality_
Definition: RecoTrackSelectorBase.h:154
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
reco::TrackBase::TrackAlgorithm
TrackAlgorithm
track algorithm
Definition: TrackBase.h:89
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle< reco::BeamSpot >
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
HLT_FULL_cff.maxPhi
maxPhi
Definition: HLT_FULL_cff.py:52995
RecoTrackSelectorBase::minPixelHit_
int minPixelHit_
Definition: RecoTrackSelectorBase.h:145
cmsdt::algo
algo
Definition: constants.h:171
RecoTrackSelectorBase::minHit_
int minHit_
Definition: RecoTrackSelectorBase.h:144
RecoTrackSelectorBase::minLayer_
int minLayer_
Definition: RecoTrackSelectorBase.h:146
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
PVValHelper::eta
Definition: PVValidationHelpers.h:70
reco::BeamSpot
Definition: BeamSpot.h:21
RecoTrackSelectorBase::tip_
double tip_
Definition: RecoTrackSelectorBase.h:141
reco::Track
Definition: Track.h:27
RecoTrackSelectorBase::ptMin_
double ptMin_
Definition: RecoTrackSelectorBase.h:136
RecoTrackSelectorBase::lip_
double lip_
Definition: RecoTrackSelectorBase.h:142
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RecoTrackSelectorBase::maxRapidity_
double maxRapidity_
Definition: RecoTrackSelectorBase.h:138
RecoTrackSelectorBase::usePV_
bool usePV_
Definition: RecoTrackSelectorBase.h:148
qcdUeDQM_cfi.algorithm
algorithm
Definition: qcdUeDQM_cfi.py:32
RecoTrackSelectorBase::vertex_
reco::Track::Point vertex_
Definition: RecoTrackSelectorBase.h:159
RecoTrackSelectorBase::maxChi2_
double maxChi2_
Definition: RecoTrackSelectorBase.h:143
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RecoTrackSelectorBase::RecoTrackSelectorBase
RecoTrackSelectorBase()
Definition: RecoTrackSelectorBase.h:18
looper.cfg
cfg
Definition: looper.py:296
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
HLT_FULL_cff.minPhi
minPhi
Definition: HLT_FULL_cff.py:52994
RecoTrackSelectorBase::algorithmMask_
std::vector< reco::TrackBase::TrackAlgorithm > algorithmMask_
Definition: RecoTrackSelectorBase.h:157
RecoTrackSelectorBase::meanPhi_
double meanPhi_
Definition: RecoTrackSelectorBase.h:139
Exception
Definition: hltDiff.cc:245
RecoTrackSelectorBase::minRapidity_
double minRapidity_
Definition: RecoTrackSelectorBase.h:137
reco::TrackBase::algoByName
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:137
RecoTrackSelectorBase::originalAlgorithm_
std::vector< reco::TrackBase::TrackAlgorithm > originalAlgorithm_
Definition: RecoTrackSelectorBase.h:156
RecoTrackSelectorBase::rangePhi_
double rangePhi_
Definition: RecoTrackSelectorBase.h:140
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::InputTag
Definition: InputTag.h:15
RecoTrackSelectorBase::min3DLayer_
int min3DLayer_
Definition: RecoTrackSelectorBase.h:147