CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MRHChi2MeasurementEstimator.cc
Go to the documentation of this file.
10 
12  const TrackingRecHit& aRecHit) const {
13  switch (aRecHit.dimension()) {
14  case 1:
15  return estimate<1>(tsos, aRecHit);
16  case 2:
17  return estimate<2>(tsos, aRecHit);
18  //avoid the not-(1D or 2D) hit due to the final sum
19  //supposing all the hits inside of a MRH have the same dimension
20  case 3:
21  case 4:
22  case 5: {
23  LogDebug("MRHChi2MeasurementEstimator") << "WARNING:The hit is not 1D either 2D:"
24  << " does not count in the MRH Chi2 estimation.";
25  double est = 0.0;
26  return HitReturnType(false, est);
27  }
28  }
29  throw cms::Exception("Rec hit of invalid dimension (not 1,2,3,4,5)")
30  << "The value was " << aRecHit.dimension() << ", type is " << typeid(aRecHit).name() << "\n";
31 }
32 
33 //---------------------------------------------------------------------------------------------------------------
34 template <unsigned int N>
35 std::pair<bool, double> MRHChi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
36  const TrackingRecHit& aRecHit) const {
37  LogDebug("MRHChi2MeasurementEstimator") << "Calling MRHChi2MeasurementEstimator";
38  SiTrackerMultiRecHit const& mHit = dynamic_cast<SiTrackerMultiRecHit const&>(aRecHit);
39  double est = 0;
40 
41  double annealing = mHit.getAnnealingFactor();
42  LogDebug("MRHChi2MeasurementEstimator") << "Current annealing factor is " << annealing;
43 
44  std::vector<const TrackingRecHit*> components = mHit.recHits();
45  LogDebug("MRHChi2MeasurementEstimator") << "this hit has " << components.size() << " components";
46 
47  int iComp = 0;
48  for (std::vector<const TrackingRecHit*>::const_iterator iter = components.begin(); iter != components.end();
49  iter++, iComp++) {
50  // define variables that will be used to setup the KfComponentsHolder
52  typename AlgebraicROOTObject<N>::Vector r, rMeas;
55  const AlgebraicSymMatrix55& C = (tsos.localError().matrix());
56 
57  // setup the holder with the correct dimensions and get the values
58  KfComponentsHolder holder;
59  holder.template setup<N>(&r, &V, &pf, &rMeas, &VMeas, x, C);
60  (**iter).getKfComponents(holder);
61 
62  r -= rMeas;
63  V = V * annealing + VMeas;
64  bool ierr = invertPosDefMatrix(V);
65  if (!ierr) {
66  edm::LogError("SiTrackerMultiRecHitUpdator")
67  << "SiTrackerMultiRecHitUpdator::ComputeParameters2dim: W not valid!" << std::endl;
68  }
69 
70  LogDebug("MRHChi2MeasurementEstimator") << "Hit with weight " << mHit.weight(iComp);
71  est += ROOT::Math::Similarity(r, V) * mHit.weight(iComp);
72  }
73 
74  return returnIt(est);
75 }
virtual int dimension() const =0
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
const LocalTrajectoryParameters & localParameters() const
virtual double getAnnealingFactor() const
Log< level::Error, false > LogError
float weight(unsigned int i) const
AlgebraicVector5 vector() const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t V
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &tsos, const TrackingRecHit &aRecHit) const override
std::pair< bool, double > returnIt(double est) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
ROOT::Math::SVector< double, D1 > Vector
std::pair< bool, double > HitReturnType
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
#define LogDebug(id)