[ROOTTALK] TH1->SetContent()

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Fri May 14 1999 - 23:56:21 MEST


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



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