Hi everyone?
I want to ask how to get average histogram from single histogram
For example: I have 3 histogram.
TH1Da with a_mean = 11 and a_rms = sqrt(11)) (rms is error for a value)
TH1Db with a_mean = 12 and b_rms = sqrt(12))
TH1Dc with a_mean = 13 and c_rms = sqrt(13))
I want to get TH1Davergage from a,b,c to get average_mean and average_rms.
Thank you very much,
Jessica

it is my code. include_errror_data.C (2.4 KB)
What I want to calculated is the average histogram " TH1D *his_event_average = new TH1D(“event_average”, “”, 100, 0, 50);". I don’t know how to calculate average values I used is right or not but I can’t run it yet.
Cheers,
Jessica

Hi @Jessica.PQ ,
if I understand your script correctly you are calculating the histogram of the average values. That’s different from calculating the average of the histograms. Which one do you need?

Note that event_aver is a double (i.e. just a number) so you can’t do event_aver->Scale(1.0 / 3.0) but you can simply divide it by 3: event_aver = event_aver / 3..

Thanks Enrico. I can fix this error.
I have a problem. In this code, I can draw a graph with the attached data file. combine_data.zip (85.7 KB)
Now I want to add a point which has coordinates (0.528, 0.0604) in the same plot. How can I do that?
Cheers.
Jessica

I added TGraphError with structure:
TGraphErrors*real = new TGraphErrors(1, 0.528, 0.0726091, 0.0465, 0.0138799);
real-> SetMarkerStyle(21);
real-> SetMarkerColor(4);
real-> Draw(“ALP”);
But I don’t know what is my fault?
error: no matching constructor for initialization of ‘TGraphErrors’
…= new TGraphErrors(1, 0.528, 0.0726091, 0.0465, 0.0138799);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks