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 std::array<bool,
sizeof...(S)> isTmpColumn;
76 for (
auto i = 0u; i < isTmpColumn.size(); ++i)
77 isTmpColumn[i] = customCols.
HasName(bn.at(i));
79 using expander =
int[];
81 (
void)expander{(isTmpColumn[
S]
82 ? values[
S].Cast<ColTypes>()->SetTmpColumn(slot, customCols.
GetColumns().at(bn.at(
S)).get())
83 : values[
S].Cast<ColTypes>()->MakeProxy(
r, bn.at(
S)),
89template <std::size_t...
S,
typename... ColTypes>
93 using expander =
int[];
94 (
void)expander{(values[
S].Cast<ColTypes>()->Reset(), 0)...};
98template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t>
103template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t>
117 fPrevDataPtr(
std::move(pd)), fPrevData(*fPrevDataPtr) { }
131 for (
auto &bookedBranch : GetCustomColumns().GetColumns())
132 bookedBranch.second->InitSlot(
r, slot);
133 static_cast<Action_t *
>(
this)->InitColumnValues(
r, slot);
134 fHelper.InitTask(
r, slot);
140 if (fPrevData.CheckFilters(slot, entry))
148 ClearValueReaders(slot);
149 for (
auto &column : GetCustomColumns().GetColumns()) {
150 column.second->ClearValueReaders(slot);
152 fHelper.CallFinalizeTask(slot);
163 std::shared_ptr<RDFGraphDrawing::GraphNode>
GetGraph()
165 auto prevNode = fPrevData.GetGraph();
166 auto prevColumns = prevNode->GetDefinedColumns();
170 auto thisNode = std::make_shared<RDFGraphDrawing::GraphNode>(fHelper.GetActionName());
171 auto evaluatedNode = thisNode;
172 for (
auto &column : GetCustomColumns().GetColumns()) {
177 if (std::find(prevColumns.begin(), prevColumns.end(), column.first) == prevColumns.end()) {
179 evaluatedNode->SetPrevNode(defineNode);
180 evaluatedNode = defineNode;
184 thisNode->AddDefinedColumns(GetCustomColumns().GetNames());
185 thisNode->SetAction(HasRun());
186 evaluatedNode->SetPrevNode(prevNode);
192 void *
PartialUpdate(
unsigned int slot)
final {
return PartialUpdateImpl(slot); }
197 template <
typename H = Helper>
198 auto PartialUpdateImpl(
unsigned int slot) ->
decltype(std::declval<H>().PartialUpdate(slot), (
void *)(
nullptr))
200 return &fHelper.PartialUpdate(slot);
204 void *
PartialUpdateImpl(...) {
throw std::runtime_error(
"This action does not support callbacks!"); }
208template <
typename Helper,
typename PrevDataFrame,
typename ColumnTypes_t =
typename Helper::ColumnTypes_t>
210 std::vector<RDFValueTuple_t<ColumnTypes_t>>
fValues;
225 template <std::size_t...
S>
232 template <std::size_t...
S>
246template <
typename... BranchTypes>
249template <
typename... BranchTypes>
252template <
typename PrevDataFrame,
typename... ColTypes>
254 :
public RActionCRTP<RAction<SnapshotHelper<ColTypes...>, PrevDataFrame, ROOT::TypeTraits::TypeList<ColTypes...>>> {
260 std::vector<std::vector<RTypeErasedColumnValue>>
fValues;
276 template <std::size_t...
S>
283 template <std::size_t...
S>
291template <
typename PrevDataFrame,
typename... ColTypes>
294 RAction<SnapshotHelperMT<ColTypes...>, PrevDataFrame, ROOT::TypeTraits::TypeList<ColTypes...>>> {
300 std::vector<std::vector<RTypeErasedColumnValue>>
fValues;
316 template <std::size_t...
S>
323 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::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
std::shared_ptr< RDFGraphDrawing::GraphNode > GetGraph()
void TriggerChildrenCount() final
RActionCRTP(Helper &&h, const ColumnNames_t &bl, std::shared_ptr< PrevDataFrame > pd, const RBookedCustomColumns &customColumns)
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, const RBookedCustomColumns &customColumns)
typename SnapshotHelperMT< ColTypes... >::ColumnTypes_t ColumnTypes_t
void InitColumnValues(TTreeReader *r, unsigned int slot)
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
RAction(SnapshotHelper< ColTypes... > &&h, const ColumnNames_t &bl, std::shared_ptr< PrevDataFrame > pd, const RBookedCustomColumns &customColumns)
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... >)
RAction(Helper &&h, const ColumnNames_t &bl, std::shared_ptr< PrevDataFrame > pd, const RBookedCustomColumns &customColumns)
std::vector< RDFValueTuple_t< ColumnTypes_t > > fValues
Encapsulates the columns defined by the user.
bool HasName(std::string name) const
Check if the provided name is tracked in the names list.
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 colmnar 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... >)
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.
Namespace for new ROOT classes and functions.
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
std::unique_ptr< T > make_unique(Args &&... args)
make_integer_sequence< size_t, _Np > make_index_sequence
Lightweight storage for a collection of types.