FEDRA emulsion software from the OPERA Collaboration
CMatrix.hh
Go to the documentation of this file.
1 #ifndef __CMATRIX_HH
2 #define __CMATRIX_HH
3 // *****************************************************************************
4 //
5 // source:
6 //
7 // type: source code
8 //
9 // created: 21. Aug 2000
10 //
11 // author: Thorsten Glebe
12 // HERA-B Collaboration
13 // Max-Planck-Institut fuer Kernphysik
14 // Saupfercheckweg 1
15 // 69117 Heidelberg
16 // Germany
17 // E-mail: T.Glebe@mpi-hd.mpg.de
18 //
19 // Description: HERA-B track covariance matrix class
20 // Attention: Contructor makes transformation
21 // sigma(Q/p) -> sigma(p) (a Vt-requirement).
22 //
23 // changes:
24 // 21 Aug 2000 (TG) creation
25 // 25 Aug 2000 (TG) replaced sgn() function by that from VtUtil.hh
26 // 06 Aug 2000 (TG) changed sigma(1/p) into sigma(p), renamed member functions
27 // x_pinv, y_pin, tx_pinv, ty_pinv, pinv into x_p, y_p, tx_p...
28 // 06 Aug 2000 (TG) removed tx_pinv_prop, ty_pinv_prop, pinv_prop
29 // 06 Aug 2000 (TG) propagate() needs now only one argument (dz).
30 // 26 Okt 2000 (TG) #ifndef NO_ARTE added (for integration into CLUE)
31 // 14 Nov 2000 (TG) added constructors for CLUE (RecoSegment, ArtePointer<RecoTrack>)
32 // 20 Nov 2000 (TG) added #include cluefwd.hh
33 // 04 Sep 2001 (TG) SMatrix CTOR added
34 // 17 Okt 2001 (TG) added/improved #defines for ARTE
35 //
36 // *****************************************************************************
37 
38 #include "VtSymMatrix.hh"
39 
40 #ifdef WIN32
41 # include "Rtypes.h"
42 #endif
43 
44 #if defined USE_ROOT
45 #ifndef __CINT__
46 #include "smatrix/SMatrix.hh"
47 #endif
48 #endif
49 
50 namespace MATRIX {
51  class VtVector;
52 
53  // template <class T>
54  // inline const double sgn(const T& x) { return (x==0)? 0. : (x<0)? -1. : 1.; }
55 
56 
60  //============================================================================
61  // Class CMatrix: Covariance Matrix class (symmetric,pos definite, dim=5)
62  //============================================================================
63  class CMatrix : public VtSymMatrix {
64  public:
67  CMatrix() : VtSymMatrix(5) {}
69  CMatrix(const CMatrix& rhs);
71  CMatrix(const VtSymMatrix& rhs) : VtSymMatrix(rhs) {}
73  CMatrix(const VtSqMatrix& rhs) : VtSymMatrix(rhs) {}
75  CMatrix(const VtMatrix& rhs) : VtSymMatrix(rhs) {}
76 #if defined USE_ROOT && !defined __CINT__
78  CMatrix(const SMatrix<double,5>& rhs);
79 #endif
80 
83  double x() const { return operator()(0,0); }
85  double x_y() const { return operator()(0,1); }
87  double x_tx() const { return operator()(0,2); }
89  double x_ty() const { return operator()(0,3); }
91  double x_p() const { return operator()(0,4); }
93  double y() const { return operator()(1,1); }
95  double y_tx() const { return operator()(1,2); }
97  double y_ty() const { return operator()(1,3); }
99  double y_p() const { return operator()(1,4); }
101  double tx() const { return operator()(2,2); }
103  double tx_ty() const { return operator()(2,3); }
105  double tx_p() const { return operator()(2,4); }
107  double ty() const { return operator()(3,3); }
109  double ty_p() const { return operator()(3,4); }
111  double p() const { return operator()(4,4); }
112 
115  void set_x (const double x) { operator()(0,0) = x; }
117  void set_x_y (const double xy) { operator()(1,0) = operator()(0,1) = xy; }
119  void set_x_tx (const double xtx) { operator()(0,2) = operator()(2,0) = xtx; }
121  void set_x_ty (const double xty) { operator()(0,3) = operator()(3,0) = xty; }
123  void set_x_p (const double xp) { operator()(0,4) = operator()(4,0) = xp; }
125  void set_y (const double y) { operator()(1,1) = y; }
127  void set_y_tx (const double ytx) { operator()(1,2) = operator()(2,1) = ytx; }
129  void set_y_ty (const double yty) { operator()(1,3) = operator()(3,1) = yty; }
131  void set_y_p (const double yp) { operator()(1,4) = operator()(4,1) = yp; }
133  void set_tx (const double tx) { operator()(2,2) = tx; }
135  void set_tx_ty (const double txty) { operator()(2,3) = operator()(3,2) = txty;}
137  void set_tx_p (const double txp) { operator()(2,4) = operator()(4,2) = txp; }
139  void set_ty (const double ty) { operator()(3,3) = ty; }
141  void set_ty_p (const double typ) { operator()(3,4) = operator()(4,3) = typ; }
143  void set_p (const double p) { operator()(4,4) = p; }
144 
147  double x_prop (double dz) const { return x() + 2. * dz * x_tx() + dz*dz * tx(); }
149  double x_y_prop (double dz) const { return x_y() + dz*(y_tx() + x_ty() + dz * tx_ty()); }
151  double x_tx_prop (double dz) const { return x_tx() + dz * tx(); }
153  double x_ty_prop (double dz) const { return x_ty() + dz * tx_ty(); }
155  double x_p_prop (double dz) const { return x_p() + dz * tx_p(); }
157  double y_prop (double dz) const { return y() + 2. * dz * y_ty() + dz*dz * ty(); }
159  double y_tx_prop (double dz) const { return y_tx() + dz * tx_ty(); }
161  double y_ty_prop (double dz) const { return y_ty() + dz * ty(); }
163  double y_p_prop (double dz) const { return y_p() + dz * ty_p(); }
164 
166  void propagate(const double dz);
167 
168 #ifdef WIN32
169  ClassDef(CMatrix,0)
170 #endif
171  }; // class CMatrix
172 
173 
174 } // namespace MATRIX
175 #endif
brick dz
Definition: RecDispMC.C:107
Definition: CMatrix.hh:63
double p() const
rtra->cvf[14] $* p^4$
Definition: CMatrix.hh:111
double tx() const
rtra->cvf[5]
Definition: CMatrix.hh:101
void set_ty_p(const double typ)
Definition: CMatrix.hh:141
void propagate(const double dz)
propagate all matrix elements
Definition: CMatrix.C:74
void set_y(const double y)
Definition: CMatrix.hh:125
double x_ty() const
rtra->cvf[6]
Definition: CMatrix.hh:89
double y_ty() const
rtra->cvf[7]
Definition: CMatrix.hh:97
void set_x_ty(const double xty)
Definition: CMatrix.hh:121
CMatrix()
Definition: CMatrix.hh:67
double x_ty_prop(double dz) const
Definition: CMatrix.hh:153
void set_x_y(const double xy)
Definition: CMatrix.hh:117
void set_y_tx(const double ytx)
Definition: CMatrix.hh:127
void set_tx_p(const double txp)
Definition: CMatrix.hh:137
double y_tx() const
rtra->cvf[4]
Definition: CMatrix.hh:95
double ty_p() const
rtra->cvf[13] $* Q * -p^2$
Definition: CMatrix.hh:109
CMatrix(const VtMatrix &rhs)
Definition: CMatrix.hh:75
double x_y() const
rtra->cvf[1]
Definition: CMatrix.hh:85
double x_tx_prop(double dz) const
Definition: CMatrix.hh:151
void set_y_ty(const double yty)
Definition: CMatrix.hh:129
void set_x_tx(const double xtx)
Definition: CMatrix.hh:119
double y_p() const
rtra->cvf[11] $* Q * -p^2$
Definition: CMatrix.hh:99
double x() const
rtra->cvf[0]
Definition: CMatrix.hh:83
double x_tx() const
rtra->cvf[3]
Definition: CMatrix.hh:87
double x_p() const
rtra->cvf[10] $* Q * -p^2$
Definition: CMatrix.hh:91
void set_x_p(const double xp)
Definition: CMatrix.hh:123
double x_y_prop(double dz) const
Definition: CMatrix.hh:149
void set_tx(const double tx)
Definition: CMatrix.hh:133
double tx_ty() const
rtra->cvf[8]
Definition: CMatrix.hh:103
CMatrix(const VtSqMatrix &rhs)
Definition: CMatrix.hh:73
void set_ty(const double ty)
Definition: CMatrix.hh:139
void set_p(const double p)
Definition: CMatrix.hh:143
double y_ty_prop(double dz) const
Definition: CMatrix.hh:161
double y_p_prop(double dz) const
Definition: CMatrix.hh:163
double x_p_prop(double dz) const
Definition: CMatrix.hh:155
double ty() const
rtra->cvf[9]
Definition: CMatrix.hh:107
double y_tx_prop(double dz) const
Definition: CMatrix.hh:159
CMatrix(const VtSymMatrix &rhs)
Definition: CMatrix.hh:71
void set_x(const double x)
Definition: CMatrix.hh:115
void set_tx_ty(const double txty)
Definition: CMatrix.hh:135
double x_prop(double dz) const
Definition: CMatrix.hh:147
double y_prop(double dz) const
Definition: CMatrix.hh:157
double y() const
rtra->cvf[2]
Definition: CMatrix.hh:93
void set_y_p(const double yp)
Definition: CMatrix.hh:131
double tx_p() const
rtra->cvf[12] $* Q * -p^2$
Definition: CMatrix.hh:105
Definition: VtMatrix.hh:49
virtual double operator()(unsigned int row, unsigned int col) const
Definition: VtMatrix.C:109
Definition: VtSqMatrix.hh:50
Definition: VtSymMatrix.hh:49
xy(float X, float Y)
Definition: init.C:303
Definition: CMatrix.C:43