Dear forum,
I am new to ROOT.RDataFrame
using pyroot and when executing
import ROOT
d = ROOT.RDataFrame("events", "ee_tt_ecm365/processed_file_004760802.root")
cut_muon_pt = "selected_muons_pt > 20."
# before applying the cut
print("Number of events ", d.Count().GetValue())
# applying the cut
entries = d.Filter(cut_muon_pt).Count()
# after applying the cut
print("{} entries passed the filter".format(entries.GetValue()))
with python file.py
, the error message
Number of events 100000
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/input_line_9:15:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/etc/dictpch/allHeaders.h:331:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RCsvDS.hxx:14:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDataFrame.hxx:20:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/RInterface.hxx:18:
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/InterfaceUtils.hxx:276:4: error: static_assert failed due to requirement ‘std::is_convertible<ROOT::VecOps::RVec, bool>::value’ “filter expression returns a type that is not convertible to bool”
static_assert(std::is_convertible<FilterRet_t, bool>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/InterfaceUtils.hxx:389:17: note: in instantiation of function template specialization ‘ROOT::Internal::RDF::CheckFilter<__rdf::(lambda at input_line_62:2:16)>’ requested here
RDFInternal::CheckFilter(f);
^
input_line_65:2:23: note: in instantiation of function template specialization ‘ROOT::Internal::RDF::JitFilterHelper<__rdf::(lambda at input_line_62:2:16) &, ROOT::Detail::RDF::RNodeBase>’ requested here
ROOT::Internal::RDF::JitFilterHelper(__rdf::lambda0, new const char*[1]{“selected_muons_pt”}, 1, “”, reinterpret_cast<std::weak_ptr ROOT::Detail::RDF::RJittedFilter*>(0x56adcf0), reinterpret_cast std::shared_ptrROOT::Detail::RDF::RNodeBase*>(0x5729e10),reinterpret_castROOT::Internal::RDF::RBookedDefines*>(0x5d61f70));
^
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/input_line_9:15:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/etc/dictpch/allHeaders.h:331:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RCsvDS.hxx:14:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDataFrame.hxx:20:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/RInterface.hxx:18:
In file included from /cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/InterfaceUtils.hxx:18:
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/RFilter.hxx:108:14: error: no viable conversion from returned value of type ‘ROOT::VecOps::RVec’ to function return type ‘bool’
return fFilter(fValues[slot][S]->template Get(entry)…);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/RFilter.hxx:92:27: note: in instantiation of function template specialization ‘ROOT::Detail::RDF::RFilter<__rdf::(lambda at input_line_62:2:16), ROOT::Detail::RDF::RNodeBase>::CheckFilterHelper<ROOT::VecOps::RVec , 0>’ requested here
auto passed = CheckFilterHelper(slot, entry, ColumnTypes_t{}, TypeInd_t{});
^
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/RFilter.hxx:67:4: note: in instantiation of member function ‘ROOT::Detail::RDF::RFilter<__rdf::(lambda at input_line_62:2:16), ROOT::Detail::RDF::RNodeBase>::CheckFilters’ requested here
RFilter(FilterF f, const ColumnNames_t &columns, std::shared_ptr pd,
^
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RDF/InterfaceUtils.hxx:398:40: note: in instantiation of member function ‘ROOT::Detail::RDF::RFilter<__rdf::(lambda at input_line_62:2:16), ROOT::Detail::RDF::RNodeBase>::RFilter’ requested here
std::unique_ptr(new F_t(std::forward(f), cols, prevNodeOnHeap, defines, name)));
^
input_line_65:2:23: note: in instantiation of function template specialization ‘ROOT::Internal::RDF::JitFilterHelper<__rdf::(lambda at input_line_62:2:16) &, ROOT::Detail::RDF::RNodeBase>’ requested here
ROOT::Internal::RDF::JitFilterHelper(__rdf::lambda0, new const char[1]{“selected_muons_pt”}, 1, “”, reinterpret_cast<std::weak_ptr ROOT::Detail::RDF::RJittedFilter >(0x56adcf0), reinterpret_cast std::shared_ptr ROOT::Detail::RDF::RNodeBase>>(0x5729e10),reinterpret_cast ROOT::Internal::RDF::RBookedDefines>(0x5d61f70));
^
/cvmfs/tmp/spack-stage/gitlab-runner/spack-stage-root-6.24.06-wgcjycjact5ghiy56f7m2laef4ag3e4q/spack-build-wgcjycj/include/ROOT/RVec.hxx:372:4: note: candidate template ignored: could not match ‘RVec’ against ‘bool’
operator RVec() const
^
Traceback (most recent call last):
File “loop.py”, line 14, in
print("{} entries passed the filter".format(entries.GetValue()))
cppyy.gbl.std.runtime_error: const ULong64_t& ROOT::RDF::RResultPtr<ULong64_t>::GetValue() =>
runtime_error:
An error occurred during just-in-time compilation in RLoopManager::Run. The lines above might indicate the cause of the crash
All RDF objects that have not run their event loop yet should be considered in an invalid state.
is printed. I’m using this setup on lxplus and don’t really have a clue, why the first GetValue()
function works properly but the second failed after the filter is used. When commenting out the last print command, no error occurs.
ROOT Version: 6.24/06
Platform: Not Provided
Compiler: Not Provided