Go to the documentation of this file.00001 #include "TrackingTools/GsfTracking/interface/GsfChi2MeasurementEstimator.h"
00002
00003
00004 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00005 #include "TrackingTools/GsfTracking/interface/PosteriorWeightsCalculator.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007
00008 std::pair<bool,double>
00009 GsfChi2MeasurementEstimator::estimate (const TrajectoryStateOnSurface& tsos,
00010 const TransientTrackingRecHit& hit) const {
00011
00012 std::vector<TrajectoryStateOnSurface> tsvec = tsos.components();
00013 if (tsvec.empty()) {
00014 edm::LogError("GsfChi2MeasurementEstimator")
00015 << "Trying to calculate chi2 of hit with respect to empty mixture!";
00016 return std::make_pair(false,0.);
00017 }
00018
00019 std::vector<double> weights = PosteriorWeightsCalculator(tsvec).weights(hit);
00020 if ( weights.empty() ) return std::make_pair(false,0);
00021
00022
00023 double chi2 = 0.;
00024 int i = 0;
00025 for (std::vector<TrajectoryStateOnSurface>::const_iterator it = tsvec.begin();
00026 it != tsvec.end(); it++) {
00027 chi2 += weights[i++] * theEstimator.estimate(*it,hit).second;
00028 }
00029
00030
00031 return returnIt(chi2);
00032 }
00033