Skip to content

Commit 3ed476b

Browse files
ferdymercurydpiparo
authored andcommitted
[tree] allow non existing entries, do not error out
otherwise many errors are printed in tests
1 parent b700afa commit 3ed476b

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

tree/treeplayer/src/TTreeFormula.cxx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
12071207
TVirtualRefProxy *refproxy = cl->GetReferenceProxy();
12081208
for(Long64_t i=0; i<leaf->GetBranch()->GetEntries()-readentry; ++i) {
12091209
auto res = R__LoadBranch(leaf->GetBranch(), readentry+i, fQuickLoad);
1210-
if (res <= 0) {
1210+
if (res < 0) {
12111211
Error("ParseWithLeaf", "Branch could not be loaded:%d", res);
12121212
continue;
12131213
}
@@ -1344,7 +1344,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
13441344

13451345
TBranch *clbranch = leaf->GetBranch();
13461346
auto lres = R__LoadBranch(clbranch,readentry,fQuickLoad);
1347-
if (lres <= 0) {
1347+
if (lres < 0) {
13481348
Error("ParseWithLeaf", "Branch could not be loaded:%d", lres);
13491349
return -2;
13501350
}
@@ -1570,7 +1570,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
15701570
bool mustderef = false;
15711571
if ( !prevUseReferenceObject && cl && cl->GetReferenceProxy() ) {
15721572
auto res = R__LoadBranch(leaf->GetBranch(), readentry, fQuickLoad);
1573-
if (res <= 0) {
1573+
if (res < 0) {
15741574
Error("ParseWithLeaf", "Branch could not be loaded:%d", res);
15751575
return -2;
15761576
}
@@ -1588,7 +1588,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
15881588
cl = nullptr;
15891589
for(Long64_t entry=0; entry<leaf->GetBranch()->GetEntries()-readentry; ++entry) {
15901590
auto eres = R__LoadBranch(leaf->GetBranch(), readentry+i, fQuickLoad);
1591-
if (eres <= 0) {
1591+
if (eres < 0) {
15921592
Error("ParseWithLeaf", "Branch could not be loaded:%d", eres);
15931593
return -2;
15941594
}
@@ -1608,7 +1608,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
16081608

16091609
TBranch *clbranch = leaf->GetBranch();
16101610
auto res = R__LoadBranch(clbranch,readentry,fQuickLoad);
1611-
if (res <= 0) {
1611+
if (res < 0) {
16121612
Error("ParseWithLeaf", "Branch could not be loaded:%d", res);
16131613
return -2;
16141614
}
@@ -1673,7 +1673,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
16731673

16741674
TBranch *clbranch = leaf->GetBranch();
16751675
auto res = R__LoadBranch(clbranch,readentry,fQuickLoad);
1676-
if (res <= 0) {
1676+
if (res < 0) {
16771677
Error("ParseWithLeaf", "Branch could not be loaded:%d", res);
16781678
return -2;
16791679
}
@@ -1738,7 +1738,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
17381738
new TFormLeafInfo(cl, clones_offset, curelem);
17391739
TClonesArray * clones;
17401740
auto res = R__LoadBranch(leaf->GetBranch(),readentry,fQuickLoad);
1741-
if (res <= 0) {
1741+
if (res < 0) {
17421742
Error("ParseWithLeaf", "Branch could not be loaded:%d", res);
17431743
return -2;
17441744
}
@@ -1959,7 +1959,7 @@ Int_t TTreeFormula::ParseWithLeaf(TLeaf* leaf, const char* subExpression, bool f
19591959
} else if ( (object || pointer) && !useReferenceObject && element->GetClassPointer()->GetReferenceProxy() ) {
19601960
TClass* c = element->GetClassPointer();
19611961
auto res = R__LoadBranch(leaf->GetBranch(),readentry,fQuickLoad);
1962-
if (res <= 0) {
1962+
if (res < 0) {
19631963
Error("ParseWithLeaf", "Branch could not be loaded:%d", res);
19641964
return -2;
19651965
}
@@ -3170,7 +3170,7 @@ TLeaf* TTreeFormula::GetLeafWithDatamember(const char* topchoice, const char* ne
31703170
// In this case we assume that cl is the class in which the TClonesArray
31713171
// belongs.
31723172
auto res = R__LoadBranch(leafcur->GetBranch(),readentry,fQuickLoad);
3173-
if (res <= 0) {
3173+
if (res < 0) {
31743174
Error("GetLeafWithDatamember", "Branch could not be loaded:%d", res);
31753175
continue;
31763176
}
@@ -3255,7 +3255,7 @@ TLeaf* TTreeFormula::GetLeafWithDatamember(const char* topchoice, const char* ne
32553255
else leafinfo = sub_clonesinfo;
32563256

32573257
auto res = R__LoadBranch(branch,readentry,fQuickLoad);
3258-
if (res <= 0) {
3258+
if (res < 0) {
32593259
Error("GetLeafWithDatamember", "Branch could not be loaded:%d", res);
32603260
continue;
32613261
}
@@ -3355,7 +3355,7 @@ bool TTreeFormula::BranchHasMethod(TLeaf* leafcur, TBranch* branch, const char*
33553355
// unsplit and/or top leaf/branch.
33563356
TClonesArray* clones = nullptr;
33573357
auto res = R__LoadBranch(branch, readentry, fQuickLoad);
3358-
if (res <= 0) {
3358+
if (res < 0) {
33593359
Error("BranchHasMethod", "Branch could not be loaded:%d", res);
33603360
return false;
33613361
}
@@ -3382,7 +3382,7 @@ bool TTreeFormula::BranchHasMethod(TLeaf* leafcur, TBranch* branch, const char*
33823382
}
33833383
if (!clones) {
33843384
auto cres = R__LoadBranch(bc, readentry, fQuickLoad);
3385-
if (cres <= 0) {
3385+
if (cres < 0) {
33863386
Error("BranchHasMethod", "Branch could not be loaded:%d", cres);
33873387
return false;
33883388
}
@@ -3754,7 +3754,7 @@ void* TTreeFormula::EvalObject(int instance)
37543754
auto res = R__LoadBranch(leaf->GetBranch(),
37553755
leaf->GetBranch()->GetTree()->GetReadEntry(),
37563756
fQuickLoad);
3757-
if (res <= 0) {
3757+
if (res < 0) {
37583758
Error("EvalObject", "Branch could not be loaded:%d", res);
37593759
return nullptr;
37603760
}
@@ -3797,7 +3797,7 @@ const char* TTreeFormula::EvalStringInstance(Int_t instance)
37973797
fNeedLoading = false;
37983798
TBranch *branch = leaf->GetBranch();
37993799
auto res = R__LoadBranch(branch,branch->GetTree()->GetReadEntry(),fQuickLoad);
3800-
if (res <= 0) {
3800+
if (res < 0) {
38013801
Error("EvalStringInstance", "Branch could not be loaded:%d", res);
38023802
return nullptr;
38033803
}
@@ -3835,7 +3835,7 @@ const char* TTreeFormula::EvalStringInstance(Int_t instance)
38353835
if (br && br->GetTree()) { \
38363836
Long64_t tEntry = br->GetTree()->GetReadEntry(); \
38373837
auto lres = R__LoadBranch(br, tEntry, fQuickLoad); \
3838-
if (lres <= 0) \
3838+
if (lres < 0) \
38393839
Error("TTreeFormula::TT_EVAL_INIT", \
38403840
"Could not read entry (%lld) of leaf (%s), r=(%d).", tEntry, leaf->GetName(), lres);\
38413841
} else { \
@@ -3883,7 +3883,7 @@ const char* TTreeFormula::EvalStringInstance(Int_t instance)
38833883
if (branch->GetTree()) { \
38843884
Long64_t tEntry = branch->GetTree()->GetReadEntry(); \
38853885
auto lres = R__LoadBranch(branch, tEntry, fQuickLoad); \
3886-
if (lres <= 0) { \
3886+
if (lres < 0) { \
38873887
Error("TTreeFormula::TT_EVAL_INIT_LOOP", \
38883888
"Could not read entry (%lld) of leaf (%s), r=(%d).", tEntry, leaf->GetName(), lres);\
38893889
} \
@@ -4566,7 +4566,7 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
45664566
TBranch *branch = leafc->GetBranch();
45674567
Long64_t readentry = branch->GetTree()->GetReadEntry();
45684568
auto res = R__LoadBranch(branch,readentry,fQuickLoad);
4569-
if (res <= 0) {
4569+
if (res < 0) {
45704570
Error("EvalInstance", "Branch could not be loaded:%d", res);
45714571
continue;
45724572
}
@@ -4578,7 +4578,7 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[])
45784578
TBranch *br = leafc->GetBranch();
45794579
Long64_t treeEntry = br->GetTree()->GetReadEntry();
45804580
auto res = R__LoadBranch(br, treeEntry, true);
4581-
if (res <= 0) {
4581+
if (res < 0) {
45824582
Error("EvalInstance", "Branch could not be loaded:%d", res);
45834583
continue;
45844584
}
@@ -5025,7 +5025,7 @@ char *TTreeFormula::PrintValue(Int_t mode, Int_t instance, const char *decform)
50255025
TBranch *branch = leaf->GetBranch();
50265026
Long64_t readentry = branch->GetTree()->GetReadEntry();
50275027
auto res = R__LoadBranch(branch,readentry,fQuickLoad);
5028-
if (res <= 0) {
5028+
if (res < 0) {
50295029
Error("PrintValue", "Branch could not be loaded:%d", res);
50305030
} else {
50315031
if (fLookupType[0]==kDirect && fNoper==1) {
@@ -5542,7 +5542,7 @@ void TTreeFormula::LoadBranches()
55425542
TBranch *br = leaf->GetBranch();
55435543
Long64_t treeEntry = br->GetTree()->GetReadEntry();
55445544
auto res = R__LoadBranch(br, treeEntry, true);
5545-
if (res <= 0) {
5545+
if (res < 0) {
55465546
Error("LoadBranches", "Branch could not be loaded:%d", res);
55475547
continue;
55485548
}
@@ -5614,7 +5614,7 @@ bool TTreeFormula::LoadCurrentDim() {
56145614
if (readentry < 0) readentry=0;
56155615
if (!branchcount->GetAddress()) {
56165616
auto res = R__LoadBranch(branchcount, readentry, fQuickLoad);
5617-
if (res <= 0) {
5617+
if (res < 0) {
56185618
Error("LoadCurrentDim", "Branch could not be loaded:%d", res);
56195619
return false;
56205620
}
@@ -5644,7 +5644,7 @@ bool TTreeFormula::LoadCurrentDim() {
56445644
if (fHasMultipleVarDim[i]) {// info && info->GetVarDim()>=0) {
56455645
info = (TFormLeafInfo* )fDataMembers.At(i);
56465646
auto res = R__LoadBranch(branch->GetBranchCount2() ? branch->GetBranchCount2() : branch, readentry, fQuickLoad);
5647-
if (res <= 0) {
5647+
if (res < 0) {
56485648
Error("LoadCurrentDim", "Branch could not be loaded:%d", res);
56495649
return false;
56505650
}
@@ -5676,7 +5676,7 @@ bool TTreeFormula::LoadCurrentDim() {
56765676
Long64_t readentry = leaf->GetBranch()->GetTree()->GetReadEntry();
56775677
if (readentry < 0) readentry=0;
56785678
auto res = R__LoadBranch(branchcount,readentry,fQuickLoad);
5679-
if (res <= 0) {
5679+
if (res < 0) {
56805680
Error("LoadCurrentDim", "Branch could not be loaded:%d", res);
56815681
return false;
56825682
}
@@ -5729,7 +5729,7 @@ bool TTreeFormula::LoadCurrentDim() {
57295729
Long64_t readentry = branch->GetTree()->GetReadEntry();
57305730
if (readentry < 0) readentry=0;
57315731
auto res = R__LoadBranch(branch,readentry,fQuickLoad);
5732-
if (res <= 0) {
5732+
if (res < 0) {
57335733
Error("LoadCurrentDim", "Branch could not be loaded:%d", res);
57345734
return false;
57355735
}
@@ -5784,7 +5784,7 @@ bool TTreeFormula::LoadCurrentDim() {
57845784
Long64_t readentry = branch->GetTree()->GetReadEntry();
57855785
if (readentry < 0) readentry=0;
57865786
auto res = R__LoadBranch(branch,readentry,fQuickLoad);
5787-
if (res <= 0) {
5787+
if (res < 0) {
57885788
Error("LoadCurrentDim", "Branch could not be loaded:%d", res);
57895789
return false;
57905790
}

0 commit comments

Comments
 (0)