File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -45,20 +45,30 @@ TEST(TChain, WrongCacheReadTwoTrees)
45
45
TChain chain (treename1);
46
46
chain.AddFile (filename1);
47
47
chain.AddFile (filename2);
48
+ int var = 0 ;
49
+ chain.SetBranchAddress (" bInt" , &var);
48
50
49
51
// first entry in first file in chain
50
52
Long64_t entry = 0 ;
51
53
Long64_t treeEntry = chain.LoadTree (entry);
54
+ EXPECT_EQ (treeEntry, 0 );
55
+ EXPECT_NE (chain.GetEntry (entry), 0 );
56
+ EXPECT_EQ (var, 1 );
52
57
53
58
// read another tree from the same file
54
59
TFile *f1 = chain.GetTree ()->GetCurrentFile ();
55
- TTree *tree2 = f1->Get <TTree>(" tree2" );
56
- tree2->GetEntry (0 );
60
+ TTree *t2 = f1->Get <TTree>(" tree2" );
61
+ double var2 = 0.0 ;
62
+ t2.Branch (" bDouble" , &var2);
63
+ EXPECT_NE (t2->GetEntry (0 ), 0 );
64
+ EXPECT_NEAR (var2, 2 .);
57
65
58
66
// first entry in second file in chain
59
67
Long64_t entry2 = 1 ;
60
68
Long64_t treeEntry2 = chain.LoadTree (entry2);
61
69
EXPECT_EQ (treeEntry2, 0 );
70
+ EXPECT_NE (chain.GetEntry (entry2), 0 );
71
+ EXPECT_EQ (var, 3 );
62
72
}
63
73
gSystem ->Unlink (filename1);
64
74
gSystem ->Unlink (filename2);
You can’t perform that action at this time.
0 commit comments