File indexing completed on 2025-09-15 09:11:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RROOTTDS
0012 #define ROOT_RROOTTDS
0013
0014 #include "ROOT/RDataFrame.hxx"
0015 #include "ROOT/RDataSource.hxx"
0016 #include <TChain.h>
0017
0018 #include <memory>
0019
0020 namespace ROOT {
0021
0022 namespace Internal {
0023
0024 namespace RDF {
0025
0026
0027
0028 class RRootDS final : public ROOT::RDF::RDataSource {
0029 private:
0030 std::string fTreeName;
0031 std::string fFileNameGlob;
0032 mutable TChain fModelChain;
0033 std::vector<double *> fAddressesToFree;
0034 std::vector<std::string> fListOfBranches;
0035 std::vector<std::pair<ULong64_t, ULong64_t>> fEntryRanges;
0036 std::vector<std::vector<void *>> fBranchAddresses;
0037 std::vector<std::unique_ptr<TChain>> fChains;
0038
0039 std::vector<void *> GetColumnReadersImpl(std::string_view, const std::type_info &) final;
0040
0041 protected:
0042 std::string AsString() final { return "ROOT data source"; };
0043
0044 public:
0045 RRootDS(std::string_view treeName, std::string_view fileNameGlob);
0046
0047 RRootDS(const RRootDS &) = delete;
0048 RRootDS &operator=(const RRootDS &) = delete;
0049 RRootDS(RRootDS &&) = delete;
0050 RRootDS &operator=(RRootDS &&) = delete;
0051 ~RRootDS() final;
0052
0053 std::size_t GetNFiles() const final;
0054 std::string GetTypeName(std::string_view colName) const final;
0055 const std::vector<std::string> &GetColumnNames() const final;
0056 bool HasColumn(std::string_view colName) const final;
0057 void InitSlot(unsigned int slot, ULong64_t firstEntry) final;
0058 void FinalizeSlot(unsigned int slot) final;
0059 std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges() final;
0060 bool SetEntry(unsigned int slot, ULong64_t entry) final;
0061 void SetNSlots(unsigned int nSlots) final;
0062 void Initialize() final;
0063 std::string GetLabel() final;
0064 };
0065
0066 }
0067
0068 }
0069
0070 }
0071
0072 #endif