TH2F stats Access

From: Adam Roe <Adam.Roe_at_cern.ch>
Date: Thu, 21 Sep 2006 16:01:52 +0200


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 [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 - 16:02:01 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET