CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 public:
33  class FittedRecHit : public TotemRPRecHit {
34  public:
35  FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull)
36  : TotemRPRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull) {}
37 
39 
40  virtual ~FittedRecHit() {}
41 
42  inline const TVector3 &globalCoordinates() const { return space_point_on_det_; }
43  inline void setGlobalCoordinates(const TVector3 &space_point_on_det) { space_point_on_det_ = space_point_on_det; }
44 
45  inline double residual() const { return residual_; }
46  inline void setResidual(double residual) { residual_ = residual; }
47 
48  inline double pull() const { return pull_; }
49  inline void setPull(double pull) { pull_ = pull; }
50 
51  inline double pullNormalization() const { return residual_ / pull_; }
52 
53  private:
55  double residual_;
56  double pull_;
57  };
58 
59 public:
61  static const int dimension = 4;
62 
64  static const int covarianceSize = dimension * dimension;
65 
67 
68  TotemRPLocalTrack(double z0,
69  const TVectorD &track_params_vector,
70  const TMatrixD &par_covariance_matrix,
71  double chiSquared);
72 
73  virtual ~TotemRPLocalTrack() {}
74 
75  inline const edm::DetSetVector<FittedRecHit> &hits() const { return track_hits_vector_; }
76  inline void addHit(unsigned int detId, const FittedRecHit &hit) {
77  track_hits_vector_.find_or_insert(detId).push_back(hit);
78  }
79 
80  inline double x0() const { return track_params_vector_[0]; }
81  inline double x0Sigma() const { return sqrt(CovarianceMatrixElement(0, 0)); }
82  inline double x0Variance() const { return CovarianceMatrixElement(0, 0); }
83 
84  inline double y0() const { return track_params_vector_[1]; }
85  inline double y0Sigma() const { return sqrt(CovarianceMatrixElement(1, 1)); }
86  inline double y0Variance() const { return CovarianceMatrixElement(1, 1); }
87 
88  inline double z0() const { return z0_; }
89  inline void setZ0(double z0) { z0_ = z0; }
90 
91  inline double tx() const { return track_params_vector_[2]; }
92  inline double txSigma() const { return sqrt(CovarianceMatrixElement(2, 2)); }
93 
94  inline double ty() const { return track_params_vector_[3]; }
95  inline double tySigma() const { return sqrt(CovarianceMatrixElement(3, 3)); }
96 
97  inline TVector3 directionVector() const {
98  TVector3 vect(tx(), ty(), 1);
99  vect.SetMag(1.0);
100  return vect;
101  }
102 
103  TVectorD parameterVector() const;
104  void setParameterVector(const TVectorD &track_params_vector);
105 
106  TMatrixD covarianceMatrix() const;
107  void setCovarianceMatrix(const TMatrixD &par_covariance_matrix);
108 
109  inline double chiSquared() const { return chiSquared_; }
110  inline void setChiSquared(double &chiSquared) { chiSquared_ = chiSquared; }
111 
112  inline double chiSquaredOverNDF() const { return chiSquared_ / (track_hits_vector_.size() - 4); }
113 
114  inline unsigned short numberOfPointsUsedForFit() const { return track_hits_vector_.size(); }
115 
117  inline TVector2 trackPoint(double z) const {
118  double delta_z = z - z0_;
119  return TVector2(track_params_vector_[0] + track_params_vector_[2] * delta_z,
120  track_params_vector_[1] + track_params_vector_[3] * delta_z);
121  }
122 
123  inline TVector3 trackCentrePoint() { return TVector3(track_params_vector_[0], track_params_vector_[1], z0_); }
124 
125  TMatrixD trackPointInterpolationCovariance(double z) const;
126 
127  inline bool isValid() const { return valid_; }
128 
129  inline void setValid(bool valid) { valid_ = valid; }
130 
131  friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r);
132 
133 private:
134  inline const double &CovarianceMatrixElement(int i, int j) const { return par_covariance_matrix_[i * dimension + j]; }
135 
136  inline double &CovarianceMatrixElement(int i, int j) { return par_covariance_matrix_[i * dimension + j]; }
137 
139 
142 
145  double z0_;
146 
148 
150  double chiSquared_;
151 
153  bool valid_;
154 };
155 
156 #endif
TVector3 trackCentrePoint()
TVector3 directionVector() const
void setChiSquared(double &chiSquared)
double x0Sigma() const
double par_covariance_matrix_[covarianceSize]
bool isValid() const
void addHit(unsigned int detId, const FittedRecHit &hit)
double y0Variance() const
double chiSquared() const
FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull)
double tx() const
double ty() const
TVector2 trackPoint(double z) const
returns (x, y) vector
A track fit through a single RP.
double y0() const
TMatrixD trackPointInterpolationCovariance(double z) const
const TVector3 & globalCoordinates() const
void setZ0(double z0)
T sqrt(T t)
Definition: SSEVec.h:19
static const int dimension
&lt; parameter vector size
double x0() const
double track_params_vector_[dimension]
track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ...
Reconstructed hit in TOTEM RP.
Definition: TotemRPRecHit.h:18
double txSigma() const
double pull_
normalised residual
double tySigma() const
const edm::DetSetVector< FittedRecHit > & hits() const
TMatrixD covarianceMatrix() const
void setValid(bool valid)
double chiSquared_
fit chi^2
double chiSquaredOverNDF() const
const double & CovarianceMatrixElement(int i, int j) const
static const int covarianceSize
unsigned short numberOfPointsUsedForFit() const
double x0Variance() const
edm::DetSetVector< FittedRecHit > track_hits_vector_
TVectorD parameterVector() const
double y0Sigma() const
virtual ~TotemRPLocalTrack()
void setCovarianceMatrix(const TMatrixD &par_covariance_matrix)
void setParameterVector(const TVectorD &track_params_vector)
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 z0() const
double & CovarianceMatrixElement(int i, int j)