CMS 3D CMS Logo

GsfChi2MeasurementEstimator.cc
Go to the documentation of this file.
3 
7 
9  const TrackingRecHit& hit) const {
10  GetComponents comps(tsos);
11  auto const& tsvec = comps();
12  if (tsvec.empty()) {
13  edm::LogError("GsfChi2MeasurementEstimator") << "Trying to calculate chi2 of hit with respect to empty mixture!";
14  return std::make_pair(false, 0.);
15  }
16 
17  auto const& weights = PosteriorWeightsCalculator(tsvec).weights(hit);
18  if (weights.empty())
19  return std::make_pair(false, 0);
20 
21  // Chi2MeasurementEstimator est(chiSquaredCut());
22  double chi2 = 0.;
23  int i = 0;
24  for (auto const& ts : tsvec)
25  chi2 += weights[i++] * theEstimator.estimate(ts, hit).second;
26  // Done - normalisation of weights is ensured
27  // by PosteriorWeightsCalculator
28  return returnIt(chi2);
29 }
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Log< level::Error, false > LogError
Chi2MeasurementEstimator theEstimator
std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
std::vector< double > weights(const TrackingRecHit &tsos) const
Create random state.
std::pair< bool, double > returnIt(double est) const