CMS 3D CMS Logo

CTPPSPixelLocalTrack.h
Go to the documentation of this file.
1 /*
2  *
3 * This is a part of CTPPS offline software.
4 * Author:
5 * Fabrizio Ferro (ferro@ge.infn.it)
6 * Enrico Robutti (robutti@ge.infn.it)
7 * Fabio Ravera (fabio.ravera@cern.ch)
8 *
9 */
10 
11 #ifndef DataFormats_CTPPSReco_CTPPSPixelLocalTrack_H
12 #define DataFormats_CTPPSReco_CTPPSPixelLocalTrack_H
13 
17 
23 
26 
28 //----------------------------------------------------------------------------------------------------
29 
31 public:
33  const GlobalPoint& space_point_on_det,
34  const LocalPoint& residual,
35  const LocalPoint& pull)
37  space_point_on_det_(space_point_on_det),
38  residual_(residual),
39  pull_(pull),
41  isRealHit_(false) {}
42 
44  : CTPPSPixelRecHit(),
45  residual_(LocalPoint(0, 0)),
46  pull_(LocalPoint(0, 0)),
48  isRealHit_(false) {}
49 
51 
52  inline const GlobalPoint& globalCoordinates() const { return space_point_on_det_; }
53  inline float xResidual() const { return residual_.x(); }
54  inline float yResidual() const { return residual_.y(); }
55 
56  inline float xPull() const { return pull_.x(); }
57  inline float yPull() const { return pull_.y(); }
58 
59  inline float xPullNormalization() const { return residual_.x() / pull_.x(); }
60  inline float yPullNormalization() const { return residual_.y() / pull_.y(); }
61 
62  inline void setIsUsedForFit(bool usedForFit) {
63  if (usedForFit)
64  isRealHit_ = true;
65  isUsedForFit_ = usedForFit;
66  }
67  inline bool isUsedForFit() const { return isUsedForFit_; }
68 
69  inline void setIsRealHit(bool realHit) {
70  if (!realHit)
71  isUsedForFit_ = false;
72  isRealHit_ = realHit;
73  }
74  inline bool isRealHit() const { return isRealHit_; }
75 
76 private:
81  bool isRealHit_;
82 };
83 
85 public:
86  enum class TrackPar { x0 = 0, y0 = 1, tx = 2, ty = 3 };
87 
89  static constexpr int dimension = 4;
92 
94  static constexpr int covarianceSize = dimension * dimension;
95 
97  : z0_(0),
98  chiSquared_(0),
99  valid_(false),
102 
103  CTPPSPixelLocalTrack(float z0,
104  const ParameterVector& track_params_vector,
105  const CovarianceMatrix& par_covariance_matrix,
106  float chiSquared);
107 
109 
111  inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit& hit) {
113  if (hit.isUsedForFit())
115  }
116 
117  inline float x0() const { return track_params_vector_[(unsigned int)TrackPar::x0]; }
118  inline float x0Sigma() const {
119  return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]);
120  }
121  inline float x0Variance() const {
122  return par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0];
123  }
124 
125  inline float y0() const { return track_params_vector_[(unsigned int)TrackPar::y0]; }
126  inline float y0Sigma() const {
127  return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]);
128  }
129  inline float y0Variance() const {
130  return par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0];
131  }
132 
133  inline float z0() const { return z0_; }
134  inline void setZ0(float z0) { z0_ = z0; }
135 
136  inline float tx() const { return track_params_vector_[(unsigned int)TrackPar::tx]; }
137  inline float txSigma() const {
138  return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::tx][(unsigned int)TrackPar::tx]);
139  }
140 
141  inline float ty() const { return track_params_vector_[(unsigned int)TrackPar::ty]; }
142  inline float tySigma() const {
143  return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::ty][(unsigned int)TrackPar::ty]);
144  }
145 
146  inline GlobalVector directionVector() const {
147  GlobalVector vect(tx(), ty(), 1);
148  return vect.unit();
149  }
150 
151  inline const ParameterVector& parameterVector() const { return track_params_vector_; }
152 
153  inline const CovarianceMatrix& covarianceMatrix() const { return par_covariance_matrix_; }
154 
155  inline float chiSquared() const { return chiSquared_; }
156 
157  inline float chiSquaredOverNDF() const {
159  return -999.;
160  else
162  }
163 
164  inline int ndf() const { return (2 * numberOfPointsUsedForFit_ - dimension); }
165 
167  inline GlobalPoint trackPoint(float z) const {
168  float delta_z = z - z0_;
169  return GlobalPoint(
170  track_params_vector_[(unsigned int)TrackPar::x0] + track_params_vector_[(unsigned int)TrackPar::tx] * delta_z,
171  track_params_vector_[(unsigned int)TrackPar::y0] + track_params_vector_[(unsigned int)TrackPar::ty] * delta_z,
172  z);
173  }
174 
176  return GlobalPoint(
177  track_params_vector_[(unsigned int)TrackPar::x0], track_params_vector_[(unsigned int)TrackPar::y0], z0_);
178  }
179 
181 
182  inline bool isValid() const { return valid_; }
183 
184  inline void setValid(bool valid) { valid_ = valid; }
185 
186  bool operator<(const CTPPSPixelLocalTrack& r);
187 
190 
191  inline unsigned short numberOfPointsUsedForFit() const { return numberOfPointsUsedForFit_; }
192 
193 private:
195 
198 
201  float z0_;
202 
204 
206  float chiSquared_;
207 
209  bool valid_;
210 
213 
215 };
216 
217 #endif
CTPPSPixelFittedRecHit(const CTPPSPixelRecHit &hit, const GlobalPoint &space_point_on_det, const LocalPoint &residual, const LocalPoint &pull)
void push_back(const T &t)
Definition: DetSet.h:66
bool operator<(const CTPPSPixelLocalTrack &r)
LocalPoint pull_
normalised residual
math::Error< dimension >::type CovarianceMatrix
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
int numberOfPointsUsedForFit_
number of points used for the track fit
static constexpr int dimension
ParameterVector track_params_vector_
track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ...
ErrorD< N >::type type
Definition: Error.h:32
CTPPSpixelLocalTrackReconstructionInfo
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:225
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
fixed size vector
Definition: Vector.h:24
T sqrt(T t)
Definition: SSEVec.h:19
unsigned short numberOfPointsUsedForFit() const
void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo)
const GlobalPoint & globalCoordinates() const
void setIsUsedForFit(bool usedForFit)
void addHit(unsigned int detId, const CTPPSPixelFittedRecHit &hit)
AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const
GlobalPoint trackPoint(float z) const
returns the point from which the track is passing by at the selected z
void setIsRealHit(bool realHit)
edm::DetSetVector< CTPPSPixelFittedRecHit > track_hits_vector_
CTPPSpixelLocalTrackReconstructionInfo recoInfo_
static constexpr int covarianceSize
const CovarianceMatrix & covarianceMatrix() const
GlobalPoint space_point_on_det_
mm
math::Vector< dimension >::type ParameterVector
covariance matrix size
reco::TrackBase::ParameterVector ParameterVector
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
const edm::DetSetVector< CTPPSPixelFittedRecHit > & hits() const
CovarianceMatrix par_covariance_matrix_
CTPPSpixelLocalTrackReconstructionInfo recoInfo() const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
const ParameterVector & parameterVector() const
GlobalVector directionVector() const