50 for ( vector<TrajectoryMeasurement>::iterator measurement = measC.begin();
51 measurement!= measC.end(); ++measurement ) {
52 if ((*measurement).recHit()->isValid()) {
54 bestMeasurement = &(*measurement);
55 validMeasurements.push_back( &(*measurement) );
62 LogTrace(metname) <<
"MuonBestMeasurement: just " << NumValidMeas
63 <<
" valid measurement ";
64 return bestMeasurement;
68 double minChi2PerNDoF=1.E6;
71 for ( measurement = validMeasurements.begin(); measurement!= validMeasurements.end(); measurement++ ) {
76 pair<double,int> chi2Info = lookAtSubRecHits(*measurement, propagator);
78 double chi2PerNDoF = chi2Info.first/chi2Info.second;
79 LogTrace(metname) <<
" The measurement has a chi2/npts " << chi2PerNDoF <<
" with dof = " << chi2Info.second
80 <<
" \n Till now the best chi2 is " << minChi2PerNDoF;
82 if ( chi2PerNDoF && chi2PerNDoF<minChi2PerNDoF ) {
83 minChi2PerNDoF = chi2PerNDoF;
84 bestMeasurement = *measurement;
88 LogTrace(metname)<<
"The final best chi2 is "<<minChi2PerNDoF<<endl;
89 return bestMeasurement;
103 std::pair<bool, double> sing_chi2 = estimator()->estimate( predState, *(muonRecHit.get()));
105 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::shared_ptr< TrackingRecHit const > ConstRecHitPointer
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)