Hello all,
I have a histogram that I’ve booked and a custom function to which I’ve fitted it to. Now what I’m trying to do is subtract the fit off of the histogram to produce a plot of the residuals. I’ve built a bit of code, which I’ve attached below. It effectively fails here:
// Build the difference histogram
TH1F DiffHist(*(residual));
DiffHist.SetNameTitle("DiffHist", "Difference in error functions (all-fit)");
DiffHist->GetXaxis()->SetTitle("'Data'");
for ( int i = 1; i <= DiffHist->GetNbinsX(); i++ )
{
DiffHist.SetBinContent(i,residual->GetBinContent(i) - f1->GetBinContent(i));
}
I believe that the problem is that f1->GetBinContent(i) doesn’t exist as the proper type of object, though I’m not sure how I can modify this code to fix my problem.
Ideas?
Thank you for your time,
John
residual.C (2.64 KB)