26 #include "RConfigure.h" 37 #ifndef ROOT_TAttMarker 41 #ifndef ROOT_Math_ParamFunctor 61 fParNames(
std::vector<
std::string>(npar) )
63 for (
int i = 0; i < npar; ++i ){
69 fParameters(rhs.fParameters),
70 fParNames(rhs.fParNames)
74 if (&rhs ==
this)
return *
this;
83 return (CheckIndex(iparam)) ? fParameters[iparam] : 0;
86 return GetParameter(GetParNumber(name) );
89 return fParameters.data();
91 const std::vector<double> &
ParamsVec()
const {
return fParameters; }
93 Int_t GetParNumber(
const char *
name)
const;
96 return (CheckIndex(iparam)) ? fParNames[iparam].c_str() :
"";
102 if (!CheckIndex(iparam))
return;
103 fParameters[iparam] = value;
106 std::copy(params, params + fParameters.size(), fParameters.begin() );
113 SetParameter(GetParNumber(name),value);
116 if (!CheckIndex(iparam))
return;
117 fParNames[iparam] = std::string(name);
119 void SetParNames(
const char *name0=
"p0",
const char *name1=
"p1",
const char *name2=
"p2",
120 const char *name3=
"p3",
const char*name4=
"p4",
const char *name5=
"p5",
121 const char *name6=
"p6",
const char *name7=
"p7",
const char *name8=
"p8",
122 const char *name9=
"p9",
const char *name10=
"p10");
130 return (i >= 0 && i <
int(fParameters.size()) );
200 void IntegrateForNormalization();
233 template <
typename Func>
237 template <
typename Func>
240 fXmin(xmin), fXmax(xmax),
241 fNpar(npar), fNdim(1),
243 fNpfits(0), fNDF(0), fChisquare(0),
244 fMinimum(-1111), fMaximum(-1111),
248 fParent(0), fHistogram(0),
250 fNormalized(false), fNormIntegral(0),
251 fFunctor(
ROOT::
Math::ParamFunctor(f)),
255 DoInitialize(addToGlobList);
267 template <
class PtrObj,
typename MemFn>
270 fXmin(xmin), fXmax(xmax),
271 fNpar(npar), fNdim(ndim),
273 fNpfits(0), fNDF(0), fChisquare(0),
274 fMinimum(-1111), fMaximum(-1111),
278 fParent(0), fHistogram(0),
280 fNormalized(false), fNormIntegral(0),
281 fFunctor (
ROOT::
Math::ParamFunctor(p,memFn) ),
285 DoInitialize(addToGlobList);
288 template <
class PtrObj,
typename MemFn>
291 fXmin(xmin), fXmax(xmax),
292 fNpar(npar), fNdim(1),
294 fNpfits(0), fNDF(0), fChisquare(0),
295 fMinimum(-1111), fMaximum(-1111),
299 fParent(0), fHistogram(0),
301 fNormalized(false), fNormIntegral(0),
302 fFunctor (
ROOT::
Math::ParamFunctor(p,memFn) ),
306 DoInitialize(addToGlobList);
310 TF1& operator=(
const TF1 &rhs);
337 virtual TH1 *GetHistogram()
const;
351 virtual Int_t GetNDF()
const;
355 virtual Int_t GetNumberFreeParameters()
const;
357 virtual char *GetObjectInfo(
Int_t px,
Int_t py)
const;
390 TAxis *GetXaxis()
const ;
391 TAxis *GetYaxis()
const ;
392 TAxis *GetZaxis()
const ;
397 static void InitStandardFunctions();
406 return IntegralMultiple(n,a,b,maxpts, epsrel, epsrel, relerr, nfnevl, ifail);
413 virtual Bool_t IsValid()
const;
415 virtual void Paint(
Option_t *option=
"");
416 virtual void ReleaseParameter(
Int_t ipar);
418 virtual void SavePrimitive(std::ostream &out,
Option_t *option =
"");
421 template <
class PtrObj,
typename MemFn>
422 void SetFunction( PtrObj& p, MemFn memFn );
423 template <
typename Func>
424 void SetFunction(
Func f );
425 virtual void SetMaximum(
Double_t maximum=-1111);
426 virtual void SetMinimum(
Double_t minimum=-1111);
427 virtual void SetNDF(
Int_t ndf);
430 virtual void SetNpx(
Int_t npx=100);
446 if (fFormula) fFormula->
SetParameters(p0,p1,
p2,
p3,p4,p5,p6,p7,p8,p9,p10);
447 else fParams->
SetParameters(p0,p1,
p2,
p3,p4,p5,p6,p7,p8,p9,p10);
450 virtual void SetParName(
Int_t ipar,
const char *name);
451 virtual void SetParNames(
const char *name0=
"p0",
const char *name1=
"p1",
const char *name2=
"p2",
452 const char *name3=
"p3",
const char *name4=
"p4",
const char *name5=
"p5",
453 const char *name6=
"p6",
const char *name7=
"p7",
const char *name8=
"p8",
454 const char *name9=
"p9",
const char *name10=
"p10");
456 virtual void SetParErrors(
const Double_t *errors);
463 virtual void SetTitle(
const char *title=
"");
464 virtual void Update();
466 static TF1 *GetCurrent();
469 static Bool_t RejectedPoint();
470 static void SetCurrent(
TF1 *f1);
487 template <
typename Func>
490 fXmin(xmin), fXmax(xmax),
491 fNpar(npar), fNdim(ndim),
493 fNpfits(0), fNDF(0), fChisquare(0),
494 fMinimum(-1111), fMaximum(-1111),
498 fParent(0), fHistogram(0),
500 fNormalized(false), fNormIntegral(0),
525 TString formulaExpression(formula);
528 TString title = formulaExpression( first, last-first);
539 {
return Eval(x,y,z,t); }
543 if (fMethodCall)
InitArgs(x,params);
553 template <
typename Func>
559 template <
class PtrObj,
typename MemFn>
ROOT::Math::ParamFunctor fFunctor
virtual TString GetExpFormula(Option_t *option="") const
virtual void SetParameters(Double_t p0, Double_t p1, Double_t p2=0, Double_t p3=0, Double_t p4=0, Double_t p5=0, Double_t p6=0, Double_t p7=0, Double_t p8=0, Double_t p9=0, Double_t p10=0)
TF1Parameters(Int_t npar)
virtual void AddParameter(const TString &name, Double_t value)
virtual void SetParameters(const Double_t *params)
Bool_t fNormalized
Pointer to MethodCall in case of interpreted function.
virtual Double_t operator()(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual TFormula * GetFormula()
virtual Int_t GetNpx() const
static double p3(double t, double a, double b, double c, double d)
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
static std::atomic< Bool_t > fgAbsValue
TF1(const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar, const char *, const char *, EAddToList addToGlobList=EAddToList::kDefault)
TMethodCall * GetMethodCall() const
void DoInitialize(EAddToList addToGlobList)
Common initialization of the TF1.
virtual Double_t GetMinimumStored() const
TObject * fParent
Array gamma.
virtual void SetRange(Double_t xmin, Double_t xmax)
Initialize the upper and lower bounds to draw the function.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
std::vector< std::string > fParNames
virtual void SetNumberFitPoints(Int_t npfits)
void SetParameter(const char *name, Double_t value)
void SetFunction(PtrObj &p, MemFn memFn)
Internal class used by TF1 for defining template specialization for different TF1 constructors...
virtual void SetNormalized(Bool_t flag)
Double_t GetParameter(Int_t iparam) const
TF1(const char *name, Func f, Double_t xmin, Double_t xmax, Int_t npar, const char *, EAddToList addToGlobList=EAddToList::kDefault)
virtual void SetParent(TObject *p=0)
TFormula * fFormula
Functor object to wrap any C++ callable object.
Fill Area Attributes class.
void SetParameters(TFitEditor::FuncParams_t &pars, TF1 *func)
Restore the parameters from pars into the function.
#define ClassDef(name, id)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
The TNamed class is the base class for all named ROOT classes.
const char * GetParName(Int_t iparam) const
virtual Double_t GetVariable(const TString &name)
virtual void GetParameters(Double_t *params)
bool CheckIndex(Int_t i) const
static double p2(double t, double a, double b, double c)
TF1()
TF1 default constructor.
void SetParameters(const Double_t *params)
std::vector< std::vector< double > > Data
virtual Double_t IntegralMultiple(Int_t n, const Double_t *a, const Double_t *b, Int_t, Int_t maxpts, Double_t epsrel, Double_t &relerr, Int_t &nfnevl, Int_t &ifail)
virtual Int_t GetNdim() const
Method or function calling interface.
virtual Double_t GetMaximumStored() const
static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
Parse comments to search for a range specifier of the style: [xmin,xmax] or [xmin,xmax,nbits] [0,1] [-10,100]; [-pi,pi], [-pi/2,pi/4],[-2pi,2*pi] [-10,100,16] [0,0,8] if nbits is not specified, or nbits <2 or nbits>32 it is set to 32 if (xmin==0 and xmax==0 and nbits <=16) the double word will be converted to a float and its mantissa truncated to nbits significative bits.
TF1Parameters & operator=(const TF1Parameters &rhs)
std::vector< Double_t > fIntegral
virtual const char * GetParName(Int_t ipar) const
Using a TBrowser one can browse all ROOT objects.
virtual void SetChisquare(Double_t chi2)
static Bool_t fgRejectPoint
std::vector< Double_t > fParameters
TH1 * fHistogram
Parent object hooking this function (if one)
virtual const Double_t * GetParErrors() const
Class to manage histogram axis.
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
virtual Int_t GetNumberFitPoints() const
double IntegralError(TF1 *func, Int_t ndim, const double *a, const double *b, const double *params, const double *covmat, double epsilon)
virtual const TObject * GetLinearPart(Int_t i) const
virtual Bool_t IsLinear() const
Double_t GetParameter(const char *name) const
virtual const TFormula * GetFormula() const
static double p1(double t, double a, double b)
const std::vector< double > & ParamsVec() const
virtual Double_t GetParameter(const TString &name) const
virtual Double_t GetXmin() const
virtual void SetParameter(const TString &name, Double_t value)
void SetParameter(Int_t iparam, Double_t value)
virtual Double_t Mean(Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001)
virtual Bool_t IsEvalNormalized() const
virtual void SetTitle(const char *title="")
Set function title if title has the form "fffffff;xxxx;yyyy", it is assumed that the function title i...
TF1(const char *name, const PtrObj &p, MemFn memFn, Double_t xmin, Double_t xmax, Int_t npar, Int_t ndim=1, EAddToList addToGlobList=EAddToList::kDefault)
Double_t GetChisquare() const
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
class containg the result of the fit and all the related information (fitted parameter values...
void Copy(void *source, void *dest)
void Print(std::ostream &os, const OptionType &opt)
std::vector< Double_t > fSave
Ssiz_t Last(char c) const
Find last occurrence of a character c.
std::vector< Double_t > fParErrors
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
void SetParName(Int_t iparam, const char *name)
Int_t GetParNumber(const char *name) const
Returns the parameter number given a name not very efficient but list of parameters is typically smal...
std::vector< Double_t > fGamma
Array beta. is approximated by x = alpha +beta*r *gamma*r**2.
double func(double *x, double *p)
virtual Double_t Variance(Double_t a, Double_t b, const Double_t *params=0, Double_t epsilon=0.000001)
virtual Double_t GetXmax() const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
std::vector< Double_t > fAlpha
Integral of function binned on fNpx bins.
Namespace for new Math classes and functions.
virtual void InitArgs(const Double_t *x, const Double_t *params)
Initialize parameters addresses.
std::vector< Double_t > fBeta
Array alpha. for each bin in x the deconvolution r of fIntegral.
TObject * GetParent() const
Mother of all ROOT objects.
you should not use this method at all Int_t Int_t z
virtual Bool_t IsInside(const Double_t *x) const
return kTRUE if the point is inside the function range
TMethodCall * fMethodCall
Pointer to histogram used for visualisation.
virtual TH1 * CreateHistogram()
RooCmdArg Save(Bool_t flag=kTRUE)
virtual Int_t GetNpar() const
static void Build(TF1 *f, Func func)
virtual Double_t GetParameter(Int_t ipar) const
Param Functor class for Multidimensional functions.
static void Build(TF1 *f, const char *formula)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
const Double_t * GetParameters() const
static std::atomic< Bool_t > fgAddToGlobList
virtual Double_t * GetParameters() const
virtual void SetParameter(Int_t param, Double_t value)
std::vector< Double_t > fParMax
virtual Double_t EvalPar(const Double_t *x, const Double_t *params=0)
Evaluate function with given coordinates and parameters.
virtual Int_t GetNumber() const
std::vector< Double_t > fParMin
virtual Int_t GetParNumber(const char *name) const
TF1Parameters(const TF1Parameters &rhs)