Skip to content

Commit 9973a55

Browse files
committed
[RDF] Remove RBranchSet from SnapshotHelpers.
It is superseded by RBranchData.
1 parent e4332b1 commit 9973a55

File tree

2 files changed

+0
-80
lines changed

2 files changed

+0
-80
lines changed

tree/dataframe/inc/ROOT/RDF/SnapshotHelpers.hxx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ class TBufferMergerFile;
4242

4343
namespace ROOT::Internal::RDF {
4444

45-
class RBranchSet {
46-
std::vector<TBranch *> fBranches;
47-
std::vector<std::string> fNames;
48-
std::vector<bool> fIsCArray;
49-
50-
public:
51-
TBranch *Get(const std::string &name) const;
52-
bool IsCArray(const std::string &name) const;
53-
void Insert(const std::string &name, TBranch *address, bool isCArray = false);
54-
void Clear();
55-
void AssertNoNullBranchAddresses();
56-
};
57-
5845
class R__CLING_PTRCHECK(off) UntypedSnapshotRNTupleHelper final : public RActionImpl<UntypedSnapshotRNTupleHelper> {
5946
std::string fFileName;
6047
std::string fDirName;

tree/dataframe/src/RDFSnapshotHelpers.cxx

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -364,73 +364,6 @@ void SetBranchesHelper(TTree *inputTree, TTree &outputTree,
364364
}
365365
} // namespace
366366

367-
TBranch *ROOT::Internal::RDF::RBranchSet::Get(const std::string &name) const
368-
{
369-
auto it = std::find(fNames.begin(), fNames.end(), name);
370-
if (it == fNames.end())
371-
return nullptr;
372-
return fBranches[std::distance(fNames.begin(), it)];
373-
}
374-
375-
bool ROOT::Internal::RDF::RBranchSet::IsCArray(const std::string &name) const
376-
{
377-
if (auto it = std::find(fNames.begin(), fNames.end(), name); it != fNames.end())
378-
return fIsCArray[std::distance(fNames.begin(), it)];
379-
return false;
380-
}
381-
382-
void ROOT::Internal::RDF::RBranchSet::Insert(const std::string &name, TBranch *address, bool isCArray)
383-
{
384-
if (address == nullptr) {
385-
throw std::logic_error("Trying to insert a null branch address.");
386-
}
387-
if (std::find(fBranches.begin(), fBranches.end(), address) != fBranches.end()) {
388-
throw std::logic_error("Trying to insert a branch address that's already present.");
389-
}
390-
if (std::find(fNames.begin(), fNames.end(), name) != fNames.end()) {
391-
throw std::logic_error("Trying to insert a branch name that's already present.");
392-
}
393-
fNames.emplace_back(name);
394-
fBranches.emplace_back(address);
395-
fIsCArray.push_back(isCArray);
396-
}
397-
398-
void ROOT::Internal::RDF::RBranchSet::Clear()
399-
{
400-
fBranches.clear();
401-
fNames.clear();
402-
fIsCArray.clear();
403-
}
404-
405-
void ROOT::Internal::RDF::RBranchSet::AssertNoNullBranchAddresses()
406-
{
407-
std::vector<TBranch *> branchesWithNullAddress;
408-
std::copy_if(fBranches.begin(), fBranches.end(), std::back_inserter(branchesWithNullAddress),
409-
[](TBranch *b) { return b->GetAddress() == nullptr; });
410-
411-
if (branchesWithNullAddress.empty())
412-
return;
413-
414-
// otherwise build error message and throw
415-
std::vector<std::string> missingBranchNames;
416-
std::transform(branchesWithNullAddress.begin(), branchesWithNullAddress.end(),
417-
std::back_inserter(missingBranchNames), [](TBranch *b) { return b->GetName(); });
418-
std::string msg = "RDataFrame::Snapshot:";
419-
if (missingBranchNames.size() == 1) {
420-
msg += " branch " + missingBranchNames[0] +
421-
" is needed as it provides the size for one or more branches containing dynamically sized arrays, but "
422-
"it is";
423-
} else {
424-
msg += " branches ";
425-
for (const auto &bName : missingBranchNames)
426-
msg += bName + ", ";
427-
msg.resize(msg.size() - 2); // remove last ", "
428-
msg += " are needed as they provide the size of other branches containing dynamically sized arrays, but they are";
429-
}
430-
msg += " not part of the set of branches that are being written out.";
431-
throw std::runtime_error(msg);
432-
}
433-
434367
ROOT::Internal::RDF::UntypedSnapshotTTreeHelper::UntypedSnapshotTTreeHelper(
435368
std::string_view filename, std::string_view dirname, std::string_view treename, const ColumnNames_t &vbnames,
436369
const ColumnNames_t &bnames, const RSnapshotOptions &options, std::vector<bool> &&isDefine,

0 commit comments

Comments
 (0)