36namespace GraphDrawing {
41 const std::vector<std::string> &prevNodeDefines);
52template <
typename FilterF,
typename PrevDataFrame>
55 using TypeInd_t = std::make_index_sequence<ColumnTypes_t::list_size>;
62 std::vector<std::array<std::unique_ptr<RColumnReaderBase>, ColumnTypes_t::list_size>>
fValues;
64 std::array<bool, ColumnTypes_t::list_size>
fIsDefine;
69 :
RFilterBase(pd->GetLoopManagerUnchecked(),
name, pd->GetLoopManagerUnchecked()->GetNSlots(), defines),
70 fFilter(std::move(
f)), fColumnNames(columns), fPrevDataPtr(std::move(pd)), fPrevData(*fPrevDataPtr),
71 fValues(fNSlots), fIsDefine()
73 const auto nColumns = fColumnNames.size();
74 for (
auto i = 0u; i < nColumns; ++i)
75 fIsDefine[i] = fDefines.
HasName(fColumnNames[i]);
86 if (entry != fLastCheckedEntry[slot * RDFInternal::CacheLineStep<Long64_t>()]) {
87 if (!fPrevData.CheckFilters(slot, entry)) {
89 fLastResult[slot * RDFInternal::CacheLineStep<int>()] =
false;
93 passed ? ++fAccepted[slot * RDFInternal::CacheLineStep<ULong64_t>()]
94 : ++fRejected[slot * RDFInternal::CacheLineStep<ULong64_t>()];
95 fLastResult[slot * RDFInternal::CacheLineStep<int>()] = passed;
97 fLastCheckedEntry[slot * RDFInternal::CacheLineStep<Long64_t>()] = entry;
99 return fLastResult[slot * RDFInternal::CacheLineStep<int>()];
102 template <
typename... ColTypes, std::size_t... S>
108 return fFilter(fValues[slot][S]->
template Get<ColTypes>(entry)...);
113 for (
auto &bookedBranch : fDefines.GetColumns())
114 bookedBranch.second->InitSlot(
r, slot);
116 fLoopManager->GetDataSource()};
125 fPrevData.PartialReport(rep);
132 if (fNStopsReceived == fNChildren)
133 fPrevData.StopProcessing();
140 if (fNChildren == 1 && fName.empty())
141 fPrevData.IncrChildrenCount();
147 fPrevData.IncrChildrenCount();
152 fPrevData.AddFilterName(
filters);
153 auto name = (HasName() ? fName :
"Unnamed Filter");
160 for (
auto &column : fDefines.GetColumns())
161 column.second->FinaliseSlot(slot);
163 for (
auto &
v : fValues[slot])
167 std::shared_ptr<RDFGraphDrawing::GraphNode>
GetGraph()
170 auto prevNode = fPrevData.GetGraph();
171 auto prevColumns = prevNode->GetDefinedColumns();
178 if (!thisNode->GetIsNew()) {
182 auto upmostNode = AddDefinesToGraph(thisNode, fDefines, prevColumns);
185 thisNode->AddDefinedColumns(fDefines.GetNames());
187 upmostNode->SetPrevNode(prevNode);
typedef void((*Func_t)())
void StopProcessing() final
std::vector< std::array< std::unique_ptr< RColumnReaderBase >, ColumnTypes_t::list_size > > fValues
Column readers per slot and per input column.
void PartialReport(ROOT::RDF::RCutFlowReport &rep) const final
void Report(ROOT::RDF::RCutFlowReport &rep) const final
bool CheckFilterHelper(unsigned int slot, Long64_t entry, TypeList< ColTypes... >, std::index_sequence< S... >)
const std::shared_ptr< PrevDataFrame > fPrevDataPtr
void AddFilterName(std::vector< std::string > &filters)
virtual void FinaliseSlot(unsigned int slot) final
Clean-up operations to be performed at the end of a task.
void IncrChildrenCount() final
void InitSlot(TTreeReader *r, unsigned int slot) final
RFilter & operator=(const RFilter &)=delete
RFilter(FilterF f, const ColumnNames_t &columns, std::shared_ptr< PrevDataFrame > pd, const RDFInternal::RBookedDefines &defines, std::string_view name="")
void TriggerChildrenCount() final
typename CallableTraits< FilterF >::arg_types ColumnTypes_t
const ColumnNames_t fColumnNames
std::array< bool, ColumnTypes_t::list_size > fIsDefine
The nth flag signals whether the nth input column is a custom column or not.
bool CheckFilters(unsigned int slot, Long64_t entry) final
RFilter(const RFilter &)=delete
std::make_index_sequence< ColumnTypes_t::list_size > TypeInd_t
PrevDataFrame & fPrevData
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::shared_ptr< GraphNode > CreateFilterNode(const ROOT::Detail::RDF::RFilterBase *filterPtr)
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.
ROOT type_traits extensions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Extract types from the signature of a callable object. See CallableTraits.
This type aggregates some of the arguments passed to InitColumnReaders.
Lightweight storage for a collection of types.