# Calculate 1st heighest point on curve

Hello,

I want to find a 1st heighest point on the Graph curve (Graph arc). Means, from which point Graph curve is start increasing. Please find the attachment.

For this, I think “Bool_t TGraph::CompareArg(const TGraph* gr, Int_t left, Int_t right)” will be useful. But I am not sure. Please guide me how to use this method? OR suggest me some other way to calculate this.

My code below is as follows:

void drawGraph()
{
TCanvas *c = new TCanvas(“Graph”, “Analysis of graph”, 0, 0, 1000, 1000);

``````     T1->Draw("A:T", "", "same");
TGraph *gr1 = new TGraph(T1->GetSelectedRows(),T1->GetV2(), T1->GetV1());
gr1->Sort();
TF1 *f11 = new TF1("f11", "pol5", 10, 253);
Double_t q1 = (f11->GetParameter(0))+(f11->GetParameter(1));
gr1->Fit(f11, "R");
gr1->SetLineColor(55);

// Get x and y values for point number i.
double ax[200],ay[200];
//Get x and y values for point number i
gr1->GetPoint(i,ax[i],ay[i]);      [color=#FF0000]//How to calculate this ith point? i point will be the 1st point on the Curve. (Please find the attachment)[/color]

T1->Draw("B:T", "", "same");
TGraph *gr2 = new TGraph(T1->GetSelectedRows(),T1->GetV2(), T1->GetV1());
gr2->Sort();
TF1 *f2 = new TF1("f2", "pol5", 10, 200);
Double_t q2 = (f2->GetParameter(0))+(f2->GetParameter(1));
gr2->Fit(f2, "R");
gr2->SetLineColor(67);

TMultiGraph *mg = new TMultiGraph();
mg -> Draw("AC");
``````

}

Just loop over the points of the graph from the 1st one to the last one.
The algorithm will be some thing like:

i = 0
loop over i {
if (y(i+1) > y(i)) i = i+1
else first_highest_point = i
}