31 "Fitting 3 TGraphErrors with linear functions");
35 makePoints(n, x, y, e, 3);
45 makePoints(n, x, y, e, 2);
57 TF1 *f2 =
new TF1(
"f2",
"sin(x) ++ sin(2*x)", -2, 2);
64 makePoints(n, x, y, e, 4);
71 gre4->
Fit(
"1 ++ exp(-x)");
79 leg->
AddEntry(gre3,
" -7 + 2*x*x + x*x*x",
"p");
80 leg->
AddEntry(gre2,
"sin(x) + sin(2*x)",
"p");
81 leg->
AddEntry(gre4,
"-2 + exp(-x)",
"p");
101 y[i] = -7 + 2*x[i]*x[i] + x[i]*x[i]*x[i]+ r.
Gaus()*0.1;
106 for (i=0; i<
n; i++) {
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
This class displays a legend box (TPaveText) containing several legend entries.
TF1 * GetFunction(const char *name) const
Return pointer to function with name.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
This is the base class for the ROOT Random number generators.
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
A TGraphErrors is a TGraph with error bars.