Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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#include "TF2.h"
27
28class TF3 : public TF2 {
29
30protected:
31 Double_t fZmin; ///< Lower bound for the range in z
32 Double_t fZmax; ///< Upper bound for the range in z
33 Int_t fNpz; ///< Number of points along z used for the graphical representation
34 Bool_t fClipBoxOn{kFALSE}; ///<! Is clip box on
35 Double_t fClipBox[3]; ///<! Coordinates of clipbox
36public:
37 TF3();
38 TF3(const char *name, const char *formula, Double_t xmin = 0, Double_t xmax = 1, Double_t ymin = 0,
39 Double_t ymax = 1, Double_t zmin = 0, Double_t zmax = 1, EAddToList addToGlobList = EAddToList::kDefault,
40 bool vectorize = false);
41 TF3(const char *name, const char *formula, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin,
42 Double_t zmax, Option_t *opt); // same as above but using a string for option
43 TF3(const char *name, Double_t (*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0,
44 Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim = 3, EAddToList addToGlobList = EAddToList::kDefault);
45 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,
46 Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim = 3, EAddToList addToGlobList = EAddToList::kDefault);
47
48 // Constructor using a functor
49 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, EAddToList addToGlobList = EAddToList::kDefault);
50
51 /// Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type MemFn.
52 template <class PtrObj, typename MemFn>
53 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,
54 Int_t ndim = 3, EAddToList addToGlobList = EAddToList::kDefault) :
55 TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,ndim,addToGlobList),
56 fZmin(zmin), fZmax(zmax), fNpz(30)
57 { }
58
59 /// Template constructors from any C++ callable object, defining the operator() (double * , double *) and returning a double.
60 template <typename Func>
61 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,
62 Int_t ndim = 3, EAddToList addToGlobList = EAddToList::kDefault) :
63 TF2(name,f,xmin,xmax,ymin,ymax,npar,ndim,addToGlobList),
64 fZmin(zmin), fZmax(zmax), fNpz(30)
65 { }
66
67 TF3(const TF3 &f3);
68 TF3& operator=(const TF3 &rhs);
69 ~TF3() override;
70 void Copy(TObject &f3) const override;
72 void Draw(Option_t *option="") override;
73 TObject *DrawDerivative(Option_t * ="al") override {return nullptr;}
74 TObject *DrawIntegral(Option_t * ="al") override {return nullptr;}
75 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
78 Int_t GetNpz() const {return fNpz;}
79 virtual void GetRandom3(Double_t &xrandom, Double_t &yrandom, Double_t &zrandom, TRandom * rng = nullptr);
80 using TF1::GetRange;
81 void GetRange(Double_t &xmin, Double_t &xmax) const override;
82 void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override ;
83 void GetRange(Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const override;
84 Double_t GetSave(const Double_t *x) override;
85 virtual Double_t GetZmin() const {return fZmin;}
86 virtual Double_t GetZmax() const {return fZmax;}
87 static void InitStandardFunctions();
88 using TF2::Integral;
89 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);
90 Bool_t IsInside(const Double_t *x) const override;
91 TH1 *CreateHistogram() override;
92 void Paint(Option_t *option="") override;
94 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
95 virtual void SetClippingBoxOff(); // *MENU*
96 virtual Bool_t GetClippingBoxOn() const { return fClipBoxOn; }
97 virtual void SetClippingBoxOn(Double_t xclip=0, Double_t yclip=0, Double_t zclip=0); // *MENU*
98 virtual const Double_t *GetClippingBox() const { return fClipBoxOn ? fClipBox : nullptr; }
99 virtual void SetNpz(Int_t npz=30);
100 void SetRange(Double_t xmin, Double_t xmax) override;
102 void SetRange(Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax) override; // *MENU*
103
104 //Moments
105 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);
106 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);
107
108 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);}
109 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);}
110 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);}
111
112 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);}
113 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);}
114 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);}
115
116 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);}
117 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);}
118 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);}
119
120protected:
121
122 Double_t FindMinMax(Double_t* x, bool findmax) const override;
123
124 ClassDefOverride(TF3,3) //The Parametric 3-D function
125};
126
135
136#endif
#define f(i)
Definition RSha256.hxx:104
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
float xmin
float ymin
float xmax
float ymax
EAddToList
Add to list behavior.
Definition TF1.h:189
virtual void GetRange(Double_t *xmin, Double_t *xmax) const
void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
void SetRange(Double_t xmin, Double_t xmax) override
Definition TF2.h:133
virtual Double_t Integral(Double_t ax, Double_t bx, Double_t ay, Double_t by, Double_t epsrel=1.e-6)
TF3(const char *name, const char *formula, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Option_t *opt)
virtual Double_t GetZmin() const
Definition TF3.h:85
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:116
virtual void SetClippingBoxOff()
void GetRange(Double_t &xmin, Double_t &xmax) const override
Definition TF3.h:127
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)
TObject * DrawIntegral(Option_t *="al") override
Definition TF3.h:74
void Paint(Option_t *option="") override
This method must be overridden if a class wants to paint itself.
TF3(const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0, Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, EAddToList addToGlobList=EAddToList::kDefault, bool vectorize=false)
Int_t GetNpz() const
Definition TF3.h:78
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:110
Bool_t IsInside(const Double_t *x) const override
return kTRUE if the point is inside the function range
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)
virtual Double_t GetMaximumXYZ(Double_t &x, Double_t &y, Double_t &z)
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to an event at (px,py).
Double_t fZmin
Lower bound for the range in z.
Definition TF3.h:31
TF3 & operator=(const TF3 &rhs)
virtual Double_t GetMinimumXYZ(Double_t &x, Double_t &y, Double_t &z)
static void InitStandardFunctions()
void GetRange(Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const override
void Copy(TObject &f3) const override
Copy this to obj.
Double_t FindMinMax(Double_t *x, bool findmax) const override
virtual void GetRandom3(Double_t &xrandom, Double_t &yrandom, Double_t &zrandom, TRandom *rng=nullptr)
~TF3() override
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:117
Bool_t fClipBoxOn
! Is clip box on
Definition TF3.h:34
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:113
Int_t fNpz
Number of points along z used for the graphical representation.
Definition TF3.h:33
virtual Bool_t GetClippingBoxOn() const
Definition TF3.h:96
void Draw(Option_t *option="") override
Default Draw method for all objects.
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:118
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, EAddToList addToGlobList=EAddToList::kDefault)
Template constructors from any C++ callable object, defining the operator() (double * ,...
Definition TF3.h:61
virtual void SetClippingBoxOn(Double_t xclip=0, Double_t yclip=0, Double_t zclip=0)
TObject * DrawDerivative(Option_t *="al") override
Definition TF3.h:73
virtual const Double_t * GetClippingBox() const
Definition TF3.h:98
Double_t fZmax
Upper bound for the range in z.
Definition TF3.h:32
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:112
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
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, Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim=3, EAddToList addToGlobList=EAddToList::kDefault)
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:108
virtual Double_t GetZmax() const
Definition TF3.h:86
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, EAddToList addToGlobList=EAddToList::kDefault)
virtual void SetNpz(Int_t npz=30)
void SetRange(Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax) override
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:114
TH1 * CreateHistogram() override
TF3(const TF3 &f3)
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, EAddToList addToGlobList=EAddToList::kDefault)
Template constructors from a pointer to any C++ class of type PtrObj with a specific member function ...
Definition TF3.h:53
void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax) override
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:109
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)
TF3(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, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim=3, EAddToList addToGlobList=EAddToList::kDefault)
Double_t GetSave(const Double_t *x) override
Double_t fClipBox[3]
! Coordinates of clipbox
Definition TF3.h:35
void SetRange(Double_t xmin, Double_t xmax) override
Definition TF3.h:131
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
Mother of all ROOT objects.
Definition TObject.h:42
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
ParamFunctorTempl< double > ParamFunctor