CMS 3D CMS Logo

TotemRPLocalTrack.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of TOTEM offline software.
4  * Authors:
5  * Hubert Niewiadomski
6  * Jan Kašpar (jan.kaspar@gmail.com)
7  *
8  ****************************************************************************/
9 
10 #ifndef DataFormats_CTPPSReco_TotemRPLocalTrack
11 #define DataFormats_CTPPSReco_TotemRPLocalTrack
12 
15 
16 #include "TVector3.h"
17 #include "TMatrixD.h"
18 #include "TVectorD.h"
19 
20 //----------------------------------------------------------------------------------------------------
21 
32 {
33  public:
35  {
36  public:
37  FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull) :
38  TotemRPRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull) {}
39 
41 
42  virtual ~FittedRecHit() {}
43 
44  inline const TVector3 & getGlobalCoordinates() const { return space_point_on_det_; }
45  inline void setGlobalCoordinates(const TVector3 & space_point_on_det) { space_point_on_det_ = space_point_on_det; }
46 
47  inline double getResidual() const { return residual_; }
48  inline void setResidual(double residual) { residual_ = residual; }
49 
50  inline double getPull() const { return pull_; }
51  inline void setPull(double pull) { pull_ = pull; }
52 
53  inline double getPullNormalization() const { return residual_ / pull_; }
54 
55  private:
57  double residual_;
58  double pull_;
59  };
60 
61  public:
63  static const int dimension = 4;
64 
66  static const int covarianceSize = dimension * dimension;
67 
69  {
70  }
71 
72  TotemRPLocalTrack(double z0, const TVectorD &track_params_vector,
73  const TMatrixD &par_covariance_matrix, double chiSquared);
74 
75  virtual ~TotemRPLocalTrack() {}
76 
78  inline void addHit(unsigned int detId, const FittedRecHit &hit)
79  {
80  track_hits_vector_.find_or_insert(detId).push_back(hit);
81  }
82 
83  inline double getX0() const { return track_params_vector_[0]; }
84  inline double getX0Sigma() const { return sqrt(CovarianceMatrixElement(0, 0)); }
85  inline double getX0Variance() const { return CovarianceMatrixElement(0, 0); }
86 
87  inline double getY0() const { return track_params_vector_[1]; }
88  inline double getY0Sigma() const { return sqrt(CovarianceMatrixElement(1, 1)); }
89  inline double getY0Variance() const { return CovarianceMatrixElement(1, 1); }
90 
91  inline double getZ0() const { return z0_; }
92  inline void setZ0(double z0) { z0_ = z0; }
93 
94  inline double getTx() const { return track_params_vector_[2]; }
95  inline double getTxSigma() const { return sqrt(CovarianceMatrixElement(2, 2)); }
96 
97  inline double getTy() const { return track_params_vector_[3]; }
98  inline double getTySigma() const { return sqrt(CovarianceMatrixElement(3, 3)); }
99 
100  inline TVector3 getDirectionVector() const
101  {
102  TVector3 vect(getTx(), getTy(), 1);
103  vect.SetMag(1.0);
104  return vect;
105  }
106 
107  TVectorD getParameterVector() const;
108  void setParameterVector(const TVectorD & track_params_vector);
109 
110  TMatrixD getCovarianceMatrix() const;
111  void setCovarianceMatrix(const TMatrixD &par_covariance_matrix);
112 
113  inline double getChiSquared() const { return chiSquared_; }
114  inline void setChiSquared(double & chiSquared) { chiSquared_ = chiSquared; }
115 
116  inline double getChiSquaredOverNDF() const { return chiSquared_ / (track_hits_vector_.size() - 4); }
117 
118  inline unsigned short getNumberOfPointsUsedForFit() const { return track_hits_vector_.size(); }
119 
121  inline TVector2 getTrackPoint(double z) const
122  {
123  double delta_z = z - z0_;
124  return TVector2(
125  track_params_vector_[0] + track_params_vector_[2] * delta_z,
126  track_params_vector_[1] + track_params_vector_[3] * delta_z);
127  }
128 
129  inline TVector3 getTrackCentrePoint()
130  {
131  return TVector3(track_params_vector_[0], track_params_vector_[1], z0_);
132  }
133 
134  TMatrixD trackPointInterpolationCovariance(double z) const;
135 
136  inline bool isValid() const { return valid_; }
137 
138  inline void setValid(bool valid) { valid_ = valid; }
139 
140  friend bool operator< (const TotemRPLocalTrack &l, const TotemRPLocalTrack &r);
141 
142  private:
143  inline const double& CovarianceMatrixElement(int i, int j) const
144  {
145  return par_covariance_matrix_[i * dimension + j];
146  }
147 
148  inline double& CovarianceMatrixElement(int i, int j)
149  {
150  return par_covariance_matrix_[i * dimension + j];
151  }
152 
154 
157 
160  double z0_;
161 
163 
165  double chiSquared_;
166 
168  bool valid_;
169 };
170 
171 #endif
void setChiSquared(double &chiSquared)
double getChiSquared() const
double par_covariance_matrix_[covarianceSize]
TVector2 getTrackPoint(double z) const
returns (x, y) vector
bool isValid() const
TVector3 getDirectionVector() const
void addHit(unsigned int detId, const FittedRecHit &hit)
TMatrixD getCovarianceMatrix() const
double getY0Variance() const
double getTx() const
FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull)
TVectorD getParameterVector() const
double getZ0() const
A track fit through a single RP.
TMatrixD trackPointInterpolationCovariance(double z) const
double getX0Variance() const
const edm::DetSetVector< FittedRecHit > & getHits() const
void setZ0(double z0)
T sqrt(T t)
Definition: SSEVec.h:18
static const int dimension
< parameter vector size
double track_params_vector_[dimension]
track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ...
double getTxSigma() const
Reconstructed hit in TOTEM RP.
Definition: TotemRPRecHit.h:18
double pull_
normalised residual
const TVector3 & getGlobalCoordinates() const
void setValid(bool valid)
double getTy() const
double chiSquared_
fit chi^2
const double & CovarianceMatrixElement(int i, int j) const
TVector3 getTrackCentrePoint()
double getX0() const
unsigned short getNumberOfPointsUsedForFit() const
double getChiSquaredOverNDF() const
static const int covarianceSize
double getY0Sigma() const
edm::DetSetVector< FittedRecHit > track_hits_vector_
double getTySigma() const
virtual ~TotemRPLocalTrack()
void setCovarianceMatrix(const TMatrixD &par_covariance_matrix)
double getY0() const
void setParameterVector(const TVectorD &track_params_vector)
double getX0Sigma() const
void setResidual(double residual)
bool valid_
fit valid?
friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r)
void setGlobalCoordinates(const TVector3 &space_point_on_det)
double & CovarianceMatrixElement(int i, int j)