35namespace GraphDrawing {
38 const std::vector<std::string> &prevNodeDefines);
52template <
typename Helper,
typename PrevNode,
typename ColumnTypes_t =
typename Helper::ColumnTypes_t>
54 using TypeInd_t = std::make_index_sequence<ColumnTypes_t::list_size>;
60 std::vector<std::array<std::unique_ptr<RColumnReaderBase>, ColumnTypes_t::list_size>>
fValues;
63 std::array<bool, ColumnTypes_t::list_size>
fIsDefine;
67 :
RActionBase(pd->GetLoopManagerUnchecked(), columns, colRegister, pd->GetVariations()),
68 fHelper(std::forward<
Helper>(
h)), fPrevNodePtr(std::move(pd)), fPrevNode(*fPrevNodePtr), fValues(
GetNSlots())
70 fLoopManager->Book(
this);
72 const auto nColumns = columns.size();
73 const auto &customCols = GetColRegister();
74 for (
auto i = 0u; i < nColumns; ++i)
75 fIsDefine[i] = customCols.HasName(columns[i]);
84 RActionBase::GetColRegister().Clear();
85 fLoopManager->Deregister(
this);
94 return fHelper.GetMergeableValue();
102 fIsDefine.data(), fLoopManager->GetDSValuePtrs(),
103 fLoopManager->GetDataSource()};
105 fHelper.InitTask(
r, slot);
108 template <
typename... ColTypes, std::size_t... S>
111 fHelper.Exec(slot, fValues[slot][S]->
template Get<ColTypes>(entry)...);
118 if (fPrevNode.CheckFilters(slot, entry))
119 CallExec(slot, entry, ColumnTypes_t{},
TypeInd_t{});
127 for (
auto &
v : fValues[slot])
129 fHelper.CallFinalizeTask(slot);
140 std::shared_ptr<RDFGraphDrawing::GraphNode>
GetGraph() final
142 auto prevNode = fPrevNode.GetGraph();
143 auto prevColumns = prevNode->GetDefinedColumns();
146 auto thisNode = std::make_shared<RDFGraphDrawing::GraphNode>(fHelper.GetActionName());
148 auto upmostNode = AddDefinesToGraph(thisNode, GetColRegister(), prevColumns);
150 thisNode->AddDefinedColumns(GetColRegister().GetNames());
151 thisNode->SetAction(HasRun());
152 upmostNode->SetPrevNode(prevNode);
158 void *
PartialUpdate(
unsigned int slot)
final {
return fHelper.CallPartialUpdate(slot); }
162 const auto nVariations = GetVariations().size();
163 assert(results.size() == nVariations);
165 std::vector<Helper> helpers;
166 helpers.reserve(nVariations);
168 for (
auto &&res : results)
169 helpers.emplace_back(fHelper.CallMakeNew(res));
172 std::move(helpers), GetColumnNames(), fPrevNodePtr, GetColRegister()});
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
A RDataFrame node that produces a result.
void FinalizeSlot(unsigned int slot) final
Clean-up operations to be performed at the end of a task.
void Run(unsigned int slot, Long64_t entry) final
void InitSlot(TTreeReader *r, unsigned int slot) final
std::make_index_sequence< ColumnTypes_t::list_size > TypeInd_t
void Finalize() final
Clean-up and finalize the action result (e.g.
RAction & operator=(const RAction &)=delete
std::shared_ptr< RDFGraphDrawing::GraphNode > GetGraph() final
void TriggerChildrenCount() final
std::unique_ptr< RDFDetail::RMergeableValueBase > GetMergeableValue() const final
Retrieve a wrapper to the result of the action that knows how to merge with others of the same type.
RAction(const RAction &)=delete
void * PartialUpdate(unsigned int slot) final
This method is invoked to update a partial result during the event loop, right before passing the res...
void CallExec(unsigned int slot, Long64_t entry, TypeList< ColTypes... >, std::index_sequence< S... >)
RAction(Helper &&h, const ColumnNames_t &columns, std::shared_ptr< PrevNode > pd, const RColumnRegister &colRegister)
const std::shared_ptr< PrevNode > fPrevNodePtr
ROOT::RDF::SampleCallback_t GetSampleCallback() final
std::unique_ptr< RActionBase > MakeVariedAction(std::vector< void * > &&results) final
std::vector< std::array< std::unique_ptr< RColumnReaderBase >, ColumnTypes_t::list_size > > fValues
Column readers per slot and per input column.
std::array< bool, ColumnTypes_t::list_size > fIsDefine
The nth flag signals whether the nth input column is a custom column or not.
A binder for user-defined columns and aliases.
Just like an RAction, but it has N action helpers (one per variation + nominal) and N previous nodes.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
std::shared_ptr< GraphNode > AddDefinesToGraph(std::shared_ptr< GraphNode > node, const RColumnRegister &colRegister, const std::vector< std::string > &prevNodeDefines)
Add the Defines that have been added between this node and the previous to the graph.
std::array< std::unique_ptr< RDFDetail::RColumnReaderBase >, sizeof...(ColTypes)> MakeColumnReaders(unsigned int slot, TTreeReader *r, TypeList< ColTypes... >, const RColumnReadersInfo &colInfo, const std::string &variationName="nominal")
Create a group of column readers, one per type in the parameter pack.
std::vector< std::string > ColumnNames_t
std::function< void(unsigned int, const ROOT::RDF::RSampleInfo &)> SampleCallback_t
The type of a data-block callback, registered with a RDataFrame computation graph via e....
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
This type aggregates some of the arguments passed to MakeColumnReaders.
Lightweight storage for a collection of types.