// AddFitCyl_Phi_Phi.h #ifndef AddFitCyl_Phi_Phi_H #define AddFitCyl_Phi_Phi_H // An add fitter to add a cylinder phi-measurement to a track // with one phi-measurement. // // If the propagator is not defined, then the parameters are set at // directly at the new surface and the fit is performed. // // If the optional propagator is defined, then the track is propagated // back to the first hit, has parameters set, and is then propagated // to the new hit surface where a fit is performed. // // The constructor takes an argument ptmin, hits are rejected if // the calculated pT is below this value. The error is not taken // into account. // // 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 // // ObjStream example: // // [ phifit AddFitCyl_Phi_Phi // bfield=2.0 // ptmin=0.5 // fitter=*myfit // propagator=@myprop // ] // // To use the global bfield: // // [ phifit AddFitCyl_Phi_Phi bfield=@bfield ... ] // #include "trffit/AddFitter.h" #include "trfutil/Tuple_fwd.h" #include "trfbase/PropagatorPtr.h" #include "trfbase/ObjDoublePtr.h" namespace trf { class AddFitCyl_Phi_Phi : 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, EQUAL_RADII = 4, DPHI_TOO_LARGE = 5, ROOT_FIND_FAILED = 6, PT_TOO_SMALL = 7, ALPHA1_OUT_OF_RANGE = 8, ALPHA2_OUT_OF_RANGE = 9, UNEXPECTED_ERROR = 10, ENCLOSED_FITTER_ERROR = 11 }; 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"; } // 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; // propagator PropagatorPtr _pprop; // Assumed B field. ObjDoublePtr _bfield; // Maximum q/pT in 1/GeV/c. double _qpt_max; // ntuple // Using Ptr instead of a bare pointer makes the tuple mutable. Ptr _ptup; 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(ObjDoublePtr bfield, const AddFitter& fit, double ptmin, const PropagatorPtr& pprop=PropagatorPtr(0)); // destructor ~AddFitCyl_Phi_Phi(); // Return the type. Type get_type() const { return get_static_type(); } // Write the object data. ObjData write_data() const; // Return the B-field. double get_bfield() const { return (*_bfield)(); } // Return the min pT. double get_ptmin() const { return 1.0/_qpt_max; } // Return the fitter. const AddFitter& get_fitter() const { return _fit; } // return the propagator. const PropagatorPtr& get_propagator() const { return _pprop; } // add the hit int add_hit(HTrack& trh, const HitPtr& phit) const; }; } // end namespace trf #endif