Print content of TGraph2DErrors

Hi,

having an TGraphErrors I can print the content with

gr->Print()
x[0]=-0.22, y[0]=1, ex[0]=0.05, ey[0]=0.8
...
x[n]=0.95, y[n]=1, ex[n]=0.05, ey[n]=0.8

For the TGraph2DErrors i would expect the same just with x, y and z. But I get the very useful output

OBJ: TGraph2DErrors	Graph2D	Graph2D

Is there a way to get the content without written them out during the filling?

It seems the TGraph2DXXX Classes get the Print method from TNamed. That’s why it gives a so short output . It should be implemented.

I totally agree. Unfortunately that means that I have to find another way to solve my problem if such a method does not exist yet…

I will implement them soon

If somebody has the same problem, a simple implementation could look like this

void Print(TGraph2DErrors& graph){
    int count = graph.GetN();
    double* xvalues = graph.GetX();
    double* xerrors = graph.GetEX();
    double* yvalues = graph.GetY();
    double* yerrors = graph.GetEY();
    double* zvalues = graph.GetZ();
    double* zerrors = graph.GetEZ();
       
    for (unsigned int i = 0; i < count; ++i){
        cout << "x[" << i << "]=" << xvalues[i] << ", "
             << "y[" << i << "]=" << yvalues[i] << ", "
             << "z[" << i << "]=" << zvalues[i] << ", " 
             << "ex[" << i << "]=" << xerrors[i] << ", "
             << "ey[" << i << "]=" << yerrors[i] << ", " 
             << "ez[" << i << "]=" << zerrors[i] << endl;
    }    
}

Now implemented in ROOOT master.

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