diff --git a/hist/hist/inc/TF2.h b/hist/hist/inc/TF2.h index 9456fa3b49cfb..df06918cdde07 100644 --- a/hist/hist/inc/TF2.h +++ b/hist/hist/inc/TF2.h @@ -36,7 +36,10 @@ class TF2 : public TF1 { 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, Option_t * opt = nullptr); + TF2(const char *name, const char *formula, Double_t xmin = 0, Double_t xmax = 1, Double_t ymin = 0, + Double_t ymax = 1, EAddToList addToGlobList = EAddToList::kDefault, bool vectorize = false); + TF2(const char *name, const char *formula, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, + Option_t *opt); // same as above but using a string for option TF2(const char *name, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, Int_t ndim = 2, EAddToList addToGlobList = EAddToList::kDefault); 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,Int_t ndim = 2, EAddToList addToGlobList = EAddToList::kDefault); 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, Int_t ndim = 2, EAddToList addToGlobList = EAddToList::kDefault); diff --git a/hist/hist/inc/TF3.h b/hist/hist/inc/TF3.h index 3792703e2aaae..13db84e6e313a 100644 --- a/hist/hist/inc/TF3.h +++ b/hist/hist/inc/TF3.h @@ -35,8 +35,11 @@ class TF3 : public TF2 { Double_t fClipBox[3]; /// 2 && xmin < xmax && ymin < ymax) { + Error("TF2", "function: %s/%s has dimension %d instead of 2", name, formula, GetNdim()); + MakeZombie(); + } +} //////////////////////////////////////////////////////////////////////////////// -/// F2 constructor using a pointer to a compiled function +/// TF2 constructor using a pointer to a compiled function /// /// npar is the number of free parameters used by the function /// @@ -147,9 +181,8 @@ TF2::TF2(const char *name, Double_t xmin, Double_t xmax, Double_t ymin, Double_t fContour.Set(0); } - //////////////////////////////////////////////////////////////////////////////// -/// F2 constructor using a pointer to a compiled function +/// TF2 constructor using a pointer to a compiled function /// /// npar is the number of free parameters used by the function /// @@ -170,7 +203,7 @@ TF2::TF2(const char *name, Double_t (*fcn)(const Double_t *, const Double_t *), } //////////////////////////////////////////////////////////////////////////////// -/// F2 constructor using a ParamFunctor, +/// TF2 constructor using a ParamFunctor, /// a functor class implementing operator() (double *, double *) /// /// npar is the number of free parameters used by the function diff --git a/hist/hist/src/TF3.cxx b/hist/hist/src/TF3.cxx index 2c090ff742f55..a7d785ca78be7 100644 --- a/hist/hist/src/TF3.cxx +++ b/hist/hist/src/TF3.cxx @@ -59,14 +59,15 @@ TF3::TF3() fZmax = 1; } - //////////////////////////////////////////////////////////////////////////////// -/// F3 constructor using a formula definition +/// TF3 constructor using a formula definition and string option args /// /// See TFormula constructor for explanation of the formula syntax. -TF3::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) - :TF2(name,formula,xmin,xmax,ymax,ymin,opt) +TF3::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) + : TF2(name, formula, xmin, xmax, ymax, ymin, + opt) // purposely swapped ymax, ymin to signal that TFormula may be 1D or 2D or 3D { fZmin = zmin; fZmax = zmax; @@ -81,7 +82,30 @@ TF3::TF3(const char *name,const char *formula, Double_t xmin, Double_t xmax, Dou } //////////////////////////////////////////////////////////////////////////////// -/// F3 constructor using a pointer to real function +/// TF3 constructor using a formula definition and explicit option args +/// +/// See TFormula constructor for explanation of the formula syntax. + +TF3::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, EAddToList addToGlobList, bool vectorize) + : TF2(name, formula, xmin, xmax, ymax, ymin, addToGlobList, + vectorize) // purposely swapped ymax, ymin to signal that TFormula may be 1D or 2D or 3D +{ + fZmin = zmin; + fZmax = zmax; + fNpz = 30; + Int_t ndim = GetNdim(); + // accept 1-d or 2-d formula + if (ndim < 3) + fNdim = 3; + if (ndim > 3 && xmin < xmax && ymin < ymax && zmin < zmax) { + Error("TF3", "function: %s/%s has dimension %d instead of 3", name, formula, ndim); + MakeZombie(); + } +} + +//////////////////////////////////////////////////////////////////////////////// +/// TF3 constructor using a pointer to real function /// /// \param[in] name object name /// \param[in] fcn pointer to real function @@ -108,7 +132,7 @@ TF3::TF3(const char *name,Double_t (*fcn)(Double_t *, Double_t *), Double_t xmin } //////////////////////////////////////////////////////////////////////////////// -/// F3 constructor using a pointer to real function--- +/// TF3 constructor using a pointer to real function--- /// /// \param[in] name object name /// \param[in] fcn pointer to real function @@ -135,7 +159,7 @@ TF3::TF3(const char *name,Double_t (*fcn)(const Double_t *, const Double_t *), D } //////////////////////////////////////////////////////////////////////////////// -/// F3 constructor using a ParamFunctor +/// TF3 constructor using a ParamFunctor /// /// a functor class implementing operator() (double *, double *) ///