How to draw a Gaussian

Hey everyone,

I had a silly question. I have all the parameters for a gaussian distribution, the mean, the standard deviation as well as its the area under curve. I am trying to recreate the gaussian with my specific parameters, how can i do that?

1 Like

Hi,

if you have area, mean and sigma, your corresponding function in ROOT is:

auto f1 = new TF1("f1","area * ROOT::Math::normal_pdf(x, sigma, mean) ", xmin, xmax);

You can also express in terms of parameters by doing instead

auto f1 = new TF1("f1","[area] * ROOT::Math::normal_pdf(x, [sigma], [mean]) ", xmin, xmax);
f1->SetParameter("area",area_value);
f1->SetParameter("mean",mean_value);
f1->SetParameter("sigma",sigma_value);

Lorenzo

How to store/convert this function as a histogram ?

Hi,
See TF1::GetHistogram,

Cheers

Lorenzo

Thanks Lorenzo!