CMS 3D CMS Logo

MuonTrajectoryUpdator Class Reference

An updator for the Muon system This class update a trajectory with a muon chamber measurement. More...

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

List of all members.

Public Member Functions

const MeasurementEstimatorestimator () const
 accasso at the propagator
NavigationDirection fitDirection ()
 get the fit direction
void makeFirstTime ()
 reset the theFirstTSOSFlag
double maxChi2 () const
 get the max chi2 allowed
const TrajectoryStateUpdatormeasurementUpdator () const
 MuonTrajectoryUpdator (NavigationDirection fitDirection, double chi2, int granularity)
 Constructor from Propagator, chi2 and the granularity flag.
 MuonTrajectoryUpdator (const edm::ParameterSet &par, NavigationDirection fitDirection)
 Constructor from Propagator and Parameter set.
void setFitDirection (NavigationDirection fitDirection)
 set fit direction
void setMaxChi2 (double chi2)
 set max chi2
virtual std::pair< bool,
TrajectoryStateOnSurface
update (const TrajectoryMeasurement *measurement, Trajectory &trajectory, const Propagator *propagator)
 update the Trajectory with the TrajectoryMeasurement
virtual ~MuonTrajectoryUpdator ()
 Destructor.

Private Member Functions

TrajectoryStateOnSurface propagateState (const TrajectoryStateOnSurface &state, const TrajectoryMeasurement *measurement, const TransientTrackingRecHit::ConstRecHitPointer &current, const Propagator *propagator) const
 Propagate the state to the hit surface if it's a multi hit RecHit.
void sort (TransientTrackingRecHit::ConstRecHitContainer &, const DetLayer *)
TrajectoryMeasurement updateMeasurement (const TrajectoryStateOnSurface &propagatedTSOS, const TrajectoryStateOnSurface &lastUpdatedTSOS, const TransientTrackingRecHit::ConstRecHitPointer &recHit, const double &chi2, const DetLayer *detLayer, const TrajectoryMeasurement *initialMeasurement)
 Return the trajectory measurement. It handles both the fw and the bw propagation.

Private Attributes

MeasurementEstimatortheEstimator
bool theFirstTSOSFlag
NavigationDirection theFitDirection
int theGranularity
 the granularity if 0 4D-segments are used both for the DT and CSC, if 1 2D-segments are used for the DT and the 2D-points for the CSC if 2 the 1D rec hit for the DT are used, while the 2D rechit for the CSC are used Maybe in a second step there will be more than 3 option i.e.
double theMaxChi2
 the max chi2 allowed
bool theRescaleErrorFlag
double theRescaleFactor
TrajectoryStateUpdatortheUpdator

Classes

struct  RadiusComparatorInOut
 Ordering along increasing radius (for DT rechits). More...
struct  RadiusComparatorOutIn
 Ordering along decreasing radius (for DT rechits). More...
struct  ZedComparatorInOut
 Ordering along increasing zed (for CSC rechits). More...
struct  ZedComparatorOutIn
 Ordering along decreasing zed (for CSC rechits). More...


Detailed Description

An updator for the Muon system This class update a trajectory with a muon chamber measurement.

In spite of the name, it is NOT an updator, but has one. A muon RecHit is a segment (for DT and CSC) or a "hit" (RPC). This updator is suitable both for FW and BW filtering. The difference between the two fitter are two: the granularity of the updating (i.e.: segment position or 1D rechit position), which can be set via parameter set, and the propagation direction which is embeded in the propagator set in the c'tor.

Date
2007/05/11 18:28:59
Revision
1.18
Author:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch>

S. Lacaprara - INFN Legnaro

In spite of the name, it is NOT an updator, but has one. A muon RecHit is a segment (for DT and CSC) or a "hit" (RPC). This updator is suitable both for FW and BW filtering. The difference between the two fitter are two: the granularity of the updating (i.e.: segment position or 1D rechit position), which can be set via parameter set, and the propagation direction which is embeded in the propagator set in the c'tor.

Date
2008/04/24 18:16:13
Revision
1.28
Author:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch>

