TF2.h

Go to the documentation of this file.
00001 // @(#)root/hist:$Id: TF2.h 29895 2009-08-25 09:35:06Z brun $
00002 // Author: Rene Brun   23/08/95
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 // ---------------------------------- F2.h
00012 
00013 #ifndef ROOT_TF2
00014 #define ROOT_TF2
00015 
00016 
00017 
00018 //////////////////////////////////////////////////////////////////////////
00019 //                                                                      //
00020 // TF2                                                                  //
00021 //                                                                      //
00022 // The Parametric 2-D function                                          //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 #ifndef ROOT_TF1
00027 #include "TF1.h"
00028 #endif
00029 #ifndef ROOT_TArrayD
00030 #include "TArrayD.h"
00031 #endif
00032 
00033 class TF2 : public TF1 {
00034 
00035 protected:
00036    Double_t  fYmin;        //Lower bound for the range in y
00037    Double_t  fYmax;        //Upper bound for the range in y
00038    Int_t     fNpy;         //Number of points along y used for the graphical representation
00039    TArrayD   fContour;     //Array to display contour levels
00040 
00041 public:
00042    TF2();
00043    TF2(const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1);
00044    TF2(const char *name, void *fcn, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Int_t npar=0);
00045 #ifndef __CINT__
00046    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);
00047    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);
00048 #endif
00049 
00050    // constructor using a functor
00051    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);  
00052 
00053    // Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type 
00054    // MemFn. 
00055    template <class PtrObj, typename MemFn>
00056    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) : 
00057       TF1(name,p,memFn,xmin,xmax,npar,c1,c2),
00058         fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0)
00059    {
00060       fNpx = 30; 
00061       fNdim = 2;
00062    } 
00063    // Template constructors from any  C++ callable object,  defining  the operator() (double * , double *) 
00064    // and returning a double.    
00065    template <typename Func> 
00066    TF2(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char * tmp  ) : 
00067       TF1(name,f,xmin,xmax,npar,tmp),
00068         fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0)
00069    {
00070       fNpx = 30; 
00071       fNdim = 2;
00072    } 
00073 
00074    // constructor used by CINT 
00075    TF2(const char *name, void *ptr,  Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char *className ); 
00076    TF2(const char *name, void *ptr, void *,Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, const char *className, const char *methodName = 0);
00077 
00078    TF2(const TF2 &f2);
00079    TF2 &operator=(const TF2& rhs);
00080    virtual   ~TF2();
00081    virtual void     Copy(TObject &f2) const;
00082    virtual Int_t    DistancetoPrimitive(Int_t px, Int_t py);
00083    virtual void     Draw(Option_t *option="");
00084    virtual TF1     *DrawCopy(Option_t *option="") const;
00085    virtual TObject *DrawDerivative(Option_t * ="al") {return 0;}
00086    virtual TObject *DrawIntegral(Option_t * ="al")   {return 0;}
00087    virtual void     DrawF2(const char *formula, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Option_t *option="");
00088    virtual void     ExecuteEvent(Int_t event, Int_t px, Int_t py);
00089    virtual Int_t    GetContour(Double_t *levels=0);
00090    virtual Double_t GetContourLevel(Int_t level) const;
00091           Int_t     GetNpy() const {return fNpy;}
00092    virtual char    *GetObjectInfo(Int_t px, Int_t py) const;
00093        Double_t     GetRandom();
00094        Double_t     GetRandom(Double_t xmin, Double_t xmax);
00095    virtual void     GetRandom2(Double_t &xrandom, Double_t &yrandom);
00096    virtual void     GetRange(Double_t &xmin, Double_t &xmax) const { TF1::GetRange(xmin, xmax); }
00097    virtual void     GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const;
00098    virtual void     GetRange(Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const;
00099    virtual Double_t GetSave(const Double_t *x);
00100    virtual void     GetMinimumXY(Double_t &x, Double_t &y);
00101    virtual Double_t GetYmin() const {return fYmin;}
00102    virtual Double_t GetYmax() const {return fYmax;}
00103    virtual Double_t Integral(Double_t a, Double_t b, const Double_t *params=0, Double_t epsil=0.000001) {return TF1::Integral(a,b,params,epsil);}
00104    virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsil=0.000001);
00105    virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsil=0.000001)
00106                             {return TF1::Integral(ax,bx,ay,by,az,bz,epsil);}
00107    virtual Bool_t   IsInside(const Double_t *x) const;
00108    virtual TH1     *CreateHistogram();
00109    virtual void     Paint(Option_t *option="");
00110    virtual void     Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax);
00111    virtual void     SavePrimitive(ostream &out, Option_t *option = "");
00112    virtual void     SetNpy(Int_t npy=100); // *MENU*
00113    virtual void     SetContour(Int_t nlevels=20, const Double_t *levels=0);
00114    virtual void     SetContourLevel(Int_t level, Double_t value);
00115    virtual void     SetRange(Double_t xmin, Double_t xmax);
00116    virtual void     SetRange(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax); // *MENU*
00117    virtual void     SetRange(Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax);
00118 
00119    //Moments
00120    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);
00121    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);
00122 
00123    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);}
00124    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);}
00125 
00126    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);}
00127    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);}
00128 
00129    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);}
00130 
00131    ClassDef(TF2,4)  //The Parametric 2-D function
00132 };
00133 
00134 inline void TF2::SetRange(Double_t xmin, Double_t xmax)
00135    { TF1::SetRange(xmin, xmax); }
00136 inline void TF2::SetRange(Double_t xmin, Double_t ymin, Double_t, Double_t xmax, Double_t ymax, Double_t)
00137    { SetRange(xmin, ymin, xmax, ymax); }
00138 
00139 #endif

Generated on Tue Jul 5 14:22:48 2011 for ROOT_528-00b_version by  doxygen 1.5.1