15 return par[0] + par[1]*x[0] + par[2]*x[0]*x[0];
36 Double_t data[nBins] = { 6, 1,10,12, 6,13,23,22,15,21,
37 23,26,36,25,27,35,40,44,66,81,
38 75,57,48,45,46,41,35,36,53,32,
39 40,37,38,31,36,44,42,37,32,32,
40 43,44,35,33,33,39,29,41,32,44,
41 26,39,29,35,32,21,21,15,25,15};
48 "Lorentzian Peak on Quadratic Background",60,0,3);
53 for(
int i=0; i < nBins; i++) histo->
SetBinContent(i+1,data[i]);
67 histo->
Fit(
"fitFcn",
"0");
73 histo->
Fit(
"fitFcn",
"V+",
"ep");
87 backFcn->
Draw(
"same");
90 signalFcn->
Draw(
"same");
96 legend->
AddEntry(histo,
"Data",
"lpe");
97 legend->
AddEntry(backFcn,
"Background fit",
"l");
98 legend->
AddEntry(signalFcn,
"Signal fit",
"l");
99 legend->
AddEntry(fitFcn,
"Global Fit",
"l");
virtual void SetLineWidth(Width_t lwidth)
virtual void SetParameters(const Double_t *params)
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
This class displays a legend box (TPaveText) containing several legend entries.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
virtual void SetTextFont(Font_t tfont=62)
Double_t fitFunction(Double_t *x, Double_t *par)
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
virtual void SetLineColor(Color_t lcolor)
virtual void SetFillColor(Color_t fcolor)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
Double_t lorentzianPeak(Double_t *x, Double_t *par)
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
virtual Double_t * GetParameters() const
Short_t Max(Short_t a, Short_t b)
Double_t background(Double_t *x, Double_t *par)
void SetFrameFillColor(Color_t color=1)
virtual void SetParameter(Int_t param, Double_t value)
virtual void SetTextSize(Float_t tsize=1)
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.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.