S. Lacaprara - INFN Legnaro

Definition at line 34 of file MuonTrajectoryUpdator.h.


Constructor & Destructor Documentation

MuonTrajectoryUpdator::MuonTrajectoryUpdator ( const edm::ParameterSet par,
NavigationDirection  fitDirection 
)

Constructor from Propagator and Parameter set.

Definition at line 41 of file MuonTrajectoryUpdator.cc.

References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, edm::ParameterSet::getParameter(), theEstimator, theFirstTSOSFlag, theGranularity, theMaxChi2, theRescaleErrorFlag, theRescaleFactor, and theUpdator.

00042                                                                               : theFitDirection(fitDirection){
00043   
00044   // The max allowed chi2 to accept a rechit in the fit
00045   theMaxChi2 = par.getParameter<double>("MaxChi2");
00046   theEstimator = new Chi2MeasurementEstimator(theMaxChi2);
00047   
00048   // The KF updator
00049   theUpdator= new KFUpdator();
00050 
00051   // The granularity
00052   theGranularity = par.getParameter<int>("Granularity");
00053 
00054   // Rescale the error of the first state?
00055   theRescaleErrorFlag =  par.getParameter<bool>("RescaleError");
00056 
00057   if(theRescaleErrorFlag)
00058     // The rescale factor
00059     theRescaleFactor =  par.getParameter<double>("RescaleErrorFactor");
00060   
00061   // Flag needed for the rescaling
00062   theFirstTSOSFlag = true;
00063 }

MuonTrajectoryUpdator::MuonTrajectoryUpdator ( NavigationDirection  fitDirection,
double  chi2,
int  granularity 
)

Constructor from Propagator, chi2 and the granularity flag.

Definition at line 65 of file MuonTrajectoryUpdator.cc.

References Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, theEstimator, theMaxChi2, and theUpdator.

00066                                                                            : theMaxChi2(chi2),
00067                                                                              theGranularity(granularity),
00068                                                                              theFitDirection(fitDirection){
00069   theEstimator = new Chi2MeasurementEstimator(theMaxChi2);
00070   
00071   // The KF updator
00072   theUpdator= new KFUpdator();
00073 }

MuonTrajectoryUpdator::~MuonTrajectoryUpdator (  )  [virtual]

Destructor.

Definition at line 76 of file MuonTrajectoryUpdator.cc.

References theEstimator, and theUpdator.

00076                                              {
00077   delete theEstimator;
00078   delete theUpdator;
00079 }


Member Function Documentation

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

accasso at the propagator

Definition at line 57 of file MuonTrajectoryUpdator.h.

References theEstimator.

Referenced by MuonSimHitProducer::produce(), CosmicMuonTrajectoryBuilder::trajectories(), and update().

00057 {return theEstimator;}

NavigationDirection MuonTrajectoryUpdator::fitDirection (  )  [inline]

get the fit direction

Definition at line 64 of file MuonTrajectoryUpdator.h.

References theFitDirection.

Referenced by sort().

00064 {return theFitDirection;}

void MuonTrajectoryUpdator::makeFirstTime (  ) 

reset the theFirstTSOSFlag

Definition at line 81 of file MuonTrajectoryUpdator.cc.

References theFirstTSOSFlag.

Referenced by CosmicMuonTrajectoryBuilder::build(), and StandAloneMuonFilter::reset().

00081                                          {
00082   theFirstTSOSFlag = true;
00083 }

double MuonTrajectoryUpdator::maxChi2 (  )  const [inline]

get the max chi2 allowed

Definition at line 61 of file MuonTrajectoryUpdator.h.

References theMaxChi2.

00061 {return theMaxChi2 ;}

const TrajectoryStateUpdator* MuonTrajectoryUpdator::measurementUpdator (  )  const [inline]

Definition at line 58 of file MuonTrajectoryUpdator.h.

References theUpdator.

Referenced by update().

00058 {return theUpdator;}

