Logo ROOT   6.18/05
Reference Guide
NodesUtils.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 02/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_RDFNODES_UTILS
12#define ROOT_RDFNODES_UTILS
13
16#include "ROOT/RVec.hxx"
17#include "ROOT/RDF/Utils.hxx" // ColumnNames_t
18
19/// \cond
20template <typename T>
22
23template <typename T>
25/// \endcond
26
27namespace ROOT {
28namespace Internal {
29namespace RDF {
30using namespace ROOT::VecOps;
31using namespace ROOT::Detail::RDF;
32using namespace ROOT::RDF;
33
34/// Choose between TTreeReader{Array,Value} depending on whether the branch type
35/// T is a `RVec<T>` or any other type (respectively).
36template <typename T>
39};
40
41template <typename T>
44};
45
46template <typename T>
48
49/// Initialize a tuple of RColumnValues.
50/// For real TTree branches a TTreeReader{Array,Value} is built and passed to the
51/// RColumnValue. For temporary columns a pointer to the corresponding variable
52/// is passed instead.
53template <typename RDFValueTuple, std::size_t... S>
54void InitRDFValues(unsigned int slot, RDFValueTuple &valueTuple, TTreeReader *r, const ColumnNames_t &bn,
55 const RBookedCustomColumns &customCols, std::index_sequence<S...>,
56 const std::array<bool, sizeof...(S)> &isCustomColumn)
57{
58 // hack to expand a parameter pack without c++17 fold expressions.
59 // The statement defines a variable with type std::initializer_list<int>, containing all zeroes, and SetTmpColumn or
60 // SetProxy are conditionally executed as the braced init list is expanded. The final ... expands S.
61 int expander[] = {(isCustomColumn[S]
62 ? std::get<S>(valueTuple).SetTmpColumn(slot, customCols.GetColumns().at(bn[S]).get())
63 : std::get<S>(valueTuple).MakeProxy(r, bn[S]),
64 0)...,
65 0};
66 (void)expander; // avoid "unused variable" warnings for expander on gcc4.9
67 (void)slot; // avoid _bogus_ "unused variable" warnings for slot on gcc 4.9
68 (void)r; // avoid "unused variable" warnings for r on gcc5.2
69}
70
71} // namespace RDF
72} // namespace Internal
73} // namespace ROOT
74
75#endif
ROOT::R::TRInterface & r
Definition: Object.C:4
typedef void((*Func_t)())
Encapsulates the columns defined by the user.
const RCustomColumnBasePtrMap_t & GetColumns() const
Returns the list of the pointers to the defined columns.
A "std::vector"-like collection of values implementing handy operation to analyse them.
Definition: RVec.hxx:272
An interface for reading collections stored in ROOT columnar datasets.
An interface for reading values stored in ROOT columnar datasets.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Definition: TTreeReader.h:44
void InitRDFValues(unsigned int slot, RDFValueTuple &valueTuple, TTreeReader *r, const ColumnNames_t &bn, const RBookedCustomColumns &customCols, std::index_sequence< S... >, const std::array< bool, sizeof...(S)> &isCustomColumn)
Initialize a tuple of RColumnValues.
Definition: NodesUtils.hxx:54
typename TReaderValueOrArray< T >::Proxy_t ReaderValueOrArray_t
Definition: NodesUtils.hxx:47
double T(double x)
Definition: ChebyshevPol.h:34
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
ROOT::Detail::RDF::ColumnNames_t ColumnNames_t
Definition: RDataFrame.cxx:788
RooArgSet S(const RooAbsArg &v1)
Choose between TTreeReader{Array,Value} depending on whether the branch type T is a RVec<T> or any ot...
Definition: NodesUtils.hxx:37