test
CMS 3D CMS Logo

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