[ROOTTALK] TH1->SetContent()

Pasha Murat (murat@cdfsga.fnal.gov)
Fri, 14 May 1999 16:56:21 -0500 (CDT)


Gerco,
this is the expected behaviour :

- bin#0 of the histogram contains underflows,
- bin#fNcells keeps overflows,
- histogram bin numbers run from 1 to fNCells-1

-pasha
--------------------------------------------------------------------------------
Gerco Onderwater writes:
> 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