We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First reported at https://root-forum.cern.ch/t/trouble-reading-rvec-of-vector-from-branch-with-tclonesarray-of-objects-with-std-vector-member/52482 .
A reproducer:
// repro.C #include <ROOT/RDataFrame.hxx> #include <ROOT/RVec.hxx> #include <TClonesArray.h> #include <TObject.h> #include <TTree.h> #include <iostream> #include <vector> class Track : public TObject { public: std::vector<double> hitEnergies; int id = 42; Track(const std::vector<double> &v = {}) : hitEnergies{v} {}; ClassDef(Track, 1); }; ClassImp(Track); void repro() { // write file { TFile f("f.root", "recreate"); TTree tree("Events", "events"); TClonesArray arr("Track", 1); tree.Branch("Tracks", &arr); arr.ConstructedAt(0); ((Track *)arr.At(0))->hitEnergies.assign({1.0, 2.0, 3.0}); arr.ConstructedAt(1); ((Track *)arr.At(1))->hitEnergies.assign({4.0, 5.0}); tree.Fill(); tree.Write(); } TFile f("f.root"); { // reading back the `id` data member works TTreeReader r("Events", &f); TTreeReaderArray<int> ids(r, "Tracks.id"); r.Next(); std::cout << ids.GetSize() << '\n'; // prints 2 std::cout << ids[0] << ' ' << ids[1] << '\n'; // prints '42 42' } { // reading back hitEnergies data member does not work TTreeReader r("Events", &f); TTreeReaderArray<std::vector<double>> tracks(r, "Tracks.hitEnergies"); r.Next(); std::cout << tracks.GetSize() << '\n'; // prints 0! } }
The text was updated successfully, but these errors were encountered:
Silently reading wrong data: critical!
Sorry, something went wrong.
Added 6.28 milestone as per discussion with @pcanal
#12137 Makes this setup a visible error pending the actual implementation.
As this error is now unsilenced in 6.28 we can at least remove the blocker.
pcanal
dpiparo
No branches or pull requests
First reported at https://root-forum.cern.ch/t/trouble-reading-rvec-of-vector-from-branch-with-tclonesarray-of-objects-with-std-vector-member/52482 .
A reproducer:
The text was updated successfully, but these errors were encountered: