16#ifndef ROOT7_RNTuplerImporter
17#define ROOT7_RNTuplerImporter
38namespace Experimental {
102 void operator()(std::uint64_t nbytesWritten, std::uint64_t neventsWritten)
104 Call(nbytesWritten, neventsWritten);
106 virtual void Call(std::uint64_t nbytesWritten, std::uint64_t neventsWritten) = 0;
107 virtual void Finish(std::uint64_t nbytesWritten, std::uint64_t neventsWritten) = 0;
134 std::unique_ptr<Detail::RFieldBase::RValue>
fValue;
253 static std::unique_ptr<RNTupleImporter>
254 Create(std::string_view sourceFileName, std::string_view treeName, std::string_view destFileName);
257 static std::unique_ptr<RNTupleImporter>
Create(
TTree *sourceTree, std::string_view destFileName);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
A field translates read and write calls from/to underlying columns to/from tree values.
Used to report every ~50MB (compressed), and at the end about the status of the import.
virtual void Finish(std::uint64_t nbytesWritten, std::uint64_t neventsWritten)=0
void operator()(std::uint64_t nbytesWritten, std::uint64_t neventsWritten)
virtual ~RProgressCallback()=default
virtual void Call(std::uint64_t nbytesWritten, std::uint64_t neventsWritten)=0
Converts a TTree into an RNTuple.
void SetWriteOptions(RNTupleWriteOptions options)
bool fConvertDotsInBranchNames
Whether or not dot characters in branch names should be converted to underscores.
std::unique_ptr< TFile > fDestFile
RNTupleWriteOptions fWriteOptions
std::int64_t fMaxEntries
The maximum number of entries to import. When this value is -1 (default), import all entries.
std::map< std::string, RImportLeafCountCollection > fLeafCountCollections
Maps the count leaf to the information about the corresponding untyped collection.
RNTupleImporter()=default
RNTupleImporter & operator=(const RNTupleImporter &other)=delete
std::vector< RImportBranch > fImportBranches
void SetNTupleName(const std::string &name)
static constexpr int kDefaultCompressionSettings
By default, compress RNTuple with zstd, level 5.
RNTupleImporter(const RNTupleImporter &other)=delete
void SetConvertDotsInBranchNames(bool value)
Whereas branch names may contain dots, RNTuple field names may not.
RNTupleImporter & operator=(RNTupleImporter &&other)=delete
static std::unique_ptr< RNTupleImporter > Create(std::string_view sourceFileName, std::string_view treeName, std::string_view destFileName)
Opens the input file for reading and the output file for writing (update).
std::unique_ptr< RProgressCallback > fProgressCallback
RNTupleImporter(RNTupleImporter &&other)=delete
RResult< void > PrepareSchema()
Sets up the connection from TTree branches to RNTuple fields, including initialization of the memory ...
ROOT::Experimental::RResult< void > InitDestination(std::string_view destFileName)
void Import()
Import works in two steps:
RNTupleWriteOptions GetWriteOptions() const
std::unique_ptr< TFile > fSourceFile
std::unique_ptr< REntry > fEntry
std::string fDestFileName
bool fIsQuiet
No standard output, conversely if set to false, schema information and progress is printed.
std::vector< RImportField > fImportFields
void SetIsQuiet(bool value)
Whether or not information and progress is printed to stdout.
void SetMaxEntries(std::uint64_t maxEntries)
std::unique_ptr< RNTupleModel > fModel
~RNTupleImporter()=default
std::vector< std::unique_ptr< RImportTransformation > > fImportTransformations
The list of transformations to be performed for every entry.
Common user-tunable settings for storing ntuples.
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
A TTree represents a columnar dataset.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
std::string fBranchName
Top-level branch name from the input TTree.
RImportBranch(const RImportBranch &other)=delete
RImportBranch & operator=(RImportBranch &&other)=default
RImportBranch & operator=(const RImportBranch &other)=delete
std::unique_ptr< unsigned char[]> fBranchBuffer
The destination of SetBranchAddress() for fBranchName
RImportBranch(RImportBranch &&other)=default
void * fFieldBuffer
Usually points to the corresponding RImportBranch::fBranchBuffer but not always.
bool fIsClass
Field imported from a branch with stramer info (e.g., STL, user-defined class)
std::unique_ptr< Detail::RFieldBase::RValue > fValue
set if a value is generated, only for transformed fields
RImportField(RImportField &&other)=default
bool fIsInUntypedCollection
Sub-fields of untyped collections (leaf count arrays in the input)
RImportField & operator=(const RImportField &other)=delete
RImportField & operator=(RImportField &&other)=default
Detail::RFieldBase * fField
The field is kept during schema preparation and transferred to the fModel before the writing starts.
RImportField(const RImportField &other)=delete
When the schema is set up and the import started, it needs to be reset before the next Import() call ...
RNTupleImporter & fImporter
RImportGuard(const RImportGuard &)=delete
RImportGuard(RImportGuard &&)=delete
RImportGuard & operator=(const RImportGuard &)=delete
RImportGuard(RNTupleImporter &importer)
RImportGuard & operator=(RImportGuard &&)=delete
Leaf count arrays require special treatment.
std::string fFieldName
name of the untyped collection, e.g. _collection0, _collection1, etc.
Int_t fMaxLength
Stores count leaf GetMaximum() to create large enough buffers for the array leafs.
std::vector< size_t > fImportFieldIndexes
Points to the correspondings fields in fImportFields.
std::unique_ptr< RNTupleModel > fCollectionModel
The model for the collection itself.
RImportLeafCountCollection & operator=(const RImportLeafCountCollection &other)=delete
RImportLeafCountCollection(RImportLeafCountCollection &&other)=default
std::shared_ptr< RCollectionNTupleWriter > fCollectionWriter
Used to fill the collection elements per event.
std::vector< std::unique_ptr< RImportTransformation > > fTransformations
One transformation for every field, to copy the content of the array one by one.
RImportLeafCountCollection(const RImportLeafCountCollection &other)=delete
RImportLeafCountCollection()=default
RImportLeafCountCollection & operator=(RImportLeafCountCollection &&other)=default
std::unique_ptr< Int_t > fCountVal
The number of elements for the collection for a particular event.
std::unique_ptr< REntry > fCollectionEntry
Keeps the memory location of the collection members.