11#ifndef ROOT_RDF_TINTERFACE_UTILS
12#define ROOT_RDF_TINTERFACE_UTILS
31#include <RConfigure.h>
53template <
typename Proxied>
75class RIgnoreErrorLevelRAII {
80 RIgnoreErrorLevelRAII(
int errorIgnoreLevel) {
gErrorIgnoreLevel = errorIgnoreLevel; }
93struct HistoNSparseD{};
95struct HistWithWeight{};
97struct GraphAsymmErrors{};
112template <
typename T,
bool ISV6HISTO = std::is_base_of<TH1, std::decay_t<T>>::value>
114 static bool HasAxisLimits(T &
h)
116 auto xaxis =
h.GetXaxis();
117 return !(xaxis->GetXmin() == 0. && xaxis->GetXmax() == 0.);
122struct HistoUtils<T, false> {
123 static bool HasAxisLimits(T &) {
return true; }
127template <
typename... ColTypes,
typename ActionTag,
typename ActionResultType,
typename PrevNodeType>
128std::unique_ptr<RActionBase>
129BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
130 std::shared_ptr<PrevNodeType> prevNode, ActionTag,
const RColumnRegister &colRegister)
132 using Helper_t = FillHelper<ActionResultType>;
133 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
134 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
138template <
typename... ColTypes,
typename PrevNodeType>
139std::unique_ptr<RActionBase>
140BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<::TH1D> &
h,
const unsigned int nSlots,
141 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo1D,
const RColumnRegister &colRegister)
143 auto hasAxisLimits = HistoUtils<::TH1D>::HasAxisLimits(*
h);
146 using Helper_t = FillHelper<::TH1D>;
147 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
148 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
150 using Helper_t = BufferedFillHelper;
151 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
152 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
157template <
typename... ColTypes,
typename ActionResultType,
typename PrevNodeType>
158std::unique_ptr<RActionBase>
159BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
160 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo3D,
const RColumnRegister &colRegister)
163 using Helper_t = FillHelper<ActionResultType>;
164 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
165 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
167 using Helper_t = ThreadSafeFillHelper<ActionResultType>;
168 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
169 if constexpr (
sizeof...(ColTypes) > 3) {
173 return std::make_unique<Action_t>(Helper_t(
h, histoSlots), bl, std::move(prevNode), colRegister);
179template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
180std::unique_ptr<RActionBase>
182 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Hist,
183 const RColumnRegister &colRegister)
185 using Helper_t = RHistFillHelper<BinContentType>;
186 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
187 return std::make_unique<Action_t>(Helper_t(
h, nSlots), columnList, std::move(prevNode), colRegister);
191template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
192std::unique_ptr<RActionBase>
194 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::HistWithWeight,
195 const RColumnRegister &colRegister)
197 using Helper_t = RHistFillHelper<BinContentType, true>;
198 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
199 return std::make_unique<Action_t>(Helper_t(
h, nSlots), columnList, std::move(prevNode), colRegister);
203template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
204std::unique_ptr<RActionBase>
206 const unsigned int, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Hist,
207 const RColumnRegister &colRegister)
209 using Helper_t = RHistEngineFillHelper<BinContentType>;
210 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
211 return std::make_unique<Action_t>(Helper_t(
h), columnList, std::move(prevNode), colRegister);
215template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
216std::unique_ptr<RActionBase>
218 const unsigned int, std::shared_ptr<PrevNodeType> prevNode, ActionTags::HistWithWeight,
219 const RColumnRegister &colRegister)
221 using Helper_t = RHistEngineFillHelper<BinContentType, true>;
222 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
223 return std::make_unique<Action_t>(Helper_t(
h), columnList, std::move(prevNode), colRegister);
227template <
typename... ColTypes,
typename PrevNodeType>
228std::unique_ptr<RActionBase>
229BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraph> &
g,
const unsigned int nSlots,
230 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Graph,
const RColumnRegister &colRegister)
232 using Helper_t = FillTGraphHelper;
233 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
234 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
237template <
typename... ColTypes,
typename PrevNodeType>
238std::unique_ptr<RActionBase>
239BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraphAsymmErrors> &
g,
const unsigned int nSlots,
240 std::shared_ptr<PrevNodeType> prevNode, ActionTags::GraphAsymmErrors,
const RColumnRegister &colRegister)
242 using Helper_t = FillTGraphAsymmErrorsHelper;
243 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
244 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
248template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
249std::unique_ptr<RActionBase>
250BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &minV,
const unsigned int nSlots,
251 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Min,
const RColumnRegister &colRegister)
253 using Helper_t = MinHelper<ActionResultType>;
254 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
255 return std::make_unique<Action_t>(Helper_t(minV, nSlots), bl, std::move(prevNode), colRegister);
259template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
260std::unique_ptr<RActionBase>
261BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &maxV,
const unsigned int nSlots,
262 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Max,
const RColumnRegister &colRegister)
264 using Helper_t = MaxHelper<ActionResultType>;
265 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
266 return std::make_unique<Action_t>(Helper_t(maxV, nSlots), bl, std::move(prevNode), colRegister);
270template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
271std::unique_ptr<RActionBase>
272BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &sumV,
const unsigned int nSlots,
273 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Sum,
const RColumnRegister &colRegister)
275 using Helper_t = SumHelper<ActionResultType>;
276 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
277 return std::make_unique<Action_t>(Helper_t(sumV, nSlots), bl, std::move(prevNode), colRegister);
281template <
typename ColType,
typename PrevNodeType>
282std::unique_ptr<RActionBase>
283BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &meanV,
const unsigned int nSlots,
284 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Mean,
const RColumnRegister &colRegister)
286 using Helper_t = MeanHelper;
287 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
288 return std::make_unique<Action_t>(Helper_t(meanV, nSlots), bl, std::move(prevNode), colRegister);
292template <
typename ColType,
typename PrevNodeType>
293std::unique_ptr<RActionBase>
294BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &stdDeviationV,
const unsigned int nSlots,
295 std::shared_ptr<PrevNodeType> prevNode, ActionTags::StdDev,
const RColumnRegister &colRegister)
297 using Helper_t = StdDevHelper;
298 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
299 return std::make_unique<Action_t>(Helper_t(stdDeviationV, nSlots), bl, prevNode, colRegister);
302using displayHelperArgs_t = std::pair<size_t, std::shared_ptr<ROOT::RDF::RDisplay>>;
305template <
typename... ColTypes,
typename PrevNodeType>
306std::unique_ptr<RActionBase>
307BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<displayHelperArgs_t> &helperArgs,
const unsigned int,
308 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Display,
const RColumnRegister &colRegister)
310 using Helper_t = DisplayHelper<PrevNodeType>;
311 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
312 return std::make_unique<Action_t>(Helper_t(helperArgs->first, helperArgs->second, prevNode), bl, prevNode,
316struct SnapshotHelperArgs {
317 std::string fFileName;
318 std::string fDirName;
319 std::string fTreeName;
320 std::vector<std::string> fOutputColNames;
325 bool fIncludeVariations;
328template <
typename PrevNodeType>
329std::unique_ptr<RActionBase>
330BuildAction(
const ColumnNames_t &colNames,
const std::shared_ptr<SnapshotHelperArgs> &snapHelperArgs,
331 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode,
const RColumnRegister &colRegister,
332 const std::vector<const std::type_info *> &colTypeIDs)
334 const auto &filename = snapHelperArgs->fFileName;
335 const auto &dirname = snapHelperArgs->fDirName;
336 const auto &treename = snapHelperArgs->fTreeName;
337 const auto &outputColNames = snapHelperArgs->fOutputColNames;
338 const auto &options = snapHelperArgs->fOptions;
339 const auto &outputLM = snapHelperArgs->fOutputLoopManager;
340 const auto &inputLM = snapHelperArgs->fInputLoopManager;
342 auto sz = colNames.size();
343 std::vector<bool> isDefine(sz);
344 for (
auto i = 0u; i < sz; ++i)
345 isDefine[i] = colRegister.IsDefineOrAlias(colNames[i]);
347 std::unique_ptr<RActionBase> actionPtr;
348 if (snapHelperArgs->fToNTuple) {
350 using Helper_t = UntypedSnapshotRNTupleHelper;
351 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
353 actionPtr.reset(
new Action_t(Helper_t(nSlots, filename, dirname, treename, colNames, outputColNames, options,
354 inputLM, outputLM, colTypeIDs),
355 colNames, colTypeIDs, prevNode, colRegister));
359 if (snapHelperArgs->fIncludeVariations) {
360 using Helper_t = SnapshotHelperWithVariations;
361 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
362 actionPtr.reset(
new Action_t(Helper_t(filename, dirname, treename, colNames, outputColNames, options,
363 std::move(isDefine), outputLM, inputLM, colTypeIDs),
364 colNames, colTypeIDs, prevNode, colRegister));
366 using Helper_t = UntypedSnapshotTTreeHelper;
367 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
368 actionPtr.reset(
new Action_t(Helper_t(filename, dirname, treename, colNames, outputColNames, options,
369 std::move(isDefine), outputLM, inputLM, colTypeIDs),
370 colNames, colTypeIDs, prevNode, colRegister));
373 if (snapHelperArgs->fIncludeVariations) {
374 throw std::invalid_argument(
"Multi-threaded snapshot with variations is not supported yet.");
377 using Helper_t = UntypedSnapshotTTreeHelperMT;
378 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
379 actionPtr.reset(
new Action_t(Helper_t(nSlots, filename, dirname, treename, colNames, outputColNames, options,
380 std::move(isDefine), outputLM, inputLM, colTypeIDs),
381 colNames, colTypeIDs, prevNode, colRegister));
389template <
typename... ColTypes,
typename PrevNodeType,
typename Helper_t>
390std::unique_ptr<RActionBase>
391BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<Helper_t> &
h,
const unsigned int ,
392 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Book,
const RColumnRegister &colRegister)
394 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
395 return std::make_unique<Action_t>(Helper_t(std::move(*
h)), bl, std::move(prevNode), colRegister);
400template <
typename Filter>
401void CheckFilter(Filter &)
403 using FilterRet_t =
typename RDF::CallableTraits<Filter>::ret_type;
404 static_assert(std::is_convertible<FilterRet_t, bool>::value,
405 "filter expression returns a type that is not convertible to bool");
412void CheckForRedefinition(
const std::string &where, std::string_view definedCol,
const RColumnRegister &colRegister,
415void CheckForDefinition(
const std::string &where, std::string_view definedColView,
const RColumnRegister &colRegister,
419 const RColumnRegister &colRegister);
423std::shared_ptr<RJittedFilter>
BookFilterJit(std::shared_ptr<RNodeBase> prevNode, std::string_view
name,
424 std::string_view expression,
const RColumnRegister &colRegister,
428 RDataSource *ds,
const RColumnRegister &colRegister);
433std::shared_ptr<RJittedVariation>
434BookVariationJit(
const std::vector<std::string> &colNames, std::string_view variationName,
435 const std::vector<std::string> &variationTags, std::string_view expression,
RLoopManager &lm,
436 RDataSource *ds,
const RColumnRegister &colRegister,
bool isSingleColumn,
437 const std::string &varyColType);
440 const unsigned int nSlots,
const RColumnRegister &colRegister,
RDataSource *ds,
441 const bool vector2RVec =
true);
447std::shared_ptr<RNodeBase>
UpcastNode(std::shared_ptr<RNodeBase> ptr);
450 const RColumnRegister &validDefines,
RDataSource *ds);
457void AddDSColumnsHelper(
const std::string &colName,
RLoopManager &lm,
RDataSource &ds, RColumnRegister &colRegister)
460 if (colRegister.IsDefineOrAlias(colName))
471 std::vector<std::unique_ptr<RColumnReaderBase>> colReaders;
472 colReaders.reserve(nSlots);
475 if (!valuePtrs.empty()) {
476 for (
auto *ptr : valuePtrs)
477 colReaders.emplace_back(
new RDSColumnReader<T>(ptr));
481 for (
auto slot = 0u; slot < lm.
GetNSlots(); ++slot)
482 colReaders.emplace_back(
491template <
typename... ColumnTypes>
493 TTraits::TypeList<ColumnTypes...>, RColumnRegister &colRegister)
496 using expander =
int[];
498 (void)expander{(AddDSColumnsHelper<ColumnTypes>(requiredCols[i], lm, ds, colRegister), ++i)..., 0};
507void JitFilterHelper(
F &&
f,
const ColumnNames_t &cols, RColumnRegister &colRegister,
517 using Callable_t = std::decay_t<F>;
519 using PrevNode_t =
typename decltype(prevNode)::element_type;
521 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
522 constexpr auto nColumns = ColTypes_t::list_size;
527 if (ds !=
nullptr && !cols.empty())
528 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
531 std::unique_ptr<RFilterBase>(
new F_t(std::forward<F>(
f), cols, prevNode, colRegister, jittedFilter->
GetName())));
534namespace DefineTypes {
536struct RDefinePerSampleTag {};
540auto MakeDefineNode(DefineTypes::RDefineTag, std::string_view
name, std::string_view dummyType,
F &&
f,
544 name, dummyType, std::forward<F>(
f), cols, colRegister, lm));
548auto MakeDefineNode(DefineTypes::RDefinePerSampleTag, std::string_view
name, std::string_view dummyType,
F &&
f,
551 return std::unique_ptr<RDefineBase>(
558template <
typename RDefineTypeTag,
typename F>
559void JitDefineHelper(
F &&
f,
const ColumnNames_t &cols, RColumnRegister &colRegister,
569 using Callable_t = std::decay_t<F>;
570 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
573 if (ds !=
nullptr && !cols.empty())
574 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
578 const auto dummyType =
"jittedCol_t";
580 std::unique_ptr<RDefineBase> newCol{
581 MakeDefineNode(RDefineTypeTag{}, jittedDefine->
GetName(), dummyType, std::forward<F>(
f), cols, colRegister, lm)};
582 jittedDefine->
SetDefine(std::move(newCol));
585template <
bool IsSingleColumn,
typename F>
586void JitVariationHelper(
F &&
f,
const ColumnNames_t &inputColNames, RColumnRegister &colRegister,
591 if (!jittedVariation) {
597 using Callable_t = std::decay_t<F>;
598 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
601 if (ds !=
nullptr && !inputColNames.empty())
602 AddDSColumns(inputColNames, lm, *ds, ColTypes_t(), colRegister);
605 std::unique_ptr<RVariationBase> newVariation{
new RVariation<std::decay_t<F>, IsSingleColumn>(
606 variedColNames, jittedVariation->GetVariationName(), std::forward<F>(
f), variationTags,
607 jittedVariation->GetTypeName(), colRegister, lm, inputColNames)};
608 jittedVariation->SetVariation(std::move(newVariation));
612template <
typename ActionTag,
typename... ColTypes,
typename HelperArgType>
615 std::shared_ptr<HelperArgType> *helperArg)
noexcept
623 using ColTypes_t =
TypeList<ColTypes...>;
624 constexpr auto nColumns = ColTypes_t::list_size;
626 if (ds !=
nullptr && !cols.empty())
627 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
630 BuildAction<ColTypes...>(cols, *helperArg, nSlots, jittedAction->
MoveOutPrevNode(), ActionTag{}, colRegister);
631 jittedAction->
SetAction(std::move(actionPtr));
635template <typename T, bool Container = IsDataContainer<T>::value && !std::is_same<T, std::string>::value>
636struct RMinReturnType {
646struct RMinReturnType<T, true> {
647 using type = TTraits::TakeFirstParameter_t<T>;
651template <
typename R,
typename F,
typename... Args>
654 return [
f](
unsigned int, Args...
a)
mutable ->
R {
return f(
a...); };
657template <
typename ColType,
typename... Rest>
658struct RNeedJittingHelper {
659 static constexpr bool value = RNeedJittingHelper<Rest...>::value;
662template <
typename... Rest>
664 static constexpr bool value =
true;
668struct RNeedJittingHelper<T> {
669 static constexpr bool value =
false;
674 static constexpr bool value =
true;
677template <
typename ...ColTypes>
679 static constexpr bool value = RNeedJittingHelper<ColTypes...>::value;
683struct RNeedJitting<> {
684 static constexpr bool value =
false;
691template <
typename R,
typename Merge,
typename U,
typename T,
typename decayedU = std::decay_t<U>,
692 typename mergeArgsNoDecay_t =
typename CallableTraits<Merge>::arg_types_nodecay,
693 typename mergeArgs_t =
typename CallableTraits<Merge>::arg_types,
694 typename mergeRet_t =
typename CallableTraits<Merge>::ret_type>
697 constexpr bool isAggregatorOk =
698 (std::is_same<R, decayedU>::value) || (std::is_same<R, void>::value && std::is_lvalue_reference<U>::value);
699 static_assert(isAggregatorOk,
"aggregator function must have signature `U(U,T)` or `void(U&,T)`");
700 constexpr bool isMergeOk =
701 (std::is_same<TypeList<decayedU, decayedU>, mergeArgs_t>::value && std::is_same<decayedU, mergeRet_t>::value) ||
702 (std::is_same<
TypeList<std::vector<decayedU> &>, mergeArgsNoDecay_t>::value &&
703 std::is_same<void, mergeRet_t>::value);
704 static_assert(isMergeOk,
"merge function must have signature `U(U,U)` or `void(std::vector<U>&)`");
709template <
typename R,
typename T>
710void CheckAggregate(T)
712 static_assert(
sizeof(T) == 0,
"aggregator function must take exactly two arguments");
727std::vector<std::string>
GetFilterNames(
const std::shared_ptr<RLoopManager> &loopManager);
730template <
typename NodeType>
731std::vector<std::string>
GetFilterNames(
const std::shared_ptr<NodeType> &node)
733 std::vector<std::string> filterNames;
734 node->AddFilterName(filterNames);
738struct ParsedTreePath {
739 std::string fTreeName;
740 std::string fDirName;
750using IsTrueForAllImpl_t =
typename std::is_same<TBoolPack<bs...,
true>, TBoolPack<
true, bs...>>;
752template <
bool... Conditions>
754 static constexpr bool value = IsTrueForAllImpl_t<Conditions...>::value;
761struct IsList_t : std::false_type {};
764struct IsList_t<std::list<T>> : std::true_type {};
767struct IsDeque_t : std::false_type {};
770struct IsDeque_t<std::deque<T>> : std::true_type {};
778struct InnerValueType {
782template <
typename Elem>
788using InnerValueType_t =
typename InnerValueType<T>::type;
790std::pair<std::vector<std::string>, std::vector<std::string>>
792 std::vector<std::string> &&colsWithAliases);
805using MinReturnType_t =
typename RDFInternal::RMinReturnType<T>::type;
808using MaxReturnType_t = MinReturnType_t<T>;
811using SumReturnType_t = MinReturnType_t<T>;
#define R(a, b, c, d, e, f, g, h, i)
externInt_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
std::shared_ptr< ROOT::Detail::RDF::RNodeBase > MoveOutPrevNode()
void SetAction(std::unique_ptr< RActionBase > a)
The head node of a RDF computation graph.
const std::set< std::string > & GetSuppressErrorsForMissingBranches() const
void AddDataSourceColumnReaders(std::string_view col, std::vector< std::unique_ptr< RColumnReaderBase > > &&readers, const std::type_info &ti)
RDataSource * GetDataSource() const
unsigned int GetNSlots() const
bool HasDataSourceColumnReaders(std::string_view col, const std::type_info &ti) const
Return true if AddDataSourceColumnReaders was called for column name col.
std::string GetName() const
std::string GetName() const
A wrapper around a concrete RDefine, which forwards all calls to it RJittedDefine is a placeholder th...
void SetDefine(std::unique_ptr< RDefineBase > c)
A wrapper around a concrete RFilter, which forwards all calls to it RJittedFilter is the type of the ...
std::shared_ptr< RNodeBase > MoveOutPrevNode()
void SetFilter(std::unique_ptr< RFilterBase > f)
The head node of a RDF computation graph.
Base class for non-leaf nodes of the computational graph.
A histogram data structure to bin data along multiple dimensions.
A histogram for aggregation of data along multiple dimensions.
A binder for user-defined columns, variations and aliases.
RDataSource defines an API that RDataFrame can use to read arbitrary data formats.
virtual bool HasColumn(std::string_view colName) const =0
Checks if the dataset has a certain column.
std::vector< T ** > GetColumnReaders(std::string_view columnName)
Called at most once per column by RDF.
The public interface to the RDataFrame federation of classes.
A "std::vector"-like collection of values implementing handy operation to analyse them.
A TTree represents a columnar dataset.
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
const ColumnNames_t SelectColumns(unsigned int nRequiredNames, const ColumnNames_t &names, const ColumnNames_t &defaultNames)
Choose between local column names or default column names, throw in case of errors.
void CheckForNoVariations(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister)
Throw if the column has systematic variations attached.
ParsedTreePath ParseTreePath(std::string_view fullTreeName)
std::shared_ptr< RJittedDefine > BookDefinePerSampleJit(std::string_view name, std::string_view expression, RLoopManager &lm, const RColumnRegister &colRegister)
Book the jitting of a DefinePerSample call.
void CheckValidCppVarName(std::string_view var, const std::string &where)
void RemoveDuplicates(ColumnNames_t &columnNames)
ColumnNames_t GetValidatedColumnNames(RLoopManager &lm, const unsigned int nColumns, const ColumnNames_t &columns, const RColumnRegister &colRegister, RDataSource *ds)
Given the desired number of columns and the user-provided list of columns:
std::shared_ptr< RNodeBase > UpcastNode(std::shared_ptr< RNodeBase > ptr)
void CheckSnapshotOptionsFormatCompatibility(const ROOT::RDF::RSnapshotOptions &opts)
void CheckForDefinition(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister, const ColumnNames_t &dataSourceColumns)
Throw if column definedColView is not already there.
std::vector< std::string > GetFilterNames(const std::shared_ptr< RLoopManager > &loopManager)
std::string PrettyPrintAddr(const void *const addr)
std::shared_ptr< RDFDetail::RJittedFilter > BookFilterJit(std::shared_ptr< RDFDetail::RNodeBase > prevNode, std::string_view name, std::string_view expression, const RColumnRegister &colRegister, TTree *tree, RDataSource *ds)
Book the jitting of a Filter call.
std::string JitBuildAction(const ColumnNames_t &cols, const std::type_info &helperArgType, const std::type_info &at, TTree *tree, const unsigned int nSlots, const RColumnRegister &colRegister, RDataSource *ds, const bool vector2RVec)
void CheckTypesAndPars(unsigned int nTemplateParams, unsigned int nColumnNames)
std::string DemangleTypeIdName(const std::type_info &typeInfo)
bool AtLeastOneEmptyString(const std::vector< std::string_view > strings)
std::unique_ptr< ROOT::Detail::RDF::RColumnReaderBase > CreateColumnReader(ROOT::RDF::RDataSource &ds, unsigned int slot, std::string_view col, const std::type_info &tid, TTreeReader *treeReader)
std::pair< std::vector< std::string >, std::vector< std::string > > AddSizeBranches(ROOT::RDF::RDataSource *ds, std::vector< std::string > &&colsWithoutAliases, std::vector< std::string > &&colsWithAliases)
Return copies of colsWithoutAliases and colsWithAliases with size branches for variable-sized array b...
void RemoveRNTupleSubfields(ColumnNames_t &columnNames)
ColumnNames_t FilterArraySizeColNames(const ColumnNames_t &columnNames, const std::string &action)
Take a list of column names, return that list with entries starting by '#' filtered out.
std::vector< std::string > GetValidatedArgTypes(const ColumnNames_t &colNames, const RColumnRegister &colRegister, TTree *tree, RDataSource *ds, const std::string &context, bool vector2RVec)
void CheckForDuplicateSnapshotColumns(const ColumnNames_t &cols)
ColumnNames_t ConvertRegexToColumns(const ColumnNames_t &colNames, std::string_view columnNameRegexp, std::string_view callerName)
ColumnNames_t FindUnknownColumns(const ColumnNames_t &requiredCols, const RColumnRegister &definedCols, const ColumnNames_t &dataSourceColumns)
unsigned int & NThreadPerTH3()
Obtain or set the number of threads that will share a clone of a thread-safe 3D histogram.
void CheckForRedefinition(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister, const ColumnNames_t &dataSourceColumns)
Throw if column definedColView is already there.
std::shared_ptr< RJittedDefine > BookDefineJit(std::string_view name, std::string_view expression, RLoopManager &lm, RDataSource *ds, const RColumnRegister &colRegister)
Book the jitting of a Define call.
std::shared_ptr< RJittedVariation > BookVariationJit(const std::vector< std::string > &colNames, std::string_view variationName, const std::vector< std::string > &variationTags, std::string_view expression, RLoopManager &lm, RDataSource *ds, const RColumnRegister &colRegister, bool isSingleColumn, const std::string &varyColType)
Book the jitting of a Vary call.
RInterface<::ROOT::Detail::RDF::RNodeBase > RNode
std::vector< std::string > ColumnNames_t
ROOT type_traits extensions.
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
A collection of options to steer the creation of the dataset on disk through Snapshot().
Lightweight storage for a collection of types.