Hello,
I can not compile the Min() function in the RDataFrame class (Max() works by the way…)
I attach test.py (574 Bytes) a simple macro where you can see the problem. Here is the result on lxplus:
python -i test.py
min= In file included from /builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/input_line_12:15:
In file included from /builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/etc/dictpch/allHeaders.h:973:
In file included from /builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/include/ROOT/RCsvDS.hxx:14:
In file included from /builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/include/ROOT/RDataFrame.hxx:20:
In file included from /builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/include/ROOT/RDF/RInterface.hxx:15:
/builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/include/ROOT/RDF/ActionHelpers.hxx:734:24: error: no matching function for call to ‘min’
fMins[slot] = std::min(v, fMins[slot]);
^~~~~~~~
/builddir/build/BUILD/root-6.22.02/x86_64-redhat-linux-gnu/include/ROOT/RDF/RAction.hxx:237:33: note: in instantiation of function template specialization ‘ROOT::Internal::RDF::MinHelper::Exec<ROOT::VecOps::RVec, 0>’ requested here
Thank you for your help.
Tancredi
_ROOT Version: root-6.22.02/
_Platform: lxplus
_Compiler: x86_64-redhat-linux-gnu
2020-09-23T22:00:00Z
Hi,
I’m not sure why the error message is so obscure. When I try to execute your script, with ROOT 6.22.02 installed via conda, here’s what I get:
~/Downloads python -i test.py (root-6-22-02)
Traceback (most recent call last):
File "test.py", line 18, in <module>
print('min= ',df["data"].Min("photon_eta[0]").GetValue())
cppyy.gbl.std.runtime_error: Template method resolution failed:
ROOT::RDF::RResultPtr<double> ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void>::Min(basic_string_view<char,char_traits<char> > columnName = "") =>
runtime_error: Unknown column: photon_eta[0]
ROOT::RDF::RResultPtr<double> ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void>::Min(basic_string_view<char,char_traits<char> > columnName = "") =>
runtime_error: Unknown column: photon_eta[0]
And indeed the problem is that Min("photon_eta[0]")
should be e.g. Define("ph_eta0", "photon_eta[0]").Min("ph_eta0")
: actions like Min
only accept column names, they don’t know how to evaluate expressions such as "photon_eta[0]"
(Define
can be used to evaluate expressions).
Cheers,
Enrico
Hello,
yes this work.
I had started the investigation with
print 'min= ',df[“data”].Min(“photon_eta”).GetValue()
print 'max= ',df[“data”].Max(“photon_eta”).GetValue()
The MAX work while the MIN gives the same error as about.
Regards,
Tancredi
1 Like
Ok I see the problem, this is now https://github.com/root-project/root/issues/6435 . Work in progress.
Hi again, the bug is understood and a fix is in the pipeline.
In Python, I can suggest to use Stats
instead of Min
/Max
to work around the issue:
stats = df["data"].Stats("photon_eta").GetValue()
min = stats.GetMin()
max = stats.GetMax()
Cheers,
Enrico
The fix will be in ROOT v6.24 and v6.22/04. Thanks for the report!