Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tree/treeplayer/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ configure_file(data.h . COPYONLY)

ROOT_ADD_GTEST(treeplayer_readerarray_iterator readerarray_iterator.cxx LIBRARIES TreePlayer)

ROOT_ADD_GTEST(treeplayer_regressions regressions.cxx LIBRARIES TreePlayer Physics)
ROOT_GENERATE_DICTIONARY(STLContInTObjDict ${CMAKE_CURRENT_SOURCE_DIR}/STLContInTObj.hxx LINKDEF STLContInTObjLinkDef.hxx DEPENDENCIES Core RIO)
ROOT_ADD_GTEST(treeplayer_regressions regressions.cxx STLContInTObjDict.cxx LIBRARIES TreePlayer Physics)

ROOT_ADD_GTEST(ttreeindex_clone ttreeindex_clone.cxx LIBRARIES TreePlayer)

Expand Down
16 changes: 16 additions & 0 deletions tree/treeplayer/test/STLContInTObj.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __Track_TObject__
#define __Track_TObject__

#include "TObject.h"

class Track : public TObject {
public:
std::vector<double> hitEnergies;
int id = 42;

Track(const std::vector<double> &v = {}) : hitEnergies{v} {};

ClassDefOverride(Track, 1);
};

#endif
5 changes: 5 additions & 0 deletions tree/treeplayer/test/STLContInTObjLinkDef.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef __CLING__

#pragma link C++ class Track+;

#endif
28 changes: 28 additions & 0 deletions tree/treeplayer/test/regressions.cxx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "TFile.h"
#include "TSystem.h"
#include "TClass.h"
#include "TClonesArray.h"
#include "TChain.h"
#include "TTree.h"
#include "TTreeReader.h"
#include "TTreeReaderValue.h"
#include "TTreeReaderArray.h"
#include "TROOT.h"
#include "TH1.h"
#include "TTreeFormula.h"
Expand Down Expand Up @@ -359,6 +361,32 @@ TEST(TTreeReaderRegressions, ValueFastTuple)
EXPECT_NEAR(total, 866026269930.1345215, 100);
}

// https://github.com/root-project/root/issues/11769
TEST(TTreeReaderRegressions, STLContainerNestedInTClonesArray)
{
const auto fileName = "tree_11769.root";
const auto treeName = "tree_11769";
gInterpreter->AutoLoad("Track");
ROOT::TestSupport::FileRaii fileGuard{fileName};
{
std::unique_ptr<TFile> file{TFile::Open(fileGuard.GetPath().c_str(), "recreate")};
auto tree = std::make_unique<TTree>(treeName, treeName);
auto arr = std::make_unique<TClonesArray>("Track", 1);

tree->Branch("Tracks", arr.get());

tree->Fill();
tree->Write();
//file->Close();
}
std::unique_ptr<TFile> file{TFile::Open(fileName)};
TTreeReader r(treeName, file.get());
TTreeReaderArray<std::vector<double>> tracks(r, "Tracks.hitEnergies");
ROOT::TestSupport::CheckDiagsRAII diags;
diags.requiredDiag(kError, "TTreeReaderArrayBase::SetImpl", "STL Collection nested in a TClonesArray not yet supported", /*matchFullMessage=*/false);
r.Next();
}

// ROOT-8000 https://its.cern.ch/jira/browse/ROOT-8000
// An unrelated file lying around in the current directory whose name matches
// the leading part of a formula (e.g. a file named "abs") must not make
Expand Down
Loading