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 {
32  public:
33  CTPPSPixelFittedRecHit(const CTPPSPixelRecHit &hit, const GlobalPoint &space_point_on_det, const LocalPoint& residual, const LocalPoint& pull) :
34  CTPPSPixelRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull), isUsedForFit_(false), isRealHit_(false) {}
35 
37 
39 
40  inline const GlobalPoint & getGlobalCoordinates() const { return space_point_on_det_; }
41  inline float getXResidual() const { return residual_.x(); }
42  inline float getYResidual() const { return residual_.y(); }
43 
44  inline float getXPull() const { return pull_.x(); }
45  inline float getYPull() const { return pull_.y(); }
46 
47  inline float getXPullNormalization() const { return residual_.x() / pull_.x(); }
48  inline float getYPullNormalization() const { return residual_.y() / pull_.y(); }
49 
50  inline void setIsUsedForFit(bool usedForFit) {
51  if(usedForFit) isRealHit_ = true;
52  isUsedForFit_ = usedForFit;
53  }
54  inline bool getIsUsedForFit() const { return isUsedForFit_; }
55 
56  inline void setIsRealHit(bool realHit) {
57  if(!realHit) isUsedForFit_ = false;
58  isRealHit_ = realHit;
59  }
60  inline bool getIsRealHit() const { return isRealHit_; }
61 
62 private:
67  bool isRealHit_;
68 };
69 
70 
72 {
73 
74  public:
75 
76  enum TrackPar {x0 = 0, y0 = 1, tx = 2, ty = 3};
77 
79  static constexpr int dimension = 4;
82 
84  static constexpr int covarianceSize = dimension * dimension;
85 
86  CTPPSPixelLocalTrack() : z0_(0), chiSquared_(0), valid_(false), numberOfPointsUsedForFit_(0),recoInfo_(CTPPSpixelLocalTrackReconstructionInfo::invalid)
87  {
88  }
89 
90  CTPPSPixelLocalTrack(float z0, const ParameterVector & track_params_vector,
91  const CovarianceMatrix &par_covariance_matrix, float chiSquared);
92 
94 
95  inline const edm::DetSetVector<CTPPSPixelFittedRecHit>& getHits() const { return track_hits_vector_; }
96  inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit &hit)
97  {
98  track_hits_vector_.find_or_insert(detId).push_back(hit);
99  if(hit.getIsUsedForFit()) ++numberOfPointsUsedForFit_;
100  }
101 
102  inline float getX0() const { return track_params_vector_[TrackPar::x0]; }
103  inline float getX0Sigma() const { return sqrt(par_covariance_matrix_[TrackPar::x0][TrackPar::x0]); }
104  inline float getX0Variance() const { return par_covariance_matrix_[TrackPar::x0][TrackPar::x0]; }
105 
106  inline float getY0() const { return track_params_vector_[TrackPar::y0]; }
107  inline float getY0Sigma() const { return sqrt(par_covariance_matrix_[TrackPar::y0][TrackPar::y0]); }
108  inline float getY0Variance() const { return par_covariance_matrix_[TrackPar::y0][TrackPar::y0]; }
109 
110  inline float getZ0() const { return z0_; }
111  inline void setZ0(float z0) { z0_ = z0; }
112 
113  inline float getTx() const { return track_params_vector_[TrackPar::tx]; }
114  inline float getTxSigma() const { return sqrt(par_covariance_matrix_[TrackPar::tx][TrackPar::tx]); }
115 
116  inline float getTy() const { return track_params_vector_[TrackPar::ty]; }
117  inline float getTySigma() const { return sqrt(par_covariance_matrix_[TrackPar::ty][TrackPar::ty]); }
118 
120  {
121  GlobalVector vect(getTx(), getTy(), 1);
122  return vect.unit();
123  }
124 
125  inline const ParameterVector& getParameterVector() const{
126  return track_params_vector_;
127  }
128 
129  inline const CovarianceMatrix& getCovarianceMatrix() const{
130  return par_covariance_matrix_;
131  }
132 
133  inline float getChiSquared() const { return chiSquared_; }
134 
135  inline float getChiSquaredOverNDF() const {
136  if(numberOfPointsUsedForFit_<= dimension/2) return -999.;
137  else return chiSquared_ / (2*numberOfPointsUsedForFit_ - dimension);
138  }
139 
140  inline int getNDF() const {return (2*numberOfPointsUsedForFit_ - dimension); }
141 
143  inline GlobalPoint getTrackPoint(float z) const
144  {
145  float delta_z = z - z0_;
146  return GlobalPoint(
147  track_params_vector_[TrackPar::x0] + track_params_vector_[TrackPar::tx] * delta_z,
148  track_params_vector_[TrackPar::y0] + track_params_vector_[TrackPar::ty] * delta_z,
149  z);
150  }
151 
153  {
154  return GlobalPoint(track_params_vector_[TrackPar::x0], track_params_vector_[TrackPar::y0], z0_);
155  }
156 
157  AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const;
158 
159  inline bool isValid() const { return valid_; }
160 
161  inline void setValid(bool valid) { valid_ = valid; }
162 
163  bool operator< (const CTPPSPixelLocalTrack &r);
164 
165  inline CTPPSpixelLocalTrackReconstructionInfo getRecoInfo() const { return recoInfo_; }
166  inline void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo) { recoInfo_ = recoInfo; }
167 
168  inline unsigned short getNumberOfPointsUsedForFit() const { return numberOfPointsUsedForFit_; }
169 
170  private:
172 
174  ParameterVector track_params_vector_;
175 
178  float z0_;
179 
180  CovarianceMatrix par_covariance_matrix_;
181 
183  float chiSquared_;
184 
186  bool valid_;
187 
190 
192 };
193 
194 #endif
195 
CTPPSPixelFittedRecHit(const CTPPSPixelRecHit &hit, const GlobalPoint &space_point_on_det, const LocalPoint &residual, const LocalPoint &pull)
CTPPSpixelLocalTrackReconstructionInfo getRecoInfo() const
const CovarianceMatrix & getCovarianceMatrix() const
unsigned short getNumberOfPointsUsedForFit() const
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
GlobalPoint getTrackPoint(float z) const
returns the point from which the track is passing by at the selected z
LocalPoint pull_
normalised residual
math::Error< dimension >::type CovarianceMatrix
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
int numberOfPointsUsedForFit_
number of points used for the track fit
ParameterVector track_params_vector_
track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ...
ErrorD< N >::type type
Definition: Error.h:33
CTPPSpixelLocalTrackReconstructionInfo
static const uint16_t valid_
Definition: Constants.h:17
float getYPullNormalization() const
fixed size vector
Definition: Vector.h:25
T sqrt(T t)
Definition: SSEVec.h:18
float getChiSquaredOverNDF() const
void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo)
void setIsUsedForFit(bool usedForFit)
void addHit(unsigned int detId, const CTPPSPixelFittedRecHit &hit)
const edm::DetSetVector< CTPPSPixelFittedRecHit > & getHits() const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
void setIsRealHit(bool realHit)
edm::DetSetVector< CTPPSPixelFittedRecHit > track_hits_vector_
CTPPSpixelLocalTrackReconstructionInfo recoInfo_
GlobalPoint space_point_on_det_
mm
math::Vector< dimension >::type ParameterVector
covariance matrix size
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
Definition: DTCELinkId.h:73
GlobalVector getDirectionVector() const
const ParameterVector & getParameterVector() const
CovarianceMatrix par_covariance_matrix_
GlobalPoint getTrackCentrePoint()
float getXPullNormalization() const
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
T x() const
Definition: PV3DBase.h:62
#define constexpr
const GlobalPoint & getGlobalCoordinates() const