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 <any>
15#include <limits>
16#include <string>
17#include <utility> // std::pair
18#include <vector>
19
20#include <ROOT/RDF/RSample.hxx>
21#include <RtypesCore.h> // Long64_t
22
23namespace ROOT::TreeUtils {
24struct RFriendInfo;
25}
26
27namespace ROOT {
28namespace Detail {
29namespace RDF {
30class RLoopManager;
31} // namespace RDF
32} // namespace Detail
33
34namespace RDF {
35namespace Experimental {
36class RDatasetSpec;
37class RSample;
38} // namespace Experimental
39} // namespace RDF
40
41namespace Internal {
42namespace RDF {
43std::vector<ROOT::RDF::Experimental::RSample> MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &spec);
44}
45} // namespace Internal
46
47namespace RDF {
48namespace Experimental {
49
50// clang-format off
51/**
52\class ROOT::RDF::Experimental::RDatasetSpec
53\ingroup dataframe
54\brief The dataset specification for RDataFrame.
55
56This class allows users to create the dataset specification for RDataFrame
57to which they add samples (using the RSample class object) with tree names and file names,
58and, optionally, the metadata information (using the RMetaData class objects).
59Adding global friend trees and/or setting the range of events to be processed
60are also available.
61
62Note, there exists yet another method to build RDataFrame from the dataset information using the JSON file format: \ref FromSpec(const std::string &jsonFile) "FromSpec()".
63*/
64
66 // clang-format on
67 friend class ::ROOT::Detail::RDF::RLoopManager; // for MoveOutSamples
68 friend std::vector<ROOT::RDF::Experimental::RSample> ROOT::Internal::RDF::MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &);
69
70
71public:
72 struct REntryRange {
74 Long64_t fEnd{std::numeric_limits<Long64_t>::max()};
78 };
79
80private:
81 std::vector<RSample> fSamples; ///< List of samples
82 std::any fFriendInfo; ///< List of friends
83 REntryRange fEntryRange; ///< Start (inclusive) and end (exclusive) entry for the dataset processing
84 std::vector<RSample> MoveOutSamples();
86
87public:
89
90 const std::vector<std::string> GetSampleNames() const;
91 const std::vector<std::string> GetTreeNames() const;
92 const std::vector<std::string> GetFileNameGlobs() const;
93 const std::vector<RMetaData> GetMetaData() const;
94 const ROOT::TreeUtils::RFriendInfo &GetFriendInfo() const;
97
99
101 WithGlobalFriends(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias = "");
102
103 RDatasetSpec &WithGlobalFriends(const std::string &treeName, const std::vector<std::string> &fileNameGlobs,
104 const std::string &alias = "");
105
106 RDatasetSpec &WithGlobalFriends(const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
107 const std::string &alias = "");
108
109 RDatasetSpec &WithGlobalFriends(const std::vector<std::string> &treeNames,
110 const std::vector<std::string> &fileNameGlobs, const std::string &alias = "");
111
113};
114
115} // namespace Experimental
116} // namespace RDF
117} // namespace ROOT
118
119#endif // ROOT_RDF_RDATASETSPEC
Basic types used by ROOT and required by TInterpreter.
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
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::any fFriendInfo
List of friends.
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.
friend std::vector< ROOT::RDF::Experimental::RSample > ROOT::Internal::RDF::MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &)
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 & GetFriendInfo()
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 behaving as a heterogenuous dictionary to store the metadata of a dataset.
Definition RMetaData.hxx:57
Class representing a sample which is a grouping of trees and their fileglobs, and,...
Definition RSample.hxx:39
Different standalone functions to work with trees and tuples, not reqiuired to be a member of any cla...
std::vector< ROOT::RDF::Experimental::RSample > MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &spec)
Definition RDFUtils.cxx:677
Namespace for new ROOT classes and functions.
Information about friend trees of a certain TTree or TChain object.