Hi all
I have a histo with differents bin bize. When I use the method GetMean() and a second method:
[code]void MeanPt(Int_t nbins_pt, TH1 *htmp)
{
Double_t numerator = 0.0;
Double_t denominator = 0.0;
for(Int_t i=1;i<=nbins_pt;i++)
{
Double_t binContent = htmp->GetBinContent(i);
Double_t pTValue = htmp->GetBinCenter(i);
numerator += binContent*pTValue
denominator += binContent
}
cout << "<Pt> :" << numerator/denominator << endl;
}[/code]
I find 2 different values. The value given by GetMean() is lower than the value given by my function.
There is a special way to extract the mean value of a histo with different bin size ? Or what is wrong in my method ?
Thanks