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>
81 GetGraph(std::unordered_map<void *, std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>> &visitedMap) = 0;
82
83 /**
84 Retrieve a wrapper to the result of the action that knows how to merge
85 with others of the same type.
86 */
87 virtual std::unique_ptr<RMergeableValueBase> GetMergeableValue() const = 0;
88
90
91 const std::vector<std::string> &GetVariations() const { return fVariations; }
92
93 virtual std::unique_ptr<RActionBase> MakeVariedAction(std::vector<void *> &&results) = 0;
94};
95} // namespace RDF
96} // namespace Internal
97} // namespace ROOT
98
99#endif // ROOT_RACTIONBASE
long long Long64_t
Definition RtypesCore.h:80
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
The head node of a RDF computation graph.
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...
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
virtual std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > GetGraph(std::unordered_map< void *, std::shared_ptr< ROOT::Internal::RDF::GraphDrawing::GraphNode > > &visitedMap)=0
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,...
Definition TTreeReader.h:44
std::vector< std::string > ColumnNames_t
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....
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.