Hii,
I am new user of root. I have a plot using TGraph and I want to extract the x and y values corresponding each data point. I am using GetPOint(int, double,double) for that. But it is not working. The following is my code:
{
TFile *f = new TFile(“inocross.root”);
if (!f) {
cout << "Failed to open: " << “inocross.root” << endl;
return;
}
TGraph h1 = (TGraph)gDirectory->Get(“nu_mu_Fe56/coh_cc”);
if (!h1) {
cout << "Failed to retrieve: " << “nu_mu_Fe56/coh_cc” << endl;
return;
}
h1->Draw(“AC”);
int num;
double numx,numy;
Double_t x, y;
num=h1->GetN();
numx=h1->GetX();
numy=h1->GetY();
cout<<"numberx "<<numx<<endl;
for(int i=0;i<num;i++)
cout<GetPoint(i,x,y)<<endl;
}
Could you tell me what is going wrong?
Thanks in advance!