Rdataframe equivalent of TTree::Scan

Dear experts,

Is there a rdataframe equivalent to the TTree::Scan? I could not find it on the rdataframe class reference page nor by a simple search in the forum… Thanks.

Dongliang

Hi,
Not a 1 to 1 equivalent, but the Display action prints branch contents to screen.
https://root.cern/doc/v616/classROOT_1_1RDF_1_1RInterface.html#aee68f4411f16f00a1d46eccb6d296f01

Why not use TTree::Scan though? :smile:

Thanks a lot for the quick reply. I want to have a quick look of the run number and event number of my selected events. I’m using pyroot in Jupyter notebook. Following your suggestion, I can use Display to show one variable, but don’t find an easy way to show multiple… do you have an example for this?

Hi,

you can select multiple columns providing them explicitly or via a regular expression matching their names.
For example:

myRdf.Display({"column_0", "column_1", ..., "column_N"});

Cheers,
D

Thanks for the example, but I guess this is an example in C++. How to do this in pyroot?

myRdf.Display(("column_0", "column_1", ..., "column_N"))

I get following errors:


TypeError Traceback (most recent call last)
in
1 d3a = d3.Define(‘Et2’,‘cQ0+cQ1+cQ6’).Define(‘Et2v’,‘E-Et2’).Filter(‘cQ0>400&&cQ1>300&&cQ6>200&&cQ3<100&&cQ5<100&&cQ18<100’)
----> 2 pp1 = d3a.Filter(‘tID>3’).Display((‘run’,‘evt’))
3 pp1.Print()

TypeError: none of the 3 overloaded methods succeeded. Full details:
ROOT::RDF::RResultPtrROOT::RDF::RDisplay ROOT::RDF::RInterfaceROOT::Detail::RDF::RJittedFilter,void::Display(const vector& columnList, const int& nRows = 5) =>
could not convert argument 1 (none of the 10 overloaded methods succeeded. Full details:
vector::vector() =>
takes at most 0 arguments (2 given)
vector::vector(const allocator& __a) =>
takes at most 1 arguments (2 given)
vector::vector(unsigned long __n, const allocator& __a = std::vector<std::basic_string, std::allocator<std::basic_string > >::allocator_type()) =>
could not convert argument 1 (an integer is required)
vector::vector(unsigned long __n, const string& __value, const allocator& __a = std::vector<std::basic_string, std::allocator<std::basic_string > >::allocator_type()) =>
could not convert argument 1 (an integer is required)
vector::vector(const vector& __x) =>
takes at most 1 arguments (2 given)
vector::vector(vector&& __x) =>
takes at most 1 arguments (2 given)
vector::vector(const vector& __x, const allocator& __a) =>
could not convert argument 1
vector::vector(vector&& __rv, const allocator& __m) =>
could not convert argument 1 (this method can not (yet) be called)
vector::vector(initializer_list __l, const allocator& __a = std::vector<std::basic_string, std::allocator<std::basic_string > >::allocator_type()) =>
could not convert argument 1
vector::vector(__gnu_cxx::__normal_iterator<const experimental::basic_string_view<char,char_traits >,vector<experimental::basic_string_view<char,char_traits > > > __first, __gnu_cxx::__normal_iterator<const experimental::basic_string_view<char,char_traits >,vector<experimental::basic_string_view<char,char_traits > > > __last, const allocator& __a = std::vector<std::basic_string, std::allocator<std::basic_string > >::allocator_type()) =>
could not convert argument 1)
ROOT::RDF::RResultPtrROOT::RDF::RDisplay ROOT::RDF::RInterfaceROOT::Detail::RDF::RJittedFilter,void::Display(experimental::basic_string_view<char,char_traits > columnNameRegexp = “”, const int& nRows = 5) =>
could not convert argument 1
ROOT::RDF::RResultPtrROOT::RDF::RDisplay ROOT::RDF::RInterfaceROOT::Detail::RDF::RJittedFilter,void::Display(initializer_list columnList, const int& nRows = 5) =>
could not convert argument 1 (none of the 3 overloaded methods succeeded. Full details:
initializer_list::initializer_list() =>
takes at most 0 arguments (2 given)
initializer_list::initializer_list(const initializer_list&) =>
takes at most 1 arguments (2 given)
initializer_list::initializer_list(initializer_list&&) =>
takes at most 1 arguments (2 given))

I’m using JupyROOT 6.16/00 on Centos 7. There is no problem to display one variable.

Unfortunately, I am afraid this syntax is not yet available and that is why Display is complaining about the type of the tuple argument.

You will need to construct an std::vector<string> from Python and pass that vector as the argument.

v = ROOT.std.vector('std::string')()
for c in 'run','evt':
  v.push_back(c)
pp1 = d3a.Filter('tID>3').Display(v)
1 Like

It works. Thanks a lot!

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