Logo ROOT  
Reference Guide
RFilterBase.cxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 09/2018
2
3/*************************************************************************
4 * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
14#include "ROOT/RDF/Utils.hxx"
15#include <numeric> // std::accumulate
16
17using namespace ROOT::Detail::RDF;
18
19RFilterBase::RFilterBase(RLoopManager *implPtr, std::string_view name, const unsigned int nSlots,
20 const RDFInternal::RColumnRegister &colRegister, const ColumnNames_t &columns,
21 const std::vector<std::string> &prevVariations, const std::string &variation)
22 : RNodeBase(ROOT::Internal::RDF::Union(colRegister.GetVariationDeps(columns), prevVariations), implPtr),
23 fLastCheckedEntry(std::vector<Long64_t>(nSlots * RDFInternal::CacheLineStep<Long64_t>(), -1)),
24 fLastResult(nSlots * RDFInternal::CacheLineStep<int>()),
25 fAccepted(nSlots * RDFInternal::CacheLineStep<ULong64_t>()),
26 fRejected(nSlots * RDFInternal::CacheLineStep<ULong64_t>()), fName(name), fColumnNames(columns),
27 fColRegister(colRegister), fIsDefine(columns.size()), fVariation(variation)
28{
29 const auto nColumns = fColumnNames.size();
30 for (auto i = 0u; i < nColumns; ++i) {
32 if (fVariation != "nominal" && fIsDefine[i])
34 }
35}
36
37// outlined to pin virtual table
39
41{
42 return !fName.empty();
43}
44
45std::string RFilterBase::GetName() const
46{
47 return fName;
48}
49
51{
52 if (fName.empty()) // FillReport is no-op for unnamed filters
53 return;
54 const auto accepted = std::accumulate(fAccepted.begin(), fAccepted.end(), 0ULL);
55 const auto all = accepted + std::accumulate(fRejected.begin(), fRejected.end(), 0ULL);
56 rep.AddCut({fName, accepted, all});
57}
58
60{
61 if (!fName.empty()) // if this is a named filter we care about its report count
63}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
long long Long64_t
Definition: RtypesCore.h:80
unsigned long long ULong64_t
Definition: RtypesCore.h:81
char name[80]
Definition: TGX11.cxx:110
virtual void MakeVariations(const std::vector< std::string > &variations)=0
Create clones of this Define that work with values in varied "universes".
const ROOT::RDF::ColumnNames_t fColumnNames
Definition: RFilterBase.hxx:45
ROOT::RVecB fIsDefine
The nth flag signals whether the nth input column is a custom column or not.
Definition: RFilterBase.hxx:48
std::vector< ULong64_t > fRejected
Definition: RFilterBase.hxx:43
virtual void FillReport(ROOT::RDF::RCutFlowReport &) const
Definition: RFilterBase.cxx:50
std::string fVariation
This indicates for what variation this filter evaluates values.
Definition: RFilterBase.hxx:49
std::string GetName() const
Definition: RFilterBase.cxx:45
RDFInternal::RColumnRegister fColRegister
Definition: RFilterBase.hxx:46
std::vector< ULong64_t > fAccepted
Definition: RFilterBase.hxx:42
The head node of a RDF computation graph.
Base class for non-leaf nodes of the computational graph.
Definition: RNodeBase.hxx:43
A binder for user-defined columns and aliases.
bool IsDefineOrAlias(std::string_view name) const
Check if the provided name is tracked in the names list.
RDFDetail::RDefineBase * GetDefine(const std::string &colName) const
Return the RDefine for the requested column name, or nullptr.
void AddCut(TCutInfo &&ci)
basic_string_view< char > string_view
constexpr std::size_t CacheLineStep()
Stepping through CacheLineStep<T> values in a vector<T> brings you to a new cache line.
Definition: Utils.hxx:220
std::vector< T > Union(const std::vector< T > &v1, const std::vector< T > &v2)
Return a vector with all elements of v1 and v2 and duplicates removed.
Definition: Utils.hxx:274
std::vector< std::string > ColumnNames_t
Definition: Utils.hxx:35
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.