diff --git a/hist/hist/inc/TF1.h b/hist/hist/inc/TF1.h index ce2a3ead9fd58d779690e38afeb2b5d46671fbf9..d2577658a4449bfdf43df79df86e4fbd1257b06d 100644 --- a/hist/hist/inc/TF1.h +++ b/hist/hist/inc/TF1.h @@ -205,7 +205,7 @@ public: // xmin and xmax specify the plotting range, npar is the number of parameters. // See the tutorial math/exampleFunctor.C for an example of using this constructor template <typename Func> - TF1(const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar,Int_t ndim = 1, const char * = 0 ) : + TF1(const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar,Int_t ndim = 1 ) : TNamed(name,name), TAttLine(), TAttFill(), TAttMarker(), fXmin(xmin), fXmax(xmax), fNpar(npar), fNdim(ndim), @@ -223,6 +223,13 @@ public: { DoInitialize(); } + // backward compatible interface + template <typename Func> + TF1(const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, const char * ) { + TF1 tmp(name,f,xmin,xmax,npar,1); + *this = tmp; + } + // Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type // MemFn. @@ -233,7 +240,7 @@ public: // xmin and xmax specify the plotting range, npar is the number of parameters. // See the tutorial math/exampleFunctor.C for an example of using this constructor template <class PtrObj, typename MemFn> - TF1(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar,Int_t ndim = 1, const char * = 0, const char * = 0) : + TF1(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar,Int_t ndim = 1) : TNamed(name,name), TAttLine(), TAttFill(), TAttMarker(), fXmin(xmin), fXmax(xmax), fNpar(npar), fNdim(ndim), @@ -251,6 +258,12 @@ public: { DoInitialize(); } + // backward compatible interface + template <class PtrObj, typename MemFn> + TF1(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar,const char * , const char * ) { + TF1 tmp(name,p, memFn,xmin,xmax,npar,1); + *this = tmp; + } TF1(const TF1 &f1); TF1& operator=(const TF1 &rhs); diff --git a/hist/hist/inc/TF2.h b/hist/hist/inc/TF2.h index 2baf3e0c16992e503126e5122d2039ad0a62c167..bae9a2316532647df82a82e866e7243a406b6ba2 100644 --- a/hist/hist/inc/TF2.h +++ b/hist/hist/inc/TF2.h @@ -54,21 +54,39 @@ public: // Template constructors from a pointer to any C++ class of type PtrObj with a specific member function of type // MemFn. template <class PtrObj, typename MemFn> - TF2(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, Int_t ndim = 2, const char * c1 = 0, const char * c2 = 0) : - TF1(name,p,memFn,xmin,xmax,npar,ndim,c1,c2), + TF2(const char *name, const PtrObj& p, MemFn memFn, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar, Int_t ndim = 2) : + TF1(name,p,memFn,xmin,xmax,npar,ndim), fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0) { fNpx = 30; - } + } + /// backward compatible ctor + template <class PtrObj, typename MemFn> + 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 * , const char *) : + TF1(name,p,memFn,xmin,xmax,npar,2), + fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0) + { + fNpx = 30; + } + // Template constructors from any C++ callable object, defining the operator() (double * , double *) // and returning a double. template <typename Func> - TF2(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar,Int_t ndim = 2, const char * tmp = 0 ) : - TF1(name,f,xmin,xmax,npar,ndim,tmp), + TF2(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar,Int_t ndim = 2) : + TF1(name,f,xmin,xmax,npar,ndim), fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0) { fNpx = 30; - } + } + /// backward compatible ctor + template <typename Func> + TF2(const char *name, Func f, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t npar,const char *) : + TF1(name,f,xmin,xmax,npar,2), + fYmin(ymin), fYmax(ymax), fNpy(30), fContour(0) + { + fNpx = 30; + } + TF2(const TF2 &f2); TF2 &operator=(const TF2& rhs); diff --git a/hist/hist/inc/TF3.h b/hist/hist/inc/TF3.h index 10ee76dcf688c5b6f0ed79cb82fb8d8098cf9bfd..d5424b6e00cbe3b422a7b795ea053453f25d4386 100644 --- a/hist/hist/inc/TF3.h +++ b/hist/hist/inc/TF3.h @@ -54,16 +54,30 @@ public: // MemFn. template <class PtrObj, typename MemFn> 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, const char * c1 = 0, const char * c2 = 0) : - TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,ndim,c1,c2), + Int_t ndim = 3) : + TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,ndim), + fZmin(zmin), fZmax(zmax), fNpz(30) + { } + /// Backward compatible ctor + template <class PtrObj, typename MemFn> + 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 * ) : + TF2(name,p,memFn,xmin,xmax,ymin,ymax,npar,3), fZmin(zmin), fZmax(zmax), fNpz(30) { } // Template constructors from any C++ callable object, defining the operator() (double * , double *) // and returning a double. template <typename Func> 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, const char * c1 = 0 ) : - TF2(name,f,xmin,xmax,ymin,ymax,npar,ndim,c1), + Int_t ndim = 3 ) : + TF2(name,f,xmin,xmax,ymin,ymax,npar,ndim), + fZmin(zmin), fZmax(zmax), fNpz(30) + { } + /// backward compatible ctor + template <typename Func> + 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 * ) : + TF2(name,f,xmin,xmax,ymin,ymax,npar,3), fZmin(zmin), fZmax(zmax), fNpz(30) { } diff --git a/hist/hist/src/TKDE.cxx b/hist/hist/src/TKDE.cxx index 12d5059867af7fb875c62b79f1337225ef7891c0..4983a5c735d3c9691265bf5b0ee9dc3b73f43b16 100644 --- a/hist/hist/src/TKDE.cxx +++ b/hist/hist/src/TKDE.cxx @@ -1000,7 +1000,7 @@ TF1* TKDE::GetPDFUpperConfidenceInterval(Double_t confidenceLevel, UInt_t npx, D TString name; name.Form("KDE_UpperCL%f5.3_%s",confidenceLevel,GetName()); if (xMin >= xMax) { xMin = fXMin; xMax = fXMax; } - TF1 * upperPDF = new TF1(name, this, &TKDE::UpperConfidenceInterval, xMin, xMax, 1,1, "TKDE", "UpperConfidenceInterval"); + TF1 * upperPDF = new TF1(name, this, &TKDE::UpperConfidenceInterval, xMin, xMax, 1); upperPDF->SetParameter(0, confidenceLevel); if (npx > 0) upperPDF->SetNpx(npx); TF1 * f = (TF1*)upperPDF->Clone(); diff --git a/roofit/roofitcore/src/RooAbsReal.cxx b/roofit/roofitcore/src/RooAbsReal.cxx index 1fa560e78ad48f2ca9e2540c28bfde51aaa61ad4..c833c635c7c0cc1850637f9306bf8c1454d8e2e7 100644 --- a/roofit/roofitcore/src/RooAbsReal.cxx +++ b/roofit/roofitcore/src/RooAbsReal.cxx @@ -4078,14 +4078,14 @@ TF1* RooAbsReal::asTF(const RooArgList& obs, const RooArgList& pars, const RooAr case 1: { RooRealVar* x = (RooRealVar*)obs.at(0) ; f = functor(obs,pars,nset) ; - tf = new TF1(GetName(),f,x->getMin(),x->getMax(),pars.getSize(),1,"RooFunctor") ; + tf = new TF1(GetName(),f,x->getMin(),x->getMax(),pars.getSize()) ; break ; } case 2: { RooRealVar* x = (RooRealVar*)obs.at(0) ; RooRealVar* y = (RooRealVar*)obs.at(1) ; f = functor(obs,pars,nset) ; - tf = new TF2(GetName(),f,x->getMin(),x->getMax(),y->getMin(),y->getMax(),pars.getSize(),2,"RooFunctor") ; + tf = new TF2(GetName(),f,x->getMin(),x->getMax(),y->getMin(),y->getMax(),pars.getSize()) ; break ; } case 3: { @@ -4093,7 +4093,7 @@ TF1* RooAbsReal::asTF(const RooArgList& obs, const RooArgList& pars, const RooAr RooRealVar* y = (RooRealVar*)obs.at(1) ; RooRealVar* z = (RooRealVar*)obs.at(2) ; f = functor(obs,pars,nset) ; - tf = new TF3(GetName(),f,x->getMin(),x->getMax(),y->getMin(),y->getMax(),z->getMin(),z->getMax(),pars.getSize(),3,"RooFunctor") ; + tf = new TF3(GetName(),f,x->getMin(),x->getMax(),y->getMin(),y->getMax(),z->getMin(),z->getMax(),pars.getSize()) ; break ; } default: