Fill the histogram with mean=1 and sigma=2

import ROOT
f = ROOT.gROOT.GetFunction("gaus")
f.SetParameters(1.0, 1.0, 2.0) # Constant, Mean, Sigma
h1 = ROOT.TH1F("h1", "", 100, -10.0, 10.0)
h1.FillRandom("gaus", 10000)
h1.Draw()
{
  TF1 *f = ((TF1*)(gROOT->GetFunction("gaus")));
  f->SetParameters(1.0, 1.0, 2.0); // Constant, Mean, Sigma
  TH1F *h1 = new TH1F("h1", "", 100, -10.0, 10.0);
  h1->FillRandom("gaus", 10000);
  h1->Draw();
}
1 Like