CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
MuonBestMeasurementFinder Class Reference

#include <MuonBestMeasurementFinder.h>

Public Member Functions

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

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 ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch
S. Lacaprara - INFN Legnaro stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t

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:
2009/10/31 02:05:11
Revision:
1.16
Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch
S. Lacaprara - INFN Legnaro stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t

Definition at line 26 of file MuonBestMeasurementFinder.h.

Member Typedef Documentation

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 ( )
MuonBestMeasurementFinder::~MuonBestMeasurementFinder ( )
virtual

Destructor.

Definition at line 36 of file MuonBestMeasurementFinder.cc.

36  {
37  delete theEstimator;
38 }
const MeasurementEstimator * theEstimator

Member Function Documentation

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

Definition at line 47 of file MuonBestMeasurementFinder.h.

References theEstimator.

47 { return theEstimator;}
const MeasurementEstimator * 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 CosmicMuonTrajectoryBuilder::findBestMeasurements(), and StandAloneMuonFilter::findBestMeasurements().

42  {
43 
44  const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder";
45 
46  TMContainer validMeasurements;
47 
48  TrajectoryMeasurement* bestMeasurement=0;
49 
50  // consider only valid TM
51  int NumValidMeas=0;
52  for ( vector<TrajectoryMeasurement>::iterator measurement = measC.begin();
53  measurement!= measC.end(); ++measurement ) {
54  if ((*measurement).recHit()->isValid()) {
55  ++NumValidMeas;
56  bestMeasurement = &(*measurement);
57  validMeasurements.push_back( &(*measurement) );
58  }
59  }
60 
61  // If we have just one (or zero) valid meas, return it at once
62  // (or return null measurement)
63  if(NumValidMeas<=1) {
64  LogTrace(metname) << "MuonBestMeasurement: just " << NumValidMeas
65  << " valid measurement ";
66  return bestMeasurement;
67  }
68 
69  TMIterator measurement;
70  double minChi2PerNDoF=1.E6;
71 
72  // if there are more than one valid measurement, then sort them.
73  for ( measurement = validMeasurements.begin(); measurement!= validMeasurements.end(); measurement++ ) {
74 
75  TransientTrackingRecHit::ConstRecHitPointer muonRecHit = (*measurement)->recHit();
76 
77  // FIXME!! FIXME !! FIXME !!
78  pair<double,int> chi2Info = lookAtSubRecHits(*measurement, propagator);
79 
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;
83 
84  if ( chi2PerNDoF && chi2PerNDoF<minChi2PerNDoF ) {
85  minChi2PerNDoF = chi2PerNDoF;
86  bestMeasurement = *measurement;
87  }
88 
89  }
90  LogTrace(metname)<<"The final best chi2 is "<<minChi2PerNDoF<<endl;
91  return bestMeasurement;
92 }
const std::string metname
std::vector< TrajectoryMeasurement * > TMContainer
#define LogTrace(id)
std::pair< double, int > lookAtSubRecHits(TrajectoryMeasurement *measurement, const Propagator *propagator)
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.

96  {
97 
98  const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder";
99 
100  unsigned int npts=0;
101  // unused double thisChi2 = 0.;
102 
103  TransientTrackingRecHit::ConstRecHitPointer muonRecHit = measurement->recHit();
104  TrajectoryStateOnSurface predState = measurement->predictedState(); // temporarily introduced by DT
105  std::pair<bool, double> sing_chi2 = estimator()->estimate( predState, *(muonRecHit.get())); // temporarily introduced by DT
106  npts = 1; // temporarily introduced by DT
107  std::pair<double, int> result = pair<double, int>(sing_chi2.second, npts); // temporarily introduced by DT
108 
109 // // ask for the 2D-segments/2D-rechit // temporarily excluded by DT
110 // TransientTrackingRecHit::ConstRecHitContainer rhits_list = muonRecHit->transientHits();
111 
112 // LogTrace(metname)<<"Number of rechits in the measurement rechit: "<<rhits_list.size()<<endl;
113 
114 // // loop over them
115 // for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator rhit = rhits_list.begin();
116 // rhit!= rhits_list.end(); ++rhit)
117 // if ((*rhit)->isValid() ) {
118 // LogTrace(metname)<<"Rechit dimension: "<<(*rhit)->dimension()<<endl;
119 // npts+=(*rhit)->dimension();
120 
121 // TrajectoryStateOnSurface predState;
122 
123 // if (!( (*rhit)->geographicalId() == muonRecHit->geographicalId() ) ){
124 // predState = propagator->propagate(*measurement->predictedState().freeState(),
125 // (*rhit)->det()->surface());
126 // }
127 // else predState = measurement->predictedState();
128 
129 // if ( predState.isValid() ) {
130 // std::pair<bool,double> sing_chi2 = estimator()->estimate( predState, *((*rhit).get()));
131 // thisChi2 += sing_chi2.second ;
132 // LogTrace(metname) << " single incremental chi2: " << sing_chi2.second;
133 // }
134 // }
135 
136 // pair<double,int> result = pair<double,int>(thisChi2,npts);
137  return result;
138 }
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const =0
const std::string metname
ConstRecHitPointer recHit() const
tuple result
Definition: query.py:137
TrajectoryStateOnSurface predictedState() const
const MeasurementEstimator * estimator() const

Member Data Documentation

const MeasurementEstimator* MuonBestMeasurementFinder::theEstimator
private

Definition at line 53 of file MuonBestMeasurementFinder.h.

Referenced by estimator().