#include <MuonBestMeasurementFinder.h>
Public Member Functions | |
const MeasurementEstimator * | estimator () const |
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) |
MuonBestMeasurementFinder () | |
Constructor. | |
virtual | ~MuonBestMeasurementFinder () |
Destructor. | |
Private Types | |
typedef std::vector < TrajectoryMeasurement * > | TMContainer |
typedef TMContainer::iterator | TMIterator |
Private Attributes | |
const MeasurementEstimator * | theEstimator |
Algorithmic class to get best measurement from a list of TM the chi2 cut for the MeasurementEstimator is huge since should not be used. The aim of this class is to return the "best" measurement according to the chi2, but without any cut. The decision whether to use or not the measurement is taken in the caller class. The evaluation is made (in hard-code way) with the granularity = 1. Where the granularity is the one defined in the MuonTrajectoyUpdatorClass.
Algorithmic class to get best measurement from a list of TM the chi2 cut for the MeasurementEstimator is huge since should not be used. The aim of this class is to return the "best" measurement according to the chi2, but without any cut. The decision whether to use or not the measurement is taken in the caller class. The evaluation is made (in hard-code way) with the granularity = 1. Where the granularity is the one defined in the MuonTrajectoyUpdatorClass.
Definition at line 26 of file MuonBestMeasurementFinder.h.
typedef std::vector<TrajectoryMeasurement*> MuonBestMeasurementFinder::TMContainer [private] |
Definition at line 27 of file MuonBestMeasurementFinder.h.
typedef TMContainer::iterator MuonBestMeasurementFinder::TMIterator [private] |
Definition at line 28 of file MuonBestMeasurementFinder.h.
MuonBestMeasurementFinder::MuonBestMeasurementFinder | ( | ) |
Constructor.
Definition at line 31 of file MuonBestMeasurementFinder.cc.
References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator.
{ theEstimator = new Chi2MeasurementEstimator(100000.); }
MuonBestMeasurementFinder::~MuonBestMeasurementFinder | ( | ) | [virtual] |
const MeasurementEstimator* MuonBestMeasurementFinder::estimator | ( | void | ) | const [inline] |
Definition at line 47 of file MuonBestMeasurementFinder.h.
References theEstimator.
{ return theEstimator;}
TrajectoryMeasurement * MuonBestMeasurementFinder::findBestMeasurement | ( | std::vector< TrajectoryMeasurement > & | measC, |
const Propagator * | propagator | ||
) |
return the Tm with the best chi2: no cut applied.
Definition at line 41 of file MuonBestMeasurementFinder.cc.
References LogTrace, and metname.
Referenced by StandAloneMuonFilter::findBestMeasurements(), and CosmicMuonTrajectoryBuilder::findBestMeasurements().
{ const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder"; TMContainer validMeasurements; TrajectoryMeasurement* bestMeasurement=0; // consider only valid TM int NumValidMeas=0; for ( vector<TrajectoryMeasurement>::iterator measurement = measC.begin(); measurement!= measC.end(); ++measurement ) { if ((*measurement).recHit()->isValid()) { ++NumValidMeas; bestMeasurement = &(*measurement); validMeasurements.push_back( &(*measurement) ); } } // If we have just one (or zero) valid meas, return it at once // (or return null measurement) if(NumValidMeas<=1) { LogTrace(metname) << "MuonBestMeasurement: just " << NumValidMeas << " valid measurement "; return bestMeasurement; } TMIterator measurement; double minChi2PerNDoF=1.E6; // if there are more than one valid measurement, then sort them. for ( measurement = validMeasurements.begin(); measurement!= validMeasurements.end(); measurement++ ) { TransientTrackingRecHit::ConstRecHitPointer muonRecHit = (*measurement)->recHit(); // FIXME!! FIXME !! FIXME !! pair<double,int> chi2Info = lookAtSubRecHits(*measurement, propagator); double chi2PerNDoF = chi2Info.first/chi2Info.second; LogTrace(metname) << " The measurement has a chi2/npts " << chi2PerNDoF << " with dof = " << chi2Info.second << " \n Till now the best chi2 is " << minChi2PerNDoF; if ( chi2PerNDoF && chi2PerNDoF<minChi2PerNDoF ) { minChi2PerNDoF = chi2PerNDoF; bestMeasurement = *measurement; } } LogTrace(metname)<<"The final best chi2 is "<<minChi2PerNDoF<<endl; return bestMeasurement; }
pair< double, int > MuonBestMeasurementFinder::lookAtSubRecHits | ( | TrajectoryMeasurement * | measurement, |
const Propagator * | propagator | ||
) |
Definition at line 95 of file MuonBestMeasurementFinder.cc.
References metname, TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), and query::result.
{ const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder"; unsigned int npts=0; // unused double thisChi2 = 0.; TransientTrackingRecHit::ConstRecHitPointer muonRecHit = measurement->recHit(); TrajectoryStateOnSurface predState = measurement->predictedState(); // temporarily introduced by DT std::pair<bool, double> sing_chi2 = estimator()->estimate( predState, *(muonRecHit.get())); // temporarily introduced by DT npts = 1; // temporarily introduced by DT std::pair<double, int> result = pair<double, int>(sing_chi2.second, npts); // temporarily introduced by DT // // ask for the 2D-segments/2D-rechit // temporarily excluded by DT // TransientTrackingRecHit::ConstRecHitContainer rhits_list = muonRecHit->transientHits(); // LogTrace(metname)<<"Number of rechits in the measurement rechit: "<<rhits_list.size()<<endl; // // loop over them // for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator rhit = rhits_list.begin(); // rhit!= rhits_list.end(); ++rhit) // if ((*rhit)->isValid() ) { // LogTrace(metname)<<"Rechit dimension: "<<(*rhit)->dimension()<<endl; // npts+=(*rhit)->dimension(); // TrajectoryStateOnSurface predState; // if (!( (*rhit)->geographicalId() == muonRecHit->geographicalId() ) ){ // predState = propagator->propagate(*measurement->predictedState().freeState(), // (*rhit)->det()->surface()); // } // else predState = measurement->predictedState(); // if ( predState.isValid() ) { // std::pair<bool,double> sing_chi2 = estimator()->estimate( predState, *((*rhit).get())); // thisChi2 += sing_chi2.second ; // LogTrace(metname) << " single incremental chi2: " << sing_chi2.second; // } // } // pair<double,int> result = pair<double,int>(thisChi2,npts); return result; }
const MeasurementEstimator* MuonBestMeasurementFinder::theEstimator [private] |
Definition at line 53 of file MuonBestMeasurementFinder.h.
Referenced by estimator().