Plotting points on the graph

Does your macro run ? it crashes for me …

It runs in mine… but I could not see the points of av0001… i don’t know why…

I do not understand your code. You have:

 TF1 *lbs[nof];

Which declares an array of pointers to TF1

Then you do:

    av001->SetPoint(j, xpt, ypt + lbs[i]->Eval(xpt)/(Double_t)nof);

But what is lbs[i] ? … the function lbs[i] has never been defined seems to me …

Same thing for lbc, les and lec

sorry… my mistake… it was defined, however, in the longer version of the code :slight_smile:

The graph has 0 point:

root [0] .x DataPointSample.C
Error in <TGraphPainter::PaintGraph>: illegal number of points (0)

That’s why you do not see it.

But i could see this:

x[97]=0.4838, y[97]=0.00089801
x[98]=0.488787, y[98]=0.000876956
x[99]=0.493775, y[99]=0.000856525
x[100]=0.498762, y[100]=0.000836693
x[101]=0.50375, y[101]=0.000817439
x[102]=0.508737, y[102]=0.000798742
x[103]=0.513725, y[103]=0.000780584

indeed, the value of x[100] of 0.498762 is a valid point in the x-axis… how could it be…

The test:

   if ( abs(xpt - 0.498762) < ept )

is never true.

I printed the points… that value was there… now, i do not know why… i tried using xpt==0.498762 but the same thing happens :slight_smile:

Make ept bigger (0.01) and you will see some points … (I told you the test I pointed is never true …)

gracias for the enlightenment :slight_smile:

I am supposed to see 4 new points but I could only see 3 for this code:

DataPointSample.C (90.1 KB)

Well, that’s your code… Regarding the code itself (c++ syntax etc… ) there is no mistakes. I guess it is up to you to check your data (you know them better than me) and the parameters settings (eps, ept …)