[ROOT] Re: get minimum of graph

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jul 19 2004 - 16:09:20 MEST


Use the functions in TMath like TMath::LocMin, LocMax to find the index
of the min/max element of an array, eg, assuming TGraph *gr;
   int n = gr->GetN();
   double* y = gr->GetY();
   int locmax = TMath::LocMax(n,y);
   double tmax = y[locmax];

To add a constant, do:
for (int i=0;i<n;i++) y[i] += constant;

Rene Brun


Avdhesh Chandra wrote:
> 
>  Hi,
> 
>    How I can get a min. and max. of Y axis on a graph? and How I can shift
>  only Y points to a new value(may be after adding a constant), (without
>  changing X, values).
> 
>  Thanks for any help,
>  Avdhesh



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET