# GetBinContent and GetBinError for the TRatioPlot

Hi,

how do I get the value and the error of the ratio, i.e. LowerRefXaxis of the TRatioPlot? Is there something similar to GetBinContent and GetBinError fit TH1?

Thanks

Hi,

is

myRatioPlot->GetLowerRefXaxis()->GetBinContent(3);

what you are looking for (here for bin #3)?

yes, I tried it but I am getting:

error: no member named ‘GetBinContent’ in ‘TAxis’

Aah, right, sorry. The following works for me (now I checked):

double x, y; // this is where the coordinates of the point will be stored
// now let's check the coordinates of e.g. 10th point
myRatioPlot->GetLowerRefGraph()->GetPoint(10, x, y);
printf("ratio of point @ x=%f is %f\n", x, y);

Yes, thanks, this works!
I also found out how to get he errors:

double x, y, e; // this is where the coordinates of the point will be stored
// now let's check the coordinates of e.g. 10th point
myRatioPlot->GetLowerRefGraph()->GetPoint(10, x, y);
e = myRatioPlot->GetLowerRefGraph()->GetErrorY(10);
printf("ratio of point @ x=%f is %f +/- %f\n", x, y, e);

and in case of asymmetric error bars you have GetErrorYhigh and GetErrorYlow.
Thanks!

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