CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h

Go to the documentation of this file.
00001 #ifndef CD_KFTrajectoryFitter_H_
00002 #define CD_KFTrajectoryFitter_H_
00003 
00012 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00013 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00014 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00015 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
00016 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00017 #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h"
00018 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
00019 #include "TrackingTools/PatternTools/interface/MeasurementEstimator.h"
00020 #include "TrackingTools/DetLayers/interface/DetLayerGeometry.h"
00021 
00022 class KFTrajectoryFitter : public TrajectoryFitter {
00023 
00024 private:
00025 
00026   typedef TrajectoryStateOnSurface TSOS;
00027   typedef FreeTrajectoryState FTS;
00028   typedef TrajectoryMeasurement TM;
00029 
00030 public:
00031 
00032 
00033   // backward compatible (too many places it uses as such...)
00034   KFTrajectoryFitter(const Propagator& aPropagator,
00035                      const TrajectoryStateUpdator& aUpdator,
00036                      const MeasurementEstimator& aEstimator,
00037                      int minHits = 3,
00038                      const DetLayerGeometry* detLayerGeometry=0) :
00039     thePropagator(aPropagator.clone()),
00040     theUpdator(aUpdator.clone()),
00041     theEstimator(aEstimator.clone()),
00042     theGeometry(detLayerGeometry),
00043     minHits_(minHits),
00044     owner(true){ 
00045     if(!theGeometry) theGeometry = &dummyGeometry;
00046     // FIXME. Why this first constructor is needed? who is using it? Can it be removed?
00047     // it is uses in many many places
00048     }
00049   
00050 
00051   KFTrajectoryFitter(const Propagator* aPropagator,
00052                      const TrajectoryStateUpdator* aUpdator,
00053                      const MeasurementEstimator* aEstimator,
00054                      int minHits = 3,
00055                      const DetLayerGeometry* detLayerGeometry=0) : 
00056     thePropagator(aPropagator),
00057     theUpdator(aUpdator),
00058     theEstimator(aEstimator),
00059     theGeometry(detLayerGeometry),
00060     minHits_(minHits),
00061     owner(false){
00062       if(!theGeometry) theGeometry = &dummyGeometry;
00063     }
00064 
00065   ~KFTrajectoryFitter(){
00066     if (owner) {
00067       delete thePropagator;
00068       delete theUpdator;
00069       delete theEstimator;
00070     }
00071   }
00072   
00073   virtual std::vector<Trajectory> fit(const Trajectory& aTraj) const;
00074   virtual std::vector<Trajectory> fit(const TrajectorySeed& aSeed,
00075                                       const RecHitContainer& hits) const;
00076 
00077   virtual std::vector<Trajectory> fit(const TrajectorySeed& aSeed,
00078                                       const RecHitContainer& hits, 
00079                                       const TSOS& firstPredTsos) const;
00080 
00081   const Propagator* propagator() const {return thePropagator;}
00082   const TrajectoryStateUpdator* updator() const {return theUpdator;}
00083   const MeasurementEstimator* estimator() const {return theEstimator;}
00084   
00085   virtual KFTrajectoryFitter* clone() const
00086   {
00087     return owner ? 
00088       new KFTrajectoryFitter(*thePropagator,*theUpdator,*theEstimator,minHits_,theGeometry) :
00089       new KFTrajectoryFitter(thePropagator,theUpdator,theEstimator,minHits_,theGeometry);
00090   }
00091   
00092 private:
00093   KFTrajectoryFitter(KFTrajectoryFitter const&);
00094                      
00095 
00096   static const DetLayerGeometry dummyGeometry;
00097   const Propagator* thePropagator;
00098   const TrajectoryStateUpdator* theUpdator;
00099   const MeasurementEstimator* theEstimator;
00100   const DetLayerGeometry* theGeometry;
00101   int minHits_;
00102   bool owner;
00103 };
00104 
00105 #endif //CD_KFTrajectoryFitter_H_