/* * CauchyDistribution.hh * * Class to provide calculation of the value and the derivatives of * the Cauchy (Breit-Wigner) distribution for fitting with the Minuit2 * CombinedMinimizer class. * * Created on: Oct 13, 2015 * Author: Hovanes Egiyan */ #ifndef CAUCHYDISTRIBUTION_HH_ #define CAUCHYDISTRIBUTION_HH_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class CauchyDistribution: public ROOT::Minuit2::FCNGradientBase { protected: const static unsigned cdNumberOfParameters; double cdErrorDef; const std::vector* cdAxisX; const std::vector* cdAxisY; public: CauchyDistribution( const std::vector* xAxis, const std::vector* yAxis ); virtual ~CauchyDistribution(); virtual double operator()( const std::vector& x ) const; CauchyDistribution& operator=( const CauchyDistribution& dist ); inline virtual double Up() const { return cdErrorDef; } inline virtual void SetErrDef( double errDef ) { setErrorDef( errDef ); } // Method to calculate the gradient of the function to minimize wrt parameters. virtual std::vector Gradient( const std::vector& x ) const; // Turns off checking the gradient calculations against the calculation by Minuit. virtual bool CheckGradient() const { // Check will not be performed return false; } inline virtual const std::vector* getAxisX() const { return cdAxisX; } inline virtual const std::vector* setAxisX( const std::vector* cdAxisX ) { return (this->cdAxisX = cdAxisX); } inline virtual const std::vector* getAxisY() const { return cdAxisY; } inline virtual const std::vector* setAxisY( const std::vector* cdAxisY ) { return (this->cdAxisY = cdAxisY); } inline double getErrorDef() const { return cdErrorDef; } inline void setErrorDef( double errDef ) { cdErrorDef = errDef; } inline static unsigned getNumberOfParameters() { return cdNumberOfParameters; } // inline static void setNumberOfParameters( const unsigned numberOfParameters ) { // cdNumberOfParameters = numberOfParameters; // } }; #endif /* CAUCHYDISTRIBUTION_HH_ */