00001 // $Id: TrackKalmanFilter.h,v 1.1 2005/06/29 15:35:02 erodrigu Exp $ 00002 #ifndef TRACKFITTER_TRACKKALMANFILTER_H 00003 #define TRACKFITTER_TRACKKALMANFILTER_H 1 00004 00005 // Include files 00006 // ------------- 00007 // from Gaudi 00008 #include "GaudiAlg/GaudiTool.h" 00009 00010 // from TrackInterfaces 00011 #include "TrackInterfaces/ITrackExtrapolator.h" 00012 #include "TrackInterfaces/ITrackProjector.h" 00013 #include "TrackInterfaces/ITrackFitter.h" 00014 00015 // from TrackEvent 00016 #include "Event/Track.h" 00017 #include "Event/FitNode.h" 00018 00029 class TrackKalmanFilter : public GaudiTool, public ITrackFitter { 00030 public: 00032 TrackKalmanFilter( const std::string& type, 00033 const std::string& name, 00034 const IInterface* parent); 00035 00037 virtual ~TrackKalmanFilter( ); 00038 00039 StatusCode initialize(); 00040 00042 StatusCode fit(Track& track) { 00043 //track.setHistoryFit( TrackKeys::Kalman ); 00044 info() << " not implemented yet!" << track.nMeasurements() << endreq; 00045 return StatusCode::SUCCESS; 00046 } 00047 00049 StatusCode fit(Track& track, const State& seed); 00050 00052 StatusCode filter(Track& track, const State& seed); 00053 00055 StatusCode filter(State& state, Measurement& meas); 00056 00057 protected: 00058 00060 StatusCode iniKalman(Track& track); 00061 00063 StatusCode predict(FitNode& node, State& state); 00064 00066 StatusCode filter(FitNode& node); 00067 00069 StatusCode smoother(Track& track); 00070 00072 StatusCode smooth(FitNode& node0, const FitNode& node1); 00073 00075 void computeChiSq(Track& track); 00076 00077 protected: 00078 00079 // ! check that the contents of the cov matrix are fine 00080 StatusCode checkInvertMatrix(const HepSymMatrix& mat); 00081 00082 // ! check that the contents of the cov matrix are fine 00083 StatusCode checkPositiveMatrix(HepSymMatrix& mat); 00084 00085 // ! invert this matrix 00086 StatusCode invertMatrix(HepSymMatrix& mat); 00087 00089 StatusCode cToG3(HepSymMatrix& C); 00090 00092 StatusCode cToG4(HepSymMatrix& invC); 00093 00094 protected: 00095 00097 State* m_state; 00098 00099 // internal copy of the nodes of the track (track owns them) 00100 std::vector<FitNode*> m_nodes; 00101 00102 // internal copy of the gain matrix in the filter of a state 00103 HepVector m_K; 00104 00105 protected: 00106 00108 ITrackExtrapolator* m_extrapolator; 00109 00111 ITrackProjector* m_projector; 00112 00113 private: 00114 00115 // job options 00116 std::string m_extrapolatorName; 00117 std::string m_projectorName; 00118 std::vector<double> m_zPositions; 00119 bool m_statesAtMeasZPos; 00120 bool m_stateAtBeamLine; 00121 int m_numFitIter; 00122 double m_chi2Outliers; 00123 double m_storeTransport; 00124 00126 StatusCode failure(const std::string& comment); 00127 00128 bool m_debugLevel; 00129 00130 }; 00131 #endif // TRACKFITTER_TRACKKALMANFILTER_H