48namespace Experimental {
 
   60   std::unique_ptr<ROOT::Experimental::Detail::RFieldBase> 
CloneImpl(std::string_view ) 
const final 
   62      return std::make_unique<RRDFCardinalityField>();
 
   64   void GenerateValue(
void *where) 
const final { *
static_cast<std::size_t *
>(where) = 0; }
 
   67   static std::string 
TypeName() { 
return "std::size_t"; }
 
   79      return representations;
 
   82   void GenerateColumnsImpl() final { assert(
false && 
"Cardinality fields must only be used for reading"); }
 
   87         ROOT::Experimental::Detail::RColumn::Create<ClusterSize_t>(
RColumnModel(onDiskTypes[0]), 0));
 
   99      *
static_cast<std::size_t *
>(to) = 
size;
 
  108      *
static_cast<std::size_t *
>(to) = 
size;
 
  129   std::unique_ptr<RNTupleColumnReader> 
Clone()
 
  131      return std::make_unique<RNTupleColumnReader>(
fField->Clone(
fField->GetName()));
 
  137      fField->ConnectPageSource(source);
 
  139         f.ConnectPageSource(source);
 
  157                         std::vector<DescriptorId_t> skeinIDs)
 
  197      skeinIDs.emplace_back(fieldId);
 
  199      if (fieldDesc.GetTypeName().empty()) {
 
  201         auto cardinalityField = std::make_unique<ROOT::Experimental::Internal::RRDFCardinalityField>();
 
  202         cardinalityField->SetOnDiskId(fieldId);
 
  203         fColumnNames.emplace_back(
"R_rdf_sizeof_" + std::string(colName));
 
  205         auto cardColReader = std::make_unique<ROOT::Experimental::Internal::RNTupleColumnReader>(
 
  206            std::move(cardinalityField));
 
  210            AddField(desc, std::string(colName) + 
"." + 
f.GetFieldName(), 
f.GetId(), skeinIDs);
 
  215         AddField(desc, colName, 
f.GetId(), skeinIDs);
 
  223         auto innerName = colName.empty() ? 
f.GetFieldName() : (std::string(colName) + 
"." + 
f.GetFieldName());
 
  224         AddField(desc, innerName, 
f.GetId(), skeinIDs);
 
  231   if (!fieldOrException)
 
  233   auto valueField = fieldOrException.Unwrap();
 
  234   valueField->SetOnDiskId(fieldId);
 
  235   for (
auto &
f : *valueField) {
 
  236      f.SetOnDiskId(desc.
FindFieldId(
f.GetName(), 
f.GetParent()->GetOnDiskId()));
 
  238   std::unique_ptr<Detail::RFieldBase> cardinalityField;
 
  240   if (!skeinIDs.empty()) {
 
  241      cardinalityField = std::make_unique<ROOT::Experimental::Internal::RRDFCardinalityField>();
 
  242      cardinalityField->SetOnDiskId(skeinIDs.back());
 
  245   for (
auto i = skeinIDs.rbegin(); i != skeinIDs.rend(); ++i) {
 
  246      valueField = std::make_unique<ROOT::Experimental::RRVecField>(
"", std::move(valueField));
 
  247      valueField->SetOnDiskId(*i);
 
  249      if (i != skeinIDs.rbegin()) {
 
  250         cardinalityField = std::make_unique<ROOT::Experimental::RRVecField>(
"", std::move(cardinalityField));
 
  251         cardinalityField->SetOnDiskId(*i);
 
  255   if (cardinalityField) {
 
  256      fColumnNames.emplace_back(
"R_rdf_sizeof_" + std::string(colName));
 
  258      auto cardColReader = std::make_unique<ROOT::Experimental::Internal::RNTupleColumnReader>(
 
  259         std::move(cardinalityField));
 
  263   skeinIDs.emplace_back(fieldId);
 
  266   auto valColReader = std::make_unique<ROOT::Experimental::Internal::RNTupleColumnReader>(std::move(valueField));
 
  272   pageSource->Attach();
 
  273   auto descriptorGuard = pageSource->GetSharedDescriptorGuard();
 
  274   fSources.emplace_back(std::move(pageSource));
 
  276   AddField(descriptorGuard.GetRef(), 
"", descriptorGuard->GetFieldZeroId(), std::vector<DescriptorId_t>());
 
  285std::unique_ptr<ROOT::Detail::RDF::RColumnReaderBase>
 
  304   std::vector<std::pair<ULong64_t, ULong64_t>> ranges;
 
  308   auto nEntries = 
fSources[0]->GetNEntries();
 
  309   const auto chunkSize = nEntries / 
fNSlots;
 
  316      ranges.emplace_back(start, end);
 
  319   ranges.back().second += reminder;
 
  348   for (
unsigned int i = 1; i < 
fNSlots; ++i) {
 
  360   ROOT::RDataFrame rdf(std::make_unique<ROOT::Experimental::RNTupleDS>(std::move(pageSource)));
 
TObject * clone(const char *newname) const override
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned long long ULong64_t
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
void GetCollectionInfo(const NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
Some fields have multiple possible column representations, e.g.
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
void Read(NTupleSize_t globalIndex)
A field translates read and write calls from/to underlying columns to/from tree values.
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &canonicalType, const std::string &typeAlias)
Factory method to resurrect a field from the stored on-disk type information.
RFieldBase(std::string_view name, std::string_view type, ENTupleStructure structure, bool isSimple, std::size_t nRepetitions=0)
The constructor creates the underlying column objects and connects them to either a sink or a source.
std::vector< std::unique_ptr< RColumn > > fColumns
The columns are connected either to a sink or to a source (not to both); they are owned by the field.
const ColumnRepresentation_t & EnsureCompatibleColumnTypes(const RNTupleDescriptor &desc) const
Returns the on-disk column types found in the provided descriptor for fOnDiskId.
RColumn * fPrincipalColumn
Points into fColumns.
Abstract interface to read data from an ntuple.
static std::unique_ptr< RPageSource > Create(std::string_view ntupleName, std::string_view location, const RNTupleReadOptions &options=RNTupleReadOptions())
Guess the concrete derived page source from the file name (location)
Every RDF column is represented by exactly one RNTuple field.
std::unique_ptr< RFieldBase > fField
The field backing the RDF column.
Long64_t fLastEntry
Last entry number that was read.
std::unique_ptr< RNTupleColumnReader > Clone()
Column readers are created as prototype and then cloned for every slot.
RNTupleColumnReader(std::unique_ptr< RFieldBase > f)
void * GetImpl(Long64_t entry) final
RFieldBase::RValue fValue
The memory location used to read from fField.
~RNTupleColumnReader()=default
void Connect(RPageSource &source)
Connect the field and its subfields to the page source.
An artificial field that transforms an RNTuple column that contains the offset of collections into co...
RRDFCardinalityField(RRDFCardinalityField &&other)=default
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type for writing.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
static std::string TypeName()
RRDFCardinalityField & operator=(RRDFCardinalityField &&other)=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::unique_ptr< ROOT::Experimental::Detail::RFieldBase > CloneImpl(std::string_view) const final
Called by Clone(), which additionally copies the on-disk ID.
void GenerateColumnsImpl(const RNTupleDescriptor &desc) final
Creates the backing columns corresponsing to the field type for reading.
void GenerateValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Gener...
void ReadInClusterImpl(const ROOT::Experimental::RClusterIndex &clusterIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
~RRDFCardinalityField()=default
void ReadGlobalImpl(ROOT::Experimental::NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Holds the static meta-data of an RNTuple column.
std::unique_ptr< ROOT::Detail::RDF::RColumnReaderBase > GetColumnReaders(unsigned int, std::string_view, const std::type_info &) final
If the other GetColumnReaders overload returns an empty vector, this overload will be called instead.
void AddField(const RNTupleDescriptor &desc, std::string_view colName, DescriptorId_t fieldId, std::vector< DescriptorId_t > skeinIDs)
Provides the RDF column "colName" given the field identified by fieldID.
void SetNSlots(unsigned int nSlots) final
Inform RDataSource of the number of processing slots (i.e.
bool SetEntry(unsigned int slot, ULong64_t entry) final
Advance the "cursors" returned by GetColumnReaders to the selected entry for a particular slot.
std::vector< std::unique_ptr< ROOT::Experimental::Internal::RNTupleColumnReader > > fColumnReaderPrototypes
We prepare a column reader prototype for every column.
std::vector< std::unique_ptr< ROOT::Experimental::Detail::RPageSource > > fSources
Clones of the first source, one for each slot.
Record_t GetColumnReadersImpl(std::string_view name, const std::type_info &) final
type-erased vector of pointers to pointers to column values - one per slot
void Initialize() final
Convenience method called before starting an event-loop.
std::vector< std::string > fColumnNames
void Finalize() final
Convenience method called after concluding an event-loop.
std::string GetTypeName(std::string_view colName) const final
Type of a column as a string, e.g.
std::vector< std::pair< ULong64_t, ULong64_t > > GetEntryRanges() final
Return ranges of entries to distribute to tasks.
RNTupleDS(std::unique_ptr< ROOT::Experimental::Detail::RPageSource > pageSource)
bool HasColumn(std::string_view colName) const final
Checks if the dataset has a certain column.
std::vector< std::string > fColumnTypes
The on-storage meta-data of an ntuple.
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
DescriptorId_t FindFieldId(std::string_view fieldName, DescriptorId_t parentId) const
const RFieldDescriptor & GetFieldDescriptor(DescriptorId_t fieldId) const
Representation of an RNTuple data set in a ROOT file.
std::unique_ptr< Detail::RPageSource > MakePageSource(const RNTupleReadOptions &options=RNTupleReadOptions())
Create a page source from the RNTuple object.
std::vector< void * > Record_t
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
RDataFrame FromRNTuple(std::string_view ntupleName, std::string_view fileName)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
TSeq< unsigned int > TSeqU
Wrap the integer in a struct in order to avoid template specialization clash with std::uint32_t.