CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  }
56 
61  if (err.num_row() == 3)
62  theCartesianError = asSMatrix<3>(err);
63  else {
64  //throw DetLogicError("Not 3x3 Error Matrix: set pointer to 0");
65  throw cms::Exception("DetLogicError")<<"Not 3x3 Error Matrix: set pointer to 0\n";
66 
67  }
68  }
69 
74  theCartesianError(err) { }
75 
77 
78  T cxx() const {
79  return theCartesianError(0,0);
80  }
81 
82  T cyx() const {
83  return theCartesianError(1,0);
84  }
85 
86  T cyy() const {
87  return theCartesianError(1,1);
88  }
89 
90  T czx() const {
91  return theCartesianError(2,0);
92  }
93 
94  T czy() const {
95  return theCartesianError(2,1);
96  }
97 
98  T czz() const {
99  return theCartesianError(2,2);
100  }
101 
108  }
114  return theCartesianError;
115  }
116 
117 
118  T rerr(const GlobalPoint& aPoint) const {
119  T r2 = aPoint.perp2();
120  T x2 = aPoint.x()*aPoint.x();
121  T y2 = aPoint.y()*aPoint.y();
122  T xy = aPoint.x()*aPoint.y();
123  if(r2 != 0)
124  return (1./r2)*(x2*cxx() + 2.*xy*cyx() + y2*cyy());
125  else
126  return 0.5*(cxx() + cyy());
127  }
128 
129  T phierr(const GlobalPoint& aPoint) const {
130  T r2 = aPoint.perp2();
131  T x2 = aPoint.x()*aPoint.x();
132  T y2 = aPoint.y()*aPoint.y();
133  T xy = aPoint.x()*aPoint.y();
134  if (r2 != 0)
135  return (1./(r2*r2))*(y2*cxx() - 2.*xy*cyx() + x2*cyy());
136  else
137  return 0;
138  }
139 
142  }
145  }
146 
147 private:
148 
150 
151 };
152 
153 #endif
154 
155 
AlgebraicSymMatrix33 theCartesianError
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:49
GlobalErrorBase operator-(const GlobalErrorBase &err) const
T y() const
Definition: PV3DBase.h:57
T perp2() const
Definition: PV3DBase.h:65
AlgebraicSymMatrix matrix() const
const AlgebraicSymMatrix33 & matrix_new() const
T phierr(const GlobalPoint &aPoint) const
GlobalErrorBase(const NullMatrix &)
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)
GlobalErrorBase(const AlgebraicSymMatrix &err)
T rerr(const GlobalPoint &aPoint) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
T x() const
Definition: PV3DBase.h:56
Basic2DVector< T > xy() const