I’m running into an issue where I fill my histograms, but when I fit them with a TF1, it fits to the middle of the bins, meaning my 0 bin is fitted as though it’s 0.5, 1 is fitted to 1.5, etc. Is there a way to either fit to the left bin edge, or fill the histogram such that the bins are centered instead of the 0 going from 0-1, etc?
Some sample code similar to what I’m doing:
(assume I have a tree called ‘tr’ with data in it)
TH1F *h_t1= new TH1F(“h_t1”,“Title”,numbins, lowbin, highbin);
for (int i =0; i<num_of_entries;i++)
TCanvas *c_t1 = new TCanvas();
TF1 *gausfit = new TF1(“gausfit”,"exp(-0.5((x-)/)^2)", -6, 6);
I’ve tried doing h_t1->SetBarOffset(-0.5), but that only shifts where the bins are drawn, not where the TF1 fits them. Is there an easy way to do this that I’m missing?
Thanks for any help you can provide!
_Platform:Scientific Linux 7
Compiler: Not Provided