Hi Piotr, The situation is "just" a bit more complex. I will have to provide TH1::SetContent(char *content) TH1::SetContent(short *content) TH1::SetContent(int *content) TH1::SetContent(float *content) TH1::SetContent(double *content) Each of these functions will have to deal with all possible combinations of histograms data types (TH1C,S,F,D). In the case of 1-d histograms, bin contents are stored as a flat array, see below. In the case of 2-d or 3-d histograms, it is more complex. Histograms with errors (Sumw2) must be taken into account. There is the special case of TProfile. memcpy cannot be used in any of the cases above. In case you have a performance problem and you want to update yourself the bin contents (or via memcpy), you can look at the class structure and you will see that you can access a public member pointing to the array of actual contents. I do not intend to document this possibility more than what you see from the header file to avoid abuse of this facility. For example if you have TH1F *h, you can access the pointer to the bin contents directly via Float_t *x = h->GetArray() I leave this possibility essentially for some online applications that require a minimum overhead. Rene Brun On Wed, 1 Dec 1999, Piotr Adam Zolnierczuk wrote: > Hi Rene, > > How about SetContent(Stat_t *content)? > > I believe it does exactly what you > > wrote - it does execute a loop. > > > > I belive, that for performance reasons, it is > > important to have a 'hpak' equivalent - > > it is much faster (and cheaper) to execute > > memcpy(....) than a loop. > > However in these days of cheap CPU power ... > > it is probably an academic dispute > > Cheers > > Piotr > > Rene Brun wrote: > > > Hi Jan, > > There is no equivalent og Hpak, simply because I do not want > > to implement this function for all possible data types. > > It is so simple and trivial to replace your loop by: > > h1=new TH1F("Test", 100, -5., 5.); > > for (int i=0;i<100;i++) h1->SetBinContent(i,i*i); > > > > Rene Brun > > > > > ________________________________________________________________ > Piotr Adam Zolnierczuk > Dept. of Physics and Astronomy http://www.pa.uky.edu/~zolnie > University of Kentucky phone: (606) 257-5565 > Lexington, KY 40506, USA fax: (606) 323-2846 > ________________________________________________________________ > written on recycled electrons > > >
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET