Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RDefineBase.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_RCUSTOMCOLUMNBASE
12#define ROOT_RCUSTOMCOLUMNBASE
13
17#include "ROOT/RDF/Utils.hxx"
18#include "ROOT/RVec.hxx"
19
20#include <deque>
21#include <map>
22#include <memory>
23#include <string>
24#include <vector>
25
26class TTreeReader;
27
28namespace ROOT {
29namespace RDF {
30class RDataSource;
31}
32namespace Detail {
33namespace RDF {
34
35class RLoopManager;
36
38
40protected:
41 const std::string fName; ///< The name of the custom column
42 const std::string fType; ///< The type of the custom column as a text string
43 std::vector<Long64_t> fLastCheckedEntry;
45 RLoopManager *fLoopManager; // non-owning pointer to the RLoopManager
47 /// The nth flag signals whether the nth input column is a custom column or not.
49 std::vector<std::string> fVariationDeps; ///< List of systematic variations that affect the value of this define.
50 std::string fVariation; ///< This indicates for what variation this define evaluates values.
51
52public:
53 RDefineBase(std::string_view name, std::string_view type, const RDFInternal::RColumnRegister &colRegister,
54 RLoopManager &lm, const ColumnNames_t &columnNames, const std::string &variationName = "nominal");
55
56 RDefineBase &operator=(const RDefineBase &) = delete;
58 virtual ~RDefineBase();
59 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
60 /// Return the (type-erased) address of the Define'd value for the given processing slot.
61 virtual void *GetValuePtr(unsigned int slot) = 0;
62 virtual const std::type_info &GetTypeId() const = 0;
63 std::string GetName() const;
64 std::string GetTypeName() const;
65 /// Update the value at the address returned by GetValuePtr with the content corresponding to the given entry
66 virtual void Update(unsigned int slot, Long64_t entry) = 0;
67 /// Update function to be called once per sample, used if the derived type is a RDefinePerSample
68 virtual void Update(unsigned int /*slot*/, const ROOT::RDF::RSampleInfo &/*id*/) {}
69 /// Clean-up operations to be performed at the end of a task.
70 virtual void FinaliseSlot(unsigned int slot) = 0;
71
72 const std::vector<std::string> &GetVariations() const { return fVariationDeps; }
73
74 /// Create clones of this Define that work with values in varied "universes".
75 virtual void MakeVariations(const std::vector<std::string> &variations) = 0;
76
77 /// Return a clone of this Define that works with values in the variationName "universe".
78 virtual RDefineBase &GetVariedDefine(const std::string &variationName) = 0;
79};
80
81} // ns RDF
82} // ns Detail
83} // ns ROOT
84
85#endif // ROOT_RCUSTOMCOLUMNBASE
ROOT::R::TRInterface & r
Definition Object.C:4
long long Long64_t
Definition RtypesCore.h:80
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
virtual void MakeVariations(const std::vector< std::string > &variations)=0
Create clones of this Define that work with values in varied "universes".
virtual void * GetValuePtr(unsigned int slot)=0
Return the (type-erased) address of the Define'd value for the given processing slot.
ROOT::RVecB fIsDefine
The nth flag signals whether the nth input column is a custom column or not.
std::string fVariation
This indicates for what variation this define evaluates values.
const std::string fType
The type of the custom column as a text string.
const std::vector< std::string > & GetVariations() const
std::vector< std::string > fVariationDeps
List of systematic variations that affect the value of this define.
virtual void Update(unsigned int, const ROOT::RDF::RSampleInfo &)
Update function to be called once per sample, used if the derived type is a RDefinePerSample.
std::string GetTypeName() const
virtual void Update(unsigned int slot, Long64_t entry)=0
Update the value at the address returned by GetValuePtr with the content corresponding to the given e...
virtual void InitSlot(TTreeReader *r, unsigned int slot)=0
std::string GetName() const
RDFInternal::RColumnRegister fColRegister
virtual void FinaliseSlot(unsigned int slot)=0
Clean-up operations to be performed at the end of a task.
const ROOT::RDF::ColumnNames_t fColumnNames
std::vector< Long64_t > fLastCheckedEntry
const std::string fName
The name of the custom column.
virtual const std::type_info & GetTypeId() const =0
virtual RDefineBase & GetVariedDefine(const std::string &variationName)=0
Return a clone of this Define that works with values in the variationName "universe".
RDefineBase & operator=(const RDefineBase &)=delete
RDefineBase & operator=(RDefineBase &&)=delete
The head node of a RDF computation graph.
A binder for user-defined columns and aliases.
This type represents a sample identifier, to be used in conjunction with RDataFrame features such as ...
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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...