Filtering and histograming with RDataFrame


ROOT Version:_ 6.24/02
Platform:_ Linux/Fedora 34
Compiler:_ gcc version 11.3.1 20220421


I have a tree: mytree, which contains columns of variable size arrays.

  1. d of type Int_t
  2. e of type ULong64_t
  3. t of type ULong64_t
    and
  4. m : variable of integer of type Int_t

I am having tough time achieving a simple task of converting the following snippet to corresponding RDataFrame code.

    for(Int_t j = 0; j < m; j++) {
            if((e[j] >= e_lo) && (e[j] <= e_hi)){
                    ht[d[j]]->Fill(t[j]);
            }
    }

where e_lo and e_hi are user defined values and ht is an array of histograms.

Any help is highly appreciated.

Regards,

Ajay

Hi @ajaydeo,
I think that @mczurylo can help with this.

Cheers,
Monica

Hi @ajaydeo,

have you tried using RVec’s (in your case together with Filters and Histo1D)?

Here is the class description:
https://root.cern/doc/master/classROOT_1_1VecOps_1_1RVec.html

and tutorials:
https://root.cern/doc/master/df016__vecOps_8C.html
https://root.cern/doc/master/df017__vecOpsHEP_8C.html

Cheers,
Marta

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.