Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RSample.hxx
Go to the documentation of this file.
1// Author: Ivan Kabadzhov CERN 11/2022
2
3/*************************************************************************
4 * Copyright (C) 1995-2022, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_RDF_RSAMPLE
12#define ROOT_RDF_RSAMPLE
13
15
16#include <string>
17#include <vector>
18
19namespace ROOT {
20namespace RDF {
21namespace Experimental {
22
23/**
24\ingroup dataframe
25\brief Class representing a sample (grouping of trees (and their fileglobs) and (optional) metadata)
26
27 This class should be passed to RDatasetSpec in order to build a RDataFrame.
28*/
29class RSample {
30 std::string fSampleName;
31 /**
32 * A list of names of trees.
33 * This list should go in lockstep with fFileNameGlobs, only in case this dataset is a TChain where each file
34 * contains its own tree with a different name from the global name of the dataset.
35 * Otherwise, fTreeNames contains 1 treename, that is common for all file globs.
36 */
37 std::vector<std::string> fTreeNames;
38 /**
39 * A list of file names.
40 * They can contain the globbing characters supported by TChain. See TChain::Add for more information.
41 */
42 std::vector<std::string> fFileNameGlobs;
44
45 unsigned int fSampleId{0}; // global sample index, set inside of the RDatasetSpec
46
47public:
48 RSample(RSample &&) = default;
49 RSample &operator=(RSample &&) = default;
50 RSample(const RSample &) = default;
51 RSample &operator=(const RSample &) = default;
52 RSample() = delete;
53
54 RSample(const std::string &sampleName, const std::string &treeName, const std::string &fileNameGlob,
55 const RMetaData &metaData = {});
56
57 RSample(const std::string &sampleName, const std::string &treeName, const std::vector<std::string> &fileNameGlobs,
58 const RMetaData &metaData = {});
59
60 RSample(const std::string &sampleName, const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
61 const RMetaData &metaData = {});
62
63 RSample(const std::string &sampleName, const std::vector<std::string> &treeNames,
64 const std::vector<std::string> &fileNameGlobs, const RMetaData &metaData = {});
65
66 const std::string &GetSampleName() const;
67 const std::vector<std::string> &GetTreeNames() const;
68 const std::vector<std::string> &GetFileNameGlobs() const;
69 const RMetaData &GetMetaData() const;
70
71 /// \cond HIDDEN_SYMBOLS
72 unsigned int GetSampleId() const; // intended to be used only after the RDataSpec is build, otherwise is 0
73 void SetSampleId(unsigned int id);
74 /// \endcond
75};
76
77} // namespace Experimental
78} // namespace RDF
79} // namespace ROOT
80
81#endif // ROOT_RDF_RSAMPLE
Class behaving as a heterogenuous dictionary to store dataset metadata.
Definition RMetaData.hxx:29
Class representing a sample (grouping of trees (and their fileglobs) and (optional) metadata)
Definition RSample.hxx:29
const std::string & GetSampleName() const
Definition RSample.cxx:74
const std::vector< std::string > & GetFileNameGlobs() const
Definition RSample.cxx:84
std::vector< std::string > fFileNameGlobs
A list of file names.
Definition RSample.hxx:42
const std::vector< std::string > & GetTreeNames() const
Definition RSample.cxx:79
RSample & operator=(const RSample &)=default
RSample(const RSample &)=default
RSample & operator=(RSample &&)=default
const RMetaData & GetMetaData() const
Definition RSample.cxx:89
std::vector< std::string > fTreeNames
A list of names of trees.
Definition RSample.hxx:37
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.