35namespace GraphDrawing {
38 const std::vector<std::string> &prevNodeDefines,
39 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap);
53template <
typename Helper,
typename PrevNode,
typename ColumnTypes_t =
typename Helper::ColumnTypes_t>
55 using TypeInd_t = std::make_index_sequence<ColumnTypes_t::list_size>;
61 std::vector<std::array<RColumnReaderBase *, ColumnTypes_t::list_size>>
fValues;
64 std::array<bool, ColumnTypes_t::list_size>
fIsDefine;
68 :
RActionBase(pd->GetLoopManagerUnchecked(), columns, colRegister, pd->GetVariations()),
69 fHelper(std::forward<Helper>(
h)), fPrevNodePtr(std::move(pd)), fPrevNode(*fPrevNodePtr), fValues(
GetNSlots())
71 fLoopManager->Register(
this);
73 const auto nColumns = columns.size();
74 for (
auto i = 0u; i < nColumns; ++i)
89 return fHelper.GetMergeableValue();
97 fIsDefine.data(), *fLoopManager};
99 fHelper.InitTask(
r, slot);
102 template <
typename... ColTypes, std::size_t... S>
106 fValues[slot][S]->template Get<ColTypes>(entry)...};
113 if (fPrevNode.CheckFilters(slot, entry))
114 CallExec(slot, entry, ColumnTypes_t{},
TypeInd_t{});
122 fValues[slot].fill(
nullptr);
123 fHelper.CallFinalizeTask(slot);
134 std::shared_ptr<RDFGraphDrawing::GraphNode>
135 GetGraph(std::unordered_map<
void *, std::shared_ptr<RDFGraphDrawing::GraphNode>> &visitedMap)
final
137 auto prevNode = fPrevNode.GetGraph(visitedMap);
138 const auto &prevColumns = prevNode->GetDefinedColumns();
141 const auto nodeType = HasRun() ? RDFGraphDrawing::ENodeType::kUsedAction : RDFGraphDrawing::ENodeType::kAction;
143 std::make_shared<RDFGraphDrawing::GraphNode>(fHelper.GetActionName(), visitedMap.size(), nodeType);
144 visitedMap[(
void *)
this] = thisNode;
146 auto upmostNode = AddDefinesToGraph(thisNode, GetColRegister(), prevColumns, visitedMap);
148 thisNode->AddDefinedColumns(GetColRegister().GetNames());
149 upmostNode->SetPrevNode(prevNode);
155 void *
PartialUpdate(
unsigned int slot)
final {
return fHelper.CallPartialUpdate(slot); }
159 const auto nVariations = GetVariations().size();
160 assert(results.size() == nVariations);
162 std::vector<Helper> helpers;
163 helpers.reserve(nVariations);
165 for (
auto &&res : results)
166 helpers.emplace_back(fHelper.CallMakeNew(res));
169 std::move(helpers), GetColumnNames(), fPrevNodePtr, GetColRegister()});
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
A RDataFrame node that produces a result.
std::shared_ptr< RDFGraphDrawing::GraphNode > GetGraph(std::unordered_map< void *, std::shared_ptr< RDFGraphDrawing::GraphNode > > &visitedMap) final
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
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::array< bool, ColumnTypes_t::list_size > fIsDefine
The nth flag signals whether the nth input column is a custom column or not.
std::vector< std::array< RColumnReaderBase *, ColumnTypes_t::list_size > > fValues
Column readers per slot and per input column.
A binder for user-defined columns, variations and aliases.
bool IsDefineOrAlias(std::string_view name) const
Check if the provided name is tracked in the names list.
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 RDFInternal::RColumnRegister &colRegister, const std::vector< std::string > &prevNodeDefines, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
std::array< RDFDetail::RColumnReaderBase *, sizeof...(ColTypes)> GetColumnReaders(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....
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Struct to wrap the call to a function with a guaranteed order of execution of its arguments.
This type aggregates some of the arguments passed to GetColumnReaders.
Lightweight storage for a collection of types.