Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::RDF::Experimental::RSample Class Reference

Class representing a sample which is a grouping of trees and their fileglobs, and, optionally, the sample's metadata information via the RMetaData object.

The class is passed to an RDatasetSpec object in order to build an RDataFrame.

For example, an RSample object can be built as follows:

// First, create the RMetaData object (to, optionally, add to the sample)
meta.Add("sample_name", "name"");
// Create an RSample with metadata information
ROOT::RDF::Experimental::RSample mySample("mySampleName", "outputTree1", "outputFile.root", meta);
Class behaving as a heterogenuous dictionary to store the metadata of a dataset.
Definition RMetaData.hxx:50
void Add(const std::string &key, int val)
Add an RMetaData class instance.
Definition RMetaData.cxx:42

Definition at line 39 of file RSample.hxx.

Public Member Functions

 RSample ()=delete
 
 RSample (const RSample &)=default
 
 RSample (const std::string &sampleName, const std::string &treeName, const std::string &fileNameGlob, const RMetaData &metaData={})
 
 RSample (const std::string &sampleName, const std::string &treeName, const std::vector< std::string > &fileNameGlobs, const RMetaData &metaData={})
 
 RSample (const std::string &sampleName, const std::vector< std::pair< std::string, std::string > > &treeAndFileNameGlobs, const RMetaData &metaData={})
 
 RSample (const std::string &sampleName, const std::vector< std::string > &treeNames, const std::vector< std::string > &fileNameGlobs, const RMetaData &metaData={})
 
 RSample (RSample &&)=default
 
const std::vector< std::string > & GetFileNameGlobs () const
 Get the collection of the filename globs associated with the sample.
 
const RMetaDataGetMetaData () const
 Get an instance of the RMetaData class.
 
const std::string & GetSampleName () const
 Get the name of the sample (RSample object).
 
const std::vector< std::string > & GetTreeNames () const
 Get the collection of the tree names associated with the sample.
 
RSampleoperator= (const RSample &)=default
 
RSampleoperator= (RSample &&)=default
 

Private Attributes

std::vector< std::string > fFileNameGlobs
 A list of file names.
 
RMetaData fMetaData
 An instance of the RMetaData class.
 
unsigned int fSampleId {0}
 Global sample index, set inside of the RDatasetSpec.
 
std::string fSampleName
 Name of the sample.
 
std::vector< std::string > fTreeNames
 A list of names of trees.
 

#include <ROOT/RDF/RSample.hxx>

Constructor & Destructor Documentation

◆ RSample() [1/7]

ROOT::RDF::Experimental::RSample::RSample ( RSample &&  )
default

◆ RSample() [2/7]

ROOT::RDF::Experimental::RSample::RSample ( const RSample )
default

◆ RSample() [3/7]

ROOT::RDF::Experimental::RSample::RSample ( )
delete

◆ RSample() [4/7]

ROOT::RDF::Experimental::RSample::RSample ( const std::string &  sampleName,
const std::string &  treeName,
const std::string &  fileNameGlob,
const RMetaData metaData = {} 
)

Definition at line 19 of file RSample.cxx.

◆ RSample() [5/7]

ROOT::RDF::Experimental::RSample::RSample ( const std::string &  sampleName,
const std::string &  treeName,
const std::vector< std::string > &  fileNameGlobs,
const RMetaData metaData = {} 
)

Definition at line 25 of file RSample.cxx.

◆ RSample() [6/7]

ROOT::RDF::Experimental::RSample::RSample ( const std::string &  sampleName,
const std::vector< std::pair< std::string, std::string > > &  treeAndFileNameGlobs,
const RMetaData metaData = {} 
)

Definition at line 31 of file RSample.cxx.

◆ RSample() [7/7]

ROOT::RDF::Experimental::RSample::RSample ( const std::string &  sampleName,
const std::vector< std::string > &  treeNames,
const std::vector< std::string > &  fileNameGlobs,
const RMetaData metaData = {} 
)

Definition at line 54 of file RSample.cxx.

Member Function Documentation

◆ GetFileNameGlobs()

const std::vector< std::string > & ROOT::RDF::Experimental::RSample::GetFileNameGlobs ( ) const

Get the collection of the filename globs associated with the sample.

Definition at line 87 of file RSample.cxx.

◆ GetMetaData()

const RMetaData & ROOT::RDF::Experimental::RSample::GetMetaData ( ) const

Get an instance of the RMetaData class.

Once this is done, the further access to the RMetaData information is granted, for example (given the metadata has a key "sample_name" that has an associated value of type string):

mySample.GetMetadata().GetS("sample_name");

Definition at line 99 of file RSample.cxx.

◆ GetSampleName()

const std::string & ROOT::RDF::Experimental::RSample::GetSampleName ( ) const

Get the name of the sample (RSample object).

Definition at line 75 of file RSample.cxx.

◆ GetTreeNames()

const std::vector< std::string > & ROOT::RDF::Experimental::RSample::GetTreeNames ( ) const

Get the collection of the tree names associated with the sample.

Definition at line 81 of file RSample.cxx.

◆ operator=() [1/2]

RSample & ROOT::RDF::Experimental::RSample::operator= ( const RSample )
default

◆ operator=() [2/2]

RSample & ROOT::RDF::Experimental::RSample::operator= ( RSample &&  )
default

Member Data Documentation

◆ fFileNameGlobs

std::vector<std::string> ROOT::RDF::Experimental::RSample::fFileNameGlobs
private

A list of file names.

They can contain the globbing characters supported by TChain. See TChain::Add for more information.

Definition at line 53 of file RSample.hxx.

◆ fMetaData

RMetaData ROOT::RDF::Experimental::RSample::fMetaData
private

An instance of the RMetaData class.

Definition at line 55 of file RSample.hxx.

◆ fSampleId

unsigned int ROOT::RDF::Experimental::RSample::fSampleId {0}
private

Global sample index, set inside of the RDatasetSpec.

Definition at line 58 of file RSample.hxx.

◆ fSampleName

std::string ROOT::RDF::Experimental::RSample::fSampleName
private

Name of the sample.

Definition at line 41 of file RSample.hxx.

◆ fTreeNames

std::vector<std::string> ROOT::RDF::Experimental::RSample::fTreeNames
private

A list of names of trees.

This list should go in lockstep with fFileNameGlobs, only in case this dataset is a TChain where each file contains its own tree with a different name from the global name of the dataset. Otherwise, fTreeNames contains 1 treename, that is common for all file globs.

Definition at line 48 of file RSample.hxx.

Libraries for ROOT::RDF::Experimental::RSample:

The documentation for this class was generated from the following files: