def getNbins(h):
  """
  To be used in loops on bin number with range()
  For each dimension there are GetNbinsX()+2 bins including underflow 
  and overflow, and range() loops starts from 0. So the total number
  of bins as upper limit of a range() loop already includes the next 
  to last value needed.
  """
  biny=h.GetNbinsY()
  if biny>1: biny+=2
  binz=h.GetNbinsZ()
  if binz>1:binz+=2
  return (h.GetNbinsX()+2)*(biny)*(binz)