Logo ROOT   6.08/07
Reference Guide
TF3.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Rene Brun 27/10/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 // ---------------------------------- F3.h
12 
13 #ifndef ROOT_TF3
14 #define ROOT_TF3
15 
16 
17 
18 //////////////////////////////////////////////////////////////////////////
19 // //
20 // TF3 //
21 // //
22 // The Parametric 3-D function //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #ifndef ROOT_TF2
27 #include "TF2.h"
28 #endif
29 
30 class TF3 : public TF2 {
31 
32 protected:
33  Double_t fZmin; //Lower bound for the range in z
34  Double_t fZmax; //Upper bound for the range in z
35  Int_t fNpz; //Number of points along z used for the graphical representation
36 
37 public:
38  TF3();
39  TF3(const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0,
40  Double_t ymax=1, Double_t zmin=0, Double_t zmax=1);
41 #ifndef __CINT__
42  TF3(const char *name, Double_t (*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0,
43  Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim = 3);
44  TF3(const char *name, Double_t (*fcn)(const Double_t *, const Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0,
45  Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim = 3);
46 #endif
47 
48  // constructor using a functor
49 
50  TF3(const char *name, ROOT::Math::ParamFunctor f, Double_t xmin = 0, Double_t xmax = 1, Double_t ymin = 0, Double_t ymax = 1, Double_t zmin=0, Double_t zmax=1, Int_t npar = 0, Int_t ndim = 3);
51 
52 
53  // Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type
54  // MemFn.
55  template <class PtrObj, typename MemFn>
56  TF3(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar,
57  Int_t ndim = 3) :
58  TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,ndim),
59  fZmin(zmin), fZmax(zmax), fNpz(30)
60  { }
61  /// Backward compatible ctor
62  template <class PtrObj, typename MemFn>
63  TF3(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar,
64  const char * , const char * ) :
65  TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,3),
66  fZmin(zmin), fZmax(zmax), fNpz(30)
67  { }
68  // Template constructors from any C++ callable object, defining the operator() (double * , double *)
69  // and returning a double.
70  template <typename Func>
71  TF3(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar,
72  Int_t ndim = 3 ) :
73  TF2(name,f,xmin,xmax,ymin,ymax,npar,ndim),
74  fZmin(zmin), fZmax(zmax), fNpz(30)
75  { }
76  /// backward compatible ctor
77  template <typename Func>
78  TF3(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar,
79  const char * ) :
80  TF2(name,f,xmin,xmax,ymin,ymax,npar,3),
81  fZmin(zmin), fZmax(zmax), fNpz(30)
82  { }
83 
84  TF3(const TF3 &f3);
85  TF3& operator=(const TF3 &rhs);
86  virtual ~TF3();
87  virtual void Copy(TObject &f3) const;
88  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
89  virtual void Draw(Option_t *option="");
90  virtual TObject *DrawDerivative(Option_t * ="al") {return 0;}
91  virtual TObject *DrawIntegral(Option_t * ="al") {return 0;}
92  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
94  virtual Double_t GetMaximumXYZ(Double_t &x, Double_t &y, Double_t &z);
95  Int_t GetNpz() const {return fNpz;}
96  virtual void GetRandom3(Double_t &xrandom, Double_t &yrandom, Double_t &zrandom);
97  using TF1::GetRange;
98  virtual void GetRange(Double_t &xmin, Double_t &xmax) const;
99  virtual void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const ;
100  virtual void GetRange(Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const;
101  virtual Double_t GetSave(const Double_t *x);
102  virtual Double_t GetZmin() const {return fZmin;}
103  virtual Double_t GetZmax() const {return fZmax;}
104  using TF2::Integral;
105  virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsrel=1.e-6);
106  virtual Bool_t IsInside(const Double_t *x) const;
107  virtual TH1 *CreateHistogram();
108  virtual void Paint(Option_t *option="");
109  virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax);
110  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
111  virtual void SetClippingBoxOff(); // *MENU*
112  virtual void SetClippingBoxOn(Double_t xclip=0, Double_t yclip=0, Double_t zclip=0); // *MENU*
113  virtual void SetNpz(Int_t npz=30);
114  virtual void SetRange(Double_t xmin, Double_t xmax);
115  virtual void SetRange(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax);
116  virtual void SetRange(Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax); // *MENU*
117 
118  //Moments
120  virtual Double_t CentralMoment3(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t nz, Double_t az, Double_t bz, Double_t epsilon=0.000001);
121 
122  virtual Double_t Mean3X(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return Moment3(1,ax,bx,0,ay,by,0,az,bz,epsilon);}
123  virtual Double_t Mean3Y(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return Moment3(0,ax,bx,1,ay,by,0,az,bz,epsilon);}
124  virtual Double_t Mean3Z(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return Moment3(0,ax,bx,0,ay,by,1,az,bz,epsilon);}
125 
126  virtual Double_t Variance3X(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return CentralMoment3(2,ax,bx,0,ay,by,0,az,bz,epsilon);}
127  virtual Double_t Variance3Y(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return CentralMoment3(0,ax,bx,2,ay,by,0,az,bz,epsilon);}
128  virtual Double_t Variance3Z(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return CentralMoment3(0,ax,bx,0,ay,by,2,az,bz,epsilon);}
129 
130  virtual Double_t Covariance3XY(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return CentralMoment3(1,ax,bx,1,ay,by,0,az,bz,epsilon);}
131  virtual Double_t Covariance3XZ(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return CentralMoment3(1,ax,bx,0,ay,by,1,az,bz,epsilon);}
132  virtual Double_t Covariance3YZ(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001) {return CentralMoment3(0,ax,bx,1,ay,by,1,az,bz,epsilon);}
133 
134 protected:
135 
136  virtual Double_t FindMinMax(Double_t* x, bool findmax) const;
137 
138  ClassDef(TF3,3) //The Parametric 3-D function
139 };
140 
141 inline void TF3::GetRange(Double_t &xmin, Double_t &xmax) const
142  { TF2::GetRange(xmin, xmax); }
144  { TF2::GetRange(xmin, ymin, xmax, ymax); }
146  { TF2::SetRange(xmin, xmax); }
148  { TF2::SetRange(xmin, ymin, xmax, ymax); }
149 
150 #endif
const int nx
Definition: kalman.C:16
virtual void Copy(TObject &f3) const
Copy this F3 to a new F3.
Definition: TF3.cxx:150
float xmin
Definition: THbookFile.cxx:93
virtual Double_t Covariance3YZ(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:132
virtual Double_t Moment3(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t nz, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Return x^nx * y^ny * z^nz moment of a 3d function in range [ax,bx],[ay,by],[az,bz].
Definition: TF3.cxx:719
virtual Double_t Covariance3XY(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:130
virtual Double_t Mean3Y(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:123
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF3.cxx:174
Double_t fZmax
Definition: TF3.h:34
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
Save values of function in array fSave.
Definition: TF3.cxx:534
const char Option_t
Definition: RtypesCore.h:62
virtual Double_t GetZmax() const
Definition: TF3.h:103
float ymin
Definition: THbookFile.cxx:93
virtual TH1 * CreateHistogram()
Create a histogram for axis range.
Definition: TF3.cxx:482
virtual ~TF3()
F3 default destructor.
Definition: TF3.cxx:135
Double_t fZmin
Definition: TF3.h:33
Int_t GetNpz() const
Definition: TF3.h:95
virtual void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Return range of a 2-D function.
Definition: TF2.cxx:554
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TF3.cxx:589
virtual Double_t Mean3X(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:122
virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsrel=1.e-6)
Return Integral of a 2d function in range [ax,bx],[ay,by] with desired relative accuracy (default val...
Definition: TF2.cxx:619
virtual Double_t GetMinimumXYZ(Double_t &x, Double_t &y, Double_t &z)
Compute the X, Y and Z values corresponding to the minimum value of the function on its range...
Definition: TF3.cxx:278
virtual void SetClippingBoxOn(Double_t xclip=0, Double_t yclip=0, Double_t zclip=0)
Set the function clipping box (for drawing) "on" and define the clipping box.
Definition: TF3.cxx:640
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Definition: TF3.cxx:189
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
const int ny
Definition: kalman.C:17
virtual TObject * DrawDerivative(Option_t *="al")
Draw derivative of this function.
Definition: TF3.h:90
virtual Double_t Mean3Z(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:124
virtual Double_t GetMaximumXYZ(Double_t &x, Double_t &y, Double_t &z)
Compute the X, Y and Z values corresponding to the maximum value of the function on its range...
Definition: TF3.cxx:294
TF3()
F3 default constructor.
Definition: TF3.cxx:36
virtual void Paint(Option_t *option="")
Paint this 3-D function with its current attributes.
Definition: TF3.cxx:494
virtual Double_t Variance3Y(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:127
virtual Double_t Covariance3XZ(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:131
TF3(const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar, const char *, const char *)
Backward compatible ctor.
Definition: TF3.h:63
TF3(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar, const char *)
backward compatible ctor
Definition: TF3.h:78
float ymax
Definition: THbookFile.cxx:93
virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsrel=1.e-6)
Return Integral of a 3d function in range [ax,bx],[ay,by],[az,bz] with a desired relative accuracy...
Definition: TF3.cxx:448
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
virtual Double_t CentralMoment3(Double_t nx, Double_t ax, Double_t bx, Double_t ny, Double_t ay, Double_t by, Double_t nz, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Return x^nx * y^ny * z^nz central moment of a 3d function in range [ax,bx],[ay,by],[az,bz].
Definition: TF3.cxx:735
A 3-Dim function with parameters.
Definition: TF3.h:30
virtual void GetRange(Double_t &xmin, Double_t &xmax) const
Return range of a 1-D function.
Definition: TF3.h:141
virtual void GetRandom3(Double_t &xrandom, Double_t &yrandom, Double_t &zrandom)
Return 3 random numbers following this function shape.
Definition: TF3.cxx:322
virtual TObject * DrawIntegral(Option_t *="al")
Draw integral of this function.
Definition: TF3.h:91
float xmax
Definition: THbookFile.cxx:93
A 2-Dim function with parameters.
Definition: TF2.h:33
Int_t fNpz
Definition: TF3.h:35
REAL epsilon
Definition: triangle.c:617
TF3 & operator=(const TF3 &rhs)
Operator =.
Definition: TF3.cxx:124
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF2.h:154
double f(double x)
double Double_t
Definition: RtypesCore.h:55
virtual Double_t Variance3Z(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:128
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:80
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
virtual void SetClippingBoxOff()
Set the function clipping box (for drawing) "off".
Definition: TF3.cxx:520
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
virtual Double_t Variance3X(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t az, Double_t bz, Double_t epsilon=0.000001)
Definition: TF3.h:126
TF3(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar, Int_t ndim=3)
Definition: TF3.h:71
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Definition: TF3.h:145
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
Return range of a generic N-D function.
Definition: TF1.cxx:1989
virtual Bool_t IsInside(const Double_t *x) const
Return kTRUE is the point is inside the function range.
Definition: TF3.cxx:471
virtual Double_t FindMinMax(Double_t *x, bool findmax) const
Return minimum/maximum value of the function.
Definition: TF3.cxx:210
Param Functor class for Multidimensional functions.
Definition: ParamFunctor.h:209
virtual Double_t GetZmin() const
Definition: TF3.h:102
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a function.
Definition: TF3.cxx:165
char name[80]
Definition: TGX11.cxx:109
virtual Double_t GetSave(const Double_t *x)
Get value corresponding to X in array of fSave values.
Definition: TF3.cxx:394
TF3(const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t npar, Int_t ndim=3)
Definition: TF3.h:56
virtual void SetNpz(Int_t npz=30)
Set the number of points used to draw the function.
Definition: TF3.cxx:664