Logo ROOT  
Reference Guide
ROOT::Experimental::RNTupleReader Class Reference

An RNTuple that is used to read data from storage.

An input ntuple provides data from storage as C++ objects. The ntuple model can be created from the data on storage or it can be imposed by the user. The latter case allows users to read into a specialized ntuple model that covers only a subset of the fields in the ntuple. The ntuple model is used when reading complete entries. Individual fields can be read as well by instantiating a tree view.

Definition at line 87 of file RNTuple.hxx.

Classes

class  RIterator
 

Public Member Functions

 RNTupleReader (std::unique_ptr< Detail::RPageSource > source)
 The model is generated from the ntuple metadata on storage. More...
 
 RNTupleReader (std::unique_ptr< RNTupleModel > model, std::unique_ptr< Detail::RPageSource > source)
 The user imposes an ntuple model, which must be compatible with the model found in the data on storage. More...
 
 ~RNTupleReader ()
 
RIterator begin ()
 
std::unique_ptr< RNTupleReaderClone ()
 
void EnableMetrics ()
 
RIterator end ()
 
const RNTupleDescriptorGetDescriptor () const
 
RNTupleGlobalRange GetEntryRange ()
 
const Detail::RNTupleMetricsGetMetrics () const
 
RNTupleModelGetModel ()
 
NTupleSize_t GetNEntries () const
 
template<typename T >
RNTupleView< T > GetView (std::string_view fieldName)
 Provides access to an individual field that can contain either a scalar value or a collection, e.g. More...
 
RNTupleViewCollection GetViewCollection (std::string_view fieldName)
 
void LoadEntry (NTupleSize_t index)
 Analogous to Fill(), fills the default entry of the model. More...
 
void LoadEntry (NTupleSize_t index, REntry &entry)
 Fills a user provided entry after checking that the entry has been instantiated from the ntuple model. More...
 
void PrintInfo (const ENTupleInfo what=ENTupleInfo::kSummary, std::ostream &output=std::cout)
 Prints a detailed summary of the ntuple, including a list of fields. More...
 
void Show (NTupleSize_t index, const ENTupleShowFormat format=ENTupleShowFormat::kCurrentModelJSON, std::ostream &output=std::cout)
 Shows the values of the i-th entry/row, starting with 0 for the first entry. More...
 

Static Public Member Functions

static std::unique_ptr< RNTupleReaderOpen (std::string_view ntupleName, std::string_view storage, const RNTupleReadOptions &options=RNTupleReadOptions())
 
static std::unique_ptr< RNTupleReaderOpen (std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const RNTupleReadOptions &options=RNTupleReadOptions())
 

Private Member Functions

void ConnectModel (const RNTupleModel &model)
 
RNTupleReaderGetDisplayReader ()
 

Private Attributes

std::unique_ptr< RNTupleReaderfDisplayReader
 We use a dedicated on-demand reader for Show() and Scan(). More...
 
Detail::RNTupleMetrics fMetrics
 
std::unique_ptr< RNTupleModelfModel
 Needs to be destructed before fSource. More...
 
std::unique_ptr< Detail::RPageSourcefSource
 

#include <ROOT/RNTuple.hxx>

Constructor & Destructor Documentation

◆ RNTupleReader() [1/2]

ROOT::Experimental::RNTupleReader::RNTupleReader ( std::unique_ptr< RNTupleModel model,
std::unique_ptr< Detail::RPageSource source 
)

The user imposes an ntuple model, which must be compatible with the model found in the data on storage.

Definition at line 46 of file RNTuple.cxx.

◆ RNTupleReader() [2/2]

ROOT::Experimental::RNTupleReader::RNTupleReader ( std::unique_ptr< Detail::RPageSource source)
explicit

The model is generated from the ntuple metadata on storage.

Definition at line 58 of file RNTuple.cxx.

◆ ~RNTupleReader()

ROOT::Experimental::RNTupleReader::~RNTupleReader ( )

Definition at line 67 of file RNTuple.cxx.

Member Function Documentation

◆ begin()

RIterator ROOT::Experimental::RNTupleReader::begin ( )
inline

Definition at line 186 of file RNTuple.hxx.

◆ Clone()

std::unique_ptr<RNTupleReader> ROOT::Experimental::RNTupleReader::Clone ( )
inline

Definition at line 139 of file RNTuple.hxx.

◆ ConnectModel()

void ROOT::Experimental::RNTupleReader::ConnectModel ( const RNTupleModel model)
private

Definition at line 34 of file RNTuple.cxx.

◆ EnableMetrics()

void ROOT::Experimental::RNTupleReader::EnableMetrics ( )
inline

Definition at line 189 of file RNTuple.hxx.

◆ end()

RIterator ROOT::Experimental::RNTupleReader::end ( )
inline

Definition at line 187 of file RNTuple.hxx.

◆ GetDescriptor()

