1D histogram for a nested data using rdataframe?

Hi all,
I am trying to plot one specific column of a TTree using RDataFrame
The data is organised like

Entry  Multplitcity   Energy 
1       N                   {E1, E2.... EN}
2       M                   {E1, E2.... EM}
as shown in below figures as well



The goal is to make a 1D Histogram of all the sub-entries within each entry as well

I would like to ask if while making a 1D histogram using RDataframe

 auto hist = rdf.Histo1D<double>("AnlEvent.pFat_QDC_E[9]");

Does it automatically loop into and fill all the entries and the sub-entries as well as corresponding to the energies for a given multiplicity? Or are there some other ways to achieve this task ?

Thanks a lot in advance!


Yes: ROOT: ROOT::RDataFrame Class Reference


1 Like

Hi @Danilo ,
Going through the " Working with collections and object selections" section, I am trying to extend the same for my case.

  auto isDet2 = [](int id) { return id == 2; }; //filter for detector 2
     auto hist = rdf.Filter(isDet2, {"AnlEvent.pFat_QDC_ID[9]"}).Histo1D<double>({Form("pFat_QDC_E[%d]", 2), Form("hist_det%d", 2), 2000, 0, 2000}, "AnlEvent.pFat_QDC_E[9]");

However, I am still not sure if I understand how to “fill” all the energies or sub-entries under the column “AnlEvent.pFat_QDC_ID[9]” to a histogram.
Can you please help in this regard?
Thanks a lot.