Quick question on TArrayD


I was following this thread:
root.cern.ch/phpBB2/viewtopic.ph … t=getarray

I decided to try out TArrayD myself and here is what I get:

root [0] TH1D *f = new TH1D("f","f",5,0,1)
root [1] f->FillRandom("gaus",20)
root [2] TArrayD *xaxis= f->GetXaxis()->GetXbins()
root [3] xaxis->GetSize()
(const Int_t)0

I was expecting the size of xaxis to be 5 and not 0. What am I missing here?

root 5.22

TAxis::GetXbins will return 0 for a fix bin size histogram. In thsi case you do not need an array, but just the origin and bin size