// AddFitKalman.h #ifndef AddFitKalman_H #define AddFitKalman_H // Fit tracks using Kalman filter. #include #include "ptr/Ptr.h" #include "ptr/AutoPolicy.h" #include "AddFitter.h" namespace trf { class AddFitKalman : public AddFitter { private: // enums // Maximum allowed hit dimension. enum { MAXDIM = 3 }; // Maximum number of track vectors. enum { MAXVECTOR = 1 }; // Maximum number of track errors. enum { MAXERROR = 1 }; private: // nested classes // The nested class Box holds the vectors, matrices and symmetric // matrices needed for adding a hit in the main class. class Box { friend class AddFitKalman; private: // typedefs typedef Ptr VectorPtr; typedef Ptr SMatrixPtr; typedef Ptr MatrixPtr; typedef std::vector VectorList; typedef std::vector SMatrixList; typedef std::vector MatrixList; private: // enums // number of vectors enum { NVECTOR = 2 }; // number of errors enum { NERROR = 3 }; // number of vectors enum { NDERIV = 2 }; // number of gains enum { NGAIN = 2 }; private: // attributes // dimension of the vector, matrix, etc int _size; // array of vectors VectorList _vectors; // array of vectors SMatrixList _errors; // array of derivatives (Nx5 matrices) MatrixList _derivs; // array of gains (5xN matrices) MatrixList _gains; public: // methods // constructor Box(int size); // destructor ~Box(); // return the dimension int get_size() { return _size; }; // fetch a vector TrfVector& get_vector(int ivec); // fetch an error TrfSMatrix& get_error(int ierr); // fetch a derivative TrfMatrix& get_deriv(int ider); // fetch a gain TrfMatrix& get_gain(int igai); }; private: // more typedefs typedef Box::VectorPtr VectorPtr; typedef Box::SMatrixPtr SMatrixPtr; typedef Box::MatrixPtr MatrixPtr; typedef Box::VectorList VectorList; typedef Box::SMatrixList SMatrixList; typedef Box::MatrixList MatrixList; typedef Ptr BoxPtr; typedef std::vector BoxList; public: // static methods // Return the type name. static TypeName get_type_name() { return "AddFitKalman"; } // Return the creator. static ObjCreator get_creator(); // Return the type. static Type get_static_type() { return get_creator(); } private: // methods // output stream void ostr(std::ostream& stream) const; // Array of boxes for each supported size. BoxList _boxes; // Track vectors. VectorList _tvectors; // Track errors. SMatrixList _terrors; public: // constructor AddFitKalman(); // destructor virtual ~AddFitKalman(); // Return the type. Type get_type() const { return get_static_type(); } // Write object data. ObjData write_data() const; // add a hit and fit with the new hit int add_hit_fit(ETrack& tre, double& chsq, const HitPtr& hit) const; }; } // end namespace trf #endif