Skip to content
Merged
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
2 changes: 1 addition & 1 deletion tree/treeplayer/inc/TTreeReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class TTreeReader : public TObject {
// List of branches for which we want to suppress the printed error about
// missing branch when switching to a new tree
std::set<std::string> fSuppressErrorsForMissingBranches{};
std::vector<std::string> fMissingProxies{};
std::set<std::string> fMissingProxies{};

friend class ROOT::Internal::TTreeReaderValueBase;
friend class ROOT::Internal::TTreeReaderArrayBase;
Expand Down
8 changes: 3 additions & 5 deletions tree/treeplayer/src/TTreeReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ bool TTreeReader::Notify()

bool TTreeReader::SetProxies()
{
fMissingProxies.clear();
fProxiesSet = false; // In the loop below, we cannot recreate proxies if this is true

for (size_t i = 0; i < fValues.size(); ++i) {
ROOT::Internal::TTreeReaderValueBase *reader = fValues[i];
Expand All @@ -399,13 +401,9 @@ bool TTreeReader::SetProxies()
if (!reader->GetProxy()) {
if (suppressErrorsForThisBranch ||
(reader->GetSetupStatus() == ROOT::Internal::TTreeReaderValueBase::ESetupStatus::kSetupMissingBranch))
fMissingProxies.push_back(reader->fBranchName.Data());
fMissingProxies.insert(reader->fBranchName.Data());
else
return false;
} else {
// Erase the branch name from the missing proxies if it was present
fMissingProxies.erase(std::remove(fMissingProxies.begin(), fMissingProxies.end(), reader->fBranchName.Data()),
fMissingProxies.end());
}
}
// If at least one proxy was there and no error occurred, we assume the proxies to be set.
Expand Down
9 changes: 5 additions & 4 deletions tree/treeplayer/src/TTreeReaderValue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -832,10 +832,11 @@ void ROOT::Internal::TTreeReaderValueBase::ErrorAboutMissingProxyIfNeeded()
{
// Print the error only if the branch name does not appear in the list of
// missing proxies that the user explicitly requested not to error about
if (!fTreeReader || std::find(fTreeReader->fMissingProxies.cbegin(), fTreeReader->fMissingProxies.cend(),
fBranchName.Data()) == fTreeReader->fMissingProxies.cend())
Error("TTreeReaderValue::Get()", "Value reader not properly initialized, did you call "
"TTreeReader::Set(Next)Entry() or TTreeReader::Next()?");
if (!fTreeReader || fTreeReader->fMissingProxies.count(fBranchName.Data()) == 0)
Error("TTreeReaderValue::Get()",
"Value reader for branch %s not properly initialized, did you call "
"TTreeReader::Set(Next)Entry() or TTreeReader::Next()?",
fBranchName.Data());
}

namespace cling {
Expand Down
8 changes: 5 additions & 3 deletions tree/treeplayer/test/leafs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "data.h"

#include "RErrorIgnoreRAII.hxx"
#include "ROOT/TestSupport.hxx"

#include <memory>
Expand Down Expand Up @@ -185,9 +184,12 @@ TEST(TTreeReaderLeafs, ArrayWithReaderValue)
TTreeReader tr(tree.get());
TTreeReaderValue<double> valueOfArr(tr, "arr");
{
RErrorIgnoreRAII errorIgnRAII;
ROOT::TestSupport::CheckDiagsRAII check;
check.requiredDiag(kError, "TTreeReaderValueBase", "Must use TTreeReaderArray to read branch", false);
check.requiredDiag(kError, "TTreeReaderValueBase", /*The branch xxx*/ "contains data of type", false);
check.requiredDiag(kError, "TTreeReaderValue", /*Value reader for xxx*/ "not properly initialized", false);
tr.Next();
*valueOfArr;
EXPECT_EQ(valueOfArr.Get(), nullptr);
}
EXPECT_FALSE(valueOfArr.IsValid());
}
Expand Down
2 changes: 1 addition & 1 deletion tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ if(ROOT_pyroot_FOUND)
endif()
endforeach()

if(NOT ${${tname}-depends} STREQUAL ${tutorial_name})
if(NOT "${${tname}-depends}" STREQUAL ${tutorial_name})
set(tutorial_dependency ${${tname}-depends})
else()
set(tutorial_dependency "")
Expand Down
Loading