// AddFitZPlane_XY2_Z2.h #ifndef AddFitZPlane_XY2_Z2_H #define AddFitZPlane_XY2_Z2_H // An add fitter to add a zplane (x,y)-measurement to a track // with one xyplane (v,z)-measurement. // // Tracks are rejected if momentum is too small (radius is smaller than // distance between to hits) //judging by magnetic field - bfield // // There is an ntuple associated with this class. If it is active, // it is filled each time add_hit is called. In order to be active, // it must meet the following two conditions // 1. enabled - this is a global state for the class // 2. defined - the ntuple is defined if it is enabled at time of // construction #include "trffit/AddFitter.h" #include "trfutil/TRFMath.h" #include "trfutil/Tuple_fwd.h" #include "trfbase/SurfacePtr.h" #include "trffit/AddFitterPtr.h" #include "trfbase/PropagatorPtr.h" #include "trfbase/TrackVector.h" #include "trfbase/ObjDoublePtr.h" namespace trf { class Propagator; class AddFitZPlane_XY2_Z2 : public AddFitter { public: // enums // add_hit return status. // We guarantee OK will always be zero. enum ReturnStatus { OK = 0, WRONG_TYPE = 1, WRONG_HIT_COUNT = 2, WRONG_TYPE_EXISTING = 3, DIFFERENT_SURFACES = 4, DZ_IS_ZERO = 5, DU_IS_ZERO = 6, LARGE_CURVATURE = 7, UNEXPECTED_ERROR = 8, ENCLOSED_FITTER_ERROR = 9, PROP_FAILED = 10, DPHI_TOO_LARGE = 11, ROOT_FIND_FAILED = 12, PT_TOO_SMALL = 13 }; public: // static methods // Return the type name. static TypeName get_type_name() { return "AddFitZPlane_XY2_Z2"; } // Return the creator. static ObjCreator get_creator(); // Return the type. static Type get_static_type() { return get_creator(); } private: // static data // ntuple flag - set true to enable ntuple static bool _ltuple; // ntuple name static char* _tuple_name; public: // static methods // global enable of ntuple for this class static void enable_tuple() { _ltuple = true; }; // global disable of ntuple for this class static void disable_tuple() { _ltuple = false; }; // return global enable status static bool tuple_is_enabled() { return _ltuple; }; private: // attributes // fitter (used to update error matrix) const AddFitterPtr _fit; // propagator const PropagatorPtr _prop; // surface at which to start track const SurfacePtr _srf; // Starting error matrix. const TrackError _err; // ntuple // Using Ptr instead of a bare pointer makes the tuple mutable. Ptr _ptup; // Assumed B field. ObjDoublePtr _bfield; //Maximum curvature double _qpt_max; //vertex position double _xv,_yv; private: // methods // output stream void ostr(std::ostream& stream) const; // return true if ntuple is defined and enabled bool tuple_is_active() const { return _ptup && tuple_is_enabled(); }; // fill tuple and echo the return status int fill_tuple(ReturnStatus status) const; // define the tuple void define_tuple(); public: // methods // constructor AddFitZPlane_XY2_Z2(const ObjDoublePtr& bfield, const AddFitterPtr& fit, const PropagatorPtr& prop, const SurfacePtr& srf,const TrackError& err, double ptmin,double xv=0.,double yv=0.); // destructor ~AddFitZPlane_XY2_Z2(); // add the hit int add_hit(HTrack& trh, const HitPtr& phit2) const; // Return the type. Type get_type() const { return get_static_type(); } // Write the object data. ObjData write_data() const; const AddFitterPtr& get_fitter() const {return _fit;} const SurfacePtr& get_surface() const {return _srf;} const PropagatorPtr& get_propagator() const {return _prop;} double get_bfield() const {return (*_bfield)();} const TrackError& get_error() const {return _err;} double get_ptmin() const { return 1./_qpt_max; } double get_vx() const { return _xv; } double get_vy() const { return _yv; } }; } #endif