19RSample::RSample(
const std::string &sampleName,
const std::string &treeName,
const std::string &fileNameGlob,
21 :
RSample(sampleName, std::
vector<std::
string>{treeName}, std::vector<std::string>{fileNameGlob}, metaData)
26 const std::vector<std::string> &fileNameGlobs,
const RMetaData &metaData)
32 const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
37 if (treeAndFileNameGlobs.empty())
41 for (
const auto &p : treeAndFileNameGlobs) {
42 const auto fullpath = p.second +
"?#" + p.first;
43 chain.Add(fullpath.c_str());
45 const auto &expandedNames = chain.GetListOfFiles();
46 fTreeNames.reserve(expandedNames->GetEntries());
48 for (
auto i = 0; i < expandedNames->GetEntries(); ++i) {
49 fTreeNames.emplace_back(expandedNames->At(i)->GetName());
54RSample::RSample(
const std::string &sampleName,
const std::vector<std::string> &treeNames,
55 const std::vector<std::string> &fileNameGlobs,
const RMetaData &metaData)
58 if (treeNames.size() != 1 && treeNames.size() != fileNameGlobs.size())
59 throw std::logic_error(
"Mismatch between number of trees and file globs.");
61 for (
auto i = 0u; i < fileNameGlobs.size(); ++i) {
62 const auto fullpath = fileNameGlobs[i] +
"?#" + (treeNames.size() == 1u ? treeNames[0] : treeNames[i]);
63 chain.Add(fullpath.c_str());
65 const auto &expandedNames = chain.GetListOfFiles();
66 fTreeNames.reserve(expandedNames->GetEntries());
68 for (
auto i = 0; i < expandedNames->GetEntries(); ++i) {
69 fTreeNames.emplace_back(expandedNames->At(i)->GetName());
104unsigned int RSample::GetSampleId()
const
109void RSample::SetSampleId(
unsigned int id)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
const std::string & GetSampleName() const
Get the name of the sample (RSample object).
const std::vector< std::string > & GetFileNameGlobs() const
Get the collection of the filename globs associated with the sample.
RMetaData fMetaData
An instance of the RMetaData class.
std::vector< std::string > fFileNameGlobs
A list of file names.
const std::vector< std::string > & GetTreeNames() const
Get the collection of the tree names associated with the sample.
unsigned int fSampleId
Global sample index, set inside of the RDatasetSpec.
RSample(RSample &&)=default
std::string fSampleName
Name of the sample.
const RMetaData & GetMetaData() const
Get an instance of the RMetaData class.
std::vector< std::string > fTreeNames
A list of names of trees.
A chain is a collection of files containing TTree objects.