John, On Fri, 16 Apr 2004, Dr. John Krane wrote: > Thanks Rene. I had heard of casting before. I guess I didn't > understand the purpose of TH1I if it returns doubles from its bins. > Let me repeat. All TH1X classes return Stat_t for GetBinContent. The virtual function is defined in TH1 and redefined in all derived classes. Althought it would be theoretically possible to return the exact type for each bin content, there are many reasons why we don't do this, including compiler restrictions regarding the change of return type for overloaded functions. In addition the Tree query mechanism assumes that all quantities to be histogramed can be accessed via a double (Stat_t). > What you seem to be saying to me is that the GetBinContent might not be GetBinContent is optimal. I do not understand you worries. You do not loose any precision at all in this operation. A Stat_t has more sigificative digits that an Int_t (this will not be however the case if we had a TH1L (with a Long_t). > optimal in this case, but its generality demands use of Stat_t. > Internally, TH1I does indeed use Int_t for the bins. Right? Internally TH1I uses an Int_t for teh bin contents storage. Rene Brun > > - John > > Rene Brun wrote: > > >TH1X::GetBinContent always return a Stat_t independently of X. > >If you have a TH1I *h, you can do > > Int_t c = (Int_t)h->GetBinContent(i); > >or > > Int_t c = h->fArray[i]; > > > >Rene Brun > > > >"Dr. John Krane" wrote: > > > > > >>Hi, > >> > >>I suspect this is just a bug that has been overlooked all this time > >>because I'm the first person in the world to use the class, but > >>shouldn't TH1I::GetBinContent(Int_t bin) have type Int_t and not > >>Stat_t? Am I missing something? > >> > >> - John > >> > >>-- > >> > >>Dr. John Krane > >>jkrane@netzero.com > >> > >> > > > > > > > > > >
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET