Re: [ROOTTALK] TH1->SetContent()

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Sat May 15 1999 - 00:03:56 MEST


Just looked at the code - Gerco is right -  "+1" is missing in here... and
has to be fixed... Apologies for the confusion, 
						pasha

Pasha Murat writes:
 > 
 > 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