Fit data is empty despite presence of histogram


I’m attempting to modify the example code, langaus.c found on this page, so it may use the histogram that I have on hand (not filling it out bin by bin). So far, the only parts of the code that I have modified are adding an additional line at the beginning,

void langaus(const char *file = “durchflug_messung_100.root”)

which contains the .root file containing the TH1F histogram, and the parts between // Fill histogram and Fitting SNR histo, in addition to the names hSNR to hFlythrough. Here’s how it looks like right now:

void langaus(const char *file = “durchflug_messung_100.root”) {
// Fill Histogram
TFile f(file);
TCanvas c_work = (TCanvas) f.Get(“c1”);
TH1F *hFlythrough_100 = (TH1F *) c_work->GetPrimitive(“h”);
// Fitting SNR histo

However, when I run this macro, I get the following error:

Warning in : Fit data is empty

Could anyone give any pointers as to why this is so? Attached is the file that I hope to fit.
durchflug_messung_100.root (22.9 KB)

ROOT Version: 6.09/01
Platform: Linux Mint 19.1
Compiler: Not Provided

Your “h” histogram has all errors 0.
Either execute “h->Sumw2(kFALSE);” or try to use the “W” or “WW” fit options.

1 Like

Thanks for noticing that! I wasn’t aware that it’d have an affect on me trying to fit a curve onto it!