Hi rooters,
I want to fill a histogram with a gaussian distribution, with specific mean & sigma values. Is there a way to do this using roots gaussian function and specifying mean & sigma, or should I create a new function …??
Thanks in advance, Loukas
Use one of the following options:
{ TF1 *mygaus = new TF1("mygaus","TMath::Gaus(x,3,.5)",0,6); TH1F h1("h1","test1",100,0,6); h1.FillRandom("mygaus",10000); h1.Draw(); } or
{ TF1 *mygaus = new TF1("mygaus","TMath::Gaus(x,3,.5)",0,6); TH1F h1("h1","test1",100,0,6); h1.FillRandom("mygaus",10000); h1.Draw(); }
{ TRandom3 r; TH1F h1("h1","test1",100,0,6); for (int i=0;i<10000;i++) h1.Fill(r.Gaus(3,.5)); h1.Draw(); } Rene
{ TRandom3 r; TH1F h1("h1","test1",100,0,6); for (int i=0;i<10000;i++) h1.Fill(r.Gaus(3,.5)); h1.Draw(); }
Thank you Rene !