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 #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>
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
KfComponentsHolder::projection
AlgebraicROOTObject< D, 5 >::Matrix projection()
Definition: KfComponentsHolder.h:47
KfComponentsHolder::projFunc
ProjectMatrix< double, 5, D > & projFunc()
Definition: KfComponentsHolder.h:56
AlgebraicObjects.h
ProjectMatrix.h
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
gather_cfg.cout
cout
Definition: gather_cfg.py:144
KfComponentsHolder::tsosLocalErrors
const AlgebraicSymMatrix55 & tsosLocalErrors() const
Definition: KfComponentsHolder.h:83
AlgebraicROOTObject::SymMatrix
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
Definition: AlgebraicROOTObjects.h:68
cms::cuda::assert
assert(be >=bs)
KfComponentsHolder::genericFill_
void genericFill_(const TrackingRecHit &hit)
Definition: KfComponentsHolder.cc:7
KfComponentsHolder::tsosLocalParameters
const AlgebraicVector5 & tsosLocalParameters() const
Definition: KfComponentsHolder.h:82
KfComponentsHolder::projFunc_
void * projFunc_
Definition: KfComponentsHolder.h:92
KfComponentsHolder::genericFill
void genericFill(const TrackingRecHit &hit)
Fill in datamembers from a generic TrackingRecHit using the CLHEP matrices.
Definition: KfComponentsHolder.cc:22
errors
Definition: errors.py:1
KfComponentsHolder::dump
void dump()
Definition: KfComponentsHolder.h:122
KfComponentsHolder::measuredParams
AlgebraicROOTObject< D >::Vector & measuredParams()
Definition: KfComponentsHolder.h:67
KfComponentsHolder::params_
void * params_
Definition: KfComponentsHolder.h:92
AlgebraicROOTObject::Matrix
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
Definition: AlgebraicROOTObjects.h:69
KfComponentsHolder::measuredErrors_
void * measuredErrors_
Definition: KfComponentsHolder.h:92
KfComponentsHolder::setup
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)
Definition: KfComponentsHolder.h:101
KfComponentsHolder::measuredErrors
AlgebraicROOTObject< D, D >::SymMatrix & measuredErrors()
Definition: KfComponentsHolder.h:75
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
KfComponentsHolder
Definition: KfComponentsHolder.h:13
KfComponentsHolder::measuredParams_
void * measuredParams_
Definition: KfComponentsHolder.h:92
TrackingRecHit
Definition: TrackingRecHit.h:21
KfComponentsHolder::errors_
void * errors_
Definition: KfComponentsHolder.h:92
KfComponentsHolder::KfComponentsHolder
KfComponentsHolder()
Definition: KfComponentsHolder.h:15
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
std
Definition: JetResolutionObject.h:76
KfComponentsHolder::tsosLocalParameters_
const AlgebraicVector5 * tsosLocalParameters_
Definition: KfComponentsHolder.h:93
KfComponentsHolder::tsosLocalErrors_
const AlgebraicSymMatrix55 * tsosLocalErrors_
Definition: KfComponentsHolder.h:94
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
ProjectMatrix
Definition: ProjectMatrix.h:8
AlgebraicROOTObject::Vector
ROOT::Math::SVector< double, D1 > Vector
Definition: AlgebraicROOTObjects.h:67
KfComponentsHolder::params
AlgebraicROOTObject< D >::Vector & params()
Definition: KfComponentsHolder.h:31
hit
Definition: SiStripHitEffFromCalibTree.cc:88
KfComponentsHolder::errors
AlgebraicROOTObject< D, D >::SymMatrix & errors()
Definition: KfComponentsHolder.h:39