Example of fit where the model is histogram + function
FCN=7.84156 FROM MIGRAD STATUS=CONVERGED 183 CALLS 184 TOTAL
EDM=4.73985e-09 STRATEGY= 1 ERROR MATRIX ACCURATE
EXT PARAMETER STEP FIRST
NO. NAME VALUE ERROR SIZE DERIVATIVE
1 p0 1.56629e+02 5.91047e+00 7.83834e-05 3.68508e-06
2 p1 5.98184e+00 1.89049e-02 2.72632e-05 -3.85176e-03
3 p2 -5.06680e-01 1.80489e-02 2.01697e-05 -3.36498e-03
4 p3 1.00029e+00 1.12955e-02 1.52093e-05 1.64149e-03
void histgen() {
TF1 f1(
"f1",
"pol1",0,10);
TH1F h(
"background",
"linear background",100,0,10);
h.FillRandom(
"f1",10000);
TFile f(
"background.root",
"recreate");
TF1 f2(
"f2",
"gaus",0,10);
f2.SetParameters(1,6,0.5);
}
double ftotal(
double *
x,
double *par) {
double arg = (xx-par[1])/par[2];
return sr + br;
}
void fithist() {
histgen();
background = (
TH1F*)
f->Get(
"background");
TF1 *ftot =
new TF1(
"ftot",ftotal,0,10,4);
double norm =
result->GetMaximum();
}
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 Int_t FindBin(Double_t x)
Find bin number corresponding to abscissa x.
virtual void SetParLimits(Int_t ipar, Double_t parmin, Double_t parmax)
Set lower and upper limits for parameter ipar.
virtual void SetParameters(const Double_t *params)
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
1-D histogram with a float per channel (see TH1 documentation)}
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
- Author
- Rene Brun
Definition in file fithist.C.