CMS 3D CMS Logo

GlobalErrorBase.h
Go to the documentation of this file.
1 #ifndef GlobalErrorType_H
2 #define GlobalErrorType_H
3 
7 //
8 // Exceptions
9 //
11 
25 template <class T, class ErrorWeightType>
27 {
28 
29 public:
31  class NullMatrix{};
32 
37 
41  GlobalErrorBase(const NullMatrix &) {}
42 
43 
48  GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33) {
49  theCartesianError(0,0)=c11;
50  theCartesianError(1,0)=c21;
51  theCartesianError(1,1)=c22;
52  theCartesianError(2,0)=c31;
53  theCartesianError(2,1)=c32;
54  theCartesianError(2,2)=c33;
55  theCartesianError(3,0) = 0.;
56  theCartesianError(3,1) = 0.;
57  theCartesianError(3,2) = 0.;
58  theCartesianError(3,3) = 0.;
59  }
60 
65  GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33, T c41, T c42, T c43, T c44) {
66  theCartesianError(0,0)=c11;
67  theCartesianError(1,0)=c21;
68  theCartesianError(1,1)=c22;
69  theCartesianError(2,0)=c31;
70  theCartesianError(2,1)=c32;
71  theCartesianError(2,2)=c33;
72  theCartesianError(3,0)=c41;
73  theCartesianError(3,1)=c42;
74  theCartesianError(3,2)=c43;
75  theCartesianError(3,3)=c44;
76  }
77 
82  theCartesianError(0,0) = err(0,0);
83  theCartesianError(1,0) = err(1,0);
84  theCartesianError(1,1) = err(1,1);
85  theCartesianError(2,0) = err(2,0);
86  theCartesianError(2,1) = err(2,1);
87  theCartesianError(2,2) = err(2,2);
88  theCartesianError(3,0) = 0.;
89  theCartesianError(3,1) = 0.;
90  theCartesianError(3,2) = 0.;
91  theCartesianError(3,3) = 0.;
92  }
93 
98  theCartesianError(err) { }
99 
100 
102 
103  T cxx() const {
104  return theCartesianError(0,0);
105  }
106 
107  T cyx() const {
108  return theCartesianError(1,0);
109  }
110 
111  T cyy() const {
112  return theCartesianError(1,1);
113  }
114 
115  T czx() const {
116  return theCartesianError(2,0);
117  }
118 
119  T czy() const {
120  return theCartesianError(2,1);
121  }
122 
123  T czz() const {
124  return theCartesianError(2,2);
125  }
126 
127  T ctx() const {
128  return theCartesianError(3,0);
129  }
130 
131  T cty() const {
132  return theCartesianError(3,1);
133  }
134 
135  T ctz() const {
136  return theCartesianError(3,2);
137  }
138 
139  T ctt() const {
140  return theCartesianError(3,3);
141  }
142 
147  const AlgebraicSymMatrix33 matrix() const {
149  out(0,0) = theCartesianError(0,0);
150  out(1,0) = theCartesianError(1,0);
151  out(1,1) = theCartesianError(1,1);
152  out(2,0) = theCartesianError(2,0);
153  out(2,1) = theCartesianError(2,1);
154  out(2,2) = theCartesianError(2,2);
155  return out;
156  }
157 
163  return theCartesianError;
164  }
165 
166  T rerr(const GlobalPoint& aPoint) const {
167  T r2 = aPoint.perp2();
168  T x2 = aPoint.x()*aPoint.x();
169  T y2 = aPoint.y()*aPoint.y();
170  T xy = aPoint.x()*aPoint.y();
171  if(r2 != 0)
172  return std::max<T>(0, (1./r2)*(x2*cxx() + 2.*xy*cyx() + y2*cyy()));
173  else
174  return 0.5*(cxx() + cyy());
175  }
176 
177  T phierr(const GlobalPoint& aPoint) const {
178  T r2 = aPoint.perp2();
179  T x2 = aPoint.x()*aPoint.x();
180  T y2 = aPoint.y()*aPoint.y();
181  T xy = aPoint.x()*aPoint.y();
182  if (r2 != 0)
183  return std::max<T>(0, (1./(r2*r2))*(y2*cxx() - 2.*xy*cyx() + x2*cyy()));
184  else
185  return 0;
186  }
187 
190  }
193  }
194 
195 private:
196 
198 
199 };
200 
201 #endif
202 
203 
GlobalErrorBase operator-(const GlobalErrorBase &err) const
GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33, T c41, T c42, T c43, T c44)
AlgebraicSymMatrix44 theCartesianError
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:63
T perp2() const
Definition: PV3DBase.h:71
const AlgebraicSymMatrix44 & matrix4D() const
T phierr(const GlobalPoint &aPoint) const
GlobalErrorBase(const NullMatrix &)
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Tag to request a null error matrix.
GlobalErrorBase operator+(const GlobalErrorBase &err) const
GlobalErrorBase(const AlgebraicSymMatrix33 &err)
GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33)
T rerr(const GlobalPoint &aPoint) const
long double T
T x() const
Definition: PV3DBase.h:62
GlobalErrorBase(const AlgebraicSymMatrix44 &err)