16#ifndef ROOT7_RNTuplerImporter
17#define ROOT7_RNTuplerImporter
39namespace Experimental {
112 void operator()(std::uint64_t nbytesWritten, std::uint64_t neventsWritten)
114 Call(nbytesWritten, neventsWritten);
116 virtual void Call(std::uint64_t nbytesWritten, std::uint64_t neventsWritten) = 0;
117 virtual void Finish(std::uint64_t nbytesWritten, std::uint64_t neventsWritten) = 0;
141 std::unique_ptr<RFieldBase::RValue>
fValue;
249 static std::unique_ptr<RNTupleImporter>
250 Create(std::string_view sourceFileName, std::string_view treeName, std::string_view destFileName);
253 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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t modifier
A field translates read and write calls from/to underlying columns to/from tree values.
Used to report every ~100 MB (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)
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 ...
std::function< void(RFieldBase &)> FieldModifier_t
Used to make adjustments to the fields of the output model.
ROOT::Experimental::RResult< void > InitDestination(std::string_view destFileName)
void SetFieldModifier(FieldModifier_t modifier)
Add custom method to adjust column representations.
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)
FieldModifier_t fFieldModifier
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 field for an untyped record.
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.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
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.
RFieldBase * fField
The field is kept during schema preparation and transferred to the fModel before the writing starts.
std::unique_ptr< RFieldBase::RValue > fValue
Set if a value is generated, only for transformed fields.
RImportField(RImportField &&other)=default
RImportField & operator=(const RImportField &other)=delete
RImportField & operator=(RImportField &&other)=default
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.
Int_t fMaxLength
Stores count leaf GetMaximum() to create large enough buffers for the array leafs.
std::vector< std::unique_ptr< RFieldBase > > fLeafFields
The leafs of the array as we encounter them traversing the TTree schema.
std::vector< unsigned char > fFieldBuffer
The collection field memory representation. Bound to the entry.
RImportLeafCountCollection & operator=(const RImportLeafCountCollection &other)=delete
RImportLeafCountCollection(RImportLeafCountCollection &&other)=default
RRecordField * fRecordField
Points to the item field of the untyped collection field in the model.
RImportLeafCountCollection(const RImportLeafCountCollection &other)=delete
RImportLeafCountCollection()=default
RImportLeafCountCollection & operator=(RImportLeafCountCollection &&other)=default
std::vector< size_t > fLeafBranchIndexes
Points to the correspondings leaf branches in fImportBranches.
std::unique_ptr< Int_t > fCountVal
The number of elements for the collection for a particular event.