34std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
39 auto model =
pageSource->GetSharedDescriptorGuard()->CreateModel();
43std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
49std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
51 std::unique_ptr<RNTupleModel> model)
56std::unique_ptr<ROOT::Experimental::RNTupleProcessor>
59 std::vector<std::unique_ptr<RNTupleModel>>
models)
65 throw RException(
R__FAIL(
"number of provided models must match number of specified ntuples"));
80 std::unique_ptr<RNTupleJoinProcessor>
processor;
87 for (
unsigned i = 1; i <
ntuples.size(); ++i) {
103 auto desc =
pageSource.GetSharedDescriptorGuard();
108 R__FAIL(
"field \"" +
fieldContext.GetProtoField().GetFieldName() +
"\" not found in current RNTuple"));
126 fPageSource->Attach();
129 fEntry = model.CreateEntry();
131 for (
const auto &
value : *fEntry) {
133 auto token = fEntry->GetToken(
field.GetFieldName());
138 if (!model.IsBare()) {
151 if (fLocalEntryNumber ==
kInvalidNTupleIndex || fLocalEntryNumber >= fPageSource->GetNEntries()) {
157 fNEntriesProcessed++;
158 return fLocalEntryNumber;
164 std::unique_ptr<RNTupleModel> model)
178 model =
fPageSource->GetSharedDescriptorGuard()->CreateModel();
181 fEntry = model->CreateEntry();
190 if (!model->IsBare()) {
191 auto valuePtr = model->GetDefaultEntry().GetPtr<
void>(
token);
210 fPageSource->Attach();
217 return fPageSource->GetNEntries();
225 if (fLocalEntryNumber >= fPageSource->GetNEntries()) {
227 if (++fCurrentNTupleNumber >= fNTuples.size()) {
231 }
while (ConnectNTuple(fNTuples.at(fCurrentNTupleNumber)) == 0);
233 fLocalEntryNumber = 0;
238 fNEntriesProcessed++;
239 return fLocalEntryNumber;
245 std::unique_ptr<RNTupleModel> model)
249 fPageSource->Attach();
251 if (fPageSource->GetNEntries() == 0) {
256 model = fPageSource->GetSharedDescriptorGuard()->CreateModel();
258 fJoinModel = model->Clone();
259 fJoinModel->Freeze();
260 fEntry = fJoinModel->CreateEntry();
262 for (
const auto &
value : *fEntry) {
269 if (!fJoinModel->IsBare()) {
276 ConnectField(
fieldContext->second, *fPageSource, *fEntry);
282 std::unique_ptr<RNTupleModel> model)
284 assert(fNEntriesProcessed == 0 &&
"cannot add auxiliary ntuples after processing has started");
296 model =
pageSource->GetSharedDescriptorGuard()->CreateModel();
299 auto entry = model->CreateBareEntry();
302 fJoinModel->Unfreeze();
308 std::vector<std::unique_ptr<RFieldBase>>
auxFields;
310 for (
const auto &val : *
entry) {
311 auto &
field = val.GetField();
325 fJoinModel->RegisterSubfield(
field->GetQualifiedFieldName());
328 fJoinModel->Freeze();
332 auto newEntry = fJoinModel->CreateEntry();
339 if (std::find_if(fNTuples.cbegin(), fNTuples.cend(),
fnIsNTuple) != fNTuples.end()) {
350 if (!model->IsBare()) {
351 auto valuePtr = model->GetDefaultEntry().GetPtr<
void>(
field.GetFieldName());
356 fFieldContexts.try_emplace(
field.GetQualifiedFieldName(),
field.Clone(
field.GetFieldName()),
token,
357 fNTuples.size() - 1);
372 fAuxiliaryPageSources.emplace_back(std::move(
pageSource));
386 if (fLocalEntryNumber ==
kInvalidNTupleIndex || fLocalEntryNumber >= fPageSource->GetNEntries()) {
392 fNEntriesProcessed++;
393 return fLocalEntryNumber;
403 value.Read(fLocalEntryNumber);
413 valPtrs.reserve(fJoinFieldTokens.size());
414 for (
const auto &
token : fJoinFieldTokens) {
415 auto ptr = fEntry->GetPtr<
void>(
token);
422 for (
unsigned i = 0; i < fJoinIndices.size(); ++i) {
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
static std::unique_ptr< RNTupleIndex > Create(const std::vector< std::string > &fieldNames, const RPageSource &pageSource, bool deferBuild=false)
Create an RNTupleIndex from an existing RNTuple.
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)
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Processor specializiation for vertically concatenated RNTuples (chains).
NTupleSize_t Advance() final
Advance the processor to the next available entry.
RNTupleChainProcessor(const std::vector< RNTupleOpenSpec > &ntuples, std::unique_ptr< RNTupleModel > model=nullptr)
Constructs a new RNTupleChainProcessor.
NTupleSize_t ConnectNTuple(const RNTupleOpenSpec &ntuple)
Connect an RNTuple for processing.
Processor specializiation for horizontally concatenated RNTuples (joins).
void AddAuxiliary(const RNTupleOpenSpec &auxNTuple, const std::vector< std::string > &joinFields, std::unique_ptr< RNTupleModel > model=nullptr)
Add an auxiliary RNTuple to the processor.
NTupleSize_t Advance() final
Advance the processor to the next available entry.
void LoadEntry() final
Fill the entry with values belonging to the current entry number of the primary RNTuple.
RNTupleJoinProcessor(const RNTupleOpenSpec &mainNTuple, std::unique_ptr< RNTupleModel > model=nullptr)
Constructs a new RNTupleJoinProcessor.
The RNTupleModel encapulates the schema of an ntuple.
Manager for a field as part of the RNTupleProcessor.
Interface for iterating over entries of RNTuples and vertically concatenated RNTuples (chains).
static std::unique_ptr< RNTupleProcessor > CreateChain(const std::vector< RNTupleOpenSpec > &ntuples, std::unique_ptr< RNTupleModel > model=nullptr)
Create a new RNTuple processor chain for vertical concatenation of RNTuples.
std::unordered_map< std::string, RFieldContext > fFieldContexts
static std::unique_ptr< RNTupleProcessor > CreateJoin(const std::vector< RNTupleOpenSpec > &ntuples, const std::vector< std::string > &joinFields, std::vector< std::unique_ptr< RNTupleModel > > models={})
Create a new RNTuple processor for horizontallly concatenated RNTuples.
static std::unique_ptr< RNTupleProcessor > Create(const RNTupleOpenSpec &ntuple)
std::unique_ptr< REntry > fEntry
void ConnectField(RFieldContext &fieldContext, Internal::RPageSource &pageSource, REntry &entry)
Creates and connects a concrete field to the current page source, based on its proto field.
std::unique_ptr< Internal::RPageSource > fPageSource
std::vector< RNTupleOpenSpec > fNTuples
Processor specializiation for processing a single RNTuple.
RNTupleSingleProcessor(const RNTupleOpenSpec &ntuple, RNTupleModel &model)
Constructs a new RNTupleProcessor for processing a single RNTuple.
NTupleSize_t Advance() final
Advance the processor to the next available entry.
Base class for all ROOT issued exceptions.
const_iterator begin() const
const_iterator end() const
void CallConnectPageSourceOnField(RFieldBase &, RPageSource &)
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
Used to specify the underlying RNTuples in RNTupleProcessor.