TrajectoryStateOnSurface MuonTrajectoryUpdator::propagateState ( const TrajectoryStateOnSurface state,
const TrajectoryMeasurement measurement,
const TransientTrackingRecHit::ConstRecHitPointer current,
const Propagator propagator 
) const [private]

Propagate the state to the hit surface if it's a multi hit RecHit.

i.e.: if "current" is a sub-rechit of the mesurement (i.e. a 1/2D RecHit) the state will be propagated to the surface where lies the "current" rechit

Definition at line 174 of file MuonTrajectoryUpdator.cc.

References TrajectoryMeasurement::predictedState(), Propagator::propagate(), and TrajectoryMeasurement::recHit().

Referenced by update().

00177                                                                          {
00178 
00179   const TransientTrackingRecHit::ConstRecHitPointer mother = measurement->recHit();
00180 
00181   if( current->geographicalId() == mother->geographicalId() )
00182     return measurement->predictedState();
00183   
00184   const TrajectoryStateOnSurface  tsos =
00185     propagator->propagate(state, current->det()->surface());
00186   return tsos;
00187 
00188 }

void MuonTrajectoryUpdator::setFitDirection ( NavigationDirection  fitDirection  )  [inline]

set fit direction

Definition at line 70 of file MuonTrajectoryUpdator.h.

References theFitDirection.

Referenced by CosmicMuonTrajectoryBuilder::build(), and CosmicMuonTrajectoryBuilder::trajectories().

void MuonTrajectoryUpdator::setMaxChi2 ( double  chi2  )  [inline]

set max chi2

Definition at line 67 of file MuonTrajectoryUpdator.h.

References theMaxChi2.

00067 {theMaxChi2 = chi2;}

void MuonTrajectoryUpdator::sort ( TransientTrackingRecHit::ConstRecHitContainer recHitsForFit,
const DetLayer detLayer 
) [private]

Definition at line 215 of file MuonTrajectoryUpdator.cc.

References GeomDetEnumerators::CSC, GeomDetEnumerators::DT, fitDirection(), insideOut, outsideIn, and DetLayer::subDetector().

Referenced by update().

00216                                                           {
00217   
00218   if(detLayer->subDetector()==GeomDetEnumerators::DT){
00219     if(fitDirection() == insideOut)
00220       stable_sort(recHitsForFit.begin(),recHitsForFit.end(), RadiusComparatorInOut() );
00221     else if(fitDirection() == outsideIn)
00222       stable_sort(recHitsForFit.begin(),recHitsForFit.end(),RadiusComparatorOutIn() ); 
00223     else
00224       LogError("Muon|RecoMuon|MuonTrajectoryUpdator") <<"MuonTrajectoryUpdator::sort: Wrong propagation direction!!";
00225   }
00226 
00227   else if(detLayer->subDetector()==GeomDetEnumerators::CSC){
00228     if(fitDirection() == insideOut)
00229       stable_sort(recHitsForFit.begin(),recHitsForFit.end(), ZedComparatorInOut() );
00230     else if(fitDirection() == outsideIn)
00231       stable_sort(recHitsForFit.begin(),recHitsForFit.end(), ZedComparatorOutIn() );  
00232     else
00233       LogError("Muon|RecoMuon|MuonTrajectoryUpdator") <<"MuonTrajectoryUpdator::sort: Wrong propagation direction!!";
00234   }
00235 }

pair< bool, TrajectoryStateOnSurface > MuonTrajectoryUpdator::update ( const TrajectoryMeasurement measurement,
Trajectory trajectory,
const Propagator propagator 
) [virtual]

update the Trajectory with the TrajectoryMeasurement

Definition at line 87 of file MuonTrajectoryUpdator.cc.

References MuonTransientTrackingRecHitBreaker::breakInSubRecHits(), MuonPatternRecoDumper::dumpTSOS(), lat::endl(), MeasurementEstimator::estimate(), estimator(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), TrajectoryMeasurement::layer(), LogTrace, measurementUpdator(), PV3DBase< T, PVType, FrameType >::perp(), TrajectoryMeasurement::predictedState(), propagateState(), Trajectory::push(), TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::rescaleError(), sort(), theFirstTSOSFlag, theGranularity, theRescaleErrorFlag, theRescaleFactor, TrajectoryStateUpdator::update(), and updateMeasurement().

