19#ifndef RDF_SNAPSHOTHELPERS
20#define RDF_SNAPSHOTHELPERS
58 std::unique_ptr<ROOT::RNTupleParallelWriter>
fWriter;
63 std::vector<std::unique_ptr<ROOT::REntry>>
fEntries;
72 const std::vector<const std::type_info *> &colTypeIDs);
82 void Exec(
unsigned int slot, const std::
vector<
void *> &values);
107 alignas(8) std::array<std::byte, fNBytes>
fBytes{std::byte{0}};
133 RBranchData(std::string inputBranchName, std::string outputBranchName,
bool isDefine,
const std::type_info *typeID);
140 void *EmptyInstance(
bool pointerToPointer);
141 void ClearBranchContents();
147 if (
auto fundamentalType = std::get_if<FundamentalType>(&
fTypeData); fundamentalType) {
148 std::memcpy(fundamentalType->fBytes.data(), valuePtr, fundamentalType->fSize);
173 const std::vector<const std::type_info *> &colTypeIDs);
183 void Exec(
unsigned int, const std::
vector<
void *> &values);
235 const std::vector<const std::type_info *> &colTypeIDs);
247 void Exec(
unsigned int slot, const std::
vector<
void *> &values);
269struct SnapshotOutputWriter;
289 const std::vector<const std::type_info *> &colTypeIDs);
297 void RegisterVariedColumn(
unsigned int slot,
unsigned int columnIndex,
unsigned int originalColumnIndex,
298 unsigned int varationIndex, std::
string const &variationName);
302 void Exec(
unsigned int , const std::
vector<
void *> &values, std::
vector<
bool> const &filterPassed);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Base class for action helpers, see RInterface::Book() for more information.
The head node of a RDF computation graph.
std::string GetActionName()
std::shared_ptr< SnapshotOutputWriter > fOutputHandle
RSnapshotOptions fOptions
void Initialize()
Nothing to do. All initialisations run in the constructor or InitTask().
SnapshotHelperWithVariations(std::string_view filename, std::string_view dirname, std::string_view treename, const ColumnNames_t &, const ColumnNames_t &bnames, const RSnapshotOptions &options, std::vector< bool > &&, ROOT::Detail::RDF::RLoopManager *outputLoopMgr, ROOT::Detail::RDF::RLoopManager *inputLoopMgr, const std::vector< const std::type_info * > &colTypeIDs)
void InitTask(TTreeReader *, unsigned int slot)
Bind all output branches to RDF columns for the given slots.
void ClearOutputBranches()
ROOT::Detail::RDF::RLoopManager * fInputLoopManager
std::vector< RBranchData > fBranchData
SnapshotHelperWithVariations(SnapshotHelperWithVariations const &) noexcept=delete
ROOT::Detail::RDF::RLoopManager * fOutputLoopManager
void Exec(unsigned int, const std::vector< void * > &values, std::vector< bool > const &filterPassed)
Connect all output fields to the values pointed to by values, fill the output dataset,...
SnapshotHelperWithVariations(SnapshotHelperWithVariations &&) noexcept=default
void RegisterVariedColumn(unsigned int slot, unsigned int columnIndex, unsigned int originalColumnIndex, unsigned int varationIndex, std::string const &variationName)
Register a new column as a variation of the column at originalColumnIndex, and clone its properties.
ROOT::RDF::SampleCallback_t GetSampleCallback() final
Override this method to register a callback that is executed before the processing a new data sample ...
std::vector< std::shared_ptr< ROOT::RNTupleFillContext > > fFillContexts
void FinalizeTask(unsigned int slot)
std::string GetActionName()
UntypedSnapshotRNTupleHelper(const UntypedSnapshotRNTupleHelper &)=delete
RSnapshotOptions fOptions
std::unique_ptr< ROOT::RNTupleParallelWriter > fWriter
ColumnNames_t fOutputFieldNames
std::unique_ptr< TFile > fOutputFile
UntypedSnapshotRNTupleHelper(unsigned int nSlots, std::string_view filename, std::string_view dirname, std::string_view ntuplename, const ColumnNames_t &vfnames, const ColumnNames_t &fnames, const RSnapshotOptions &options, ROOT::Detail::RDF::RLoopManager *inputLM, ROOT::Detail::RDF::RLoopManager *outputLM, const std::vector< const std::type_info * > &colTypeIDs)
UntypedSnapshotRNTupleHelper & operator=(const UntypedSnapshotRNTupleHelper &)=delete
std::vector< std::unique_ptr< ROOT::REntry > > fEntries
std::vector< const std::type_info * > fInputColumnTypeIDs
void Exec(unsigned int slot, const std::vector< void * > &values)
ROOT::Detail::RDF::RLoopManager * fOutputLoopManager
UntypedSnapshotRNTupleHelper(UntypedSnapshotRNTupleHelper &&) noexcept
std::vector< ROOT::RFieldToken > fFieldTokens
ROOT::Detail::RDF::RLoopManager * fInputLoopManager
ColumnNames_t fInputFieldNames
void InitTask(TTreeReader *, unsigned int slot)
UntypedSnapshotTTreeHelperMT(unsigned int nSlots, std::string_view filename, std::string_view dirname, std::string_view treename, const ColumnNames_t &vbnames, const ColumnNames_t &bnames, const RSnapshotOptions &options, std::vector< bool > &&isDefine, ROOT::Detail::RDF::RLoopManager *loopManager, ROOT::Detail::RDF::RLoopManager *inputLM, const std::vector< const std::type_info * > &colTypeIDs)
void UpdateCArraysPtrs(unsigned int slot, const std::vector< void * > &values)
void SetEmptyBranches(TTree *inputTree, TTree &outputTree)
ROOT::Detail::RDF::RLoopManager * fInputLoopManager
UntypedSnapshotTTreeHelperMT(UntypedSnapshotTTreeHelperMT &&) noexcept
ROOT::Detail::RDF::RLoopManager * fOutputLoopManager
std::vector< std::shared_ptr< ROOT::TBufferMergerFile > > fOutputFiles
std::vector< std::vector< RBranchData > > fBranchData
ROOT::RDF::SampleCallback_t GetSampleCallback() final
Override this method to register a callback that is executed before the processing a new data sample ...
RSnapshotOptions fOptions
std::vector< int > fBranchAddressesNeedReset
void InitTask(TTreeReader *r, unsigned int slot)
std::vector< TTree * > fInputTrees
UntypedSnapshotTTreeHelperMT & operator=(const UntypedSnapshotTTreeHelperMT &)=delete
void FinalizeTask(unsigned int slot)
void Exec(unsigned int slot, const std::vector< void * > &values)
std::string GetActionName()
std::vector< std::unique_ptr< TTree > > fOutputTrees
std::unique_ptr< ROOT::TBufferMerger > fMerger
void SetBranches(unsigned int slot, const std::vector< void * > &values)
UntypedSnapshotTTreeHelperMT(const UntypedSnapshotTTreeHelperMT &)=delete
RSnapshotOptions fOptions
ROOT::Detail::RDF::RLoopManager * fOutputLoopManager
ROOT::Detail::RDF::RLoopManager * fInputLoopManager
std::vector< RBranchData > fBranchData
void InitTask(TTreeReader *, unsigned int)
UntypedSnapshotTTreeHelper(UntypedSnapshotTTreeHelper &&) noexcept
void SetEmptyBranches(TTree *inputTree, TTree &outputTree)
std::string GetActionName()
bool fBranchAddressesNeedReset
std::unique_ptr< TFile > fOutputFile
void SetBranches(const std::vector< void * > &values)
UntypedSnapshotTTreeHelper(const UntypedSnapshotTTreeHelper &)=delete
std::unique_ptr< TTree > fOutputTree
void Exec(unsigned int, const std::vector< void * > &values)
UntypedSnapshotTTreeHelper(std::string_view filename, std::string_view dirname, std::string_view treename, const ColumnNames_t &vbnames, const ColumnNames_t &bnames, const RSnapshotOptions &options, std::vector< bool > &&isDefine, ROOT::Detail::RDF::RLoopManager *loopManager, ROOT::Detail::RDF::RLoopManager *inputLM, const std::vector< const std::type_info * > &colTypeIDs)
void UpdateCArraysPtrs(const std::vector< void * > &values)
UntypedSnapshotTTreeHelper & operator=(const UntypedSnapshotTTreeHelper &)=delete
ROOT::RDF::SampleCallback_t GetSampleCallback() final
Override this method to register a callback that is executed before the processing a new data sample ...
This type represents a sample identifier, to be used in conjunction with RDataFrame features such as ...
The REntry is a collection of values in an RNTuple corresponding to a complete row in the data set.
A field token identifies a (sub)field in an entry.
A context for filling entries (data) into clusters of an RNTuple.
A writer to fill an RNTuple from multiple contexts.
A TBufferMergerFile is similar to a TMemFile, but when data is written to it, it is appended to the T...
TBufferMerger is a class to facilitate writing data in parallel from multiple threads,...
A TTree is a list of TBranches.
TClass instances represent classes, structs and namespaces in the ROOT type system.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
A TTree represents a columnar dataset.
std::function< void(unsigned int, const ROOT::RDF::RSampleInfo &)> SampleCallback_t
The type of a data-block callback, registered with an RDataFrame computation graph via e....
std::vector< std::string > ColumnNames_t
Stores empty instances of classes, so a dummy object can be written when a systematic variation doesn...
FundamentalType(unsigned short size)
std::shared_ptr< void > fEmptyInstance
void * fRawPtrToEmptyInstance
Stores variations of a fundamental type.
static constexpr std::size_t fNBytes
FundamentalType(unsigned short size)
std::array< std::byte, fNBytes > fBytes
void * fBranchAddressForCArrays
bool WriteValueIfFundamental(void *valuePtr)
For fundamental types represented by TDataType, fetch a value from the pointer into the local branch ...
std::variant< FundamentalType, EmptyDynamicType > fTypeData
std::string fOutputBranchName
void ClearBranchPointers()
std::string fInputBranchName
const std::type_info * fInputTypeID
A collection of options to steer the creation of the dataset on disk through Snapshot().