52 for ( vector<TrajectoryMeasurement>::iterator measurement = measC.begin();
53 measurement!= measC.end(); ++measurement ) {
54 if ((*measurement).recHit()->isValid()) {
56 bestMeasurement = &(*measurement);
57 validMeasurements.push_back( &(*measurement) );
64 LogTrace(metname) <<
"MuonBestMeasurement: just " << NumValidMeas
65 <<
" valid measurement ";
66 return bestMeasurement;
70 double minChi2PerNDoF=1.E6;
73 for ( measurement = validMeasurements.begin(); measurement!= validMeasurements.end(); measurement++ ) {
78 pair<double,int> chi2Info = lookAtSubRecHits(*measurement, propagator);
80 double chi2PerNDoF = chi2Info.first/chi2Info.second;
81 LogTrace(metname) <<
" The measurement has a chi2/npts " << chi2PerNDoF <<
" with dof = " << chi2Info.second
82 <<
" \n Till now the best chi2 is " << minChi2PerNDoF;
84 if ( chi2PerNDoF && chi2PerNDoF<minChi2PerNDoF ) {
85 minChi2PerNDoF = chi2PerNDoF;
86 bestMeasurement = *measurement;
90 LogTrace(metname)<<
"The final best chi2 is "<<minChi2PerNDoF<<endl;
91 return bestMeasurement;
105 std::pair<bool, double> sing_chi2 = estimator()->estimate( predState, *(muonRecHit.get()));
107 std::pair<double, int>
result = pair<double, int>(sing_chi2.second, npts);
TMContainer::iterator TMIterator
virtual ~MuonBestMeasurementFinder()
Destructor.
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & recHit() const
const std::string metname
std::vector< TrajectoryMeasurement * > TMContainer
tuple Chi2MeasurementEstimator
MuonBestMeasurementFinder()
Constructor.
TrajectoryMeasurement * findBestMeasurement(std::vector< TrajectoryMeasurement > &measC, const Propagator *propagator)
return the Tm with the best chi2: no cut applied.
std::pair< double, int > lookAtSubRecHits(TrajectoryMeasurement *measurement, const Propagator *propagator)