RDataFrame creation without giving nentries in advance

Dear Users,

I am interested in the possibility to create a RDataFrame without knowing in advance the number of entries.
So I would like to know wich is the constructor form.
Thank you in advance

ROOT Version: 6.32.00
Platform: Ubuntu 22.04
Compiler: gcc 11.4.0


Try maybe with the default constructor. RDataframe d;
And then call d.Fill(…) every time you want to add an entry

Thank you for this suggestion.
I tried with the following declaration:
ROOT::RDataFrame test;
and it yields me the following error:
error: no matching function for call to ‘ROOT::RDataFrame::RDataFrame()’

In addition, I would be interested in the process to construct/insert values in the RDataFrame created this way.
To my knowledge both Define and Foreach automatically iterate on the nentries which are supposed to be known in advance.
Thanks

Maybe try setting 0 as number of entries, and then call Fill ?

Thanks, creating RDataFrame test(0); works.
But I dont understand how to use command Fill, since it has not been created as a ttree.
Define and Foreach loop over 0 entries.

Could you provide a snippet of code?

Thank

Ohh, I see, I was wrong. The Fill method is for filling eg a histogram from the already created RDataFrame.

I am not an expert on this class, but I think RDataFrame is just an interface to a TTree or another data source (CSV file, Numpy array, etc.). You need to “fill” the Datasource (ROOT: ROOT::RDF::RDataSource Class Reference), not the RDataFrame. @vpadulan might confirm.

So I guess in your case you would need to do:

TTree t;
t.Fill(your_event1);
t.Fill(your_event2);
RDataFrame r(t.GetEntries(), …);