Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RActionBase.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 09/2018
2
3/*************************************************************************
4 * Copyright (C) 1995-2020, 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_RACTIONBASE
12#define ROOT_RACTIONBASE
13
16#include "ROOT/RDF/Utils.hxx" // ColumnNames_t
17#include "RtypesCore.h"
18
19#include <memory>
20#include <string>
21
22namespace ROOT {
23
24namespace Detail {
25namespace RDF {
26class RLoopManager;
27class RDefineBase;
28class RMergeableValueBase;
29} // namespace RDF
30} // namespace Detail
31
32namespace Internal {
33namespace RDF {
34namespace GraphDrawing {
35class GraphNode;
36}
37
38using namespace ROOT::Detail::RDF;
39
41protected:
42 /// A raw pointer to the RLoopManager at the root of this functional graph.
43 /// Never null: children nodes have shared ownership of parent nodes in the graph.
45
46private:
47 const unsigned int fNSlots; ///< Number of thread slots used by this node.
48 bool fHasRun = false;
50 /// List of systematic variations that affect the result of this action ("nominal" excluded).
51 std::vector<std::string> fVariations;
52
54
55public:
56 RActionBase(RLoopManager *lm, const ColumnNames_t &colNames, const RColumnRegister &colRegister,
57 const std::vector<std::string> &prevVariations);
58 RActionBase(const RActionBase &) = delete;
59 RActionBase &operator=(const RActionBase &) = delete;
60 virtual ~RActionBase();
61
62 const ColumnNames_t &GetColumnNames() const { return fColumnNames; }
65 unsigned int GetNSlots() const { return fNSlots; }
66 virtual void Run(unsigned int slot, Long64_t entry) = 0;
67 virtual void Initialize() = 0;
68 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
69 virtual void TriggerChildrenCount() = 0;
70 virtual void FinalizeSlot(unsigned int) = 0;
71 virtual void Finalize() = 0;
72 /// This method is invoked to update a partial result during the event loop, right before passing the result to a
73 /// user-defined callback registered via RResultPtr::RegisterCallback
74 virtual void *PartialUpdate(unsigned int slot) = 0;
75
76 // overridden by RJittedAction
77 virtual bool HasRun() const { return fHasRun; }
78 virtual void SetHasRun() { fHasRun = true; }
79
80 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> GetGraph() = 0;
81
82 /**
83 Retrieve a wrapper to the result of the action that knows how to merge
84 with others of the same type.
85 */
86 virtual std::unique_ptr<RMergeableValueBase> GetMergeableValue() const = 0;
87
89
90 const std::vector<std::string> &GetVariations() const { return fVariations; }
91
92 virtual std::unique_ptr<RActionBase> MakeVariedAction(std::vector<void *> &&results) = 0;
93};
94} // namespace RDF
95} // namespace Internal
96} // namespace ROOT
97
98#endif // ROOT_RACTIONBASE
ROOT::R::TRInterface & r
Definition Object.C:4
long long Long64_t
Definition RtypesCore.h:80
The head node of a RDF computation graph.
Class used to create the operation graph to be printed in the dot representation.
const ColumnNames_t fColumnNames
std::vector< std::string > fVariations
List of systematic variations that affect the result of this action ("nominal" excluded).
const unsigned int fNSlots
Number of thread slots used by this node.
RActionBase & operator=(const RActionBase &)=delete
virtual std::unique_ptr< RMergeableValueBase > GetMergeableValue() const =0
Retrieve a wrapper to the result of the action that knows how to merge with others of the same type.
virtual void TriggerChildrenCount()=0
unsigned int GetNSlots() const
const std::vector< std::string > & GetVariations() const
virtual void Run(unsigned int slot, Long64_t entry)=0
const ColumnNames_t & GetColumnNames() const
virtual void FinalizeSlot(unsigned int)=0
virtual ROOT::RDF::SampleCallback_t GetSampleCallback()=0
RActionBase(const RActionBase &)=delete
virtual void * PartialUpdate(unsigned int slot)=0
This method is invoked to update a partial result during the event loop, right before passing the res...
virtual std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > GetGraph()=0
RLoopManager * fLoopManager
A raw pointer to the RLoopManager at the root of this functional graph.
RColumnRegister & GetColRegister()
virtual std::unique_ptr< RActionBase > MakeVariedAction(std::vector< void * > &&results)=0
virtual void InitSlot(TTreeReader *r, unsigned int slot)=0
A binder for user-defined columns and aliases.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Definition TTreeReader.h:44
std::vector< std::string > ColumnNames_t
Definition Utils.hxx:35
std::function< void(unsigned int, const ROOT::RDF::RSampleInfo &)> SampleCallback_t
The type of a data-block callback, registered with a RDataFrame computation graph via e....
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...