Hello,
I am trying to get errors in a TGraphError plot. I have tried GetErrorY, but it has not worked so far. Following is a simple snippet of my code -
double mass[] = {12, 16, 20, 25, 30, 40, 50, 60, 77};
double sigma[] = {0.263,0.345,0.442,0.53,0.633,0.897,1.106,1.283,1.892};
double err[9];
TCanvas* c1 = new TCanvas("c1", "c1", 600, 600);
auto res = new TGraphErrors(9,mass,sigma);
for(int i = 0; i<9; i++){
res->SetPoint(i, mass[i], sigma[i]);
err[i] = res->GetEY()[i];
res->SetPointError(i, 0, err[i]);
}
res->Draw("ALP");
c1->Update();
But I do not see any errors in the plot I get, is there anything I am missing here ?
Thanks !
Best,
Shreya
Hi @couet,
Okay I see, I misunderstood that there is a method for TGraphError to calculate the errors, similar to GetBinError in histograms.
Thanks for the reply !