Logo ROOT   6.14/05
Reference Guide
RTrivialDS.hxx
Go to the documentation of this file.
1 // Author: Enrico Guiraud, Danilo Piparo CERN 9/2017
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2016, 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_RTRIVIALTDS
12 #define ROOT_RTRIVIALTDS
13 
14 #include "ROOT/RDataFrame.hxx"
15 #include "ROOT/RDataSource.hxx"
16 
17 namespace ROOT {
18 
19 namespace RDF {
20 
21 class RTrivialDS final : public ROOT::RDF::RDataSource {
22 private:
23  unsigned int fNSlots = 0U;
24  ULong64_t fSize = 0ULL;
25  bool fSkipEvenEntries = false;
26  std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
27  std::vector<std::string> fColNames{"col0"};
28  std::vector<ULong64_t> fCounter;
29  std::vector<ULong64_t *> fCounterAddr;
30  std::vector<void *> GetColumnReadersImpl(std::string_view name, const std::type_info &);
31 
32 public:
33  RTrivialDS(ULong64_t size, bool skipEvenEntries = false);
34  ~RTrivialDS();
35  const std::vector<std::string> &GetColumnNames() const;
36  bool HasColumn(std::string_view colName) const;
37  std::string GetTypeName(std::string_view) const;
38  std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges();
39  bool SetEntry(unsigned int slot, ULong64_t entry);
40  void SetNSlots(unsigned int nSlots);
41  void Initialise();
42 };
43 
44 RDataFrame MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries = false);
45 
46 } // ns RDF
47 
48 } // ns ROOT
49 
50 #endif
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
Definition: RTrivialDS.hxx:26
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges()
Return ranges of entries to distribute to tasks.
Definition: RTrivialDS.cxx:47
RTrivialDS(ULong64_t size, bool skipEvenEntries=false)
Definition: RTrivialDS.cxx:24
bool SetEntry(unsigned int slot, ULong64_t entry)
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot...
Definition: RTrivialDS.cxx:53
std::vector< void * > GetColumnReadersImpl(std::string_view name, const std::type_info &)
type-erased vector of pointers to pointers to column values - one per slot
Definition: RTrivialDS.cxx:10
std::vector< ULong64_t * > fCounterAddr
Definition: RTrivialDS.hxx:29
std::vector< std::string > fColNames
Definition: RTrivialDS.hxx:27
std::string GetTypeName(std::string_view) const
Type of a column as a string, e.g.
Definition: RTrivialDS.cxx:42
bool HasColumn(std::string_view colName) const
Checks if the dataset has a certain column.
Definition: RTrivialDS.cxx:37
void Initialise()
Convenience method called before starting an event-loop.
Definition: RTrivialDS.cxx:71
ROOT&#39;s RDataFrame offers a high level interface for analyses of data stored in TTrees, CSV&#39;s and other data formats.
Definition: RDataFrame.hxx:42
RDataFrame MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries=false)
Definition: RTrivialDS.cxx:86
unsigned int fNSlots
Definition: RTrivialDS.hxx:23
void SetNSlots(unsigned int nSlots)
Inform RDataSource of the number of processing slots (i.e.
Definition: RTrivialDS.cxx:62
unsigned long long ULong64_t
Definition: RtypesCore.h:70
basic_string_view< char > string_view
Definition: RStringView.hxx:35
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
Definition: RDataSource.hxx:91
char name[80]
Definition: TGX11.cxx:109
std::vector< ULong64_t > fCounter
Definition: RTrivialDS.hxx:28
const std::vector< std::string > & GetColumnNames() const
Returns a reference to the collection of the dataset&#39;s column names.
Definition: RTrivialDS.cxx:32