Referenced by CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::trajectories(), and StandAloneMuonFilter::update().

00089                                                            {
00090   
00091   const std::string metname = "Muon|RecoMuon|MuonTrajectoryUpdator";
00092 
00093   MuonPatternRecoDumper muonDumper;
00094 
00095   // Status of the updating
00096   bool updated=false;
00097   
00098   if(!measurement) return pair<bool,TrajectoryStateOnSurface>(updated,TrajectoryStateOnSurface() );
00099 
00100   // measurement layer
00101   const DetLayer* detLayer=measurement->layer();
00102 
00103   // this are the 4D segment for the CSC/DT and a point for the RPC 
00104   TransientTrackingRecHit::ConstRecHitPointer muonRecHit = measurement->recHit();
00105  
00106   // The KFUpdator takes TransientTrackingRecHits as arg.
00107   TransientTrackingRecHit::ConstRecHitContainer recHitsForFit =
00108   MuonTransientTrackingRecHitBreaker::breakInSubRecHits(muonRecHit,theGranularity);
00109 
00110   // sort the container in agreement with the porpagation direction
00111   sort(recHitsForFit,detLayer);
00112   
00113   TrajectoryStateOnSurface lastUpdatedTSOS = measurement->predictedState();
00114   
00115   LogTrace(metname)<<"Number of rechits for the fit: "<<recHitsForFit.size()<<endl;
00116  
00117   TransientTrackingRecHit::ConstRecHitContainer::iterator recHit;
00118   for(recHit = recHitsForFit.begin(); recHit != recHitsForFit.end(); ++recHit ) {
00119     if ((*recHit)->isValid() ) {
00120 
00121       // propagate the TSOS onto the rechit plane
00122       TrajectoryStateOnSurface propagatedTSOS  = propagateState(lastUpdatedTSOS, measurement, 
00123                                                                 *recHit, propagator);
00124       
00125       if ( propagatedTSOS.isValid() ) {
00126         pair<bool,double> thisChi2 = estimator()->estimate(propagatedTSOS, *((*recHit).get()));
00127 
00128         LogTrace(metname) << "Estimation for Kalman Fit. Chi2: " << thisChi2.second;
00129         
00130         // The Chi2 cut was already applied in the estimator, which
00131         // returns 0 if the chi2 is bigger than the cut defined in its
00132         // constructor
00133         if ( thisChi2.first ) {
00134           updated=true;
00135           
00136           LogTrace(metname) << endl 
00137                             << "     Kalman Start" << "\n" << "\n";
00138           LogTrace(metname) << "  Meas. Position : " << (**recHit).globalPosition() << "\n"
00139                             << "  Pred. Position : " << propagatedTSOS.globalPosition()
00140                             << "  Pred Direction : " << propagatedTSOS.globalDirection()<< endl;
00141 
00142           if(theRescaleErrorFlag && theFirstTSOSFlag){
00143             propagatedTSOS.rescaleError(theRescaleFactor);
00144             theFirstTSOSFlag = false;
00145           }
00146 
00147           lastUpdatedTSOS = measurementUpdator()->update(propagatedTSOS,*((*recHit).get()));
00148 
00149           LogTrace(metname) << "  Fit   Position : " << lastUpdatedTSOS.globalPosition()
00150                             << "  Fit  Direction : " << lastUpdatedTSOS.globalDirection()
00151                             << "\n"
00152                             << "  Fit position radius : " 
00153                             << lastUpdatedTSOS.globalPosition().perp()
00154                             << "filter updated" << endl;
00155           
00156           LogTrace(metname) << muonDumper.dumpTSOS(lastUpdatedTSOS);
00157           
00158           LogTrace(metname) << "\n\n     Kalman End" << "\n" << "\n";         
00159           
00160           TrajectoryMeasurement updatedMeasurement = updateMeasurement( propagatedTSOS, lastUpdatedTSOS, 
00161                                                                         *recHit,thisChi2.second,detLayer, 
00162                                                                         measurement);
00163           // FIXME: check!
00164           trajectory.push(updatedMeasurement, thisChi2.second);   
00165         }
00166       }
00167     }
00168   }
00169   recHitsForFit.clear();
00170   return pair<bool,TrajectoryStateOnSurface>(updated,lastUpdatedTSOS);
00171 }

