[ROOTTALK] TH1->SetContent()

From: Gerco Onderwater (onderwat@nialas.npl.uiuc.edu)
Date: Fri May 14 1999 - 23:34:03 MEST


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