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 
12 #include "ROOT/RDF/RFilterBase.hxx"
13 #include <numeric> // std::accumulate
14 
15 using namespace ROOT::Detail::RDF;
16 
17 RFilterBase::RFilterBase(RLoopManager *implPtr, std::string_view name, const unsigned int nSlots,
18  const RDFInternal::RBookedDefines &defines)
19  : RNodeBase(implPtr), fLastResult(nSlots), fAccepted(nSlots), fRejected(nSlots), fName(name), fNSlots(nSlots),
20  fDefines(defines) {}
21 
22 // outlined to pin virtual table
24 
26 {
27  return !fName.empty();
28 }
29 
30 std::string RFilterBase::GetName() const
31 {
32  return fName;
33 }
34 
36 {
37  if (fName.empty()) // FillReport is no-op for unnamed filters
38  return;
39  const auto accepted = std::accumulate(fAccepted.begin(), fAccepted.end(), 0ULL);
40  const auto all = accepted + std::accumulate(fRejected.begin(), fRejected.end(), 0ULL);
41  rep.AddCut({fName, accepted, all});
42 }
43 
45 {
46  fLastCheckedEntry = std::vector<Long64_t>(fNSlots, -1);
47  if (!fName.empty()) // if this is a named filter we care about its report count
49 }
ROOT::Detail::RDF::RFilterBase::~RFilterBase
virtual ~RFilterBase()
Definition: RFilterBase.cxx:23
ROOT::Detail::RDF::RFilterBase::FillReport
virtual void FillReport(ROOT::RDF::RCutFlowReport &) const
Definition: RFilterBase.cxx:35
ROOT::Detail::RDF::RFilterBase::fName
const std::string fName
Definition: RFilterBase.hxx:42
string_view
basic_string_view< char > string_view
Definition: libcpp_string_view.h:785
ROOT::Detail::RDF::RNodeBase
Base class for non-leaf nodes of the computational graph.
Definition: RNodeBase.hxx:41
RFilterBase.hxx
ROOT::Internal::RDF::RBookedDefines
Encapsulates the columns defined by the user.
Definition: RBookedDefines.hxx:39
ROOT::Detail::RDF::RFilterBase::GetName
std::string GetName() const
Definition: RFilterBase.cxx:30
ROOT::Detail::RDF::RFilterBase::InitNode
virtual void InitNode()
Definition: RFilterBase.cxx:44
RCutFlowReport.hxx
ROOT::Detail::RDF
Definition: GraphUtils.hxx:28
ROOT::Detail::RDF::RFilterBase::fNSlots
const unsigned int fNSlots
Number of thread slots used by this node, inherited from parent node.
Definition: RFilterBase.hxx:43
ROOT::Detail::RDF::RFilterBase::HasName
bool HasName() const
Definition: RFilterBase.cxx:25
ROOT::Detail::RDF::RFilterBase::fRejected
std::vector< ULong64_t > fRejected
Definition: RFilterBase.hxx:41
ROOT::Detail::RDF::RFilterBase::fLastCheckedEntry
std::vector< Long64_t > fLastCheckedEntry
Definition: RFilterBase.hxx:38
ROOT::RDF::RCutFlowReport
Definition: RCutFlowReport.hxx:47
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Detail::RDF::RFilterBase::fAccepted
std::vector< ULong64_t > fAccepted
Definition: RFilterBase.hxx:40
ROOT::Detail::RDF::RFilterBase::RFilterBase
RFilterBase(RLoopManager *df, std::string_view name, const unsigned int nSlots, const RDFInternal::RBookedDefines &defines)
Definition: RFilterBase.cxx:17
ROOT::Detail::RDF::RLoopManager
The head node of a RDF computation graph.
Definition: RLoopManager.hxx:57
ROOT::Detail::RDF::RFilterBase::ResetReportCount
virtual void ResetReportCount()
Definition: RFilterBase.hxx:59
ROOT::RDF::RCutFlowReport::AddCut
void AddCut(TCutInfo &&ci)
Definition: RCutFlowReport.hxx:52