[ROOT] Re: TProfile->Scale()

From: Art Poskanzer (AMPoskanzer@lbl.gov)
Date: Thu Apr 13 2000 - 02:36:43 MEST


I got no response to the mail below. But I have since learned that
profile histograms have always behaved this way, even in PAW. I am now
trying to scale my profile histogram by looping over all the bins,
doing GetBinContent, scaling it, and then doing SetBinContent. (I
would do the same for the errors.) However, this procedure gives
nonsense (very low) results when I do a GetBinContent again. Although
GetBinContent is a member function of TProfile, SetBinContent is
inherited from TH1D.

Someone, please tell me how to correctly scale a profile histogram.

My code at the moment is:
 double content;
 for (int n = 0; n < nBins+1 ; n++) {
   content = hp>GetBinContent(n);
   content *= scaleFactor;
   hp>SetBinContent(n, content);
 }

Art Poskanzer


Art Poskanzer wrote:

> When ROOT scales a profile histogram it keeps the contents fixed
> and reduces the error by the square root of the scale factor.
> This is because it scales the sum of the weights, the sum of the
> weights squared, and also the number of entries. Is this behavior
> correct?
>
> I want to scale the histogram, that is, the contents and the
> errors, like one would scale a 1D histogram. Do I have to convert
> it to a 1D and then scale it?
>
> Is the only way to convert it to loop over the bins getting each
> content and error and putting them into the 1D?
>
> I am using root 2.23/12 in root4star.
>
> Art Poskanzer and Glenn Cooper





This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:23 MET