The looping to do this should be extremely simple (3 C++ lines), but you
don't need to do this
for the goal that you want to achieve.
You should simply use the automatic binning facility of the
histogramming package.Instead of
root [1] TH2F* h2Test = new TH2F("h2Test", "test of yMax", 10, 0, 10, -5, 20);
do
root [1] TH2F* h2Test = new TH2F("h2Test", "test of yMax", 10, 0, 0, 10,0,0);
Rene Brun
Adam Roe wrote:
> Hi all (again),
> I asked a question this morning, but i believe i phrased it wrong. I am trying to access the highest y-value in a data set which is in a histogram. Here is an explicit (trivial) example of what I am trying to do:
>
> root [1] TH2F* h2Test = new TH2F("h2Test", "test of yMax", 10, 0, 10, -5, 20);
> root [1] TH2F* h2Test = new TH2F("h2Test", "test of yMax", 10, 0, 10, -5, 20);
>
> root [2] h2Test->SetBinContent(1,1,1);
> root [3] h2Test->SetBinContent(3,5,2);
> root [4] h2Test->SetBinContent(4,41,3);
>
> And now i would like to call somethineg which returns 41, the maximum y value in h2Test. I would then use this to reset the yaxis range, so that this point is included.
>
> I cannot find a way to get this value. The looping is rather large and complicated, so i am trying to avoid filling a vector with x-y coordinates and then fidning the maximum value in it.
>
> This functionality is very simple for a TH1F. calling h1->GetMaximum() returns the highest y-value that is reached in h1. But i cannot get it to function for TH2F.
>
> Thanks,
> Adam
>
Received on Thu Sep 21 2006 - 18:03:15 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET