Logo ROOT   6.12/07
Reference Guide
TRootDS.hxx
Go to the documentation of this file.
1 #ifndef ROOT_TROOTTDS
2 #define ROOT_TROOTTDS
3 
4 #include "ROOT/TDataFrame.hxx"
5 #include "ROOT/TDataSource.hxx"
6 #include <TChain.h>
7 
8 #include <memory>
9 
10 namespace ROOT {
11 namespace Experimental {
12 namespace TDF {
13 
15 private:
16  unsigned int fNSlots = 0U;
17  std::string fTreeName;
18  std::string fFileNameGlob;
19  mutable TChain fModelChain; // Mutable needed for getting the column type name
20  std::vector<double *> fAddressesToFree;
21  std::vector<std::string> fListOfBranches;
22  std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
23  std::vector<std::vector<void *>> fBranchAddresses; // first container-> slot, second -> column;
24  std::vector<std::unique_ptr<TChain>> fChains;
25 
26  std::vector<void *> GetColumnReadersImpl(std::string_view, const std::type_info &);
27 
28 public:
29  TRootDS(std::string_view treeName, std::string_view fileNameGlob);
30  ~TRootDS();
31  std::string GetTypeName(std::string_view colName) const;
32  const std::vector<std::string> &GetColumnNames() const;
33  bool HasColumn(std::string_view colName) const;
34  void InitSlot(unsigned int slot, ULong64_t firstEntry);
35  std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges();
36  void SetEntry(unsigned int slot, ULong64_t entry);
37  void SetNSlots(unsigned int nSlots);
38  void Initialise();
39 };
40 
42 
43 } // ns TDF
44 } // ns Experimental
45 } // ns ROOT
46 
47 #endif
std::vector< std::vector< void * > > fBranchAddresses
Definition: TRootDS.hxx:23
basic_string_view< char > string_view
Definition: RStringView.h:35
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: TRootDS.cxx:113
const std::vector< std::string > & GetColumnNames() const
Returns a reference to the collection of the dataset&#39;s column names.
Definition: TRootDS.cxx:72
std::vector< void * > GetColumnReadersImpl(std::string_view, const std::type_info &)
type-erased vector of pointers to pointers to column values - one per slot
Definition: TRootDS.cxx:16
std::vector< std::string > fListOfBranches
Definition: TRootDS.hxx:21
std::string GetTypeName(std::string_view colName) const
Type of a column as a string, e.g.
Definition: TRootDS.cxx:55
void InitSlot(unsigned int slot, ULong64_t firstEntry)
Convenience method called at the start of the data processing associated to a slot.
Definition: TRootDS.cxx:84
std::vector< double * > fAddressesToFree
Definition: TRootDS.hxx:20
TDataSource defines an API that TDataFrame can use to read arbitrary data formats.
Definition: TDataSource.hxx:51
std::vector< std::unique_ptr< TChain > > fChains
Definition: TRootDS.hxx:24
TRootDS(std::string_view treeName, std::string_view fileNameGlob)
Definition: TRootDS.cxx:38
void SetEntry(unsigned int slot, ULong64_t entry)
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot...
Definition: TRootDS.cxx:119
unsigned long long ULong64_t
Definition: RtypesCore.h:70
bool HasColumn(std::string_view colName) const
Checks if the dataset has a certain column.
Definition: TRootDS.cxx:77
std::vector< std::pair< ULong64_t, ULong64_t > > fEntryRanges
Definition: TRootDS.hxx:22
TDataFrame MakeRootDataFrame(std::string_view treeName, std::string_view fileNameGlob)
Definition: TRootDS.cxx:153
ROOT&#39;s TDataFrame offers a high level interface for analyses of data stored in TTrees.
Definition: TDataFrame.hxx:39
A chain is a collection of files containing TTree objects.
Definition: TChain.h:33
void SetNSlots(unsigned int nSlots)
Inform TDataSource of the number of processing slots (i.e.
Definition: TRootDS.cxx:124
void Initialise()
Convenience method called before starting an event-loop.
Definition: TRootDS.cxx:137