I want to fill a histogram with a Gaussian distribution with known mean value (most likely x$_c$ is 0) and sigma.
How can do that?
Secondly, I want to use the values of y for various x values.
Is it possible access that also for further calculation.
one way to do it:
TH1D h("h", "h", /*nbins=*/100, /*xmin=*/-3, /*xmax=*/3);
You can access the bin content of a histogram with
Hope this helps,
Thanks for your kind help.
One more thing is I was trying something like:
But I don't get any Gaussian distribution, instead, I get a line.
Do you have any idea to fix it?
from just that snippet I can’t be sure exactly what you are doing wrong, but this works:
TH1D h("h", "h", 100, -3., 3.);
for (int i = 0; i < 100; ++i) h.Fill(rndgen.Gaus(0.,1.));
Now it works.
Thank you very much.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.