Creating many histograms with few lines of code

Hi ROOTers,
I would like you to suggest me the right way to translate a routine written in fortran to ROOT/C++.
This routine books a lot of histograms using an offset variable(hoff) which has different values if we’re booking MC or DATA histograms. Here’s a piece of code:

where hoff is an integer.

As you know, this allows you to work with your histogram just considering the number, so you can write somewhere else another bit of code to switch from DATA to MC histograms without writing many lines of code for each dataset.

Does anybody know a way to do it in ROOT/C++?

Create 2 directories MC and DATA where your histograms have the same name and store the corresponding pointers in , say
TH1 *hMC[maxid] and TH1 *hDATA[maxid]
where maxid is the maximum ID used for hbook