**TASK**
I need the values of the Y axis and it's corresponding
X axis as plotted on my TGraphgErrors.
I am trying to store the values of x and y in two separate arrays then
compare their values to a user-defined boundary.
**PROBLEM**
When I write the values of x and y to a file,
I get the desired output, but when I try to access the array,
I do not get a valid result.
**HINT**
/*Get x and y values for point number i.
The function returns -1 in case of an invalid request or the point number otherwise
*/
Int_t TGraph::GetPoint(Int_t i, Double_t &x, Double_t &y) const
I just learned that C++ doesn't permit storing a reference into an array
but how else can I store the values of x and y for further comparison?
_**//code is below**_
void pulse
{
int n;
Double_t x,y;
Double_t xPoints[71];
Double_t yPoints[71];
TGraph *g = new TGraph();
|
.
.
.
.
//get number of points on the TGraph *g
m = g->GetN()
for(n = 0; n < m; n++)
{
g->GetPoint(n,x,y);
//assign values to the array
xPoints[n] = x;
yPoints[n] = y;
f << "xPoints[" << n << "] = " << xPoints[n] << "\t" << "yPoints["<< n << "]=" << yPoints[n] << endl;
}
}
EXPECTED OUTPUT
xPoints[0] = -4 yPoints[0]=-0.00644252
xPoints[1] = -3.8 yPoints[1]=0.00168338
xPoints[2] = -3.6 yPoints[2]=-0.00267442
xPoints[3] = -3.4 yPoints[3]=-4.06603e-05
xPoints[4] = -3.2 yPoints[4]=-0.00406858
xPoints[5] = -3 yPoints[5]=0.00133091
xPoints[6] = -2.8 yPoints[6]=0.00035244
xPoints[7] = -2.6 yPoints[7]=-0.000301726
ACTUAL OUTPUT
xPoints[0] = 7.06416e-304 yPoints[0]=7.06327e-304
xPoints[1] = 7.06416e-304 yPoints[1]=7.06327e-304
xPoints[2] = 7.06416e-304 yPoints[2]=7.06327e-304
xPoints[3] = 7.06416e-304 yPoints[3]=7.06327e-304
xPoints[4] = 7.06416e-304 yPoints[4]=7.06327e-304
xPoints[5] = 7.06416e-304 yPoints[5]=7.06327e-304
xPoints[6] = 7.06416e-304 yPoints[6]=7.06327e-304
xPoints[7] = 7.06416e-304 yPoints[7]=7.06327e-304