Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleView.cxx
Go to the documentation of this file.
1/// \file RNTupleView.cxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2024-10-28
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#include <ROOT/RError.hxx>
17#include <ROOT/RFieldBase.hxx>
19#include <ROOT/RNTupleView.hxx>
20#include <ROOT/RPageStorage.hxx>
21
24{
25 const auto &desc = pageSource.GetSharedDescriptorGuard().GetRef();
26
27 auto fnGetPrincipalColumnId = [&desc](DescriptorId_t fieldId) -> DescriptorId_t {
28 auto columnIterable = desc.GetColumnIterable(fieldId);
29 return (columnIterable.size() > 0) ? columnIterable.begin()->GetPhysicalId() : kInvalidDescriptorId;
30 };
31
32 auto columnId = fnGetPrincipalColumnId(field.GetOnDiskId());
33 if (columnId == kInvalidDescriptorId) {
34 for (const auto &f : field) {
35 columnId = fnGetPrincipalColumnId(f.GetOnDiskId());
36 if (columnId != kInvalidDescriptorId)
37 break;
38 }
39 }
40
41 if (columnId == kInvalidDescriptorId) {
43 }
44
45 auto arraySize = std::max(std::uint64_t(1), desc.GetFieldDescriptor(field.GetOnDiskId()).GetNRepetitions());
46 return RNTupleGlobalRange(0, desc.GetNElements(columnId) / arraySize);
47}
#define f(i)
Definition RSha256.hxx:104
Abstract interface to read data from an ntuple.
const RSharedDescriptorGuard GetSharedDescriptorGuard() const
Takes the read lock for the descriptor.
A field translates read and write calls from/to underlying columns to/from tree values.
DescriptorId_t GetOnDiskId() const
RColumnDescriptorIterable GetColumnIterable() const
Used to loop over indexes (entries or collections) between start and end.
RNTupleGlobalRange GetFieldRange(const RFieldBase &field, const RPageSource &pageSource)
Helper to get the iteration space of the given field that needs to be connected to the given page sou...
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr NTupleSize_t kInvalidNTupleIndex
constexpr DescriptorId_t kInvalidDescriptorId