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

The dataset specification for RDataFrame.

This class allows users to create the dataset specification for RDataFrame to which they add samples (using the RSample class object) with tree names and file names, and, optionally, the metadata information (using the RMetaData class objects). Adding global friend trees and/or setting the range of events to be processed are also available.

Note, there exists yet another method to build RDataFrame from the dataset information using the JSON file format: FromSpec().

Definition at line 47 of file RDatasetSpec.hxx.

Classes

struct  REntryRange
 

Public Member Functions

 RDatasetSpec ()=default
 
RDatasetSpecAddSample (RSample sample)
 Add sample (RSample class object) to the RDatasetSpec object.
 
Long64_t GetEntryRangeBegin () const
 Returns the first entry as defined by the global range provided in the specification.
 
Long64_t GetEntryRangeEnd () const
 Returns the last entry as defined by the global range provided in the specification.
 
const std::vector< std::string > GetFileNameGlobs () const
 Returns the collection of the dataset's paths to files, or globs if specified in input.
 
const ROOT::TreeUtils::RFriendInfoGetFriendInfo () const
 Returns the reference to the friend tree information.
 
const std::vector< RMetaDataGetMetaData () const
 Returns the collection of the dataset's metadata (RMetaData class objects).
 
const std::vector< std::string > GetSampleNames () const
 Returns the collection of the dataset's sample names.
 
const std::vector< std::string > GetTreeNames () const
 Returns the collection of the dataset's tree names.
 
RDatasetSpecWithGlobalFriends (const std::string &treeName, const std::string &fileNameGlob, const std::string &alias="")
 Add friend tree to RDatasetSpec object.
 
RDatasetSpecWithGlobalFriends (const std::string &treeName, const std::vector< std::string > &fileNameGlobs, const std::string &alias="")
 Add friend tree to RDatasetSpec object.
 
RDatasetSpecWithGlobalFriends (const std::vector< std::pair< std::string, std::string > > &treeAndFileNameGlobs, const std::string &alias="")
 Add friend tree to RDatasetSpec object.
 
RDatasetSpecWithGlobalFriends (const std::vector< std::string > &treeNames, const std::vector< std::string > &fileNameGlobs, const std::string &alias="")
 Add friend tree to RDatasetSpec object.
 
RDatasetSpecWithGlobalRange (const RDatasetSpec::REntryRange &entryRange={})
 Create an RDatasetSpec object for a given range of entries.
 

Private Member Functions

std::vector< RSampleMoveOutSamples ()
 Returns a collection of instances of the RSample class.
 

Private Attributes

REntryRange fEntryRange
 Start (inclusive) and end (exclusive) entry for the dataset processing.
 
ROOT::TreeUtils::RFriendInfo fFriendInfo
 List of friends.
 
std::vector< RSamplefSamples
 List of samples.
 

Friends

class ::ROOT::Detail::RDF::RLoopManager
 

#include <ROOT/RDF/RDatasetSpec.hxx>

Constructor & Destructor Documentation

◆ RDatasetSpec()

ROOT::RDF::Experimental::RDatasetSpec::RDatasetSpec ( )
default

Member Function Documentation

◆ AddSample()

RDatasetSpec & ROOT::RDF::Experimental::RDatasetSpec::AddSample ( RSample  sample)

Add sample (RSample class object) to the RDatasetSpec object.

Parameters
[in]sampleRSample class object. RSample class represents a sample i.e. a grouping of trees (and their corresponding fileglobs) and, optionally, the sample's metadata.

Example usage:

Our goal is to create an RDataFrame from the RDatasetSpec object. In order to do that, we need to create an RSample object first. In order to make this example even fuller, before we create the RSample object, we also create the RMetaData object which will be associated with our RSample object. Note that adding this metadata information to the RSample object is optional.

// Create the RMetaData object which will be used to create the RSample object.
meta.Add("sample_name", "name");
// Create the RSample object "mySample" with sample name "mySampleName", tree name "outputTree1",
// file name "outputFile.root" and associated metadata information.
ROOT::RDF::Experimental::RSample mySample("mySampleName", "outputTree1", "outputFile.root", meta);
// Create the RDatasetSpec object to which we add the sample (RSample object).
spec.AddSample(mySample);
// Finally, create an RDataFrame from the RDatasetSpec object.
auto df = ROOT::RDataFrame(spec);
The dataset specification for RDataFrame.
RDatasetSpec & AddSample(RSample sample)
Add sample (RSample class object) to the RDatasetSpec object.
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
Class representing a sample which is a grouping of trees and their fileglobs, and,...
Definition RSample.hxx:39
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...

Definition at line 131 of file RDatasetSpec.cxx.

◆ GetEntryRangeBegin()

Long64_t ROOT::RDF::Experimental::RDatasetSpec::GetEntryRangeBegin ( ) const

Returns the first entry as defined by the global range provided in the specification.

The first entry is inclusive.

Definition at line 85 of file RDatasetSpec.cxx.

◆ GetEntryRangeEnd()

Long64_t ROOT::RDF::Experimental::RDatasetSpec::GetEntryRangeEnd ( ) const

Returns the last entry as defined by the global range provided in the specification.

The last entry is exclusive.

Definition at line 93 of file RDatasetSpec.cxx.

◆ GetFileNameGlobs()

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

Returns the collection of the dataset's paths to files, or globs if specified in input.

Definition at line 55 of file RDatasetSpec.cxx.

◆ GetFriendInfo()

const ROOT::TreeUtils::RFriendInfo & ROOT::RDF::Experimental::RDatasetSpec::GetFriendInfo ( ) const

