TDataFrame: store Histo1D output in a collection / list /map

ROOT Version: 6.10/09
Platform: slc6
Compiler: gcc630

Hi all,
my purpose is to use TDataFrame and in particular the methods Filter and, on top of it, Histo1D in order to create a collection of histograms with different cuts in a variable, to be plotted in a second time. My problem is that i am not able to properly define the class of the container. For example:

UNKNOWN_CLASS histos_mgg[10];
float MVA1;
auto MVAfilter = [&MVA1](float MVAscore){ return (MVAscore>MVA1);};
for(int i=0 ; i<10 ; ++i)
   MVA1 = -1. + i * 0.2; 
   histos_mgg[i]= d_sig.Filter(MVAfilter, {"mva"}).Histo1D("mgg"));
[...]plot and save histos[...] 

I made some trials:

UNKNOWN_CLASS= ROOT::RDF::RResultPtr< ::TH1D> but the compilation error is " no member named ‘RDF’ in namespace ‘ROOT’ "

UNKNOWN_CLASS = ROOT::Experimental::TDF::TResultProxy< ::TH1F> but the compilation error is "call to deleted constructor of ‘ROOT::Experimental::TDF::TResultProxy< ::TH1F> [10]’ "

My questions are:

  1. Is there a smarter way to solve my problem with TDataFrame?
  2. If not, what is the correct UNKNOWN_CLASS? Didn’t I #include something?


v6.10 is pretty old in terms of RDataFrame (it only implemented a small part of the features, it had quite a few bugs, and was still in namespace ROOT::Experimental as a consequence).

With v6.14 you can just use std::vector<ROOT::RDF::RResultPtr<TH1D>>.


Hi Enrico,
using root v6.14 i can define a vector of ROOT::RDF::RResultPtr< ::TH1D> > without any problem, thank you!
I still have some problem with my code that I have to debug but the main issue is solved thank you.

1 Like

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