Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNodeBase.hxx
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
11#ifndef ROOT_RDFNODEBASE
12#define ROOT_RDFNODEBASE
13
14#include "RtypesCore.h"
15#include "TError.h" // R__ASSERT
16
17#include <memory>
18#include <string>
19#include <vector>
20
21namespace ROOT {
22namespace RDF {
23class RCutFlowReport;
24}
25
26namespace Internal {
27namespace RDF {
28namespace GraphDrawing {
29class GraphNode;
30}
31}
32}
33
34namespace Detail {
35namespace RDF {
36
37class RLoopManager;
38
39/// Base class for non-leaf nodes of the computational graph.
40/// It only exposes the bare minimum interface required to work as a generic part of the computation graph.
41/// RDataFrames and results of transformations can be cast to this type via ROOT::RDF::RNode (or ROOT.RDF.AsRNode in PyROOT).
42class RNodeBase {
43protected:
45 unsigned int fNChildren{0}; ///< Number of nodes of the functional graph hanging from this object
46 unsigned int fNStopsReceived{0}; ///< Number of times that a children node signaled to stop processing entries.
47 std::vector<std::string> fVariations; ///< List of systematic variations that affect this node.
48
49public:
50 RNodeBase(const std::vector<std::string> &variations = {}, RLoopManager *lm = nullptr)
51 : fLoopManager(lm), fVariations(variations)
52 {
53 }
54 virtual ~RNodeBase() {}
55 virtual bool CheckFilters(unsigned int, Long64_t) = 0;
56 virtual void Report(ROOT::RDF::RCutFlowReport &) const = 0;
57 virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const = 0;
58 virtual void IncrChildrenCount() = 0;
59 virtual void StopProcessing() = 0;
60 virtual void AddFilterName(std::vector<std::string> &filters) = 0;
61 // Helper function for SaveGraph
62 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0;
63
64 virtual void ResetChildrenCount()
65 {
66 fNChildren = 0;
68 }
69
71
72 const std::vector<std::string> &GetVariations() const { return fVariations; }
73
74 /// Return a clone of this node that acts as a Filter working with values in the variationName "universe".
75 virtual std::shared_ptr<RNodeBase> GetVariedFilter(const std::string &variationName)
76 {
77 R__ASSERT(false &&
78 "GetVariedFilter was called on a node type that does not implement it. This should never happen.");
79 (void)variationName;
80 return nullptr;
81 }
82};
83} // ns RDF
84} // ns Detail
85} // ns ROOT
86
87#endif
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
long long Long64_t
Definition RtypesCore.h:80
#define R__ASSERT(e)
Definition TError.h:118
const char * filters[]
The head node of a RDF computation graph.
Base class for non-leaf nodes of the computational graph.
Definition RNodeBase.hxx:42
const std::vector< std::string > & GetVariations() const
Definition RNodeBase.hxx:72
virtual void AddFilterName(std::vector< std::string > &filters)=0
virtual void StopProcessing()=0
virtual RLoopManager * GetLoopManagerUnchecked()
Definition RNodeBase.hxx:70
virtual bool CheckFilters(unsigned int, Long64_t)=0
virtual std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > GetGraph()=0
virtual void IncrChildrenCount()=0
unsigned int fNStopsReceived
Number of times that a children node signaled to stop processing entries.
Definition RNodeBase.hxx:46
virtual void Report(ROOT::RDF::RCutFlowReport &) const =0
unsigned int fNChildren
Number of nodes of the functional graph hanging from this object.
Definition RNodeBase.hxx:45
virtual std::shared_ptr< RNodeBase > GetVariedFilter(const std::string &variationName)
Return a clone of this node that acts as a Filter working with values in the variationName "universe"...
Definition RNodeBase.hxx:75
virtual void PartialReport(ROOT::RDF::RCutFlowReport &) const =0
RNodeBase(const std::vector< std::string > &variations={}, RLoopManager *lm=nullptr)
Definition RNodeBase.hxx:50
virtual void ResetChildrenCount()
Definition RNodeBase.hxx:64
std::vector< std::string > fVariations
List of systematic variations that affect this node.
Definition RNodeBase.hxx:47
Class used to create the operation graph to be printed in the dot representation.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...