28double g2(
double *
x,
double *par) {
29 double r1 =
double((
x[0]-par[1])/par[2]);
30 double r2 =
double((
x[1]-par[3])/par[4]);
33double fun2(
double *
x,
double *par) {
36 double *p3 = &par[10];
37 double result = g2(
x,p1) + g2(
x,p2) + g2(
x,p3);
43 double f2params[npar] =
44 {100,-3,3,-3,3,160,0,0.8,0,0.9,40,4,0.7,4,0.7};
45 TF2 *f2 =
new TF2(
"f2",fun2,-10,10,-10,10, npar);
49 TH2F *h2 =
new TH2F(
"h2",
"from f2",40,-10,10,40,-10,10);
54 f2params[ 0] *= ratio;
55 f2params[ 5] *= ratio;
56 f2params[10] *= ratio;
59 f2->
Draw(
"cont1 same");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
virtual void SetParameters(const Double_t *params)
A 2-Dim function with parameters.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
Fit histogram with function fname.
2-D histogram with a float per channel (see TH1 documentation)}
void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.