CMS 3D CMS Logo

TrackSelection.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 
6 //#define EDM_ML_DEBUG
7 
8 namespace spr {
9 
10  bool goodTrack(const reco::Track* pTrack,
11  math::XYZPoint leadPV,
13  bool
14 #ifdef EDM_ML_DEBUG
15  debug
16 #endif
17  ) {
18 
19  bool select = pTrack->quality(parameters.minQuality);
20  double dxy = pTrack->dxy(leadPV);
21  double dz = pTrack->dz(leadPV);
22  double dpbyp = 999;
23  if (std::abs(pTrack->qoverp()) > 0.0000001)
24  dpbyp = std::abs(pTrack->qoverpError() / pTrack->qoverp());
25 
26 #ifdef EDM_ML_DEBUG
27  if (debug)
28  std::cout << "Track:: Pt " << pTrack->pt() << " dxy " << dxy << " dz " << dz << " Chi2 "
29  << pTrack->normalizedChi2() << " dpbyp " << dpbyp << " Quality " << select << std::endl;
30 #endif
31  if (pTrack->pt() < parameters.minPt)
32  select = false;
33  if (dxy > parameters.maxDxyPV || dz > parameters.maxDzPV)
34  select = false;
35  if (pTrack->normalizedChi2() > parameters.maxChi2)
36  select = false;
37  if (dpbyp > parameters.maxDpOverP)
38  select = false;
39 
40  if (parameters.minLayerCrossed > 0 || parameters.minOuterHit > 0) {
41  const reco::HitPattern& hitp = pTrack->hitPattern();
42  if (parameters.minLayerCrossed > 0 && hitp.trackerLayersWithMeasurement() < parameters.minLayerCrossed)
43  select = false;
44  if (parameters.minOuterHit > 0 &&
46  select = false;
47 #ifdef EDM_ML_DEBUG
48  if (debug) {
49  std::cout << "Default Hit Pattern with " << hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS) << " hits"
50  << std::endl;
51  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++)
53  }
54 #endif
55  }
56  if (parameters.maxInMiss >= 0) {
57  const reco::HitPattern& hitp = pTrack->hitPattern();
59  select = false;
60 #ifdef EDM_ML_DEBUG
61  if (debug) {
62  std::cout << "Inner Hit Pattern with " << hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS) << " hits"
63  << std::endl;
64  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS); i++)
66  }
67 #endif
68  }
69  if (parameters.maxOutMiss >= 0) {
70  const reco::HitPattern& hitp = pTrack->hitPattern();
72  select = false;
73 #ifdef EDM_ML_DEBUG
74  if (debug) {
75  std::cout << "Outer Hit Pattern with " << hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS) << " hits"
76  << std::endl;
77  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS); i++)
79  }
80 #endif
81  }
82 #ifdef EDM_ML_DEBUG
83  if (debug)
84  std::cout << "Final Selection Result " << select << std::endl;
85 #endif
86  return select;
87  }
88 } // namespace spr
reco::HitPattern::MISSING_OUTER_HITS
Definition: HitPattern.h:155
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
mps_fire.i
i
Definition: mps_fire.py:428
reco::TrackBase::qoverpError
double qoverpError() const
error on signed transverse curvature
Definition: TrackBase.h:732
spr
Definition: CaloConstants.h:6
reco::HitPattern::stripTOBLayersWithMeasurement
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:594
reco::HitPattern::trackerLayersWithoutMeasurement
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:529
gather_cfg.cout
cout
Definition: gather_cfg.py:144
singleTopDQM_cfi.select
select
Definition: singleTopDQM_cfi.py:50
spr::goodTrack
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
Definition: TrackSelection.cc:10
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:637
reco::HitPattern
Definition: HitPattern.h:147
debug
#define debug
Definition: HDRShower.cc:19
reco::HitPattern::trackerLayersWithMeasurement
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:510
EDM_ML_DEBUG
#define EDM_ML_DEBUG
Definition: MPUnpacker.cc:1
reco::Track
Definition: Track.h:27
reco::TrackBase::dz
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
spr::trackSelectionParameters
Definition: TrackSelection.h:12
reco::HitPattern::printHitPattern
void printHitPattern(HitCategory category, int position, std::ostream &stream) const
Definition: HitPattern.cc:800
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TrackSelection.h
reco::TrackBase::normalizedChi2
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:593
HitPattern.h
reco::HitPattern::TRACK_HITS
Definition: HitPattern.h:155
reco::TrackBase::hitPattern
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
reco::HitPattern::numberOfAllHits
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:791
PVValHelper::dxy
Definition: PVValidationHelpers.h:48
PVValHelper::dz
Definition: PVValidationHelpers.h:51
reco::HitPattern::MISSING_INNER_HITS
Definition: HitPattern.h:155
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::HitPattern::stripTECLayersWithMeasurement
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:604
reco::TrackBase::dxy
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:608
reco::TrackBase::quality
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
reco::TrackBase::qoverp
double qoverp() const
q / p
Definition: TrackBase.h:599