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 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 
38  FittedRecHit() : TotemRPRecHit(), residual_(0), pull_(0) {}
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 
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,
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
TotemRPLocalTrack::FittedRecHit
Definition: TotemRPLocalTrack.h:39
TotemRPRecHit
Reconstructed hit in TOTEM RP.
Definition: TotemRPRecHit.h:17
edm::DetSetVector
Definition: DetSetVector.h:61
TotemRPLocalTrack::z0_
double z0_
Definition: TotemRPLocalTrack.h:151
TotemRPLocalTrack::y0
double y0() const
Definition: TotemRPLocalTrack.h:90
TotemRPLocalTrack::tySigma
double tySigma() const
Definition: TotemRPLocalTrack.h:101
mps_fire.i
i
Definition: mps_fire.py:355
TotemRPLocalTrack::setChiSquared
void setChiSquared(double &chiSquared)
Definition: TotemRPLocalTrack.h:116
funct::false
false
Definition: Factorize.h:34
TotemRPLocalTrack::covarianceMatrix
TMatrixD covarianceMatrix() const
Definition: TotemRPLocalTrack.cc:66
TotemRPLocalTrack::par_covariance_matrix_
double par_covariance_matrix_[covarianceSize]
Definition: TotemRPLocalTrack.h:153
TotemRPLocalTrack::addHit
void addHit(unsigned int detId, const FittedRecHit &hit)
Definition: TotemRPLocalTrack.h:82
TotemRPLocalTrack::trackPoint
TVector2 trackPoint(double z) const
returns (x, y) vector
Definition: TotemRPLocalTrack.h:123
TotemRPLocalTrack::z0
double z0() const
Definition: TotemRPLocalTrack.h:94
TotemRPLocalTrack::TotemRPLocalTrack
TotemRPLocalTrack()
Definition: TotemRPLocalTrack.h:72
TotemRPRecHit.h
TotemRPLocalTrack::tx
double tx() const
Definition: TotemRPLocalTrack.h:97
TotemRPLocalTrack::isValid
bool isValid() const
Definition: TotemRPLocalTrack.h:133
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
TotemRPLocalTrack::FittedRecHit::residual
double residual() const
Definition: TotemRPLocalTrack.h:57
TotemRPLocalTrack::FittedRecHit::pull
double pull() const
Definition: TotemRPLocalTrack.h:60
TotemRPLocalTrack::FittedRecHit::globalCoordinates
const TVector3 & globalCoordinates() const
Definition: TotemRPLocalTrack.h:54
TotemRPLocalTrack::dimension
static const int dimension
< parameter vector size
Definition: TotemRPLocalTrack.h:67
TotemRPLocalTrack::FittedRecHit::space_point_on_det_
TVector3 space_point_on_det_
mm
Definition: TotemRPLocalTrack.h:66
TotemRPLocalTrack::parameterVector
TVectorD parameterVector() const
Definition: TotemRPLocalTrack.cc:48
TotemRPLocalTrack::hits
const edm::DetSetVector< FittedRecHit > & hits() const
Definition: TotemRPLocalTrack.h:81
TotemRPLocalTrack::track_params_vector_
double track_params_vector_[dimension]
track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ...
Definition: TotemRPLocalTrack.h:147
TotemRPLocalTrack::trackPointInterpolationCovariance
TMatrixD trackPointInterpolationCovariance(double z) const
Definition: TotemRPLocalTrack.cc:13
TotemRPLocalTrack::FittedRecHit::setPull
void setPull(double pull)
Definition: TotemRPLocalTrack.h:61
TotemRPLocalTrack::FittedRecHit::pullNormalization
double pullNormalization() const
Definition: TotemRPLocalTrack.h:63
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
TotemRPLocalTrack::y0Variance
double y0Variance() const
Definition: TotemRPLocalTrack.h:92
TotemRPLocalTrack::numberOfPointsUsedForFit
unsigned short numberOfPointsUsedForFit() const
Definition: TotemRPLocalTrack.h:120
DDAxes::z
TotemRPLocalTrack::FittedRecHit::setGlobalCoordinates
void setGlobalCoordinates(const TVector3 &space_point_on_det)
Definition: TotemRPLocalTrack.h:55
TotemRPLocalTrack::chiSquared
double chiSquared() const
Definition: TotemRPLocalTrack.h:115
TotemRPLocalTrack::FittedRecHit::pull_
double pull_
normalised residual
Definition: TotemRPLocalTrack.h:68
TotemRPLocalTrack::y0Sigma
double y0Sigma() const
Definition: TotemRPLocalTrack.h:91
TotemRPLocalTrack::setZ0
void setZ0(double z0)
Definition: TotemRPLocalTrack.h:95
TotemRPLocalTrack::chiSquared_
double chiSquared_
fit chi^2
Definition: TotemRPLocalTrack.h:156
TotemRPLocalTrack::FittedRecHit::setResidual
void setResidual(double residual)
Definition: TotemRPLocalTrack.h:58
TotemRPLocalTrack::CovarianceMatrixElement
const double & CovarianceMatrixElement(int i, int j) const
Definition: TotemRPLocalTrack.h:140
TotemRPLocalTrack::directionVector
TVector3 directionVector() const
Definition: TotemRPLocalTrack.h:103
TotemRPLocalTrack::txSigma
double txSigma() const
Definition: TotemRPLocalTrack.h:98
TotemRPLocalTrack::covarianceSize
static const int covarianceSize
Definition: TotemRPLocalTrack.h:70
TotemRPLocalTrack::track_hits_vector_
edm::DetSetVector< FittedRecHit > track_hits_vector_
Definition: TotemRPLocalTrack.h:144
TotemRPLocalTrack::ty
double ty() const
Definition: TotemRPLocalTrack.h:100
TotemRPLocalTrack::FittedRecHit::residual_
double residual_
mm
Definition: TotemRPLocalTrack.h:67
DetSetVector.h
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
alignCSCRings.r
r
Definition: alignCSCRings.py:93
TotemRPLocalTrack::x0Variance
double x0Variance() const
Definition: TotemRPLocalTrack.h:88
TotemRPLocalTrack::~TotemRPLocalTrack
virtual ~TotemRPLocalTrack()
Definition: TotemRPLocalTrack.h:79
TotemRPLocalTrack::FittedRecHit::~FittedRecHit
virtual ~FittedRecHit()
Definition: TotemRPLocalTrack.h:52
TotemRPLocalTrack::setValid
void setValid(bool valid)
Definition: TotemRPLocalTrack.h:135
TotemRPRecHit::TotemRPRecHit
TotemRPRecHit(double position=0, double sigma=0)
Definition: TotemRPRecHit.h:25
TotemRPLocalTrack
A track fit through a single RP.
Definition: TotemRPLocalTrack.h:31
TotemRPLocalTrack::setParameterVector
void setParameterVector(const TVectorD &track_params_vector)
Definition: TotemRPLocalTrack.cc:59
TotemRPLocalTrack::chiSquaredOverNDF
double chiSquaredOverNDF() const
Definition: TotemRPLocalTrack.h:118
TotemRPLocalTrack::x0Sigma
double x0Sigma() const
Definition: TotemRPLocalTrack.h:87
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TotemRPLocalTrack::x0
double x0() const
Definition: TotemRPLocalTrack.h:86
TotemRPLocalTrack::operator<
friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r)
Definition: TotemRPLocalTrack.cc:86
TotemRPLocalTrack::FittedRecHit::FittedRecHit
FittedRecHit()
Definition: TotemRPLocalTrack.h:50
TotemRPLocalTrack::setCovarianceMatrix
void setCovarianceMatrix(const TMatrixD &par_covariance_matrix)
Definition: TotemRPLocalTrack.cc:78
TotemRPLocalTrack::trackCentrePoint
TVector3 trackCentrePoint()
Definition: TotemRPLocalTrack.h:129
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TotemRPLocalTrack::valid_
bool valid_
fit valid?
Definition: TotemRPLocalTrack.h:159