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 
4 
7 #include <cstdint>
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>
22  void setup(
30  ) ;
31 
32 
33  template <unsigned int D>
35 #ifdef Debug_KfComponentsHolder
36  assert(size_ == D);
37 #endif
38  return * reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(params_);
39  }
40 
41  template <unsigned int D>
43 #ifdef Debug_KfComponentsHolder
44  assert(size_ == D);
45 #endif
46  return * reinterpret_cast<typename AlgebraicROOTObject<D,D>::SymMatrix *>(errors_);
47  }
48 
49 
50  template <unsigned int D>
52 #ifdef Debug_KfComponentsHolder
53  assert(size_ == D);
54 #endif
55  return this->projFunc<D>().matrix();
56  //return * reinterpret_cast<typename AlgebraicROOTObject<D,5>::Matrix *>(projection_);
57  }
58 
59 
60 
61  template <unsigned int D>
63 #ifdef Debug_KfComponentsHolder
64  assert(size_ == D);
65 #endif
66  return * reinterpret_cast< ProjectMatrix<double,5,D> *>(projFunc_);
67  }
68 
70  void genericFill(const TrackingRecHit &hit);
71 
72  template <unsigned int D>
74 #ifdef Debug_KfComponentsHolder
75  assert(size_ == D);
76 #endif
77  return * reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(measuredParams_);
78  }
79 
80  template <unsigned int D>
82 #ifdef Debug_KfComponentsHolder
83  assert(size_ == D);
84 #endif
85  return * reinterpret_cast<typename AlgebraicROOTObject<D,D>::SymMatrix *>(measuredErrors_);
86  }
87 
90 
91 
92  template<unsigned int D> void dump() ;
93  private:
94 #ifdef Debug_KfComponentsHolder
95  uint16_t size_;
96 #endif
100 
101  template<unsigned int D>
102  void genericFill_(const TrackingRecHit &hit);
103 
104 };
105 
106 
107 template<unsigned int D>
116 {
117 #ifdef Debug_KfComponentsHolder
118  assert(size_ == 0); // which means it was uninitialized
119  size_ = D;
120 #endif
121  params_ = params;
122  errors_ = errors;
128 }
129 
130 template<unsigned int D>
132  using namespace std;
133  cout << "Params my: " << params<D>() << endl;
134  cout << " tsos: " << tsosLocalParameters() << endl;
135  cout << " meas: " << measuredParams<D>() << endl;
136  cout << "Errors my:\n" << errors<D>() << endl;
137  cout << " tsos:\n" << tsosLocalErrors() << endl;
138  cout << " meas:\n" << measuredErrors<D>() << endl;
139  cout << "Projection:\n" << projection<D>() << endl;
140 }
141 
142 #ifdef Debug_KfComponentsHolder
143 // undef it so we don't pollute someone else's code.
144 #undef Debug_KfComponentsHolder
145 #endif
146 
147 #endif
148 
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.
AlgebraicROOTObject< D, D >::SymMatrix & measuredErrors()
void genericFill_(const TrackingRecHit &hit)
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
AlgebraicROOTObject< D, 5 >::Matrix projection()
AlgebraicROOTObject< D >::Vector & params()
ROOT::Math::SVector< double, D1 > Vector
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const AlgebraicVector5 & tsosLocalParameters() const
const AlgebraicSymMatrix55 * tsosLocalErrors_
AlgebraicROOTObject< D >::Vector & measuredParams()
Definition: errors.py:1
AlgebraicROOTObject< D, D >::SymMatrix & errors()
const AlgebraicSymMatrix55 & tsosLocalErrors() const
ProjectMatrix< double, 5, D > & projFunc()
const AlgebraicVector5 * tsosLocalParameters_