File indexing completed on 2025-01-18 10:11:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_TF3
0014 #define ROOT_TF3
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "TF2.h"
0027
0028 class TF3 : public TF2 {
0029
0030 protected:
0031 Double_t fZmin;
0032 Double_t fZmax;
0033 Int_t fNpz;
0034 Bool_t fClipBoxOn{kFALSE};
0035 Double_t fClipBox[3];
0036 public:
0037 TF3();
0038 TF3(const char *name, const char *formula, Double_t xmin=0, Double_t xmax=1, Double_t ymin=0,
0039 Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Option_t * opt = nullptr);
0040 TF3(const char *name, Double_t (*fcn)(Double_t *, Double_t *), Double_t xmin=0, Double_t xmax=1, Double_t ymin=0,
0041 Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim = 3);
0042 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,
0043 Double_t ymax=1, Double_t zmin=0, Double_t zmax=1, Int_t npar=0, Int_t ndim = 3);
0044
0045
0046 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);
0047
0048
0049 template <class PtrObj, typename MemFn>
0050 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,
0051 Int_t ndim = 3) :
0052 TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,ndim),
0053 fZmin(zmin), fZmax(zmax), fNpz(30)
0054 { }
0055
0056
0057 template <class PtrObj, typename MemFn>
0058 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,
0059 const char * , const char * ) :
0060 TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,3),
0061 fZmin(zmin), fZmax(zmax), fNpz(30)
0062 { }
0063
0064
0065 template <typename Func>
0066 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,
0067 Int_t ndim = 3 ) :
0068 TF2(name,f,xmin,xmax,ymin,ymax,npar,ndim),
0069 fZmin(zmin), fZmax(zmax), fNpz(30)
0070 { }
0071
0072
0073 template <typename Func>
0074 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,
0075 const char * ) :
0076 TF2(name,f,xmin,xmax,ymin,ymax,npar,3),
0077 fZmin(zmin), fZmax(zmax), fNpz(30)
0078 { }
0079
0080 TF3(const TF3 &f3);
0081 TF3& operator=(const TF3 &rhs);
0082 ~TF3() override;
0083 void Copy(TObject &f3) const override;
0084 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0085 void Draw(Option_t *option="") override;
0086 TObject *DrawDerivative(Option_t * ="al") override {return nullptr;}
0087 TObject *DrawIntegral(Option_t * ="al") override {return nullptr;}
0088 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0089 virtual Double_t GetMinimumXYZ(Double_t &x, Double_t &y, Double_t &z);
0090 virtual Double_t GetMaximumXYZ(Double_t &x, Double_t &y, Double_t &z);
0091 Int_t GetNpz() const {return fNpz;}
0092 virtual void GetRandom3(Double_t &xrandom, Double_t &yrandom, Double_t &zrandom, TRandom * rng = nullptr);
0093 using TF1::GetRange;
0094 void GetRange(Double_t &xmin, Double_t &xmax) const override;
0095 void GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override ;
0096 void GetRange(Double_t &xmin, Double_t &ymin, Double_t &zmin, Double_t &xmax, Double_t &ymax, Double_t &zmax) const override;
0097 Double_t GetSave(const Double_t *x) override;
0098 virtual Double_t GetZmin() const {return fZmin;}
0099 virtual Double_t GetZmax() const {return fZmax;}
0100 using TF2::Integral;
0101 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);
0102 Bool_t IsInside(const Double_t *x) const override;
0103 TH1 *CreateHistogram() override;
0104 void Paint(Option_t *option="") override;
0105 void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax) override;
0106 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0107 virtual void SetClippingBoxOff();
0108 virtual Bool_t GetClippingBoxOn() const { return fClipBoxOn; }
0109 virtual void SetClippingBoxOn(Double_t xclip=0, Double_t yclip=0, Double_t zclip=0);
0110 virtual const Double_t *GetClippingBox() const { return fClipBoxOn ? fClipBox : nullptr; }
0111 virtual void SetNpz(Int_t npz=30);
0112 void SetRange(Double_t xmin, Double_t xmax) override;
0113 void SetRange(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax) override;
0114 void SetRange(Double_t xmin, Double_t ymin, Double_t zmin, Double_t xmax, Double_t ymax, Double_t zmax) override;
0115
0116
0117 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);
0118 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);
0119
0120 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);}
0121 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);}
0122 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);}
0123
0124 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);}
0125 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);}
0126 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);}
0127
0128 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);}
0129 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);}
0130 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);}
0131
0132 protected:
0133
0134 Double_t FindMinMax(Double_t* x, bool findmax) const override;
0135
0136 ClassDefOverride(TF3,3)
0137 };
0138
0139 inline void TF3::GetRange(Double_t &xmin, Double_t &xmax) const
0140 { TF2::GetRange(xmin, xmax); }
0141 inline void TF3::GetRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
0142 { TF2::GetRange(xmin, ymin, xmax, ymax); }
0143 inline void TF3::SetRange(Double_t xmin, Double_t xmax)
0144 { TF2::SetRange(xmin, xmax); }
0145 inline void TF3::SetRange(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
0146 { TF2::SetRange(xmin, ymin, xmax, ymax); }
0147
0148 #endif