34namespace GraphDrawing {
40template <
typename Dummy>
42 static_assert(
sizeof(Dummy) < 0,
"The unspecialized version of RActionCRTP should never be instantiated");
48 std::shared_ptr<void>
fPtr;
59 return std::static_pointer_cast<RColumnValue<T>>(
fPtr)->
Get(
e);
70template <std::size_t...
S,
typename... ColTypes>
75 using expander =
int[];
79 (
void)expander{(isTmpColumn[
S]
80 ? values[
S].Cast<ColTypes>()->SetTmpColumn(slot, customCols.
GetColumns().at(bn.at(
S)).get())
81 : values[
S].Cast<ColTypes>()->MakeProxy(
r, bn.at(
S)),
87template <std::size_t...
S,
typename... ColTypes>
91 using expander =
int[];
92 (
void)expander{(values[
S].Cast<ColTypes>()->Reset(), 0)...};
96template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t>
101template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t>
114 using TypeInd_t = std::make_index_sequence<ColumnTypes_t::list_size>;
118 :
RActionBase(pd->GetLoopManagerUnchecked(), columns, std::move(customColumns)), fHelper(std::
forward<Helper>(
h)),
119 fPrevDataPtr(std::move(pd)), fPrevData(*fPrevDataPtr), fIsCustomColumn()
121 const auto nColumns = columns.size();
122 const auto &customCols = GetCustomColumns();
123 for (
auto i = 0u; i < nColumns; ++i)
124 fIsCustomColumn[i] = customCols.
HasName(columns[i]);
139 for (
auto &bookedBranch : GetCustomColumns().GetColumns())
140 bookedBranch.second->InitSlot(
r, slot);
141 static_cast<Action_t *
>(
this)->InitColumnValues(
r, slot);
142 fHelper.InitTask(
r, slot);
148 if (fPrevData.CheckFilters(slot, entry))
156 ClearValueReaders(slot);
157 for (
auto &column : GetCustomColumns().GetColumns()) {
158 column.second->ClearValueReaders(slot);
160 fHelper.CallFinalizeTask(slot);
171 std::shared_ptr<RDFGraphDrawing::GraphNode>
GetGraph()
173 auto prevNode = fPrevData.GetGraph();
174 auto prevColumns = prevNode->GetDefinedColumns();
178 auto thisNode = std::make_shared<RDFGraphDrawing::GraphNode>(fHelper.GetActionName());
179 auto evaluatedNode = thisNode;
180 for (
auto &column : GetCustomColumns().GetColumns()) {
185 if (std::find(prevColumns.begin(), prevColumns.end(), column.first) == prevColumns.end()) {
187 evaluatedNode->SetPrevNode(defineNode);
188 evaluatedNode = defineNode;
192 thisNode->AddDefinedColumns(GetCustomColumns().GetNames());
193 thisNode->SetAction(HasRun());
194 evaluatedNode->SetPrevNode(prevNode);
200 void *
PartialUpdate(
unsigned int slot)
final {
return PartialUpdateImpl(slot); }
205 template <
typename H = Helper>
206 auto PartialUpdateImpl(
unsigned int slot) ->
decltype(std::declval<H>().PartialUpdate(slot), (
void *)(
nullptr))
208 return &fHelper.PartialUpdate(slot);
212 void *
PartialUpdateImpl(...) {
throw std::runtime_error(
"This action does not support callbacks!"); }
216template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t =
typename Helper::ColumnTypes_t>
218 std::vector<RDFValueTuple_t<ColumnTypes_t>>
fValues;
233 template <std::size_t...
S>
234 void Exec(
unsigned int slot,
Long64_t entry, std::index_sequence<S...>)
240 template <std::size_t...
S>
254template <
typename... BranchTypes>
257template <
typename... BranchTypes>
260template <
typename PrevDataFrame,
typename... ColTypes>
262 :
public RActionCRTP<RAction<SnapshotHelper<ColTypes...>, PrevDataFrame, ROOT::TypeTraits::TypeList<ColTypes...>>> {
268 std::vector<std::vector<RTypeErasedColumnValue>>
fValues;
284 template <std::size_t...
S>
285 void Exec(
unsigned int slot,
Long64_t entry, std::index_sequence<S...>)
291 template <std::size_t...
S>
299template <
typename PrevDataFrame,
typename... ColTypes>
302 RAction<SnapshotHelperMT<ColTypes...>, PrevDataFrame, ROOT::TypeTraits::TypeList<ColTypes...>>> {
308 std::vector<std::vector<RTypeErasedColumnValue>>
fValues;
324 template <std::size_t...
S>
325 void Exec(
unsigned int slot,
Long64_t entry, std::index_sequence<S...>)
331 template <std::size_t...
S>
unsigned long long ULong64_t
typedef void((*Func_t)())
const ColumnNames_t & GetColumnNames() const
RBookedCustomColumns & GetCustomColumns()
A common template base class for all RActions.
void Run(unsigned int slot, Long64_t entry) final
std::array< bool, ColumnTypes_t::list_size > fIsCustomColumn
The nth flag signals whether the nth input column is a custom column or not.
std::make_index_sequence< ColumnTypes_t::list_size > TypeInd_t
void * PartialUpdate(unsigned int slot) final
This method is invoked to update a partial result during the event loop, right before passing the res...
PrevDataFrame & fPrevData
void ClearValueReaders(unsigned int slot)
RActionCRTP & operator=(const RActionCRTP &)=delete
RActionCRTP(const RActionCRTP &)=delete
void * PartialUpdateImpl(...)
void FinalizeSlot(unsigned int slot) final
void InitSlot(TTreeReader *r, unsigned int slot) final
const std::shared_ptr< PrevDataFrame > fPrevDataPtr
RActionCRTP(Helper &&h, const ColumnNames_t &columns, std::shared_ptr< PrevDataFrame > pd, RBookedCustomColumns &&customColumns)
std::shared_ptr< RDFGraphDrawing::GraphNode > GetGraph()
void TriggerChildrenCount() final
auto PartialUpdateImpl(unsigned int slot) -> decltype(std::declval< H >().PartialUpdate(slot),(void *)(nullptr))
Unused, not instantiatable. Only the partial specialization RActionCRTP<RAction<.....
void InitColumnValues(TTreeReader *r, unsigned int slot)
void ResetColumnValues(unsigned int slot, std::index_sequence< S... > s)
void Exec(unsigned int slot, Long64_t entry, std::index_sequence< S... >)
std::vector< std::vector< RTypeErasedColumnValue > > fValues
RAction(SnapshotHelperMT< ColTypes... > &&h, const ColumnNames_t &bl, std::shared_ptr< PrevDataFrame > pd, RBookedCustomColumns &&customColumns)
typename SnapshotHelperMT< ColTypes... >::ColumnTypes_t ColumnTypes_t
void InitColumnValues(TTreeReader *r, unsigned int slot)
RAction(SnapshotHelper< ColTypes... > &&h, const ColumnNames_t &bl, std::shared_ptr< PrevDataFrame > pd, RBookedCustomColumns &&customColumns)
void Exec(unsigned int slot, Long64_t entry, std::index_sequence< S... >)
void ResetColumnValues(unsigned int slot, std::index_sequence< S... > s)
typename SnapshotHelper< ColTypes... >::ColumnTypes_t ColumnTypes_t
std::vector< std::vector< RTypeErasedColumnValue > > fValues
An action node in a RDF computation graph.
void InitColumnValues(TTreeReader *r, unsigned int slot)
void ResetColumnValues(unsigned int slot, std::index_sequence< S... > s)
void Exec(unsigned int slot, Long64_t entry, std::index_sequence< S... >)
std::vector< RDFValueTuple_t< ColumnTypes_t > > fValues
RAction(Helper &&h, const ColumnNames_t &bl, std::shared_ptr< PrevDataFrame > pd, RBookedCustomColumns &&customColumns)
Encapsulates the columns defined by the user.
bool HasName(std::string_view name) const
Check if the provided name is tracked in the names list.
const RCustomColumnBasePtrMap_t & GetColumns() const
Returns the list of the pointers to the defined columns.
Helper class that updates and returns TTree branches as well as RDataFrame temporary columns.
A type-erasing wrapper around RColumnValue.
RColumnValue< T > * Cast()
RTypeErasedColumnValue(std::unique_ptr< RColumnValue< T > > v)
std::shared_ptr< void > fPtr
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
bool CheckIfDefaultOrDSColumn(const std::string &name, const std::shared_ptr< ROOT::Detail::RDF::RCustomColumnBase > &column)
std::shared_ptr< GraphNode > CreateDefineNode(const std::string &columnName, const ROOT::Detail::RDF::RCustomColumnBase *columnPtr)
void InitRDFValues(unsigned int slot, RDFValueTuple &valueTuple, TTreeReader *r, const ColumnNames_t &bn, const RBookedCustomColumns &customCols, std::index_sequence< S... >, const std::array< bool, sizeof...(S)> &isCustomColumn)
Initialize a tuple of RColumnValues.
void ResetRDFValueTuple(std::vector< RTypeErasedColumnValue > &values, std::index_sequence< S... >, ROOT::TypeTraits::TypeList< ColTypes... >)
This overload is specialized to act on RTypeErasedColumnValues instead of RColumnValues.
ROOT::Detail::RDF::ColumnNames_t ColumnNames_t
RooArgSet S(const RooAbsArg &v1)
static constexpr double s
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
Lightweight storage for a collection of types.