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_RDEFINEBASE
12#define ROOT_RDEFINEBASE
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 FinalizeSlot(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_RDEFINEBASE
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
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
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.
virtual void FinalizeSlot(unsigned int slot)=0
Clean-up operations to be performed at the end of a task.
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
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, variations 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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...