34namespace GraphDrawing {
37 const std::vector<std::string> &prevNodeDefines);
51template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t =
typename Helper::ColumnTypes_t>
53 using TypeInd_t = std::make_index_sequence<ColumnTypes_t::list_size>;
59 std::vector<std::array<std::unique_ptr<RColumnReaderBase>, ColumnTypes_t::list_size>>
fValues;
62 std::array<bool, ColumnTypes_t::list_size>
fIsDefine;
66 :
RActionBase(pd->GetLoopManagerUnchecked(), columns, defines), fHelper(std::forward<Helper>(
h)),
67 fPrevDataPtr(std::move(pd)), fPrevData(*fPrevDataPtr), fValues(
GetNSlots()), fIsDefine()
69 const auto nColumns = columns.size();
70 const auto &customCols = GetDefines();
71 for (
auto i = 0u; i < nColumns; ++i)
72 fIsDefine[i] = customCols.HasName(columns[i]);
87 return fHelper.GetMergeableValue();
94 for (
auto &bookedBranch : GetDefines().GetColumns())
95 bookedBranch.second->InitSlot(
r, slot);
97 fLoopManager->GetDSValuePtrs(), fLoopManager->GetDataSource()};
99 fHelper.InitTask(
r, slot);
102 template <
typename... ColTypes, std::size_t... S>
105 fHelper.Exec(slot, fValues[slot][S]->
template Get<ColTypes>(entry)...);
112 if (fPrevData.CheckFilters(slot, entry))
113 CallExec(slot, entry, ColumnTypes_t{},
TypeInd_t{});
121 for (
auto &column : GetDefines().GetColumns())
122 column.second->FinaliseSlot(slot);
123 for (
auto &
v : fValues[slot])
125 fHelper.CallFinalizeTask(slot);
136 std::shared_ptr<RDFGraphDrawing::GraphNode>
GetGraph()
138 auto prevNode = fPrevData.GetGraph();
139 auto prevColumns = prevNode->GetDefinedColumns();
142 auto thisNode = std::make_shared<RDFGraphDrawing::GraphNode>(fHelper.GetActionName());
144 auto upmostNode = AddDefinesToGraph(thisNode, GetDefines(), prevColumns);
146 thisNode->AddDefinedColumns(GetDefines().GetNames());
147 thisNode->SetAction(HasRun());
148 upmostNode->SetPrevNode(prevNode);
154 void *
PartialUpdate(
unsigned int slot)
final {
return PartialUpdateImpl(slot); }
161 template <
typename H = Helper>
162 auto PartialUpdateImpl(
unsigned int slot) ->
decltype(std::declval<H>().PartialUpdate(slot), (
void *)(
nullptr))
164 return &fHelper.PartialUpdate(slot);
168 void *
PartialUpdateImpl(...) {
throw std::runtime_error(
"This action does not support callbacks!"); }
typedef void((*Func_t)())
A RDataFrame node that produces a result.
void Run(unsigned int slot, Long64_t entry) final
auto PartialUpdateImpl(unsigned int slot) -> decltype(std::declval< H >().PartialUpdate(slot),(void *)(nullptr))
const std::shared_ptr< PrevDataFrame > fPrevDataPtr
void CallExec(unsigned int slot, Long64_t entry, TypeList< ColTypes... >, std::index_sequence< S... >)
void FinalizeSlot(unsigned int slot) final
Clean-up operations to be performed at the end of a task.
RAction & operator=(const RAction &)=delete
PrevDataFrame & fPrevData
void * PartialUpdate(unsigned int slot) final
This method is invoked to update a partial result during the event loop, right before passing the res...
std::make_index_sequence< ColumnTypes_t::list_size > TypeInd_t
std::array< bool, ColumnTypes_t::list_size > fIsDefine
The nth flag signals whether the nth input column is a custom column or not.
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.
std::vector< std::array< std::unique_ptr< RColumnReaderBase >, ColumnTypes_t::list_size > > fValues
Column readers per slot and per input column.
void Finalize() final
Clean-up and finalize the action result (e.g.
void * PartialUpdateImpl(...)
std::function< void(unsigned int)> GetDataBlockCallback() final
void InitSlot(TTreeReader *r, unsigned int slot) final
RAction(const RAction &)=delete
void TriggerChildrenCount() final
RAction(Helper &&h, const ColumnNames_t &columns, std::shared_ptr< PrevDataFrame > pd, const RBookedDefines &defines)
std::shared_ptr< RDFGraphDrawing::GraphNode > GetGraph()
Encapsulates the columns defined by the user.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
std::vector< std::string > ColumnNames_t
std::shared_ptr< GraphNode > AddDefinesToGraph(std::shared_ptr< GraphNode > node, const RDFInternal::RBookedDefines &defines, 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)
Create a group of column readers, one per type in the parameter pack.
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 InitColumnReaders.
Lightweight storage for a collection of types.