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 template<unsigned int D>
150  using namespace std;
151  cout << "Params my: " << params<D>() << endl;
152  cout << " tsos: " << tsosLocalParameters() << endl;
153  cout << " meas: " << measuredParams<D>() << endl;
154  cout << "Errors my:\n" << errors<D>() << endl;
155  cout << " tsos:\n" << tsosLocalErrors() << endl;
156  cout << " meas:\n" << measuredErrors<D>() << endl;
157  cout << "Projection:\n" << projection<D>() << endl;
158 }
159 
160 #ifdef Debug_KfComponentsHolder
161 // undef it so we don't pollute someone else's code.
162 #undef Debug_KfComponentsHolder
163 #endif
164 
165 #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
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const AlgebraicVector5 & tsosLocalParameters() const
const AlgebraicSymMatrix55 * tsosLocalErrors_
AlgebraicROOTObject< D >::Vector & measuredParams()
tuple cout
Definition: gather_cfg.py:121
volatile std::atomic< bool > shutdown_flag false
AlgebraicROOTObject< D, D >::SymMatrix & errors()
AlgebraicROOTObject< D, 5 >::Matrix & projection()
const AlgebraicSymMatrix55 & tsosLocalErrors() const
ProjectMatrix< double, 5, D > & projFunc()
const AlgebraicVector5 * tsosLocalParameters_