28 throw std::logic_error(
"The starting entry cannot be larger than the ending entry in the "
29 "creation of a dataset specification.");
36 std::vector<std::string> sampleNames;
37 sampleNames.reserve(
fSamples.size());
39 sampleNames.emplace_back(sample.GetSampleName());
47 std::vector<std::string> treeNames;
48 for (
const auto &sample :
fSamples) {
49 const auto &trees = sample.GetTreeNames();
50 treeNames.insert(std::end(treeNames), std::begin(trees), std::end(trees));
58 std::vector<std::string> fileNames;
59 for (
const auto &sample :
fSamples) {
60 const auto &files = sample.GetFileNameGlobs();
61 fileNames.insert(std::end(fileNames), std::begin(files), std::end(files));
69 std::vector<RMetaData> metaDatas;
72 metaDatas.emplace_back(sample.GetMetaData());
80 return *std::any_cast<ROOT::TreeUtils::RFriendInfo>(&
fFriendInfo);
85 return *std::any_cast<ROOT::TreeUtils::RFriendInfo>(&
fFriendInfo);
139 sample.SetSampleId(
fSamples.size());
140 fSamples.push_back(std::move(sample));
173 const std::vector<std::string> &fileNameGlobs,
const std::string &alias)
185 const std::string &alias)
197 const std::vector<std::string> &fileNameGlobs,
const std::string &alias)
199 if (treeNames.size() != 1 && treeNames.size() != fileNameGlobs.size())
200 throw std::logic_error(
"Mismatch between number of trees and file globs.");
201 std::vector<std::pair<std::string, std::string>> target;
202 target.reserve(fileNameGlobs.size());
203 for (
auto i = 0u; i < fileNameGlobs.size(); ++i)
204 target.emplace_back(std::make_pair((treeNames.size() == 1u ? treeNames[0] : treeNames[i]), fileNameGlobs[i]));
long long Long64_t
Portable signed long integer 8 bytes.
The dataset specification for RDataFrame.
const std::vector< std::string > GetFileNameGlobs() const
Returns the collection of the dataset's paths to files, or globs if specified in input.
std::any fFriendInfo
List of friends.
std::vector< RSample > MoveOutSamples()
Returns a collection of instances of the RSample class.
REntryRange fEntryRange
Start (inclusive) and end (exclusive) entry for the dataset processing.
RDatasetSpec & WithGlobalFriends(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias="")
Add friend tree to RDatasetSpec object.
const std::vector< std::string > GetTreeNames() const
Returns the collection of the dataset's tree names.
Long64_t GetEntryRangeBegin() const
Returns the first entry as defined by the global range provided in the specification.
const std::vector< RMetaData > GetMetaData() const
Returns the collection of the dataset's metadata (RMetaData class objects).
RDatasetSpec & AddSample(RSample sample)
Add sample (RSample class object) to the RDatasetSpec object.
ROOT::TreeUtils::RFriendInfo & GetFriendInfo()
RDatasetSpec & WithGlobalRange(const RDatasetSpec::REntryRange &entryRange={})
Create an RDatasetSpec object for a given range of entries.
std::vector< RSample > fSamples
List of samples.
const std::vector< std::string > GetSampleNames() const
Returns the collection of the dataset's sample names.
Long64_t GetEntryRangeEnd() const
Returns the last entry as defined by the global range provided in the specification.
Class representing a sample which is a grouping of trees and their fileglobs, and,...
Information about friend trees of a certain TTree or TChain object.
void AddFriend(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias="", Long64_t nEntries=TTree::kMaxEntries, TVirtualIndex *indexInfo=nullptr)
Add information of a single friend.