CMS 3D CMS Logo

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

◆ TMContainer

Definition at line 25 of file MuonBestMeasurementFinder.h.

◆ TMIterator

typedef TMContainer::iterator MuonBestMeasurementFinder::TMIterator
private

Definition at line 26 of file MuonBestMeasurementFinder.h.

Constructor & Destructor Documentation

◆ MuonBestMeasurementFinder()

MuonBestMeasurementFinder::MuonBestMeasurementFinder ( )

Constructor.

Definition at line 28 of file MuonBestMeasurementFinder.cc.

28 { theEstimator = new Chi2MeasurementEstimator(100000.); }

References Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator.

◆ ~MuonBestMeasurementFinder()

MuonBestMeasurementFinder::~MuonBestMeasurementFinder ( )
virtual

Destructor.

Definition at line 30 of file MuonBestMeasurementFinder.cc.

30 { delete theEstimator; }

Member Function Documentation

◆ estimator()

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

Definition at line 42 of file MuonBestMeasurementFinder.h.

42 { return theEstimator; }

References theEstimator.

◆ findBestMeasurement()

TrajectoryMeasurement * MuonBestMeasurementFinder::findBestMeasurement ( std::vector< TrajectoryMeasurement > &  measC,
const Propagator propagator 
)

return the Tm with the best chi2: no cut applied.

Definition at line 32 of file MuonBestMeasurementFinder.cc.

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

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

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

◆ lookAtSubRecHits()

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

Definition at line 80 of file MuonBestMeasurementFinder.cc.

81  {
82  const std::string metname = "Muon|RecoMuon|MuonBestMeasurementFinder";
83 
84  unsigned int npts = 0;
85  // unused double thisChi2 = 0.;
86 
87  const TransientTrackingRecHit::ConstRecHitPointer& muonRecHit = measurement->recHit();
88  const TrajectoryStateOnSurface& predState = measurement->predictedState(); // temporarily introduced by DT
89  std::pair<bool, double> sing_chi2 =
90  estimator()->estimate(predState, *(muonRecHit.get())); // temporarily introduced by DT
91  npts = 1; // temporarily introduced by DT
92  std::pair<double, int> result = pair<double, int>(sing_chi2.second, npts); // temporarily introduced by DT
93 
94  // // ask for the 2D-segments/2D-rechit // temporarily excluded by DT
95  // TransientTrackingRecHit::ConstRecHitContainer rhits_list = muonRecHit->transientHits();
96 
97  // LogTrace(metname)<<"Number of rechits in the measurement rechit: "<<rhits_list.size()<<endl;
98 
99  // // loop over them
100  // for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator rhit = rhits_list.begin();
101  // rhit!= rhits_list.end(); ++rhit)
102  // if ((*rhit)->isValid() ) {
103  // LogTrace(metname)<<"Rechit dimension: "<<(*rhit)->dimension()<<endl;
104  // npts+=(*rhit)->dimension();
105 
106  // TrajectoryStateOnSurface predState;
107 
108  // if (!( (*rhit)->geographicalId() == muonRecHit->geographicalId() ) ){
109  // predState = propagator->propagate(*measurement->predictedState().freeState(),
110  // (*rhit)->det()->surface());
111  // }
112  // else predState = measurement->predictedState();
113 
114  // if ( predState.isValid() ) {
115  // std::pair<bool,double> sing_chi2 = estimator()->estimate( predState, *((*rhit).get()));
116  // thisChi2 += sing_chi2.second ;
117  // LogTrace(metname) << " single incremental chi2: " << sing_chi2.second;
118  // }
119  // }
120 
121  // pair<double,int> result = pair<double,int>(thisChi2,npts);
122  return result;
123 }

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

Member Data Documentation

◆ theEstimator

const MeasurementEstimator* MuonBestMeasurementFinder::theEstimator
private

Definition at line 46 of file MuonBestMeasurementFinder.h.

Referenced by estimator().

MuonBestMeasurementFinder::TMIterator
TMContainer::iterator TMIterator
Definition: MuonBestMeasurementFinder.h:26
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrajectoryMeasurement::predictedState
TrajectoryStateOnSurface const & predictedState() const
Definition: TrajectoryMeasurement.h:174
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
Chi2MeasurementEstimator_cfi.Chi2MeasurementEstimator
Chi2MeasurementEstimator
Definition: Chi2MeasurementEstimator_cfi.py:5
MuonBestMeasurementFinder::estimator
const MeasurementEstimator * estimator() const
Definition: MuonBestMeasurementFinder.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonBestMeasurementFinder::lookAtSubRecHits
std::pair< double, int > lookAtSubRecHits(TrajectoryMeasurement *measurement, const Propagator *propagator)
Definition: MuonBestMeasurementFinder.cc:80
TrackingRecHit::ConstRecHitPointer
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
Definition: TrackingRecHit.h:25
MuonBestMeasurementFinder::TMContainer
std::vector< TrajectoryMeasurement * > TMContainer
Definition: MuonBestMeasurementFinder.h:25
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
MuonBestMeasurementFinder::theEstimator
const MeasurementEstimator * theEstimator
Definition: MuonBestMeasurementFinder.h:46
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40