CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include <cassert>
8 
9 class TrackingRecHit;
10 
11 // #define Debug_KfComponentsHolder
12 
14 public:
16 #ifdef Debug_KfComponentsHolder
17  size_ = 0;
18 #endif
19  }
20 
21  template <unsigned int D>
29 
30  template <unsigned int D>
32 #ifdef Debug_KfComponentsHolder
33  assert(size_ == D);
34 #endif
35  return *reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(params_);
36  }
37 
38  template <unsigned int D>
40 #ifdef Debug_KfComponentsHolder
41  assert(size_ == D);
42 #endif
43  return *reinterpret_cast<typename AlgebraicROOTObject<D, D>::SymMatrix *>(errors_);
44  }
45 
46  template <unsigned int D>
48 #ifdef Debug_KfComponentsHolder
49  assert(size_ == D);
50 #endif
51  return this->projFunc<D>().matrix();
52  //return * reinterpret_cast<typename AlgebraicROOTObject<D,5>::Matrix *>(projection_);
53  }
54 
55  template <unsigned int D>
57 #ifdef Debug_KfComponentsHolder
58  assert(size_ == D);
59 #endif
60  return *reinterpret_cast<ProjectMatrix<double, 5, D> *>(projFunc_);
61  }
62 
64  void genericFill(const TrackingRecHit &hit);
65 
66  template <unsigned int D>
68 #ifdef Debug_KfComponentsHolder
69  assert(size_ == D);
70 #endif
71  return *reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(measuredParams_);
72  }
73 
74  template <unsigned int D>
76 #ifdef Debug_KfComponentsHolder
77  assert(size_ == D);
78 #endif
79  return *reinterpret_cast<typename AlgebraicROOTObject<D, D>::SymMatrix *>(measuredErrors_);
80  }
81 
84 
85  template <unsigned int D>
86  void dump();
87 
88 private:
89 #ifdef Debug_KfComponentsHolder
90  uint16_t size_;
91 #endif
95 
96  template <unsigned int D>
97  void genericFill_(const TrackingRecHit &hit);
98 };
99 
100 template <unsigned int D>
102  typename AlgebraicROOTObject<D, D>::SymMatrix *errors,
103  ProjectMatrix<double, 5, D> *projFunc,
104  typename AlgebraicROOTObject<D>::Vector *measuredParams,
105  typename AlgebraicROOTObject<D, D>::SymMatrix *measuredErrors,
106  const AlgebraicVector5 &tsosLocalParameters,
107  const AlgebraicSymMatrix55 &tsosLocalErrors) {
108 #ifdef Debug_KfComponentsHolder
109  assert(size_ == 0); // which means it was uninitialized
110  size_ = D;
111 #endif
112  params_ = params;
113  errors_ = errors;
119 }
120 
121 template <unsigned int D>
123  using namespace std;
124  cout << "Params my: " << params<D>() << endl;
125  cout << " tsos: " << tsosLocalParameters() << endl;
126  cout << " meas: " << measuredParams<D>() << endl;
127  cout << "Errors my:\n" << errors<D>() << endl;
128  cout << " tsos:\n" << tsosLocalErrors() << endl;
129  cout << " meas:\n" << measuredErrors<D>() << endl;
130  cout << "Projection:\n" << projection<D>() << endl;
131 }
132 
133 #ifdef Debug_KfComponentsHolder
134 // undef it so we don't pollute someone else's code.
135 #undef Debug_KfComponentsHolder
136 #endif
137 
138 #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
assert(be >=bs)
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()
tuple cout
Definition: gather_cfg.py:144
const AlgebraicSymMatrix55 & tsosLocalErrors() const
const AlgebraicVector5 * tsosLocalParameters_