CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Chi2MeasurementEstimator.cc
Go to the documentation of this file.
7 
8 namespace {
9  template <unsigned int D>
10  double lestimate(const TrajectoryStateOnSurface& tsos, const TrackingRecHit& aRecHit) {
11  typedef typename AlgebraicROOTObject<D, 5>::Matrix MatD5;
12  typedef typename AlgebraicROOTObject<5, D>::Matrix Mat5D;
13  typedef typename AlgebraicROOTObject<D, D>::SymMatrix SMatDD;
14  typedef typename AlgebraicROOTObject<D>::Vector VecD;
15  using ROOT::Math::SMatrixNoInit;
16 
17  VecD r, rMeas;
18  SMatDD R(SMatrixNoInit{}), RMeas(SMatrixNoInit{});
19  ProjectMatrix<double, 5, D> dummyProjFunc;
20  auto&& v = tsos.localParameters().vector();
21  auto&& m = tsos.localError().matrix();
22  KfComponentsHolder holder;
23  holder.template setup<D>(&r, &R, &dummyProjFunc, &rMeas, &RMeas, v, m);
24  aRecHit.getKfComponents(holder);
25 
26  R += RMeas;
28  return ROOT::Math::Similarity(r - rMeas, R);
29  }
30 } // namespace
31 
33  const TrackingRecHit& aRecHit) const {
34  switch (aRecHit.dimension()) {
35  case 1:
36  return returnIt(lestimate<1>(tsos, aRecHit));
37  case 2:
38  return returnIt(lestimate<2>(tsos, aRecHit));
39  case 3:
40  return returnIt(lestimate<3>(tsos, aRecHit));
41  case 4:
42  return returnIt(lestimate<4>(tsos, aRecHit));
43  case 5:
44  return returnIt(lestimate<5>(tsos, aRecHit));
45  }
46  throw cms::Exception("RecHit of invalid size (not 1,2,3,4,5)");
47 }
virtual int dimension() const =0
virtual void getKfComponents(KfComponentsHolder &holder) const
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
const LocalTrajectoryParameters & localParameters() const
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
AlgebraicVector5 vector() const
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
std::pair< bool, double > returnIt(double est) const
ROOT::Math::SVector< double, D1 > Vector