CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
4 
7 #include <stdint.h>
8 
9 class TrackingRecHit;
10 
11 #define Debug_KfComponentsHolder
12 
14  public:
16  {
17 #ifdef Debug_KfComponentsHolder
18  size_ = 0;
19 #endif
20  }
21 
22  template <unsigned int D>
23  void setup(
32  ) ;
33 
34 
35  // backward compatible call
36  template <unsigned int D>
37  void setup(
45  ) ;
46 
47 
48  template <unsigned int D>
50 #ifdef Debug_KfComponentsHolder
51  assert(size_ == D);
52 #endif
53  return * reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(params_);
54  }
55 
56  template <unsigned int D>
58 #ifdef Debug_KfComponentsHolder
59  assert(size_ == D);
60 #endif
61  return * reinterpret_cast<typename AlgebraicROOTObject<D,D>::SymMatrix *>(errors_);
62  }
63 
64  template <unsigned int D>
66 #ifdef Debug_KfComponentsHolder
67  assert(size_ == D);
68 #endif
69  return * reinterpret_cast<typename AlgebraicROOTObject<D,5>::Matrix *>(projection_);
70  }
71 
72  template <unsigned int D>
74 #ifdef Debug_KfComponentsHolder
75  assert(size_ == D);
76 #endif
77  return * reinterpret_cast< ProjectMatrix<double,5,D> *>(projFunc_);
78  }
79 
81  void genericFill(const TrackingRecHit &hit);
82 
83  template <unsigned int D>
85 #ifdef Debug_KfComponentsHolder
86  assert(size_ == D);
87 #endif
88  return * reinterpret_cast<typename AlgebraicROOTObject<D>::Vector *>(measuredParams_);
89  }
90 
91  template <unsigned int D>
93 #ifdef Debug_KfComponentsHolder
94  assert(size_ == D);
95 #endif
96  return * reinterpret_cast<typename AlgebraicROOTObject<D,D>::SymMatrix *>(measuredErrors_);
97  }
98 
101 
102  bool useProjFunc() const { return useProjFunc_;}
103  void doUseProjFunc() { useProjFunc_ = true; }
104 
105  template<unsigned int D> void dump() ;
106  private:
107 #ifdef Debug_KfComponentsHolder
108  uint16_t size_;
109 #endif
113 
115 
116  template<unsigned int D>
117  void genericFill_(const TrackingRecHit &hit);
118 
119 
120 };
121 
122 
123 template<unsigned int D>
125  typename AlgebraicROOTObject<D>::Vector *params,
127  typename AlgebraicROOTObject<D,5>::Matrix *projection,
128  ProjectMatrix<double,5,D> *projFunc,
129  typename AlgebraicROOTObject<D>::Vector *measuredParams,
130  typename AlgebraicROOTObject<D,D>::SymMatrix *measuredErrors,
131  const AlgebraicVector5 & tsosLocalParameters,
132  const AlgebraicSymMatrix55 & tsosLocalErrors)
133 {
134 #ifdef Debug_KfComponentsHolder
135  assert(size_ == 0); // which means it was uninitialized
136  size_ = D;
137 #endif
138  params_ = params;
139  errors_ = errors;
146 }
147 
148 // backward compatible
149 template<unsigned int D>
151  typename AlgebraicROOTObject<D>::Vector *params,
153  typename AlgebraicROOTObject<D,5>::Matrix *projection,
154  typename AlgebraicROOTObject<D>::Vector *measuredParams,
155  typename AlgebraicROOTObject<D,D>::SymMatrix *measuredErrors,
156  const AlgebraicVector5 & tsosLocalParameters,
157  const AlgebraicSymMatrix55 & tsosLocalErrors)
158 {
159 #ifdef Debug_KfComponentsHolder
160  assert(size_ == 0); // which means it was uninitialized
161  size_ = D;
162 #endif
163  static ProjectMatrix<double,5,D> dummy;
164  params_ = params;
165  errors_ = errors;
167  projFunc_ = &dummy;
172 }
173 
174 
175 template<unsigned int D>
177  using namespace std;
178  cout << "Params my: " << params<D>() << endl;
179  cout << " tsos: " << tsosLocalParameters() << endl;
180  cout << " meas: " << measuredParams<D>() << endl;
181  cout << "Errors my:\n" << errors<D>() << endl;
182  cout << " tsos:\n" << tsosLocalErrors() << endl;
183  cout << " meas:\n" << measuredErrors<D>() << endl;
184  cout << "Projection:\n" << projection<D>() << endl;
185 }
186 
187 #ifdef Debug_KfComponentsHolder
188 // undef it so we don't pollute someone else's code.
189 #undef Debug_KfComponentsHolder
190 #endif
191 
192 #endif
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
bool useProjFunc() const
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
void setup(typename AlgebraicROOTObject< D >::Vector *params, typename AlgebraicROOTObject< D, D >::SymMatrix *errors, typename AlgebraicROOTObject< D, 5 >::Matrix *projection, ProjectMatrix< double, 5, D > *projFunc, typename AlgebraicROOTObject< D >::Vector *measuredParams, typename AlgebraicROOTObject< D, D >::SymMatrix *measuredErrors, const AlgebraicVector5 &tsosLocalParameters, const AlgebraicSymMatrix55 &tsosLocalErrors)
AlgebraicROOTObject< D >::Vector & params()
ROOT::Math::SVector< double, D1 > Vector
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const AlgebraicVector5 & tsosLocalParameters() const
const AlgebraicSymMatrix55 * tsosLocalErrors_
AlgebraicROOTObject< D >::Vector & measuredParams()
tuple cout
Definition: gather_cfg.py:121
AlgebraicROOTObject< D, D >::SymMatrix & errors()
AlgebraicROOTObject< D, 5 >::Matrix & projection()
const AlgebraicSymMatrix55 & tsosLocalErrors() const
ProjectMatrix< double, 5, D > & projFunc()
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
const AlgebraicVector5 * tsosLocalParameters_