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} // namespace RDF
28} // namespace Detail
29
30namespace RDF {
31namespace Experimental {
32class RDatasetSpec;
33class RSample;
34} // namespace Experimental
35} // namespace RDF
36
37namespace Internal {
38namespace RDF {
39std::vector<ROOT::RDF::Experimental::RSample> MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &spec);
40}
41} // namespace Internal
42
43namespace RDF {
44namespace Experimental {
45
46// clang-format off
47/**
48\class ROOT::RDF::Experimental::RDatasetSpec
49\ingroup dataframe
50\brief The dataset specification for RDataFrame.
51
52This class allows users to create the dataset specification for RDataFrame
53to which they add samples (using the RSample class object) with tree names and file names,
54and, optionally, the metadata information (using the RMetaData class objects).
55Adding global friend trees and/or setting the range of events to be processed
56are also available.
57
58Note, there exists yet another method to build RDataFrame from the dataset information using the JSON file format: \ref FromSpec(const std::string &jsonFile) "FromSpec()".
59*/
60
62 // clang-format on
63 friend class ::ROOT::Detail::RDF::RLoopManager; // for MoveOutSamples
64 friend std::vector<ROOT::RDF::Experimental::RSample> ROOT::Internal::RDF::MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &);
65
66
67public:
68 struct REntryRange {
70 Long64_t fEnd{std::numeric_limits<Long64_t>::max()};
74 };
75
76private:
77 std::vector<RSample> fSamples; ///< List of samples
79 REntryRange fEntryRange; ///< Start (inclusive) and end (exclusive) entry for the dataset processing
80 std::vector<RSample> MoveOutSamples();
81
82public:
83 RDatasetSpec() = default;
84
85 const std::vector<std::string> GetSampleNames() const;
86 const std::vector<std::string> GetTreeNames() const;
87 const std::vector<std::string> GetFileNameGlobs() const;
88 const std::vector<RMetaData> GetMetaData() const;
92
94
96 WithGlobalFriends(const std::string &treeName, const std::string &fileNameGlob, const std::string &alias = "");
97
98 RDatasetSpec &WithGlobalFriends(const std::string &treeName, const std::vector<std::string> &fileNameGlobs,
99 const std::string &alias = "");
100
101 RDatasetSpec &WithGlobalFriends(const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs,
102 const std::string &alias = "");
103
104 RDatasetSpec &WithGlobalFriends(const std::vector<std::string> &treeNames,
105 const std::vector<std::string> &fileNameGlobs, const std::string &alias = "");
106
108};
109
110} // namespace Experimental
111} // namespace RDF
112} // namespace ROOT
113
114#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.
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 &)
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
std::vector< ROOT::RDF::Experimental::RSample > MoveOutSamples(ROOT::RDF::Experimental::RDatasetSpec &spec)
Definition RDFUtils.cxx:598
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.