CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfChi2MeasurementEstimator.cc
Go to the documentation of this file.
2 
3 // #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
7 
8 std::pair<bool,double>
10  const TrackingRecHit& hit) const {
11 
12  std::vector<TrajectoryStateOnSurface> tsvec = tsos.components();
13  if (tsvec.empty()) {
14  edm::LogError("GsfChi2MeasurementEstimator")
15  << "Trying to calculate chi2 of hit with respect to empty mixture!";
16  return std::make_pair(false,0.);
17  }
18 
19  std::vector<double> weights = PosteriorWeightsCalculator(tsvec).weights(hit);
20  if ( weights.empty() ) return std::make_pair(false,0);
21 
22  // Chi2MeasurementEstimator est(chiSquaredCut());
23  double chi2 = 0.;
24  int i = 0;
25  for (std::vector<TrajectoryStateOnSurface>::const_iterator it = tsvec.begin();
26  it != tsvec.end(); it++) {
27  chi2 += weights[i++] * theEstimator.estimate(*it,hit).second;
28  }
29  // Done - normalisation of weights is ensured
30  // by PosteriorWeightsCalculator
31  return returnIt(chi2);
32 }
33 
int i
Definition: DBlmapReader.cc:9
std::pair< bool, double > returnIt(double est) const
std::vector< double > weights(const TrackingRecHit &tsos) const
Create random state.
Chi2MeasurementEstimator theEstimator
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
std::vector< TrajectoryStateOnSurface > components() const