CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GlobalErrorBase.h
Go to the documentation of this file.
1 #ifndef GlobalErrorType_H
2 #define GlobalErrorType_H
3 
7 //
8 // Exceptions
9 //
11 
24 template <class T, class ErrorWeightType>
26 public:
28  class NullMatrix {};
29 
34 
38  GlobalErrorBase(const NullMatrix&) {}
39 
44  GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33) {
45  theCartesianError(0, 0) = c11;
46  theCartesianError(1, 0) = c21;
47  theCartesianError(1, 1) = c22;
48  theCartesianError(2, 0) = c31;
49  theCartesianError(2, 1) = c32;
50  theCartesianError(2, 2) = c33;
51  theCartesianError(3, 0) = 0.;
52  theCartesianError(3, 1) = 0.;
53  theCartesianError(3, 2) = 0.;
54  theCartesianError(3, 3) = 0.;
55  }
56 
61  GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33, T c41, T c42, T c43, T c44) {
62  theCartesianError(0, 0) = c11;
63  theCartesianError(1, 0) = c21;
64  theCartesianError(1, 1) = c22;
65  theCartesianError(2, 0) = c31;
66  theCartesianError(2, 1) = c32;
67  theCartesianError(2, 2) = c33;
68  theCartesianError(3, 0) = c41;
69  theCartesianError(3, 1) = c42;
70  theCartesianError(3, 2) = c43;
71  theCartesianError(3, 3) = c44;
72  }
73 
78  theCartesianError(0, 0) = err(0, 0);
79  theCartesianError(1, 0) = err(1, 0);
80  theCartesianError(1, 1) = err(1, 1);
81  theCartesianError(2, 0) = err(2, 0);
82  theCartesianError(2, 1) = err(2, 1);
83  theCartesianError(2, 2) = err(2, 2);
84  theCartesianError(3, 0) = 0.;
85  theCartesianError(3, 1) = 0.;
86  theCartesianError(3, 2) = 0.;
87  theCartesianError(3, 3) = 0.;
88  }
89 
94 
96 
97  T cxx() const { return theCartesianError(0, 0); }
98 
99  T cyx() const { return theCartesianError(1, 0); }
100 
101  T cyy() const { return theCartesianError(1, 1); }
102 
103  T czx() const { return theCartesianError(2, 0); }
104 
105  T czy() const { return theCartesianError(2, 1); }
106 
107  T czz() const { return theCartesianError(2, 2); }
108 
109  T ctx() const { return theCartesianError(3, 0); }
110 
111  T cty() const { return theCartesianError(3, 1); }
112 
113  T ctz() const { return theCartesianError(3, 2); }
114 
115  T ctt() const { return theCartesianError(3, 3); }
116 
121  const AlgebraicSymMatrix33 matrix() const {
123  out(0, 0) = theCartesianError(0, 0);
124  out(1, 0) = theCartesianError(1, 0);
125  out(1, 1) = theCartesianError(1, 1);
126  out(2, 0) = theCartesianError(2, 0);
127  out(2, 1) = theCartesianError(2, 1);
128  out(2, 2) = theCartesianError(2, 2);
129  return out;
130  }
131 
137 
138  T rerr(const GlobalPoint& aPoint) const {
139  T r2 = aPoint.perp2();
140  T x2 = aPoint.x() * aPoint.x();
141  T y2 = aPoint.y() * aPoint.y();
142  T xy = aPoint.x() * aPoint.y();
143  if (r2 != 0)
144  return std::max<T>(0, (1. / r2) * (x2 * cxx() + 2. * xy * cyx() + y2 * cyy()));
145  else
146  return 0.5 * (cxx() + cyy());
147  }
148 
149  T phierr(const GlobalPoint& aPoint) const {
150  T r2 = aPoint.perp2();
151  T x2 = aPoint.x() * aPoint.x();
152  T y2 = aPoint.y() * aPoint.y();
153  T xy = aPoint.x() * aPoint.y();
154  if (r2 != 0)
155  return std::max<T>(0, (1. / (r2 * r2)) * (y2 * cxx() - 2. * xy * cyx() + x2 * cyy()));
156  else
157  return 0;
158  }
159 
162  }
165  }
166 
167 private:
169 };
170 
171 #endif
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:60
T perp2() const
Definition: PV3DBase.h:68
const AlgebraicSymMatrix44 & matrix4D() const
T phierr(const GlobalPoint &aPoint) const
GlobalErrorBase(const NullMatrix &)
Tag to request a null error matrix.
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
GlobalErrorBase operator+(const GlobalErrorBase &err) const
GlobalErrorBase(const AlgebraicSymMatrix33 &err)
Basic2DVector< T > xy() const
GlobalErrorBase(T c11, T c21, T c22, T c31, T c32, T c33)
T rerr(const GlobalPoint &aPoint) const
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
long double T
T x() const
Definition: PV3DBase.h:59
GlobalErrorBase(const AlgebraicSymMatrix44 &err)