[ROOT] How to set binning of an existing hist correctly?

From: Thomas Bretz (tbretz@astro.uni-wuerzburg.de)
Date: Wed Feb 13 2002 - 16:52:47 MET


Hi,

I have an already existing instance of TH1D and want to set the binning
of it. Because there is no interface I descided to use TAxis directly,
but this fails. To workaround I can do the follwoing:

TH1D *h = new TH1D;

// some other code....

h->SetBins(100, 0, 1); // 100 bins (this number is the important one, so
that TH1D knows the correct number, 0 and one are dummy values.
h->GetXaxis()->Set(100, edges); //edges is an array of 101 entreis
containing the edges of my bins....

Some idea? Can you implement a more straight forward function for this?

Thanks,
Thomas.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET