Error of datapoints in a graph

Draft.C (9.1 KB)
Here I have 2 graphs. I need the error for the data points in each graph.

Please help!
Thanks

Hi @tanmaya_shree; maybe @couet can help you with that.

Cheers,
J.

1 Like

So I saw some threads regarding TGraphErrors. There I saw ex, ey, which I think is error in x and error in y. How do I proceed after that? Can I obtain ex and ey from the graph itself and plot it using TGraphErrors or is there any other approach? Where do I find ex and ey from? I have no idea regarding this.
@jalopezg
@couet

Thanks!

TGraphErrors

1 Like

Yes there in the example it has two arrays for ex and ey with different set of values.
Double_t ex[n] = {.05,.1,.07,.07,.04,.05,.06,.07,.08,.05};

Double_t ey[n] = {.8,.7,.6,.5,.4,.4,.5,.6,.7,.8};

So my doubt is how do I get these error values for my graph or how is it calculated?

It’s the user’s responsibility to provide the data points and their errors / uncertainties.

1 Like

Also I found these from one of your replies.

for (int i = 0; i < myGraph1->GetN(); i++) myGraph1->SetPointError(i, 0., 0.1);

What this statement does?

TGraphErrors::SetPointError

Draft.C (9.1 KB)

1 Like

Point1_0.C (12.3 KB)
Here I have graphs with only a single point along with their corresponding error. But in the graphs I am not getting the errors. Can someone please have a look?

The root files used here are large. I will try and give a link. But if possible please check the attach code file.

Thanks!

Points are numbered from 0, not from 1 (so, when you “add” the very first point, it should be number 0).

1 Like

Yes yes tried it just now and its working. Thank you! :grin:

Hello,
I am facing some error when I am trying to use multigraph with TGraphErrors.
Point1_0.root (6.8 KB)
Point1_1.root (6.8 KB)
Point_Comb.C (1.7 KB)

For 2 cases I am getting the graph but for other two cases I am not.

Graph3 is missing in Point1_0.root:

 % rootls Point1_0.root
Graph1  Graph2  Graph4  Graph4  Pt_0

1 Like

:smiling_face_with_tear: :smiling_face_with_tear: :smiling_face_with_tear:
thanks!

Can someone guide me about bins and no. of bins. How do they work? What happens when I increase the no. of bins in a TProfile?

Thanks!

TProfile
TH1

1 Like

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