RE: [ROOTDEV] TGraph GetMaximum

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Thu, 11 Feb 2010 17:47:01 +0100


Dear Christian,

What about :

   TMath::MaxElement(gr->GetN(),gr->GetY());

?

Olivier

-----Original Message-----
From: Christian Hansen
Sent: Thursday, February 11, 2010 5:31 PM To: Olivier Couet
Cc: roottalk_at_root.cern.ch; roottalk
Subject: Re: [ROOTDEV] TGraph GetMaximum

Dear Olivier,

At a first glance this seemed to work. But looking into more details I see that

  cout<<"YMin = "<<gr->GetHistogram()->GetMinimum()<<" YMax = "<<gr->GetHistogram()->GetMaximum()<<endl;

gives

  YMin = -140 YMax = 340

but I hoped to see this output:
YMin = -100 YMax = 300
I guess it has something to do with the bin size of the graph's histogram. Is there any way I can get the maximum and minimum value entered into the graph at the initialization? That is, I want to get the maximum and minimum values shown in the attached plot.

I would also like to do the same with the X-axis, i.e. I would want to be able to get this output:

                                                           XMin = 0
XMax = 4
but I haven't manage this either.
Any ideas...?
(Test program is attached.)

With best regards
/Christian Received on Thu Feb 11 2010 - 17:47:06 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 11 2010 - 23:50:01 CET