TrajectoryMeasurement MuonTrajectoryUpdator::updateMeasurement ( const TrajectoryStateOnSurface propagatedTSOS,
const TrajectoryStateOnSurface lastUpdatedTSOS,
const TransientTrackingRecHit::ConstRecHitPointer recHit,
const double &  chi2,
const DetLayer detLayer,
const TrajectoryMeasurement initialMeasurement 
) [private]

Return the trajectory measurement. It handles both the fw and the bw propagation.

Definition at line 191 of file MuonTrajectoryUpdator.cc.

Referenced by update().

00195                                                                                                                  {
00196   return TrajectoryMeasurement(propagatedTSOS, lastUpdatedTSOS, 
00197                                recHit,chi2,detLayer);
00198 
00199   //   // FIXME: put a better check! One could fit in first out-in and then in - out 
00200   //   if(propagator()->propagationDirection() == alongMomentum) 
00201   //     return TrajectoryMeasurement(propagatedTSOS, lastUpdatedTSOS, 
00202   //                             recHit,thisChi2.second,detLayer);
00203   
00204   //   // FIXME: Check this carefully!!
00205   //   else if(propagator()->propagationDirection() == oppositeToMomentum)
00206   //     return TrajectoryMeasurement(initialMeasurement->forwardPredictedState(),
00207   //                             propagatedTSOS, lastUpdatedTSOS, 
00208   //                             recHit,thisChi2.second,detLayer);
00209   //   else{
00210   //     LogError("MuonTrajectoryUpdator::updateMeasurement") <<"Wrong propagation direction!!";
00211   //   }
00212 }


Member Data Documentation

MeasurementEstimator* MuonTrajectoryUpdator::theEstimator [private]

Definition at line 142 of file MuonTrajectoryUpdator.h.

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

bool MuonTrajectoryUpdator::theFirstTSOSFlag [private]

Definition at line 151 of file MuonTrajectoryUpdator.h.

Referenced by makeFirstTime(), MuonTrajectoryUpdator(), and update().

NavigationDirection MuonTrajectoryUpdator::theFitDirection [private]

Definition at line 148 of file MuonTrajectoryUpdator.h.

Referenced by fitDirection(), and setFitDirection().

int MuonTrajectoryUpdator::theGranularity [private]

the granularity if 0 4D-segments are used both for the DT and CSC, if 1 2D-segments are used for the DT and the 2D-points for the CSC if 2 the 1D rec hit for the DT are used, while the 2D rechit for the CSC are used Maybe in a second step there will be more than 3 option i.e.

max granularity for DT but not for the CSC and the viceversa

Definition at line 96 of file MuonTrajectoryUpdator.h.

Referenced by MuonTrajectoryUpdator(), and update().

double MuonTrajectoryUpdator::theMaxChi2 [private]

the max chi2 allowed

Definition at line 88 of file MuonTrajectoryUpdator.h.

Referenced by maxChi2(), MuonTrajectoryUpdator(), and setMaxChi2().

bool MuonTrajectoryUpdator::theRescaleErrorFlag [private]

Definition at line 152 of file MuonTrajectoryUpdator.h.

Referenced by MuonTrajectoryUpdator(), and update().

double MuonTrajectoryUpdator::theRescaleFactor [private]

Definition at line 153 of file MuonTrajectoryUpdator.h.

Referenced by MuonTrajectoryUpdator(), and update().

TrajectoryStateUpdator* MuonTrajectoryUpdator::theUpdator [private]

Definition at line 143 of file MuonTrajectoryUpdator.h.

Referenced by measurementUpdator(), MuonTrajectoryUpdator(), and ~MuonTrajectoryUpdator().


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