CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackSelection.cc
Go to the documentation of this file.
3 
4 #include<iostream>
5 
6 namespace spr{
7 
9 
10  bool select = pTrack->quality(parameters.minQuality);
11  double dxy = pTrack->dxy(leadPV);
12  double dz = pTrack->dz(leadPV);
13  double dpbyp = 999;
14  if (std::abs(pTrack->qoverp()) > 0.0000001)
15  dpbyp = std::abs(pTrack->qoverpError()/pTrack->qoverp());
16 
17  if (debug) std::cout << "Track:: Pt " << pTrack->pt() << " dxy " << dxy << " dz " << dz << " Chi2 " << pTrack->normalizedChi2() << " dpbyp " << dpbyp << " Quality " << select << std::endl;
18 
19  if (pTrack->pt() < parameters.minPt) select = false;
20  if (dxy > parameters.maxDxyPV || dz > parameters.maxDzPV) select = false;
21  if (pTrack->normalizedChi2() > parameters.maxChi2) select = false;
22  if (dpbyp > parameters.maxDpOverP) select = false;
23 
24  if (parameters.minLayerCrossed>0 || parameters.minOuterHit>0) {
25  const reco::HitPattern& hitp = pTrack->hitPattern();
26  if (parameters.minLayerCrossed>0 && hitp.trackerLayersWithMeasurement() < parameters.minLayerCrossed) select = false;
27  if (parameters.minOuterHit>0 && (hitp.stripTOBLayersWithMeasurement()+hitp.stripTECLayersWithMeasurement() ) < parameters.minOuterHit) select = false;
28  if (debug) {
29  std::cout << "Default Hit Pattern with " << hitp.numberOfHits(reco::HitPattern::TRACK_HITS) << " hits" << std::endl;
30  for (int i=0; i<hitp.numberOfHits(reco::HitPattern::TRACK_HITS); i++)
32  }
33  }
34  if (parameters.maxInMiss >= 0) {
35  const reco::HitPattern& hitp = pTrack->hitPattern();
37  if (debug) {
38  std::cout << "Inner Hit Pattern with " << hitp.numberOfHits(reco::HitPattern::MISSING_INNER_HITS) << " hits" << std::endl;
41  }
42  }
43  if (parameters.maxOutMiss >= 0) {
44  const reco::HitPattern& hitp = pTrack->hitPattern();
46  if (debug) {
47  std::cout << "Outer Hit Pattern with " << hitp.numberOfHits(reco::HitPattern::MISSING_OUTER_HITS) << " hits" << std::endl;
50  }
51  }
52  if (debug) std::cout << "Final Selection Result " << select << std::endl;
53 
54  return select;
55  }
56 }
double qoverp() const
q / p
Definition: TrackBase.h:621
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:563
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
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:609
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
void printHitPattern(HitCategory category, int position, std::ostream &stream) const
Definition: HitPattern.cc:791
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
double pt() const
track transverse momentum
Definition: TrackBase.h:669
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double qoverpError() const
error on signed transverse curvature
Definition: TrackBase.h:805
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:657
#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:384
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:551
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:494
reco::TrackBase::TrackQuality minQuality
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:574
tuple cout
Definition: gather_cfg.py:121
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:639
int numberOfHits(HitCategory category) const
Definition: HitPattern.h:718