I have this part of the code:

`````` Int_t nop=100;
Double_t xpt, ypt, del = 0.9975/nop;

TGraph *av1 = new TGraph();

for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av1->SetPoint(j, xpt, 0.0);
}

for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av1->GetPoint(j, xpt, ypt);
av1->SetPoint(j, xpt, ypt + fpf[i]->Eval(xpt)/(Double_t)nof);
}
}

TGraph *av2 = new TGraph();

for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av2->SetPoint(j, xpt, 0.0);
}

for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av2->GetPoint(j, xpt, ypt);
av2->SetPoint(j, xpt, ypt + ebu[i]->Eval(xpt)/(Double_t)nof);
}
}

TGraph *av3 = new TGraph();

for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av3->SetPoint(j, xpt, 0.0);
}

for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av3->GetPoint(j, xpt, ypt);
av3->SetPoint(j, xpt, ypt + ebd[i]->Eval(xpt)/(Double_t)nof);
}
}
``````

i wanted to get the value in the x-axis of the point of intersection between graphs av1 & av2 and av1 & av3. how will i do that? thanks for your helpâ€¦

@moneta can you give a hand with this one?

1 Like

Hi,

As far as I know we donâ€™t have a function in ROOT to find the intersection between two Graphs. You have probably to write yourself an algorithm that find the intersection point using from example Graph::Eval.

In case of linear TGraph, you might assume that locally, there is some example code available here

Lorenzo

graciasâ€¦ @moneta

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