Gausian Fit in a histogram

I am having trouble getting the Gaussian fit for the histogram. I got the error: too few arguments to a function call, expected at least 2, have 1.

More: I am trying to read the data points from the txt file and make a histogram out of it. If there is a better way to do that or improve my code, please let me know that as well. Thank you very much!

TNtuple t(“current_data”, “Data from HV”, “datapoints”);

TH1F h(“Difference_Hist”, “Differences between Expected and Recorded Value;Difference;Frequency”, 20, -5, 5);
Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


how do you expect to fit a TNtuple? We usually fit histograms, not ntuples…

1 Like

I am trying to fit the histogram. When I use h.Fit(“gaus”), it says Fit data is empty. Please guide me on how to get the gaussian fit. Thanks!

Did you try the fit after filling the histogram (Draw(...) line)?

Thank you. It worked!