CMS 3D CMS Logo

TrackBase.cc
Go to the documentation of this file.
1 #include "Rtypes.h"
4 #include <algorithm>
5 
6 using namespace reco;
7 
8 // To be kept in synch with the enumerator definitions in TrackBase.h file
9 std::string const TrackBase::algoNames[] = {"undefAlgorithm",
10  "ctf",
11  "duplicateMerge",
12  "cosmics",
13  "initialStep",
14  "lowPtTripletStep",
15  "pixelPairStep",
16  "detachedTripletStep",
17  "mixedTripletStep",
18  "pixelLessStep",
19  "tobTecStep",
20  "jetCoreRegionalStep",
21  "conversionStep",
22  "muonSeededStepInOut",
23  "muonSeededStepOutIn",
24  "outInEcalSeededConv",
25  "inOutEcalSeededConv",
26  "nuclInter",
27  "standAloneMuon",
28  "globalMuon",
29  "cosmicStandAloneMuon",
30  "cosmicGlobalMuon",
31  "highPtTripletStep",
32  "lowPtQuadStep",
33  "detachedQuadStep",
34  "displacedGeneralStep",
35  "displacedRegionalStep",
36  "bTagGhostTracks",
37  "beamhalo",
38  "gsf",
39  "hltPixel",
40  "hltIter0",
41  "hltIter1",
42  "hltIter2",
43  "hltIter3",
44  "hltIter4",
45  "hltIterX",
46  "hiRegitMuInitialStep",
47  "hiRegitMuLowPtTripletStep",
48  "hiRegitMuPixelPairStep",
49  "hiRegitMuDetachedTripletStep",
50  "hiRegitMuMixedTripletStep",
51  "hiRegitMuPixelLessStep",
52  "hiRegitMuTobTecStep",
53  "hiRegitMuMuonSeededStepInOut",
54  "hiRegitMuMuonSeededStepOutIn"};
55 
57  "loose", "tight", "highPurity", "confirmed", "goodIterative", "looseSetWithPV", "highPuritySetWithPV", "discarded"};
58 
60  : covt0t0_(-1.f),
61  covbetabeta_(-1.f),
62  chi2_(0),
63  vertex_(0, 0, 0),
64  t0_(0),
65  momentum_(0, 0, 0),
66  beta_(0),
67  ndof_(0),
68  charge_(0),
69  algorithm_(undefAlgorithm),
70  originalAlgorithm_(undefAlgorithm),
71  quality_(0),
72  nLoops_(0),
73  stopReason_(0) {
74  algoMask_.set(algorithm_);
75  index idx = 0;
76  for (index i = 0; i < dimension; ++i) {
77  for (index j = 0; j <= i; ++j) {
78  covariance_[idx++] = 0;
79  }
80  }
81 }
82 
84  double ndof,
85  const Point &vertex,
86  const Vector &momentum,
87  int charge,
88  const CovarianceMatrix &cov,
91  signed char nloops,
92  uint8_t stopReason,
93  float t0,
94  float beta,
95  float covt0t0,
96  float covbetabeta)
97  : covt0t0_(covt0t0),
98  covbetabeta_(covbetabeta),
99  chi2_(chi2),
100  vertex_(vertex),
101  t0_(t0),
102  momentum_(momentum),
103  beta_(beta),
104  ndof_(ndof),
105  charge_(charge),
106  algorithm_(algorithm),
107  originalAlgorithm_(algorithm),
108  quality_(0),
109  nLoops_(nloops),
110  stopReason_(stopReason) {
111  algoMask_.set(algorithm_);
112 
113  index idx = 0;
114  for (index i = 0; i < dimension; ++i) {
115  for (index j = 0; j <= i; ++j) {
116  covariance_[idx++] = cov(i, j);
117  }
118  }
120 }
121 
123 
125 
127  TrackQuality size = qualitySize;
129  if (index == size) {
130  return undefQuality; // better this or throw() ?
131  }
132 
133  // cast
134  return TrackQuality(index);
135 }
136 
138  TrackAlgorithm size = algoSize;
139  int index = std::find(algoNames, algoNames + size, name) - algoNames;
140  if (index == size) {
141  return undefAlgorithm; // better this or throw() ?
142  }
143 
144  // cast
145  return TrackAlgorithm(index);
146 }
147 
148 double TrackBase::dxyError(Point const &vtx, math::Error<3>::type const &vertexCov) const {
149  // Gradient of TrackBase::dxy(const Point &myBeamSpot) with respect to track parameters. Using unrolled expressions to avoid calling for higher dimension matrices
150  // ( 0, 0, x_vert * cos(phi) + y_vert * sin(phi), 1, 0 )
151  // Gradient with respect to point parameters
152  // ( sin(phi), -cos(phi))
153  // Propagate covariance assuming cross-terms of the covariance between track and vertex parameters are 0
154  return std::sqrt((vtx.x() * px() + vtx.y() * py()) * (vtx.x() * px() + vtx.y() * py()) / (pt() * pt()) *
156  2 * (vtx.x() * px() + vtx.y() * py()) / pt() * covariance(i_phi, i_dxy) + covariance(i_dxy, i_dxy) +
157  py() * py() / (pt() * pt()) * vertexCov(0, 0) - 2 * py() * px() / (pt() * pt()) * vertexCov(0, 1) +
158  px() * px() / (pt() * pt()) * vertexCov(1, 1));
159 }
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
void setQuality(const TrackQuality)
Definition: TrackBase.h:564
unsigned int index
index type
Definition: TrackBase.h:86
TrackBase()
default constructor
Definition: TrackBase.cc:59
TrackQuality
track quality
Definition: TrackBase.h:150
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
ErrorD< N >::type type
Definition: Error.h:32
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float charge(ConstView const &tracks, int32_t i)
Definition: TracksSoA.h:73
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TrackAlgorithm
track algorithm
Definition: TrackBase.h:89
double pt() const
track transverse momentum
Definition: TrackBase.h:637
string quality
CovarianceMatrix covariance() const
return track covariance matrix
Definition: TrackBase.h:716
static const std::string qualityNames[]
Definition: TrackBase.h:163
double dxyError() const
error on dxy
Definition: TrackBase.h:769
std::bitset< algoSize > algoMask_
algo mask, bit set for the algo where it was reconstructed + each algo a track was found overlapping ...
Definition: TrackBase.h:478
T sqrt(T t)
Definition: SSEVec.h:19
PerigeeCovarianceMatrix & fillCovariance(PerigeeCovarianceMatrix &v, const float *data)
double f[11][100]
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
virtual ~TrackBase()
virtual destructor
Definition: TrackBase.cc:122
This class analyses the reconstruction quality for a given track.
Definition: TrackQuality.h:28
static const std::string algoNames[]
Definition: TrackBase.h:147
fixed size matrix
float covariance_[covarianceSize]
perigee 5x5 covariance matrix
Definition: TrackBase.h:456
Structure Point Contains parameters of Gaussian fits to DMRs.
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:137
CovarianceMatrix & fill(CovarianceMatrix &v) const
fill SMatrix
Definition: TrackBase.cc:124
uint8_t algorithm_
track algorithm
Definition: TrackBase.h:487
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74