How do you declare 2D array of histograms?


I have been able to make 1-D arrays of TH1D histograms using this syntax:

  TH1F** xarray = new TH1F*[xcoords];
  for(int x = 0; x < xcoords; x++) {
    xarray[x] = new TH1F(...);

However, trying to extend this to 2D does not work. How do you declare the pointers for a 2D array? I know there is something wrong with the first line, but I am not sure how to fix it.

  TH1F** xyarray = new TH1F*[xcoords][ycoords];
  for(int x = 0; x < xcoords; x++) {
    for(int y = 0; y < ycoords; y++) {
      xarray[x][y] = new TH1F(...);
  } -> Create a two-dimensional array at runtime -> Multi-Dimensional Arrays -> Introduction to dynamic two dimensional arrays in C++