CMS 3D CMS Logo

MuonBestMeasurementFinder Class Reference

Algorithmic class to get best measurement from a list of TM the chi2 cut for the MeasurementEstimator is huge since should not be used. More...

#include <RecoMuon/TrackingTools/interface/MuonBestMeasurementFinder.h>

List of all members.

Public Member Functions

const MeasurementEstimatorestimator () const
TrajectoryMeasurementfindBestMeasurement (std::vector< TrajectoryMeasurement > &measC, const Propagator *propagator)
 return the Tm with the best chi2: no cut applied.
std::pair< double, intlookAtSubRecHits (TrajectoryMeasurement *measurement, const Propagator *propagator)
 MuonBestMeasurementFinder ()
 Constructor.
virtual ~MuonBestMeasurementFinder ()
 Destructor.

Private Types

typedef std::vector
< TrajectoryMeasurement * > 
TMContainer
typedef TMContainer::iterator TMIterator

Private Attributes

const MeasurementEstimatortheEstimator


Detailed Description

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.

Date
2007/12/19 15:46:03
Revision
1.6
Author:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch>

S. Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>

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.

Date
2007/12/19 15:46:40
Revision
1.14
Author:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch>

S. Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>

Definition at line 26 of file MuonBestMeasurementFinder.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

MuonBestMeasurementFinder::MuonBestMeasurementFinder (  ) 

Constructor.

Definition at line 31 of file MuonBestMeasurementFinder.cc.

References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, and theEstimator.

00031                                                     {
00032   
00033   theEstimator = new Chi2MeasurementEstimator(100000.);
00034 }

MuonBestMeasurementFinder::~MuonBestMeasurementFinder (  )  [virtual]

Destructor.

Definition at line 36 of file MuonBestMeasurementFinder.cc.

References theEstimator.

00036                                                      {
00037   delete theEstimator;
00038 }


Member Function Documentation

const MeasurementEstimator* MuonBestMeasurementFinder::estimator ( void   )  const [inline]

Definition at line 47 of file MuonBestMeasurementFinder.h.

References theEstimator.

Referenced by lookAtSubRecHits().

00047 { 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 lat::endl(), LogTrace, and lookAtSubRecHits().

Referenced by StandAloneMuonFilter::findBestMeasurements(), and CosmicMuonTrajectoryBuilder::findBestMeasurements().

00042                                                                             {
00043   
00044   const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder";
00045 
00046   TMContainer validMeasurements;
00047 
00048   TrajectoryMeasurement* bestMeasurement=0;
00049 
00050   // consider only valid TM
00051   int NumValidMeas=0;
00052   for ( vector<TrajectoryMeasurement>::iterator measurement = measC.begin(); 
00053         measurement!= measC.end(); ++measurement ) {
00054     if ((*measurement).recHit()->isValid()) {
00055       ++NumValidMeas;
00056       bestMeasurement = &(*measurement);
00057       validMeasurements.push_back( &(*measurement) );
00058     }
00059   }
00060 
00061   // If we have just one (or zero) valid meas, return it at once 
00062   // (or return null measurement)
00063   if(NumValidMeas<=1) {
00064     LogTrace(metname) << "MuonBestMeasurement: just " << NumValidMeas
00065                       << " valid measurement ";
00066     return bestMeasurement;
00067   }
00068 
00069   TMIterator measurement;
00070   double minChi2PerNDoF=1.E6;
00071 
00072   // if there are more than one valid measurement, then sort them.
00073   for ( measurement = validMeasurements.begin(); measurement!= validMeasurements.end(); measurement++ ) {
00074 
00075     TransientTrackingRecHit::ConstRecHitPointer muonRecHit = (*measurement)->recHit();
00076     
00077     // FIXME!! FIXME !! FIXME !!
00078     pair<double,int> chi2Info = lookAtSubRecHits(*measurement, propagator);
00079 
00080     double chi2PerNDoF = chi2Info.first/chi2Info.second;
00081     LogTrace(metname) << " The measurement has a chi2/npts " << chi2PerNDoF << " with dof = " << chi2Info.second
00082                       << " \n Till now the best chi2 is " << minChi2PerNDoF;
00083     
00084     if ( chi2PerNDoF && chi2PerNDoF<minChi2PerNDoF ) {
00085       minChi2PerNDoF = chi2PerNDoF;     
00086       bestMeasurement = *measurement;
00087     }
00088     
00089   }
00090   LogTrace(metname)<<"The final best chi2 is "<<minChi2PerNDoF<<endl;
00091   return bestMeasurement;
00092 }

pair< double, int > MuonBestMeasurementFinder::lookAtSubRecHits ( TrajectoryMeasurement measurement,
const Propagator propagator 
)

Definition at line 95 of file MuonBestMeasurementFinder.cc.

References lat::endl(), MeasurementEstimator::estimate(), estimator(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::isValid(), LogTrace, TrajectoryMeasurement::predictedState(), Propagator::propagate(), TrajectoryMeasurement::recHit(), and HLT_VtxMuL3::result.

Referenced by findBestMeasurement().

00096                                                                                           {
00097   
00098   const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder";
00099 
00100   unsigned int npts=0;
00101   double thisChi2 = 0.;
00102 
00103   TransientTrackingRecHit::ConstRecHitPointer muonRecHit = measurement->recHit();
00104 
00105   
00106   // ask for the 2D-segments/2D-rechit
00107   TransientTrackingRecHit::ConstRecHitContainer rhits_list = muonRecHit->transientHits();
00108   
00109   LogTrace(metname)<<"Number of rechits in the measurement rechit: "<<rhits_list.size()<<endl;
00110   
00111   // loop over them
00112   for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator rhit = rhits_list.begin(); 
00113        rhit!= rhits_list.end(); ++rhit)
00114     if ((*rhit)->isValid() ) {
00115       LogTrace(metname)<<"Rechit dimension: "<<(*rhit)->dimension()<<endl;
00116       npts+=(*rhit)->dimension();
00117       
00118       TrajectoryStateOnSurface predState;
00119       
00120       if (!( (*rhit)->geographicalId() == muonRecHit->geographicalId() ) ){
00121         predState = propagator->propagate(*measurement->predictedState().freeState(),
00122                                           (*rhit)->det()->surface()); 
00123       }
00124       else predState = measurement->predictedState();  
00125       
00126       if ( predState.isValid() ) { 
00127         std::pair<bool,double> sing_chi2 = estimator()->estimate( predState, *((*rhit).get()));
00128         thisChi2 += sing_chi2.second ;
00129         LogTrace(metname) << " single incremental chi2: " << sing_chi2.second;
00130       }
00131     }
00132   
00133   pair<double,int> result = pair<double,int>(thisChi2,npts);
00134   return result;
00135 }


Member Data Documentation

const MeasurementEstimator* MuonBestMeasurementFinder::theEstimator [private]

Definition at line 53 of file MuonBestMeasurementFinder.h.

Referenced by estimator(), MuonBestMeasurementFinder(), and ~MuonBestMeasurementFinder().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:40 2009 for CMSSW by  doxygen 1.5.4