// AddFitCyl_PhiZ.h #ifndef AddFitCyl_PhiZ_H #define AddFitCyl_PhiZ_H // An add fitter to add the first cylinder phiz-measurement to // a track. // // Limits for z are specified in the constructor. The hit is rejected // if it falls outside this range. // // 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 tthe following wo 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 // // The data in the ntuple: // z0 - initial calculated z-position // z - calculated z-position making z > _zmin // return - return status (0 for no error) // // ObjStream example: // // [ myfit AddFitCyl_PhiZ zmin=-60. zmax=60. ] // #include "trffit/AddFitter.h" #include "ptr/Ptr.h" #include "trfutil/Tuple_fwd.h" namespace trf { class AddFitCyl_PhiZ : public AddFitter { public: // enums // add_hit return status. // We guarantee OK will always be zero. enum ReturnStatus { OK = 0, WRONG_TYPE = 1, WRONG_TYPE_EXISTING = 2, ZERO_STEREO = 3, OUT_OF_RANGE = 4 }; 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_PhiZ"; } // 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 // Z-limits and their average. double _zmin; double _zmax; double _zavg; // ntuple // Using Ptr instead of a bare pointer makes the tuple mutable. Ptr _ptup; private: // methods // ouput 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_PhiZ(double zmin, double zmax); // destructor ~AddFitCyl_PhiZ(); // Return the type. Type get_type() const { return get_static_type(); } // Write the object data. ObjData write_data() const; // Return zmin. double get_zmin() const { return _zmin; } // Return zmax. double get_zmax() const { return _zmax; } // add the hit int add_hit(HTrack& trh, const HitPtr& phit) const; }; } // end namespace trf #endif