6 #include "gtest/gtest.h" 11 TTree*
tree =
new TTree(
"TTreeReaderArrayTree",
"In-memory test tree");
12 std::vector<float> vecf{17.f, 18.f, 19.f, 20.f, 21.f};
13 tree->
Branch(
"vec", &vecf);
27 EXPECT_FLOAT_EQ(19.
f, vec[2]);
28 EXPECT_FLOAT_EQ(17.
f, vec[0]);
34 TTree*
tree =
new TTree(
"TTreeReaderArrayTree",
"In-memory test tree");
35 double Double[6] = {42.f, 43.f, 44.f, 45.f, 46.f, 47.f};
36 tree->
Branch(
"D", &Double,
"D[4]/D");
54 EXPECT_EQ(4u, trDouble0.
GetSize());
55 EXPECT_EQ(4u, trDouble1.
GetSize());
56 EXPECT_EQ(4u, trDouble2.
GetSize());
57 EXPECT_EQ(4u, trDouble3.
GetSize());
58 EXPECT_EQ(4u, trDouble4.
GetSize());
59 EXPECT_EQ(4u, trDouble5.
GetSize());
60 for (
int i = 0; i < 4; ++i) {
61 EXPECT_DOUBLE_EQ(Double[i], trDouble0[i]);
62 EXPECT_DOUBLE_EQ(Double[i], trDouble1[i]);
63 EXPECT_DOUBLE_EQ(Double[i], trDouble2[i]);
64 EXPECT_DOUBLE_EQ(Double[i], trDouble3[i]);
65 EXPECT_DOUBLE_EQ(Double[i], trDouble4[i]);
66 EXPECT_DOUBLE_EQ(Double[i], trDouble5[i]);
TTreeReader is a simple, robust and fast interface to read values from a TTree, TChain or TNtuple...
virtual Int_t Fill()
Fill all branches.
EEntryStatus SetEntry(Long64_t entry)
Set the next entry (or index of the TEntryList if that is set).
Extracts array data from a TTree.
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
TEST(TTreeReaderArray, Vector)
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
A TTree object has a header with a name and a title.