Trouble with SetBinError

Hi everyone, i’m trying to plot some data to make a double gaussian fit and it seems to be working well, however i can’t get rid of the error bars, i’m trying SetBinError to set the error to 0 for every bin but it does’nt work, drawing with (“HIST”) is not an option because it does’nt let me see the fit curve. i don’t really know what i am doing wrong, can anyone help me? i attached my macro, the data and the graph that i am getting

datos.txt (253 Bytes) gaus.C (1.6 KB)

Hi,
I suggest you draw the histogram with

g->Draw("hist p");

and then you draw fit functions:

 g1->Draw("same");
 g2->Draw("same");
1 Like

thank you bro, this worked well.
do you have any idea why the SetBinError is not working? or why am i using it wrong?

Yep, you were using it wrong. The first parameter should be bin number. Instead of

g->SetBinError(x,0);

you should do

g->SetBinError(g->GetXaxis()->FindFixBin(x),0);
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.