Dear All
Could anybody please suggest me how to fit some distribution with some exponential function in root.
Thanks
Shikshit
Dear All
Could anybody please suggest me how to fit some distribution with some exponential function in root.
Thanks
Shikshit
Hi,
root [0] TH1F* h = new TH1F("h", "hist", 110, -1., 10)
root [1] TF1* fillfunc = new TF1("fillfunc", "TMath::Exp((x - 3.)/10.2)")
root [2] h->FillRandom("fillfunc")
root [3] h->Draw()
Now we have a filled histogram. Let’s fit it with an exp() with a few parameters:
root [4] TF1* fitfunc = new TF1("fitfunc", "TMath::Exp((x-[0])/[1])")
root [5] fitfunc->SetParameter(0, 0.);
root [6] fitfunc->SetParameter(1, 1.);
root [7] h->Fit(fitfunc)
Cheers, Axel.