Returns the reference to the friend tree information.

Definition at line 77 of file RDatasetSpec.cxx.

◆ GetMetaData()

const std::vector< RMetaData > ROOT::RDF::Experimental::RDatasetSpec::GetMetaData ( ) const

Returns the collection of the dataset's metadata (RMetaData class objects).

Definition at line 66 of file RDatasetSpec.cxx.

◆ GetSampleNames()

const std::vector< std::string > ROOT::RDF::Experimental::RDatasetSpec::GetSampleNames ( ) const

Returns the collection of the dataset's sample names.

Definition at line 33 of file RDatasetSpec.cxx.

◆ GetTreeNames()

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

Returns the collection of the dataset's tree names.

Definition at line 44 of file RDatasetSpec.cxx.

◆ MoveOutSamples()

std::vector< RSample > ROOT::RDF::Experimental::RDatasetSpec::MoveOutSamples ( )
private

Returns a collection of instances of the RSample class.

RSample class represents a sample i.e. a grouping of trees (and their corresponding fileglobs) and, optionally, the sample's metadata.

Definition at line 102 of file RDatasetSpec.cxx.

◆ WithGlobalFriends() [1/4]

RDatasetSpec & ROOT::RDF::Experimental::RDatasetSpec::WithGlobalFriends ( const std::string &  treeName,
const std::string &  fileNameGlob,
const std::string &  alias = "" 
)

Add friend tree to RDatasetSpec object.

Parameters
[in]treeNameName of the tree.
[in]fileNameGlobPath to the file in which the tree is stored. Refer to TChain::Add for globbing rules.
[in]aliasAlias for this friend.

Example usage:

ROOT::RDF::Experimental::RSample s("mySample", "outputTree1", "outputFile.root");
spec.AddSample(s);
// Add friend tree "outputTree2" with the alias "myTreeFriend"
spec.WithGlobalFriends("outputTree2", "outputFile.root", "myTreeFriend");
auto df = ROOT::RDataFrame(spec);
RDatasetSpec & WithGlobalFriends(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias="")
Add friend tree to RDatasetSpec object.

Definition at line 154 of file RDatasetSpec.cxx.

◆ WithGlobalFriends() [2/4]

RDatasetSpec & ROOT::RDF::Experimental::RDatasetSpec::WithGlobalFriends ( const std::string &  treeName,
const std::vector< std::string > &  fileNameGlobs,
const std::string &  alias = "" 
)

Add friend tree to RDatasetSpec object.

Parameters
[in]treeNameName of the tree.
[in]fileNameGlobsCollection of paths to the files in which the tree is stored. Refer to TChain::Add for globbing rules.
[in]aliasAlias for this friend.

Definition at line 166 of file RDatasetSpec.cxx.

◆ WithGlobalFriends() [3/4]

RDatasetSpec & ROOT::RDF::Experimental::RDatasetSpec::WithGlobalFriends ( const std::vector< std::pair< std::string, std::string > > &  treeAndFileNameGlobs,
const std::string &  alias = "" 
)

Add friend tree to RDatasetSpec object.

Parameters
[in]treeAndFileNameGlobsCollection of pairs of paths to trees and paths to files.
[in]aliasAlias for this friend.

Definition at line 178 of file RDatasetSpec.cxx.

◆ WithGlobalFriends() [4/4]

RDatasetSpec & ROOT::RDF::Experimental::RDatasetSpec::WithGlobalFriends ( const std::vector< std::string > &  treeNames,
const std::vector< std::string > &  fileNameGlobs,
const std::string &  alias = "" 
)

Add friend tree to RDatasetSpec object.

Parameters
[in]treeNamesCollection of paths to trees.
[in]fileNameGlobsCollection of paths to files.
[in]aliasAlias for this friend.

Definition at line 190 of file RDatasetSpec.cxx.

◆ WithGlobalRange()

RDatasetSpec & ROOT::RDF::Experimental::RDatasetSpec::WithGlobalRange ( const RDatasetSpec::REntryRange entryRange = {})

Create an RDatasetSpec object for a given range of entries.

Parameters
[in]entryRange

Example usage:

ROOT::RDF::Experimental::RSample s("mySample", "outputTree1", "outputFile.root");
spec.AddSample(s);
// Set the entries range to be processed: including entry 1 and excluding entry 10.
spec.WithGlobalRange({1, 10});
auto df = ROOT::RDataFrame(spec);
RDatasetSpec & WithGlobalRange(const RDatasetSpec::REntryRange &entryRange={})
Create an RDatasetSpec object for a given range of entries.

Definition at line 216 of file RDatasetSpec.cxx.

Friends And Related Symbol Documentation

◆ ::ROOT::Detail::RDF::RLoopManager

friend class ::ROOT::Detail::RDF::RLoopManager
friend

Definition at line 49 of file RDatasetSpec.hxx.

Member Data Documentation

◆ fEntryRange

REntryRange ROOT::RDF::Experimental::RDatasetSpec::fEntryRange
private

Start (inclusive) and end (exclusive) entry for the dataset processing.

Definition at line 63 of file RDatasetSpec.hxx.

◆ fFriendInfo

ROOT::TreeUtils::RFriendInfo ROOT::RDF::Experimental::RDatasetSpec::fFriendInfo
private

List of friends.

Definition at line 62 of file RDatasetSpec.hxx.

◆ fSamples

std::vector<RSample> ROOT::RDF::Experimental::RDatasetSpec::fSamples
private

List of samples.

Definition at line 61 of file RDatasetSpec.hxx.

Libraries for ROOT::RDF::Experimental::RDatasetSpec:

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