// AddFitCyl_Phi_Phi_Phi.h #ifndef AddFitCyl_Phi_Phi_Phi_H #define AddFitCyl_Phi_Phi_Phi_H // An add fitter to add a cylinder phi-measurement to a track // with two phi-measurements. // // The constructor takes an argment nsigma. // Hits are rejected if they are more than nsigma sigma from their // predicted positions. // // If this test is passed, the hit is added with the enclosed fitter. // // ObjStream example: // // [ phifit AddFitCyl_Phi_Phi_Phi // nsigma=5.0 // fitter=*myfit // propagator=*myprop // surface=@mysurf // error_matrix=double( // 0.01 // 0.0 0.02 // 0.0 0.0 0.03 // 0.0 0.0 0.0 0.04 // 0.0 0.0 0.0 0.0 0.05 // ) // flag="unchanged" // ] // #include "trffit/AddFitter.h" #include "trfutil/Tuple_fwd.h" #include "trfbase/SurfacePtr.h" #include "trfbase/TrackVector.h" namespace trf { class Propagator; class AddFitCyl_Phi_Phi_Phi : public AddFitter { public: // enums // add_hit reurn indices. // We guarantee OK will always be zero. enum ReturnStatus { OK = 0, WRONG_TYPE = 1, WRONG_HIT_COUNT = 2, WRONG_TYPE_FIRST = 3, WRONG_TYPE_SECOND = 4, CHSQ_DIFF_TOO_LARGE = 5, ENCLOSED_FITTER_ERROR = 11 }; enum FitOrder { INWARD = 0, OUTWARD = 1, UNCHANGED = 2 }; private: // static data // ntuple flag - set true to enable ntuple static bool _ltuple; // ntuple name static char* _tuple_name; public: // static methods // Return the type name. static TypeName get_type_name() { return "AddFitCyl_Phi_Phi_Phi"; } // Return the creator. static ObjCreator get_creator(); // Return the type. static Type get_static_type() { return get_creator(); } // 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 AddFitter& _fit; // hits more than _nsigma sigma from predicted positon // are rejected double _nsigma; // ntuple // Using Ptr instead of a bare pointer makes the tuple mutable. Ptr _ptup; int _fit_order; const Propagator* _pprop; const TrackError _err; SurfacePtr _psrf; 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 AddFitCyl_Phi_Phi_Phi(double nsigma, const AddFitter& fit); AddFitCyl_Phi_Phi_Phi(double nsigma, const AddFitter& fit,const Propagator* prop, const SurfacePtr& psrf,const TrackError& err,int fit_order); // destructor ~AddFitCyl_Phi_Phi_Phi(); // Return the type. Type get_type() const { return get_static_type(); } // Write the object data. ObjData write_data() const; // Return the sigma cut. double get_nsigma() const { return _nsigma; } // Return the fitter. const AddFitter& get_fitter() const { return _fit; } // add the hit int add_hit(HTrack& trh, const HitPtr& phit) const; public: const SurfacePtr& get_surface() const { return _psrf;} const TrackError& get_error() const { return _err;} const Propagator* get_propagator() const { return _pprop;} int get_fit_order() const { return _fit_order;} }; } // end namespace trf #endif