00001 #ifndef RecoMuon_TrackingTools_MuonTrajectoryUpdator_H
00002 #define RecoMuon_TrackingTools_MuonTrajectoryUpdator_H
00003
00019 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00020 #include "TrackingTools/DetLayers/interface/NavigationDirection.h"
00021
00022 #include <functional>
00023
00024 class Propagator;
00025 class MeasurementEstimator;
00026 class TrajectoryMeasurement;
00027 class Trajectory;
00028 class TrajectoryStateOnSurface;
00029 class TrajectoryStateUpdator;
00030 class DetLayer;
00031
00032 namespace edm{class ParameterSet;}
00033
00034 class MuonTrajectoryUpdator {
00035
00036 public:
00037
00039 MuonTrajectoryUpdator(const edm::ParameterSet& par,
00040 NavigationDirection fitDirection);
00041
00043 MuonTrajectoryUpdator(NavigationDirection fitDirection,
00044 double chi2, int granularity);
00045
00047 virtual ~MuonTrajectoryUpdator();
00048
00049
00050
00052 virtual std::pair<bool,TrajectoryStateOnSurface> update(const TrajectoryMeasurement* measurement,
00053 Trajectory& trajectory,
00054 const Propagator *propagator);
00055
00057 const MeasurementEstimator *estimator() const {return theEstimator;}
00058 const TrajectoryStateUpdator *measurementUpdator() const {return theUpdator;}
00059
00061 double maxChi2() const {return theMaxChi2 ;}
00062
00064 NavigationDirection fitDirection() {return theFitDirection;}
00065
00067 void setMaxChi2(double chi2) {theMaxChi2 = chi2;}
00068
00070 void setFitDirection(NavigationDirection fitDirection) {theFitDirection = fitDirection;}
00071
00073 void makeFirstTime();
00074
00075 protected:
00076
00077 private:
00078
00082 TrajectoryStateOnSurface propagateState(const TrajectoryStateOnSurface& state,
00083 const TrajectoryMeasurement* measurement,
00084 const TransientTrackingRecHit::ConstRecHitPointer& current,
00085 const Propagator *propagator) const;
00086
00088 double theMaxChi2;
00089
00096 int theGranularity;
00097
00098
00100 struct RadiusComparatorInOut{
00101 bool operator()(const TransientTrackingRecHit::ConstRecHitPointer &a,
00102 const TransientTrackingRecHit::ConstRecHitPointer &b) const{
00103 return a->det()->surface().position().perp() < b->det()->surface().position().perp();
00104 }
00105 };
00106
00108 struct RadiusComparatorOutIn{
00109 bool operator()(const TransientTrackingRecHit::ConstRecHitPointer &a,
00110 const TransientTrackingRecHit::ConstRecHitPointer &b) const{
00111 return a->det()->surface().position().perp() > b->det()->surface().position().perp();
00112 }
00113 };
00114
00116 struct ZedComparatorInOut{
00117 bool operator()( const TransientTrackingRecHit::ConstRecHitPointer &a,
00118 const TransientTrackingRecHit::ConstRecHitPointer &b) const{
00119 return fabs(a->globalPosition().z()) < fabs(b->globalPosition().z());
00120 }
00121 };
00122
00124 struct ZedComparatorOutIn{
00125 bool operator()( const TransientTrackingRecHit::ConstRecHitPointer &a,
00126 const TransientTrackingRecHit::ConstRecHitPointer &b) const{
00127 return fabs(a->globalPosition().z()) > fabs(b->globalPosition().z());
00128 }
00129 };
00130
00131 void sort(TransientTrackingRecHit::ConstRecHitContainer&, const DetLayer*);
00132
00134 TrajectoryMeasurement updateMeasurement( const TrajectoryStateOnSurface &propagatedTSOS,
00135 const TrajectoryStateOnSurface &lastUpdatedTSOS,
00136 const TransientTrackingRecHit::ConstRecHitPointer &recHit,
00137 const double &chi2, const DetLayer *detLayer,
00138 const TrajectoryMeasurement *initialMeasurement);
00139
00140
00141
00142 MeasurementEstimator *theEstimator;
00143 TrajectoryStateUpdator *theUpdator;
00144
00145
00146
00147
00148 NavigationDirection theFitDirection;
00149
00150
00151 bool theFirstTSOSFlag;
00152 bool theRescaleErrorFlag;
00153 double theRescaleFactor;
00154 };
00155 #endif
00156