2 line->SetLineWidth(5);
line->SetLineColor(col);
3 line->SetLineStyle(sty);}
7 pars[3]+pars[4]*vars[0]+pars[5]*vars[0]*vars[0];}
14 TF1 parabola(
"parabola",
"[0]+[1]*x+[2]*x**2",0,20);
17 TF1 gaussian(
"gaussian",
"[0]*TMath::Gaus(x,[1],[2])",0,20);
21 double a=15;
double b=-1.2;
double c=.03;
22 double norm=4;
double mean=7;
double sigma=1;
24 gausppar.
SetParNames(
"Norm",
"Mean",
"Sigma",
"a",
"b",
"c");
27 TH1F histo(
"histo",
"Signal plus background;X vals;Y Vals",50,0,20);
28 histo.SetMarkerStyle(8);
38 for (
int ipar=2;ipar<npar;++ipar) gausppar.
SetParameter(ipar,1);
41 auto fitResPtr =
histo.Fit(&gausppar,
"S");
45 TMatrixDSym covMatrix (fitResPtr->GetCovarianceMatrix());
49 for (
int ipar=0;ipar<3;ipar++){
54 histo.GetYaxis()->SetRangeUser(0,250);
55 histo.DrawClone(
"PE");
56 parabola.
DrawClone(
"Same"); gaussian.DrawClone(
"Same");
57 TLatex latex(2,220,
"#splitline{Signal Peak over}{background}");
58 latex.DrawClone(
"Same");
TMatrixTSym< Double_t > TMatrixDSym
virtual Double_t GetRandom(TRandom *rng=nullptr, Option_t *opt=nullptr)
Return a random number following this function shape.
virtual Int_t GetNpar() const
virtual void SetParNames(const char *name0="", const char *name1="", const char *name2="", const char *name3="", const char *name4="", const char *name5="", const char *name6="", const char *name7="", const char *name8="", const char *name9="", const char *name10="")
Set up to 10 parameter names.
virtual void SetParameters(const Double_t *params)
virtual void SetParameter(Int_t param, Double_t value)
virtual Double_t GetParameter(Int_t ipar) const
1-D histogram with a float per channel (see TH1 documentation)
To draw Mathematical Formula.
void Print(Option_t *name="") const override
Print the matrix as a table of elements.
virtual TObject * DrawClone(Option_t *option="") const
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
double the_gausppar(double *vars, double *pars)
void format_line(TAttLine *line, int col, int sty)
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculates a gaussian function with mean and sigma.