Accessing statistical information

HI ,
I am creating an array of 2d histograms, I want to save the mean of the x axis and y axis for each histogram, how doI do it ?
-thanks debdatta.

h2mean.C file:

[code]void h2mean()
{
const Int_t num = 3;
TH2F *hh[num];
for (Int_t i = 0; i < num; i++) {
hh[i] = new TH2F(Form(“hh%d”,i),"", 10, -1, 1, 10, -1, 1);
hh[i]->FillRandom(“gaus”);
Printf(“X = %8.6g, Y = %8.6g”, hh[i]->GetMean(1), hh[i]->GetMean(2));
}

// second
Printf("\n___second___\n");
TIter next(gDirectory->GetList());
TH2F *htmp;
TObject otmp;
while (otmp = next())
if (otmp->InheritsFrom(“TH2F”)) {
htmp = (TH2F
)otmp;
Printf(“X = %8.6g, Y = %8.6g”, htmp->GetMean(1), htmp->GetMean(2));
}
}
[/code]

[quote]root [0] .L h2mean.C
root [1] h2mean(); > out
[/quote]
I hope this help
Jan

Hi,
thanks for your reply. I would like to ask another question. I want to create a 2dimensional array of histograms. I also want the upper and lower limit to change for each histogram. Is it possible to put this in a loop and change the limits w/o changing each one by hand ?

I also want to have just one bin in both x and y axis, but it doesn’t seem to work because the plots look strange when I try to do that.

                                               -thanks debdatta.

HI,
another quick question is , is there anyway of getting the mean of “each bin” instead of the mean of an axis ?