Logo ROOT  
Reference Guide
RJittedAction.cxx
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
12// Avoid error: invalid application of ‘sizeof’ to incomplete type in RJittedAction::GetMergeableValue
14
15#include <cassert>
16#include <memory>
17
20
21// fwd decls
22class TTreeReader;
23namespace ROOT {
24namespace Detail {
25namespace RDF {
26class RLoopManager;
27}
28} // namespace Detail
29} // namespace ROOT
30namespace ROOT {
31namespace Detail {
32namespace RDF {
33class RLoopManager;
34}
35} // namespace Detail
36} // namespace ROOT
37namespace ROOT {
38namespace Detail {
39namespace RDF {
40class RMergeableValueBase;
41}
42} // namespace Detail
43} // namespace ROOT
44namespace ROOT {
45namespace Internal {
46namespace RDF {
47class RColumnRegister;
48}
49} // namespace Internal
50} // namespace ROOT
51namespace ROOT {
52namespace Internal {
53namespace RDF {
54namespace GraphDrawing {
55class GraphNode;
56}
57} // namespace RDF
58} // namespace Internal
59} // namespace ROOT
60
61RJittedAction::RJittedAction(RLoopManager &lm, const ROOT::RDF::ColumnNames_t &columns,
62 const ROOT::Internal::RDF::RColumnRegister &colRegister,
63 const std::vector<std::string> &prevVariations)
64 : RActionBase(&lm, columns, colRegister, prevVariations)
65{
66}
67
69
70void RJittedAction::Run(unsigned int slot, Long64_t entry)
71{
72 assert(fConcreteAction != nullptr);
73 fConcreteAction->Run(slot, entry);
74}
75
77{
78 assert(fConcreteAction != nullptr);
79 fConcreteAction->Initialize();
80}
81
82void RJittedAction::InitSlot(TTreeReader *r, unsigned int slot)
83{
84 assert(fConcreteAction != nullptr);
85 fConcreteAction->InitSlot(r, slot);
86}
87
89{
90 assert(fConcreteAction != nullptr);
91 fConcreteAction->TriggerChildrenCount();
92}
93
94void RJittedAction::FinalizeSlot(unsigned int slot)
95{
96 assert(fConcreteAction != nullptr);
97 fConcreteAction->FinalizeSlot(slot);
98}
99
101{
102 assert(fConcreteAction != nullptr);
103 fConcreteAction->Finalize();
104}
105
106void *RJittedAction::PartialUpdate(unsigned int slot)
107{
108 assert(fConcreteAction != nullptr);
109 return fConcreteAction->PartialUpdate(slot);
110}
111
113{
114 if (fConcreteAction != nullptr) {
115 return fConcreteAction->HasRun();
116 } else {
117 // The action has not been JITted. This means that it has not run.
118 return false;
119 }
120}
121
123{
124 assert(fConcreteAction != nullptr);
125 return fConcreteAction->SetHasRun();
126}
127
128std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode> RJittedAction::GetGraph(
129 std::unordered_map<void *, std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>> &visitedMap)
130{
131 assert(fConcreteAction != nullptr);
132 return fConcreteAction->GetGraph(visitedMap);
133}
134
135/**
136 Retrieve a wrapper to the result of the action that knows how to merge
137 with others of the same type.
138*/
139std::unique_ptr<ROOT::Detail::RDF::RMergeableValueBase> RJittedAction::GetMergeableValue() const
140{
141 assert(fConcreteAction != nullptr);
142 return fConcreteAction->GetMergeableValue();
143}
144
146{
147 assert(fConcreteAction != nullptr);
148 return fConcreteAction->GetSampleCallback();
149}
150
151std::unique_ptr<ROOT::Internal::RDF::RActionBase> RJittedAction::MakeVariedAction(std::vector<void *> &&results)
152{
153 assert(fConcreteAction != nullptr);
154 return fConcreteAction->MakeVariedAction(std::move(results));
155}
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.
A binder for user-defined columns, variations and aliases.
ROOT::RDF::SampleCallback_t GetSampleCallback() final
std::unique_ptr< ROOT::Detail::RDF::RMergeableValueBase > GetMergeableValue() const final
Retrieve a wrapper to the result of the action that knows how to merge with others of the same type.
void FinalizeSlot(unsigned int) final
void Run(unsigned int slot, Long64_t entry) final
void * PartialUpdate(unsigned int slot) final
This method is invoked to update a partial result during the event loop, right before passing the res...
void InitSlot(TTreeReader *r, unsigned int slot) final
std::unique_ptr< RActionBase > fConcreteAction
std::shared_ptr< GraphDrawing::GraphNode > GetGraph(std::unordered_map< void *, std::shared_ptr< GraphDrawing::GraphNode > > &visitedMap) final
std::unique_ptr< RActionBase > MakeVariedAction(std::vector< void * > &&results) final
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....
Definition: RSampleInfo.hxx:84
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.