{ TH2D * h = new TH2D("h", "h", 30, -3, 3, 10000, 0, 1); h->FillRandom("gaus"); h->Draw(); TAxis * x = h->GetXaxis(); cout << "There are " << x->GetNbins() << " bins." << endl; TArrayD * array = x->GetXbins(); cout << "There are " << array->GetSize() << " bins." << endl; }