Re: [ROOTTALK] TH1->SetContent()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat May 15 1999 - 11:07:01 MEST


Hi Gerco, Pasha,
TH1::SetContent is correct.
More comments in this function are missing.
The function expects a user array contents including
underflows and overflows.
contents[0] must be the underflow bin
contents[1] the first bin, etc

Rene Brun


On Fri, 14 May 1999, Gerco Onderwater wrote:

> Hi All,
> 
> I encountered the following behaviour that reminded me of the times when I
> just switched from Fortran to C/C++ :)
> 
> If I use TH1::SetContent(Stat_t* content), the first element of my array
> is missing and the last bin in my histo is empty. The mistake is in the
> following code
> 
> void TH1::SetContent(Stat_t *content)
> {
>    Int_t bin;
>    Stat_t bincontent;
>    for (bin=0; bin<fNcells; bin++) {
>       bincontent = *(content + bin);
>       SetBinContent(bin+1, bincontent);
>                        ^^
>             add this +1 here; Histo bins still live in the F-world
>    }
> }
> 
> Rene, please update this in the working version.
> 
> Thanks,
> 
> -- Gerco
> 
> Dr. C.J.G. Onderwater
> Nuclear Physics Laboratory
> 312 Loomis Laboratory of Physics
> University of Illinois at Urbana-Champaign
> 1110 West Green Street
> Urbana, IL 61801-3080     
> Phone : (217) 244-7363
> Fax   : (217) 333-1215  
> E-mail: onderwat@uiuc.edu
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:33 MET