Logo ROOT  
Reference Guide
RRootDS.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 9/2017
2
3/*************************************************************************
4 * Copyright (C) 1995-2018, 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_RROOTTDS
12#define ROOT_RROOTTDS
13
14#include "ROOT/RDataFrame.hxx"
15#include "ROOT/RDataSource.hxx"
16#include <TChain.h>
17
18#include <memory>
19
20namespace ROOT {
21
22namespace RDF {
23
24class R__DEPRECATED(6, 24,
25 "RRootDS will be removed from the public namespace. Please use standard RDataFrame constructors "
26 "and interfaces instead")
27RRootDS final : public ROOT::RDF::RDataSource {
28private:
29 unsigned int fNSlots = 0U;
30 std::string fTreeName;
31 std::string fFileNameGlob;
32 mutable TChain fModelChain; // Mutable needed for getting the column type name
33 std::vector<double *> fAddressesToFree;
34 std::vector<std::string> fListOfBranches;
35 std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
36 std::vector<std::vector<void *>> fBranchAddresses; // first container-> slot, second -> column;
37 std::vector<std::unique_ptr<TChain>> fChains;
38
39 std::vector<void *> GetColumnReadersImpl(std::string_view, const std::type_info &);
40
41protected:
42 std::string AsString() { return "ROOT data source"; };
43
44public:
45 RRootDS(std::string_view treeName, std::string_view fileNameGlob);
46 ~RRootDS();
47 std::string GetTypeName(std::string_view colName) const;
48 const std::vector<std::string> &GetColumnNames() const;
49 bool HasColumn(std::string_view colName) const;
50 void InitSlot(unsigned int slot, ULong64_t firstEntry);
51 void FinaliseSlot(unsigned int slot);
52 std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges();
53 bool SetEntry(unsigned int slot, ULong64_t entry);
54 void SetNSlots(unsigned int nSlots);
55 void Initialise();
56 std::string GetLabel();
57};
58
59RDataFrame MakeRootDataFrame(std::string_view treeName, std::string_view fileNameGlob);
60
61} // ns RDF
62
63} // ns ROOT
64
65#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition: RConfig.hxx:522
unsigned long long ULong64_t
Definition: RtypesCore.h:72
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
A chain is a collection of files containing TTree objects.
Definition: TChain.h:34
basic_string_view< char > string_view
class R__DEPRECATED(6, 24, "RRootDS will be removed from the public namespace. Please use standard RDataFrame constructors " "and interfaces instead") RRootDS final RDataFrame MakeRootDataFrame(std::string_view treeName, std::string_view fileNameGlob)
Definition: RRootDS.cxx:162
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21