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 //----------------------------------------------------------------------------------------------------
27 
29 {
30  public:
31  CTPPSPixelFittedRecHit(const CTPPSPixelRecHit &hit, const GlobalPoint &space_point_on_det, const LocalPoint& residual, const LocalPoint& pull) :
32  CTPPSPixelRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull), isUsedForFit_(false), isRealHit_(false) {}
33 
35 
37 
38  inline const GlobalPoint & getGlobalCoordinates() const { return space_point_on_det_; }
39  inline float getXResidual() const { return residual_.x(); }
40  inline float getYResidual() const { return residual_.y(); }
41 
42  inline float getXPull() const { return pull_.x(); }
43  inline float getYPull() const { return pull_.y(); }
44 
45  inline float getXPullNormalization() const { return residual_.x() / pull_.x(); }
46  inline float getYPullNormalization() const { return residual_.y() / pull_.y(); }
47 
48  inline void setIsUsedForFit(bool usedForFit) {
49  if(usedForFit) isRealHit_ = true;
50  isUsedForFit_ = usedForFit;
51  }
52  inline bool getIsUsedForFit() const { return isUsedForFit_; }
53 
54  inline void setIsRealHit(bool realHit) {
55  if(!realHit) isUsedForFit_ = false;
56  isRealHit_ = realHit;
57  }
58  inline bool getIsRealHit() const { return isRealHit_; }
59 
60 private:
65  bool isRealHit_;
66 };
67 
68 
70 {
71 
72  public:
73 
74  enum TrackPar {x0 = 0, y0 = 1, tx = 2, ty = 3};
75 
77  static constexpr int dimension = 4;
80 
82  static constexpr int covarianceSize = dimension * dimension;
83 
84  CTPPSPixelLocalTrack() : z0_(0), chiSquared_(0), valid_(false), numberOfPointUsedForFit_(0)
85  {
86  }
87 
88  CTPPSPixelLocalTrack(float z0, const ParameterVector & track_params_vector,
89  const CovarianceMatrix &par_covariance_matrix, float chiSquared);
90 
92 
93  inline const edm::DetSetVector<CTPPSPixelFittedRecHit>& getHits() const { return track_hits_vector_; }
94  inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit &hit)
95  {
96  track_hits_vector_.find_or_insert(detId).push_back(hit);
97  if(hit.getIsUsedForFit()) ++numberOfPointUsedForFit_;
98  }
99 
100  inline float getX0() const { return track_params_vector_[TrackPar::x0]; }
101  inline float getX0Sigma() const { return sqrt(par_covariance_matrix_[TrackPar::x0][TrackPar::x0]); }
102  inline float getX0Variance() const { return par_covariance_matrix_[TrackPar::x0][TrackPar::x0]; }
103 
104  inline float getY0() const { return track_params_vector_[TrackPar::y0]; }
105  inline float getY0Sigma() const { return sqrt(par_covariance_matrix_[TrackPar::y0][TrackPar::y0]); }
106  inline float getY0Variance() const { return par_covariance_matrix_[TrackPar::y0][TrackPar::y0]; }
107 
108  inline float getZ0() const { return z0_; }
109  inline void setZ0(float z0) { z0_ = z0; }
110 
111  inline float getTx() const { return track_params_vector_[TrackPar::tx]; }
112  inline float getTxSigma() const { return sqrt(par_covariance_matrix_[TrackPar::tx][TrackPar::tx]); }
113 
114  inline float getTy() const { return track_params_vector_[TrackPar::ty]; }
115  inline float getTySigma() const { return sqrt(par_covariance_matrix_[TrackPar::ty][TrackPar::ty]); }
116 
118  {
119  GlobalVector vect(getTx(), getTy(), 1);
120  return vect.unit();
121  }
122 
123  inline const ParameterVector& getParameterVector() const{
124  return track_params_vector_;
125  }
126 
127  inline const CovarianceMatrix& getCovarianceMatrix() const{
128  return par_covariance_matrix_;
129  }
130 
131  inline float getChiSquared() const { return chiSquared_; }
132 
133  inline float getChiSquaredOverNDF() const {
134  if(numberOfPointUsedForFit_<= dimension/2) return -999.;
135  else return chiSquared_ / (2*numberOfPointUsedForFit_ - dimension);
136  }
137 
138  inline int getNDF() const {return (2*numberOfPointUsedForFit_ - dimension); }
139 
141  inline GlobalPoint getTrackPoint(float z) const
142  {
143  float delta_z = z - z0_;
144  return GlobalPoint(
145  track_params_vector_[TrackPar::x0] + track_params_vector_[TrackPar::tx] * delta_z,
146  track_params_vector_[TrackPar::y0] + track_params_vector_[TrackPar::ty] * delta_z,
147  z);
148  }
149 
151  {
152  return GlobalPoint(track_params_vector_[TrackPar::x0], track_params_vector_[TrackPar::y0], z0_);
153  }
154 
155  AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const;
156 
157  inline bool isValid() const { return valid_; }
158 
159  inline void setValid(bool valid) { valid_ = valid; }
160 
161  bool operator< (const CTPPSPixelLocalTrack &r);
162 
163  private:
165 
167  ParameterVector track_params_vector_;
168 
171  float z0_;
172 
173  CovarianceMatrix par_covariance_matrix_;
174 
176  float chiSquared_;
177 
179  bool valid_;
180 
182 
183 };
184 
185 #endif
186 
CTPPSPixelFittedRecHit(const CTPPSPixelRecHit &hit, const GlobalPoint &space_point_on_det, const LocalPoint &residual, const LocalPoint &pull)
const CovarianceMatrix & getCovarianceMatrix() 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
ParameterVector track_params_vector_
track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ...
ErrorD< N >::type type
Definition: Error.h:33
static const uint16_t valid_
Definition: Constants.h:17
#define constexpr
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
float getYPullNormalization() const
fixed size vector
Definition: Vector.h:25
T sqrt(T t)
Definition: SSEVec.h:18
float getChiSquaredOverNDF() const
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_
GlobalPoint space_point_on_det_
mm
math::Vector< dimension >::type ParameterVector
covariance matrix size
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
const GlobalPoint & getGlobalCoordinates() const