11#ifndef ROOT_RDF_RFilterWithMissingValues
12#define ROOT_RDF_RFilterWithMissingValues
28#include <unordered_map>
34std::shared_ptr<GraphNode>
CreateFilterNode(
const ROOT::Detail::RDF::RFilterBase *filterPtr,
35 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap);
38 const ROOT::Internal::RDF::RColumnRegister &colRegister,
39 const std::vector<std::string> &prevNodeDefines,
40 std::unordered_map<
void *, std::shared_ptr<GraphNode>> &visitedMap);
57template <
typename PrevNodeRaw>
63 using PrevNode_t = std::conditional_t<std::is_same<PrevNodeRaw, RJittedFilter>::value,
RFilterBase, PrevNodeRaw>;
75 std::string_view filterName =
"",
const std::string &variationName =
"nominal")
111 const bool valueIsMissing =
fValues[slot]->template TryGet<void>(entry) ==
nullptr;
113 valueIsMissing ? ++
fRejected[slot * cacheLineStepULong64_t] : ++
fAccepted[slot * cacheLineStepULong64_t];
114 fLastResult[slot * cacheLineStepint] = !valueIsMissing;
116 valueIsMissing ? ++
fAccepted[slot * cacheLineStepULong64_t] : ++
fRejected[slot * cacheLineStepULong64_t];
117 fLastResult[slot * cacheLineStepint] = valueIsMissing;
159 assert(!
fName.empty());
173 std::shared_ptr<RDFGraphDrawing::GraphNode>
174 GetGraph(std::unordered_map<
void *, std::shared_ptr<RDFGraphDrawing::GraphNode>> &visitedMap)
final
178 const auto &prevColumns = prevNode->GetDefinedColumns();
180 auto thisNode = RDFGraphDrawing::CreateFilterNode(
this, visitedMap);
185 if (!thisNode->IsNew()) {
189 auto upmostNode = AddDefinesToGraph(thisNode,
fColRegister, prevColumns, visitedMap);
192 thisNode->AddDefinedColumns(
fColRegister.GenerateColumnNames());
194 upmostNode->SetPrevNode(prevNode);
205 assert(variationName !=
"nominal");
217 prevNode = std::static_pointer_cast<PrevNode_t>(prevNode->GetVariedFilter(variationName));
223 auto e =
fVariedFilters.insert({variationName, std::move(variedFilter)});
224 return e.first->second;
Basic types used by ROOT and required by TInterpreter.
long long Long64_t
Portable signed long integer 8 bytes.
const ROOT::RDF::ColumnNames_t fColumnNames
std::vector< ULong64_t > fRejected
virtual void FillReport(ROOT::RDF::RCutFlowReport &) const
RFilterBase(RLoopManager *df, std::string_view name, const unsigned int nSlots, const RDFInternal::RColumnRegister &colRegister, const ColumnNames_t &columns, const std::vector< std::string > &prevVariations, const std::string &variation="nominal")
std::string fVariation
This indicates for what variation this filter evaluates values.
std::vector< int > fLastResult
std::unordered_map< std::string, std::shared_ptr< RFilterBase > > fVariedFilters
RDFInternal::RColumnRegister fColRegister
std::vector< ULong64_t > fAccepted
std::vector< Long64_t > fLastCheckedEntry
RFilterWithMissingValues & operator=(RFilterWithMissingValues &&)=delete
const std::shared_ptr< PrevNode_t > fPrevNodePtr
void TriggerChildrenCount() final
void StopProcessing() final
std::vector< RColumnReaderBase * > fValues
bool CheckFilters(unsigned int slot, Long64_t entry) final
void FinalizeSlot(unsigned int slot) final
Clean-up operations to be performed at the end of a task.
bool fDiscardEntryWithMissingValue
std::shared_ptr< RDFGraphDrawing::GraphNode > GetGraph(std::unordered_map< void *, std::shared_ptr< RDFGraphDrawing::GraphNode > > &visitedMap) final
void IncrChildrenCount() final
std::conditional_t< std::is_same< PrevNodeRaw, RJittedFilter >::value, RFilterBase, PrevNodeRaw > PrevNode_t
std::shared_ptr< RNodeBase > GetVariedFilter(const std::string &variationName) final
Return a clone of this Filter that works with values in the variationName "universe".
RFilterWithMissingValues(const RFilterWithMissingValues &)=delete
void InitSlot(TTreeReader *r, unsigned int slot) final
~RFilterWithMissingValues() final
void AddFilterName(std::vector< std::string > &filters) final
RFilterWithMissingValues & operator=(const RFilterWithMissingValues &)=delete
RFilterWithMissingValues(RFilterWithMissingValues &&)=delete
void PartialReport(ROOT::RDF::RCutFlowReport &rep) const final
void Report(ROOT::RDF::RCutFlowReport &rep) const final
RFilterWithMissingValues(bool discardEntry, std::shared_ptr< PrevNode_t > pd, const RDFInternal::RColumnRegister &colRegister, const ColumnNames_t &columns, std::string_view filterName="", const std::string &variationName="nominal")
A wrapper around a concrete RFilter, which forwards all calls to it RJittedFilter is the type of the ...
Base class for non-leaf nodes of the computational graph.
const std::vector< std::string > & GetVariations() const
virtual RLoopManager * GetLoopManagerUnchecked()
unsigned int fNStopsReceived
Number of times that a children node signaled to stop processing entries.
unsigned int fNChildren
Number of nodes of the functional graph hanging from this object.
RLoopManager * fLoopManager
std::vector< std::string > fVariations
List of systematic variations that affect this node.
A binder for user-defined columns, variations and aliases.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
std::shared_ptr< GraphNode > CreateFilterNode(const ROOT::Detail::RDF::RFilterBase *filterPtr, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
std::shared_ptr< GraphNode > AddDefinesToGraph(std::shared_ptr< GraphNode > node, const RColumnRegister &colRegister, const std::vector< std::string > &prevNodeDefines, std::unordered_map< void *, std::shared_ptr< GraphNode > > &visitedMap)
RDFDetail::RColumnReaderBase * GetColumnReader(unsigned int slot, RColumnReaderBase *defineOrVariationReader, RLoopManager &lm, TTreeReader *treeReader, std::string_view colName, const std::type_info &ti)
bool IsStrInVec(const std::string &str, const std::vector< std::string > &vec)
constexpr std::size_t CacheLineStep()
Stepping through CacheLineStep<T> values in a vector<T> brings you to a new cache line.
std::vector< std::string > ColumnNames_t