42 for (vector<TrajectoryMeasurement>::iterator measurement = measC.begin(); measurement != measC.end(); ++measurement) {
43 if ((*measurement).recHit()->isValid()) {
45 bestMeasurement = &(*measurement);
46 validMeasurements.push_back(&(*measurement));
52 if (NumValidMeas <= 1) {
53 LogTrace(metname) <<
"MuonBestMeasurement: just " << NumValidMeas <<
" valid measurement ";
54 return bestMeasurement;
58 double minChi2PerNDoF = 1.E6;
61 for (measurement = validMeasurements.begin(); measurement != validMeasurements.end(); measurement++) {
65 pair<double, int> chi2Info = lookAtSubRecHits(*measurement, propagator);
67 double chi2PerNDoF = chi2Info.first / chi2Info.second;
68 LogTrace(metname) <<
" The measurement has a chi2/npts " << chi2PerNDoF <<
" with dof = " << chi2Info.second
69 <<
" \n Till now the best chi2 is " << minChi2PerNDoF;
71 if (chi2PerNDoF && chi2PerNDoF < minChi2PerNDoF) {
72 minChi2PerNDoF = chi2PerNDoF;
73 bestMeasurement = *measurement;
76 LogTrace(metname) <<
"The final best chi2 is " << minChi2PerNDoF << endl;
77 return bestMeasurement;
84 unsigned int npts = 0;
89 std::pair<bool, double> sing_chi2 =
90 estimator()->estimate(predState, *(muonRecHit.get()));
92 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
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)
tuple Chi2MeasurementEstimator