CMS 3D CMS Logo

KfComponentsHolder.h
Go to the documentation of this file.
1 #ifndef DataFormats_TrackingRecHit_interface_KfComponentsHolder_h_
2 #define DataFormats_TrackingRecHit_interface_KfComponentsHolder_h_
3 
6 #include <cstdint>
7 
8 class TrackingRecHit;
9 
10 // #define Debug_KfComponentsHolder
11 
13 public:
15 #ifdef Debug_KfComponentsHolder
16  size_ = 0;
17 #endif
18  }
19 
20  template <unsigned int D>
28 
29  template <unsigned int D>
31 #ifdef Debug_KfComponentsHolder
32  assert(size_ == D);
33 #endif
34  return *reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(params_);
35  }
36 
37  template <unsigned int D>
39 #ifdef Debug_KfComponentsHolder
40  assert(size_ == D);
41 #endif
42  return *reinterpret_cast<typename AlgebraicROOTObject<D, D>::SymMatrix *>(errors_);
43  }
44 
45  template <unsigned int D>
47 #ifdef Debug_KfComponentsHolder
48  assert(size_ == D);
49 #endif
50  return this->projFunc<D>().matrix();
51  //return * reinterpret_cast<typename AlgebraicROOTObject<D,5>::Matrix *>(projection_);
52  }
53 
54  template <unsigned int D>
56 #ifdef Debug_KfComponentsHolder
57  assert(size_ == D);
58 #endif
59  return *reinterpret_cast<ProjectMatrix<double, 5, D> *>(projFunc_);
60  }
61 
63  void genericFill(const TrackingRecHit &hit);
64 
65  template <unsigned int D>
67 #ifdef Debug_KfComponentsHolder
68  assert(size_ == D);
69 #endif
70  return *reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(measuredParams_);
71  }
72 
73  template <unsigned int D>
75 #ifdef Debug_KfComponentsHolder
76  assert(size_ == D);
77 #endif
78  return *reinterpret_cast<typename AlgebraicROOTObject<D, D>::SymMatrix *>(measuredErrors_);
79  }
80 
83 
84  template <unsigned int D>
85  void dump();
86 
87 private:
88 #ifdef Debug_KfComponentsHolder
89  uint16_t size_;
90 #endif
94 
95  template <unsigned int D>
96  void genericFill_(const TrackingRecHit &hit);
97 };
98 
99 template <unsigned int D>
107 #ifdef Debug_KfComponentsHolder
108  assert(size_ == 0); // which means it was uninitialized
109  size_ = D;
110 #endif
111  params_ = params;
112  errors_ = errors;
118 }
119 
120 template <unsigned int D>
122  using namespace std;
123  cout << "Params my: " << params<D>() << endl;
124  cout << " tsos: " << tsosLocalParameters() << endl;
125  cout << " meas: " << measuredParams<D>() << endl;
126  cout << "Errors my:\n" << errors<D>() << endl;
127  cout << " tsos:\n" << tsosLocalErrors() << endl;
128  cout << " meas:\n" << measuredErrors<D>() << endl;
129  cout << "Projection:\n" << projection<D>() << endl;
130 }
131 
132 #ifdef Debug_KfComponentsHolder
133 // undef it so we don't pollute someone else's code.
134 #undef Debug_KfComponentsHolder
135 #endif
136 
137 #endif
void setup(typename AlgebraicROOTObject< D >::Vector *params, typename AlgebraicROOTObject< D, D >::SymMatrix *errors, ProjectMatrix< double, 5, D > *projFunc, typename AlgebraicROOTObject< D >::Vector *measuredParams, typename AlgebraicROOTObject< D, D >::SymMatrix *measuredErrors, const AlgebraicVector5 &tsosLocalParameters, const AlgebraicSymMatrix55 &tsosLocalErrors)
void genericFill(const TrackingRecHit &hit)
Fill in datamembers from a generic TrackingRecHit using the CLHEP matrices.
void genericFill_(const TrackingRecHit &hit)
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
AlgebraicROOTObject< D, 5 >::Matrix projection()
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
AlgebraicROOTObject< D, D >::SymMatrix & measuredErrors()
ROOT::Math::SVector< double, 5 > AlgebraicVector5
AlgebraicROOTObject< D >::Vector & params()
AlgebraicROOTObject< D, D >::SymMatrix & errors()
ProjectMatrix< double, 5, D > & projFunc()
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const AlgebraicVector5 & tsosLocalParameters() const
const AlgebraicSymMatrix55 * tsosLocalErrors_
ROOT::Math::SVector< double, D1 > Vector
AlgebraicROOTObject< D >::Vector & measuredParams()
Definition: errors.py:1
const AlgebraicSymMatrix55 & tsosLocalErrors() const
const AlgebraicVector5 * tsosLocalParameters_