#ifndef ROOT_TF2
#define ROOT_TF2
#ifndef ROOT_TF1
#include "TF1.h"
#endif
#ifndef ROOT_TArrayD
#include "TArrayD.h"
#endif
class TF2 : public TF1 {
protected:
Double_t fYmin;
Double_t fYmax;
Int_t fNpy;
TArrayD fContour;
public:
TF2();
TF2(const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1);
#ifndef __CINT__
TF2(const char *name, Double_t (*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Int_t npar=0);
TF2(const char *name, Double_t (*fcn)(const Double_t *, const Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Int_t npar=0);
#endif
TF2(const char *name, ROOT::Math::ParamFunctor f, Double_t xmin = 0, Double_t xmax = 1, Double_t ymin = 0, Double_t ymax = 1, Int_t npar = 0);
template <class PtrObj, typename MemFn>
TF2(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char * c1, const char * c2) :
TF1(name,p,memFn,xmin,xmax,npar,c1,c2),
fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0)
{
fNpx = 30;
fNdim = 2;
}
template <typename Func>
TF2(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char * tmp ) :
TF1(name,f,xmin,xmax,npar,tmp),
fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0)
{
fNpx = 30;
fNdim = 2;
}
TF2(const TF2 &f2);
TF2 &operator=(const TF2& rhs);
virtual ~TF2();
virtual void Copy(TObject &f2) const;
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
virtual void Draw(Option_t *option="");
virtual TF1 *DrawCopy(Option_t *option="") const;
virtual TObject *DrawDerivative(Option_t * ="al") {return 0;}
virtual TObject *DrawIntegral(Option_t * ="al") {return 0;}
virtual void DrawF2(const char *formula, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Option_t *option="");
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
virtual Int_t GetContour(Double_t *levels=0);
virtual Double_t GetContourLevel(Int_t level) const;
Int_t GetNpy() const {return fNpy;}
virtual char *GetObjectInfo(Int_t px, Int_t py) const;
Double_t GetRandom();
Double_t GetRandom(Double_t xmin, Double_t xmax);
virtual void GetRandom2(Double_t &xrandom, Double_t &yrandom);
using TF1::GetRange;
virtual void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const;
virtual void GetRange(Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const;
virtual Double_t GetSave(const Double_t *x);
virtual Double_t GetMinimumXY(Double_t &x, Double_t &y) const;
virtual Double_t GetMaximumXY(Double_t &x, Double_t &y) const;
using TF1::GetMinimum;
using TF1::GetMaximum;
virtual Double_t GetMinimum(Double_t *x ) const;
virtual Double_t GetMaximum(Double_t *x ) const;
virtual Double_t GetYmin() const {return fYmin;}
virtual Double_t GetYmax() const {return fYmax;}
using TF1::Integral;
virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsrel=1.e-6);
virtual Bool_t IsInside(const Double_t *x) const;
virtual TH1 *CreateHistogram();
virtual void Paint(Option_t *option="");
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax);
virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
virtual void SetNpy(Int_t npy=100);
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=0);
virtual void SetContourLevel(Int_t level, Double_t value);
virtual void SetRange(Double_t xmin, Double_t xmax);
virtual void SetRange(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
virtual void SetRange(Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax);
virtual Double_t Moment2(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t epsilon=0.000001);
virtual Double_t CentralMoment2(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t epsilon=0.000001);
virtual Double_t Mean2X(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001) {return Moment2(1,ax,bx,0,ay,by,epsilon);}
virtual Double_t Mean2Y(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001) {return Moment2(0,ax,bx,1,ay,by,epsilon);}
virtual Double_t Variance2X(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001) {return CentralMoment2(2,ax,bx,0,ay,by,epsilon);}
virtual Double_t Variance2Y(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001) {return CentralMoment2(0,ax,bx,2,ay,by,epsilon);}
virtual Double_t Covariance2XY(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsilon=0.000001) {return CentralMoment2(1,ax,bx,1,ay,by,epsilon);}
protected:
virtual Double_t FindMinMax(Double_t* x, bool findmax) const;
ClassDef(TF2,4)
};
inline void TF2::SetRange(Double_t xmin, Double_t xmax)
{ TF1::SetRange(xmin, xmax); }
inline void TF2::SetRange(Double_t xmin, Double_t ymin, Double_t, Double_t xmax, Double_t ymax, Double_t)
{ SetRange(xmin, ymin, xmax, ymax); }
#endif