CMS 3D CMS Logo

TrackSelection.cc
Go to the documentation of this file.
4 
5 #include <sstream>
6 
7 namespace spr {
8 
9  bool goodTrack(const reco::Track* pTrack,
10  math::XYZPoint leadPV,
12  bool debug) {
13  bool select = pTrack->quality(parameters.minQuality);
14  double dxy = pTrack->dxy(leadPV);
15  double dz = pTrack->dz(leadPV);
16  double dpbyp = 999;
17  if (std::abs(pTrack->qoverp()) > 0.0000001)
18  dpbyp = std::abs(pTrack->qoverpError() / pTrack->qoverp());
19 
20  if (debug)
21  edm::LogVerbatim("IsoTrack") << "Track:: Pt " << pTrack->pt() << " dxy " << dxy << " dz " << dz << " Chi2 "
22  << pTrack->normalizedChi2() << " dpbyp " << dpbyp << " Quality " << select;
23 
24  if (pTrack->pt() < parameters.minPt)
25  select = false;
26  if (dxy > parameters.maxDxyPV || dz > parameters.maxDzPV)
27  select = false;
28  if (pTrack->normalizedChi2() > parameters.maxChi2)
29  select = false;
30  if (dpbyp > parameters.maxDpOverP)
31  select = false;
32 
33  if (parameters.minLayerCrossed > 0 || parameters.minOuterHit > 0) {
34  const reco::HitPattern& hitp = pTrack->hitPattern();
35  if (parameters.minLayerCrossed > 0 && hitp.trackerLayersWithMeasurement() < parameters.minLayerCrossed)
36  select = false;
37  if (parameters.minOuterHit > 0 &&
39  select = false;
40 
41  if (debug) {
42  edm::LogVerbatim("IsoTrack") << "Default Hit Pattern with "
44  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) {
45  std::ostringstream st1;
47  edm::LogVerbatim("IsoTrack") << st1.str();
48  }
49  }
50  }
51  if (parameters.maxInMiss >= 0) {
52  const reco::HitPattern& hitp = pTrack->hitPattern();
54  select = false;
55  if (debug) {
56  edm::LogVerbatim("IsoTrack") << "Inner Hit Pattern with "
58  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_INNER_HITS); i++) {
59  std::ostringstream st1;
61  edm::LogVerbatim("IsoTrack") << st1.str();
62  }
63  }
64  }
65  if (parameters.maxOutMiss >= 0) {
66  const reco::HitPattern& hitp = pTrack->hitPattern();
68  select = false;
69  if (debug) {
70  edm::LogVerbatim("IsoTrack") << "Outer Hit Pattern with "
72  for (int i = 0; i < hitp.numberOfAllHits(reco::HitPattern::MISSING_OUTER_HITS); i++) {
73  std::ostringstream st1;
75  edm::LogVerbatim("IsoTrack") << st1.str();
76  }
77  }
78  }
79  if (debug)
80  edm::LogVerbatim("IsoTrack") << "Final Selection Result " << select;
81  return select;
82  }
83 } // namespace spr
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
Log< level::Info, true > LogVerbatim
double qoverp() const
q / p
Definition: TrackBase.h:599
double qoverpError() const
error on signed transverse curvature
Definition: TrackBase.h:732
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:535
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:804
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:629
double pt() const
track transverse momentum
Definition: TrackBase.h:637
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
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:619
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:554
#define debug
Definition: HDRShower.cc:19
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:504
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
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
void printHitPattern(HitCategory category, int position, std::ostream &stream) const
Definition: HitPattern.cc:825
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