Home | News | Documentation | Download

Getting a 1D histogram by looping over a pair of histograms under multiple categories

So I have a three categories “A”,“B”,“C”. They are stored in a vector called vec_hist. Within each categories, there are six 2D histograms each of same bin sizes (5 by 6 to be specific) that are named as follows:

A has hist_A_1a, hist_A_1b, hist_A_2a, hist_A_2b, hist_A_3a,hist_A_3b
B has hist_B_1a, hist_B_1b, hist_B_2a, hist_B_2b, hist_B_3a,hist_B_3b
C has hist_C_1a, hist_C_1b, hist_C_2a, hist_C_2b, hist_C_3a,hist_C_3b

What I want to do is something like this in the order:
i) Go to category “A”
ii) Take hist_A_1a and hist_A_1b, and get their bin contents and fill a 1D histogram with them.
iii) Take hist_A_2a and hist_A_2b and again get their bin contents and fill a different histogram with them.
iv) After done with “A”, go to “B” repeat ii) and iii) and then move on to “C”.

So, in total I am supposed to have nine 1D histograms. I wish I had a script to show but, I have no clue where to start. So any pointer would be useful. Let me know if my question does not make sense.

ROOT Version: 5.18
Platform: Ubuntu 18.04
Compiler: Not Provided