Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RDatasetSpec.hxx
Go to the documentation of this file.
1// Author: Vincenzo Eduardo Padulano CERN/UPV, Ivan Kabadzhov CERN 06/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_RDATASETSPEC
12#define ROOT_RDF_RDATASETSPEC
13
14#include <limits>
15#include <string>
16#include <utility> // std::pair
17#include <vector>
18
19#include <ROOT/RDF/RSample.hxx>
20#include <ROOT/RFriendInfo.hxx>
21#include <RtypesCore.h> // Long64_t
22
23namespace ROOT {
24namespace Detail {
25namespace RDF {
26class RLoopManager;
27}
28} // namespace Detail
29namespace RDF {
30namespace Experimental {
31
32// clang-format off
33/**
34\class ROOT::RDF::Experimental::RDatasetSpec
35\ingroup dataframe
36\brief The dataset specification for RDataFrame.
37
38This class allows users to create the dataset specification for RDataFrame
39to which they add samples (using the RSample class object) with tree names and file names,
40and, optionally, the metadata information (using the RMetaData class objects).
41Adding global friend trees and/or setting the range of events to be processed
42are also available.
43
44Note, there exists yet another method to build RDataFrame from the dataset information using the JSON file format: \ref FromSpec(const std::string &jsonFile) "FromSpec()".
45*/
46
48 // clang-format on
49 friend class ::ROOT::Detail::RDF::RLoopManager; // for MoveOutSamples
50
51public:
52 struct REntryRange {
54 Long64_t fEnd{std::numeric_limits<Long64_t>::max()};
56 REntryRange(Long64_t endEntry);
57 REntryRange(Long64_t startEntry, Long64_t endEntry);
58 };
59
60private:
61 std::vector<RSample> fSamples; ///< List of samples
63 REntryRange fEntryRange; ///< Start (inclusive) and end (exclusive) entry for the dataset processing
64
65 std::vector<RSample> MoveOutSamples();
66
67public:
68 RDatasetSpec() = default;
69
70 const std::vector<std::string> GetSampleNames() const;
71 const std::vector<std::string> GetTreeNames() const;
72 const std::vector<std::string> GetFileNameGlobs() const;
73 const std::vector<RMetaData> GetMetaData() const;
77
79
81 WithGlobalFriends(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias = "");
82
83 RDatasetSpec &WithGlobalFriends(const std::string &treeName, const std::vector<std::string> &fileNameGlobs,
84 const std::string &alias = "");
85
86 RDatasetSpec &WithGlobalFriends(const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
87 const std::string &alias = "");
88
89 RDatasetSpec &WithGlobalFriends(const std::vector<std::string> &treeNames,
90 const std::vector<std::string> &fileNameGlobs, const std::string &alias = "");
91
93};
94
95} // namespace Experimental
96} // namespace RDF
97} // namespace ROOT
98
99#endif // ROOT_RDF_RDATASETSPEC
long long Long64_t
Definition RtypesCore.h:69
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::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.
const ROOT::TreeUtils::RFriendInfo & GetFriendInfo() const
Returns the reference to the friend tree information.
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 fFriendInfo
List of friends.
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,...
Definition RSample.hxx:39
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Information about friend trees of a certain TTree or TChain object.