Hi,
This is what I got:
root [0] TH2F* h2Test = new TH2F("h2Test", "test of autoBin", 10, 0, 0, 10, 0,0); root [1] h2Test->SetBinContent(7,12,2); root [2] h2Test->SetBinContent(1,5,1); root [3] h2Test->Draw();
The plot shown has 2 entires in the stats, but none are shown. the other stats all say 0 as well. If it makes a difference, I am using CERN linux, and the release of root that is built with a recent CMS software package, CMSSW_0_9_0_pre2
Thanks,
Adam
-----Original Message-----
From: Rene Brun
Sent: Thu 9/21/2006 6:03 PM
To: Adam Roe
Cc: roottalk (Mailing list discussing all aspects of the ROOT system)
Subject: Re: [ROOT] TH2F stats Access
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 Fri Sep 22 2006 - 10:01:09 MEST
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:01 MET