test
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.

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 24 of file MuonBestMeasurementFinder.h.

Member Typedef Documentation

Definition at line 25 of file MuonBestMeasurementFinder.h.

typedef TMContainer::iterator MuonBestMeasurementFinder::TMIterator
private

Definition at line 26 of file MuonBestMeasurementFinder.h.

Constructor & Destructor Documentation

MuonBestMeasurementFinder::MuonBestMeasurementFinder ( )

Constructor.

Definition at line 29 of file MuonBestMeasurementFinder.cc.

29  {
30 
32 }
const MeasurementEstimator * theEstimator
MuonBestMeasurementFinder::~MuonBestMeasurementFinder ( )
virtual

Destructor.

Definition at line 34 of file MuonBestMeasurementFinder.cc.

34  {
35  delete theEstimator;
36 }
const MeasurementEstimator * theEstimator

Member Function Documentation

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

Definition at line 45 of file MuonBestMeasurementFinder.h.

References theEstimator.

45 { 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 39 of file MuonBestMeasurementFinder.cc.

References LogTrace, metname, TrajectoryMeasurement::recHit(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

References HLT_25ns10e33_v2_cff::estimator, metname, TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Data Documentation

const MeasurementEstimator* MuonBestMeasurementFinder::theEstimator
private

Definition at line 51 of file MuonBestMeasurementFinder.h.

Referenced by estimator().