Stumbled on a weird error in the new ROOT version while trying to read TTree with XYZVector and vector<XYZVector> with RDataFrame…
Here is the full reproducible:
$ source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-centos7-gcc11-opt/setup.sh
$ root --version
ROOT Version: 6.27/01
Built for linuxx8664gcc on Apr 19 2022, 02:25:00
From heads/master@v6-25-02-1027-g2aa0235
$ root
root [0] ROOT::RDataFrame d(1)
d.Define("x", "ROOT::Math::XYZVector(1,2,3)")\
.Define("y", "std::vector<ROOT::Math::XYZVector> {ROOT::Math::XYZVector(4,5,6)}")\
.Snapshot("tree", "file.root")
$ python --version
Python 3.9.6
$ python
>>> import ROOT
>>> d = ROOT.RDataFrame("tree", "file.root")
>>> d.Define("r", "x.r()").Display("r").Print()
Error in <TTreeReaderValueBase::CreateProxy()>: The branch x contains data of type ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<Double32_t>,ROOT::Math::DefaultCoordinateSystemTag>. It cannot be accessed by a TTreeReaderValue<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>,ROOT::Math::DefaultCoordinateSystemTag>>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cppyy.gbl.std.runtime_error: ROOT::RDF::RDisplay& ROOT::RDF::RResultPtr<ROOT::RDF::RDisplay>::operator*() =>
runtime_error: An error was encountered while processing the data. TTreeReader status code is: 6
Looks like ROOT is being confused with Double32_t and double types…
Any ideas why this happens and if there a workaround?
Hi Bohdan,
sorry about the issue! I don’t think I have never seen this either.
I guess running equivalent C++ code at the prompt produces the same error? Do you know whether this is a recently introduced issue or older ROOT versions have the same problem?
Running in C++ equivalent still results in the same error.
Works properly in 6.18. But still happens in 6.20
// source /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-centos7-gcc9-opt/setup.sh
// ROOT Version: 6.20/02
// Built for linuxx8664gcc on Mar 15 2020, 15:25:34
// From tags/v6-20-02@v6-20-02
root [0] ROOT::RDataFrame d(1);
root [1] d.Define("x", "ROOT::Math::XYZVector(1,2,3)")\
.Define("y", "std::vector<ROOT::Math::XYZVector> {ROOT::Math::XYZVector(4,5,6)}")\
.Snapshot("tree", "file_620.root")
root [2] ROOT::RDataFrame d_read("tree", "file_620.root")
root [3] d_read.Define("r", "x.r()").Display("r")->Print()
Error in <TTreeReaderValueBase::CreateProxy()>: The branch x contains data of type ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<Double32_t>,ROOT::Math::DefaultCoordinateSystemTag>. It cannot be accessed by a TTreeReaderValue<ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>,ROOT::Math::DefaultCoordinateSystemTag>>
r |
// source /cvmfs/sft.cern.ch/lcg/views/LCG_96/x86_64-centos7-gcc8-opt/setup.sh
// ROOT Version: 6.18/00
// Built for linuxx8664gcc on Jun 25 2019, 09:22:23
// From tags/v6-18-00@v6-18-00
root [0] ROOT::RDataFrame d(1);
root [1] d.Define("x", "ROOT::Math::XYZVector(1,2,3)")\
.Define("y", "std::vector<ROOT::Math::XYZVector> {ROOT::Math::XYZVector(4,5,6)}")\
.Snapshot("tree", "file_618.root")
root [2] ROOT::RDataFrame d_read("tree", "file_618.root")
root [3] d_read.Define("r", "x.r()").Display("r")->Print()
r |
3.7416574 |