const RNTupleDescriptor& ROOT::Experimental::RNTupleReader::GetDescriptor ( ) const
inline

Definition at line 144 of file RNTuple.hxx.

◆ GetDisplayReader()

ROOT::Experimental::RNTupleReader * ROOT::Experimental::RNTupleReader::GetDisplayReader ( )
private

Definition at line 157 of file RNTuple.cxx.

◆ GetEntryRange()

RNTupleGlobalRange ROOT::Experimental::RNTupleReader::GetEntryRange ( )
inline

Definition at line 171 of file RNTuple.hxx.

◆ GetMetrics()

const Detail::RNTupleMetrics& ROOT::Experimental::RNTupleReader::GetMetrics ( ) const
inline

Definition at line 190 of file RNTuple.hxx.

◆ GetModel()

ROOT::Experimental::RNTupleModel * ROOT::Experimental::RNTupleReader::GetModel ( )

Definition at line 88 of file RNTuple.cxx.

◆ GetNEntries()

NTupleSize_t ROOT::Experimental::RNTupleReader::GetNEntries ( ) const
inline

Definition at line 143 of file RNTuple.hxx.

◆ GetView()

template<typename T >
RNTupleView<T> ROOT::Experimental::RNTupleReader::GetView ( std::string_view  fieldName)
inline

Provides access to an individual field that can contain either a scalar value or a collection, e.g.

GetView<double>("particles.pt") or GetView<std::vector<double>>("particle"). It can as well be the index field of a collection itself, like GetView<NTupleSize_t>("particle")

Definition at line 177 of file RNTuple.hxx.

◆ GetViewCollection()

RNTupleViewCollection ROOT::Experimental::RNTupleReader::GetViewCollection ( std::string_view  fieldName)
inline

Definition at line 181 of file RNTuple.hxx.

◆ LoadEntry() [1/2]

void ROOT::Experimental::RNTupleReader::LoadEntry ( NTupleSize_t  index)
inline

Analogous to Fill(), fills the default entry of the model.

Returns false at the end of the ntuple. On I/O errors, raises an expection.

Definition at line 157 of file RNTuple.hxx.

◆ LoadEntry() [2/2]

void ROOT::Experimental::RNTupleReader::LoadEntry ( NTupleSize_t  index,
REntry entry 
)
inline

Fills a user provided entry after checking that the entry has been instantiated from the ntuple model.

Definition at line 159 of file RNTuple.hxx.

◆ Open() [1/2]

std::unique_ptr< ROOT::Experimental::RNTupleReader > ROOT::Experimental::RNTupleReader::Open ( std::string_view  ntupleName,
std::string_view  storage,
const RNTupleReadOptions options = RNTupleReadOptions() 
)
static

Definition at line 80 of file RNTuple.cxx.

◆ Open() [2/2]

std::unique_ptr< ROOT::Experimental::RNTupleReader > ROOT::Experimental::RNTupleReader::Open ( std::unique_ptr< RNTupleModel model,
std::string_view  ntupleName,
std::string_view  storage,
const RNTupleReadOptions options = RNTupleReadOptions() 
)
static

Definition at line 71 of file RNTuple.cxx.

◆ PrintInfo()

void ROOT::Experimental::RNTupleReader::PrintInfo ( const ENTupleInfo  what = ENTupleInfo::kSummary,
std::ostream &  output = std::cout 
)

Prints a detailed summary of the ntuple, including a list of fields.

Definition at line 97 of file RNTuple.cxx.

◆ Show()

void ROOT::Experimental::RNTupleReader::Show ( NTupleSize_t  index,
const ENTupleShowFormat  format = ENTupleShowFormat::kCurrentModelJSON,
std::ostream &  output = std::cout 
)

Shows the values of the i-th entry/row, starting with 0 for the first entry.

By default, prints the output in JSON format. Uses the visitor pattern to traverse through each field of the given entry.

Definition at line 165 of file RNTuple.cxx.

Member Data Documentation

◆ fDisplayReader

std::unique_ptr<RNTupleReader> ROOT::Experimental::RNTupleReader::fDisplayReader
private

We use a dedicated on-demand reader for Show() and Scan().

Printing data uses all the fields from the full model even if the analysis code uses only a subset of fields. The display reader is a clone of the original reader.

Definition at line 95 of file RNTuple.hxx.

◆ fMetrics

Detail::RNTupleMetrics ROOT::Experimental::RNTupleReader::fMetrics
private

Definition at line 96 of file RNTuple.hxx.

◆ fModel

std::unique_ptr<RNTupleModel> ROOT::Experimental::RNTupleReader::fModel
private

Needs to be destructed before fSource.

Definition at line 91 of file RNTuple.hxx.

◆ fSource

std::unique_ptr<Detail::RPageSource> ROOT::Experimental::RNTupleReader::fSource
private

Definition at line 89 of file RNTuple.hxx.


The documentation for this class was generated from the following files: