11#ifndef ROOT_RDF_TINTERFACE_UTILS
12#define ROOT_RDF_TINTERFACE_UTILS
33#include <RConfigure.h>
55template <
typename Proxied>
74ConvertRegexToColumns(
const ColumnNames_t &colNames, std::string_view columnNameRegexp, std::string_view callerName);
77class RIgnoreErrorLevelRAII {
82 RIgnoreErrorLevelRAII(
int errorIgnoreLevel) {
gErrorIgnoreLevel = errorIgnoreLevel; }
95struct HistoNSparseD{};
97struct HistWithWeight{};
99struct GraphAsymmErrors{};
115template <
typename T,
bool ISV6HISTO = std::is_base_of<TH1, std::decay_t<T>>::value>
117 static bool HasAxisLimits(T &
h)
119 auto xaxis =
h.GetXaxis();
120 return !(xaxis->GetXmin() == 0. && xaxis->GetXmax() == 0.);
125struct HistoUtils<T, false> {
126 static bool HasAxisLimits(T &) {
return true; }
130template <
typename... ColTypes,
typename ActionTag,
typename ActionResultType,
typename PrevNodeType>
131std::unique_ptr<RActionBase>
132BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
133 std::shared_ptr<PrevNodeType> prevNode, ActionTag,
const RColumnRegister &colRegister)
135 using Helper_t = FillHelper<ActionResultType>;
136 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
137 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
141template <
typename... ColTypes,
typename PrevNodeType>
142std::unique_ptr<RActionBase>
143BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<::TH1D> &
h,
const unsigned int nSlots,
144 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo1D,
const RColumnRegister &colRegister)
146 auto hasAxisLimits = HistoUtils<::TH1D>::HasAxisLimits(*
h);
149 using Helper_t = FillHelper<::TH1D>;
150 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
151 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
153 using Helper_t = BufferedFillHelper;
154 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
155 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
160template <
typename... ColTypes,
typename ActionResultType,
typename PrevNodeType>
161std::unique_ptr<RActionBase>
162BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
163 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo3D,
const RColumnRegister &colRegister)
166 using Helper_t = FillHelper<ActionResultType>;
167 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
168 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
170 using Helper_t = ThreadSafeFillHelper<ActionResultType>;
171 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
172 if constexpr (
sizeof...(ColTypes) > 3) {
176 return std::make_unique<Action_t>(Helper_t(
h, histoSlots), bl, std::move(prevNode), colRegister);
182template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
183std::unique_ptr<RActionBase>
185 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Hist,
186 const RColumnRegister &colRegister)
188 using Helper_t = RHistFillHelper<BinContentType>;
189 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
190 return std::make_unique<Action_t>(Helper_t(
h, nSlots), columnList, std::move(prevNode), colRegister);
194template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
195std::unique_ptr<RActionBase>
197 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::HistWithWeight,
198 const RColumnRegister &colRegister)
200 using Helper_t = RHistFillHelper<BinContentType, true>;
201 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
202 return std::make_unique<Action_t>(Helper_t(
h, nSlots), columnList, std::move(prevNode), colRegister);
206template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
207std::unique_ptr<RActionBase>
209 const unsigned int, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Hist,
210 const RColumnRegister &colRegister)
212 using Helper_t = RHistEngineFillHelper<BinContentType>;
213 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
214 return std::make_unique<Action_t>(Helper_t(
h), columnList, std::move(prevNode), colRegister);
218template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
219std::unique_ptr<RActionBase>
221 const unsigned int, std::shared_ptr<PrevNodeType> prevNode, ActionTags::HistWithWeight,
222 const RColumnRegister &colRegister)
224 using Helper_t = RHistEngineFillHelper<BinContentType, true>;
225 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
226 return std::make_unique<Action_t>(Helper_t(
h), columnList, std::move(prevNode), colRegister);
230template <
typename... ColTypes,
typename PrevNodeType>
231std::unique_ptr<RActionBase>
232BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraph> &
g,
const unsigned int nSlots,
233 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Graph,
const RColumnRegister &colRegister)
235 using Helper_t = FillTGraphHelper;
236 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
237 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
240template <
typename... ColTypes,
typename PrevNodeType>
241std::unique_ptr<RActionBase>
242BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraphAsymmErrors> &
g,
const unsigned int nSlots,
243 std::shared_ptr<PrevNodeType> prevNode, ActionTags::GraphAsymmErrors,
const RColumnRegister &colRegister)
245 using Helper_t = FillTGraphAsymmErrorsHelper;
246 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
247 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
251template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
252std::unique_ptr<RActionBase>
253BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &minV,
const unsigned int nSlots,
254 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Min,
const RColumnRegister &colRegister)
256 using Helper_t = MinHelper<ActionResultType>;
257 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
258 return std::make_unique<Action_t>(Helper_t(minV, nSlots), bl, std::move(prevNode), colRegister);
262template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
263std::unique_ptr<RActionBase>
264BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &maxV,
const unsigned int nSlots,
265 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Max,
const RColumnRegister &colRegister)
267 using Helper_t = MaxHelper<ActionResultType>;
268 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
269 return std::make_unique<Action_t>(Helper_t(maxV, nSlots), bl, std::move(prevNode), colRegister);
273template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
274std::unique_ptr<RActionBase>
275BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &sumV,
const unsigned int nSlots,
276 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Sum,
const RColumnRegister &colRegister)
278 using Helper_t = SumHelper<ActionResultType>;
279 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
280 return std::make_unique<Action_t>(Helper_t(sumV, nSlots), bl, std::move(prevNode), colRegister);
284template <
typename ColType,
typename PrevNodeType>
285std::unique_ptr<RActionBase>
286BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &meanV,
const unsigned int nSlots,
287 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Mean,
const RColumnRegister &colRegister)
289 using Helper_t = MeanHelper;
290 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
291 return std::make_unique<Action_t>(Helper_t(meanV, nSlots), bl, std::move(prevNode), colRegister);
295template <
typename ColType,
typename PrevNodeType>
296std::unique_ptr<RActionBase>
297BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &stdDeviationV,
const unsigned int nSlots,
298 std::shared_ptr<PrevNodeType> prevNode, ActionTags::StdDev,
const RColumnRegister &colRegister)
300 using Helper_t = StdDevHelper;
301 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
302 return std::make_unique<Action_t>(Helper_t(stdDeviationV, nSlots), bl, prevNode, colRegister);
306template <
typename ColType,
typename PrevNodeType>
307std::unique_ptr<RActionBase>
308BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &meanV,
const unsigned int nSlots,
309 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Median,
const RColumnRegister &colRegister)
311 using Helper_t = MedianHelper;
312 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
313 return std::make_unique<Action_t>(Helper_t(meanV, nSlots), bl, std::move(prevNode), colRegister);
316using displayHelperArgs_t = std::pair<size_t, std::shared_ptr<ROOT::RDF::RDisplay>>;
319template <
typename... ColTypes,
typename PrevNodeType>
320std::unique_ptr<RActionBase>
321BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<displayHelperArgs_t> &helperArgs,
const unsigned int,
322 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Display,
const RColumnRegister &colRegister)
324 using Helper_t = DisplayHelper<PrevNodeType>;
325 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
326 return std::make_unique<Action_t>(Helper_t(helperArgs->first, helperArgs->second, prevNode), bl, prevNode,
330struct SnapshotHelperArgs {
331 std::string fFileName;
332 std::string fDirName;
333 std::string fTreeName;
334 std::vector<std::string> fOutputColNames;
339 bool fIncludeVariations;
342template <
typename PrevNodeType>
343std::unique_ptr<RActionBase>
344BuildAction(
const ColumnNames_t &colNames,
const std::shared_ptr<SnapshotHelperArgs> &snapHelperArgs,
345 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode,
const RColumnRegister &colRegister,
346 const std::vector<const std::type_info *> &colTypeIDs)
348 const auto &
filename = snapHelperArgs->fFileName;
349 const auto &dirname = snapHelperArgs->fDirName;
350 const auto &treename = snapHelperArgs->fTreeName;
351 const auto &outputColNames = snapHelperArgs->fOutputColNames;
352 const auto &options = snapHelperArgs->fOptions;
353 const auto &outputLM = snapHelperArgs->fOutputLoopManager;
354 const auto &inputLM = snapHelperArgs->fInputLoopManager;
356 auto sz = colNames.size();
357 std::vector<bool> isDefine(sz);
358 for (
auto i = 0u; i < sz; ++i)
359 isDefine[i] = colRegister.IsDefineOrAlias(colNames[i]);
361 std::unique_ptr<RActionBase> actionPtr;
362 if (snapHelperArgs->fToNTuple) {
364 using Helper_t = UntypedSnapshotRNTupleHelper;
365 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
367 actionPtr.reset(
new Action_t(Helper_t(nSlots,
filename, dirname, treename, colNames, outputColNames, options,
368 inputLM, outputLM, colTypeIDs),
369 colNames, colTypeIDs, prevNode, colRegister));
373 if (snapHelperArgs->fIncludeVariations) {
374 using Helper_t = SnapshotHelperWithVariations;
375 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
376 actionPtr.reset(
new Action_t(Helper_t(
filename, dirname, treename, colNames, outputColNames, options,
377 std::move(isDefine), outputLM, inputLM, colTypeIDs),
378 colNames, colTypeIDs, prevNode, colRegister));
380 using Helper_t = UntypedSnapshotTTreeHelper;
381 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
382 actionPtr.reset(
new Action_t(Helper_t(
filename, dirname, treename, colNames, outputColNames, options,
383 std::move(isDefine), outputLM, inputLM, colTypeIDs),
384 colNames, colTypeIDs, prevNode, colRegister));
387 if (snapHelperArgs->fIncludeVariations) {
388 throw std::invalid_argument(
"Multi-threaded snapshot with variations is not supported yet.");
391 using Helper_t = UntypedSnapshotTTreeHelperMT;
392 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
393 actionPtr.reset(
new Action_t(Helper_t(nSlots,
filename, dirname, treename, colNames, outputColNames, options,
394 std::move(isDefine), outputLM, inputLM, colTypeIDs),
395 colNames, colTypeIDs, prevNode, colRegister));
402template <
typename PrevNodeType>
403std::unique_ptr<RActionBase>
404BuildAction(
const ColumnNames_t &colNames,
const std::vector<const std::type_info *> &colTypeIDs,
405 const std::shared_ptr<ROOT::RVecF> &location,
const std::vector<std::size_t> &vecSizes,
float vecPadding,
406 std::shared_ptr<PrevNodeType> prevNode,
const RColumnRegister &colRegister)
410 return std::make_unique<Action_t>(Helper_t(location, colTypeIDs, vecSizes, vecPadding), colNames, colTypeIDs,
411 prevNode, colRegister);
415template <
typename... ColTypes,
typename PrevNodeType,
typename Helper_t>
416std::unique_ptr<RActionBase>
417BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<Helper_t> &
h,
const unsigned int ,
418 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Book,
const RColumnRegister &colRegister)
420 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
421 return std::make_unique<Action_t>(Helper_t(std::move(*
h)), bl, std::move(prevNode), colRegister);
426template <
typename Filter>
427void CheckFilter(Filter &)
429 using FilterRet_t =
typename RDF::CallableTraits<Filter>::ret_type;
430 static_assert(std::is_convertible<FilterRet_t, bool>::value,
431 "filter expression returns a type that is not convertible to bool");
438void CheckForRedefinition(
const std::string &where, std::string_view definedCol,
const RColumnRegister &colRegister,
439 const ColumnNames_t &dataSourceColumns);
441void CheckForDefinition(
const std::string &where, std::string_view definedColView,
const RColumnRegister &colRegister,
442 const ColumnNames_t &dataSourceColumns);
445 const RColumnRegister &colRegister);
449std::shared_ptr<RJittedFilter>
BookFilterJit(std::shared_ptr<RNodeBase> prevNode, std::string_view
name,
450 std::string_view expression,
const RColumnRegister &colRegister,
454 RDataSource *ds,
const RColumnRegister &colRegister);
459std::shared_ptr<RJittedVariation>
460BookVariationJit(
const std::vector<std::string> &colNames, std::string_view variationName,
461 const std::vector<std::string> &variationTags, std::string_view expression,
RLoopManager &lm,
462 RDataSource *ds,
const RColumnRegister &colRegister,
bool isSingleColumn,
463 const std::string &varyColType);
465std::string
JitBuildAction(
const ColumnNames_t &bl,
const std::type_info &art,
const std::type_info &at,
TTree *tree,
466 const unsigned int nSlots,
const RColumnRegister &colRegister,
RDataSource *ds,
467 const bool vector2RVec =
true);
473std::shared_ptr<RNodeBase>
UpcastNode(std::shared_ptr<RNodeBase> ptr);
476 const RColumnRegister &validDefines,
RDataSource *ds);
478std::vector<std::string>
GetValidatedArgTypes(
const ColumnNames_t &colNames,
const RColumnRegister &colRegister,
483void AddDSColumnsHelper(
const std::string &colName,
RLoopManager &lm,
RDataSource &ds, RColumnRegister &colRegister)
486 if (colRegister.IsDefineOrAlias(colName))
497 std::vector<std::unique_ptr<RColumnReaderBase>> colReaders;
498 colReaders.reserve(nSlots);
501 if (!valuePtrs.empty()) {
502 for (
auto *ptr : valuePtrs)
503 colReaders.emplace_back(
new RDSColumnReader<T>(ptr));
507 for (
auto slot = 0u; slot < lm.
GetNSlots(); ++slot)
508 colReaders.emplace_back(
517template <
typename... ColumnTypes>
522 using expander =
int[];
524 (void)expander{(AddDSColumnsHelper<ColumnTypes>(requiredCols[i], lm, ds, colRegister), ++i)..., 0};
533void JitFilterHelper(F &&
f,
const ColumnNames_t &cols, RColumnRegister &colRegister,
543 using Callable_t = std::decay_t<F>;
545 using PrevNode_t =
typename decltype(prevNode)::element_type;
547 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
548 constexpr auto nColumns = ColTypes_t::list_size;
553 if (ds !=
nullptr && !cols.empty())
554 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
557 std::unique_ptr<RFilterBase>(
new F_t(std::forward<F>(
f), cols, prevNode, colRegister, jittedFilter->
GetName())));
560namespace DefineTypes {
562struct RDefinePerSampleTag {};
566auto MakeDefineNode(DefineTypes::RDefineTag, std::string_view
name, std::string_view dummyType, F &&
f,
567 const ColumnNames_t &cols, RColumnRegister &colRegister,
RLoopManager &lm)
570 name, dummyType, std::forward<F>(
f), cols, colRegister, lm));
574auto MakeDefineNode(DefineTypes::RDefinePerSampleTag, std::string_view
name, std::string_view dummyType, F &&
f,
575 const ColumnNames_t &, RColumnRegister &,
RLoopManager &lm)
577 return std::unique_ptr<RDefineBase>(
584template <
typename RDefineTypeTag,
typename F>
585void JitDefineHelper(F &&
f,
const ColumnNames_t &cols, RColumnRegister &colRegister,
595 using Callable_t = std::decay_t<F>;
596 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
599 if (ds !=
nullptr && !cols.empty())
600 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
604 const auto dummyType =
"jittedCol_t";
606 std::unique_ptr<RDefineBase> newCol{
607 MakeDefineNode(RDefineTypeTag{}, jittedDefine->
GetName(), dummyType, std::forward<F>(
f), cols, colRegister, lm)};
608 jittedDefine->
SetDefine(std::move(newCol));
611template <
bool IsSingleColumn,
typename F>
612void JitVariationHelper(F &&
f,
const ColumnNames_t &inputColNames, RColumnRegister &colRegister,
614 const ColumnNames_t &variedColNames,
const ColumnNames_t &variationTags)
noexcept
617 if (!jittedVariation) {
623 using Callable_t = std::decay_t<F>;
624 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
627 if (ds !=
nullptr && !inputColNames.empty())
628 AddDSColumns(inputColNames, lm, *ds, ColTypes_t(), colRegister);
631 std::unique_ptr<RVariationBase> newVariation{
new RVariation<std::decay_t<F>, IsSingleColumn>(
632 variedColNames, jittedVariation->GetVariationName(), std::forward<F>(
f), variationTags,
633 jittedVariation->GetTypeName(), colRegister, lm, inputColNames)};
634 jittedVariation->SetVariation(std::move(newVariation));
638template <
typename ActionTag,
typename... ColTypes,
typename HelperArgType>
640 RJittedAction *jittedAction,
unsigned int nSlots,
641 std::shared_ptr<HelperArgType> *helperArg)
noexcept
649 using ColTypes_t =
TypeList<ColTypes...>;
650 constexpr auto nColumns = ColTypes_t::list_size;
652 if (ds !=
nullptr && !cols.empty())
653 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
656 BuildAction<ColTypes...>(cols, *helperArg, nSlots, jittedAction->MoveOutPrevNode(), ActionTag{}, colRegister);
657 jittedAction->SetAction(std::move(actionPtr));
661template <typename T, bool Container = IsDataContainer<T>::value && !std::is_same<T, std::string>::value>
662struct RMinReturnType {
672struct RMinReturnType<T, true> {
673 using type = TTraits::TakeFirstParameter_t<T>;
677template <
typename R,
typename F,
typename... Args>
680 return [
f](
unsigned int, Args...
a)
mutable ->
R {
return f(
a...); };
683template <
typename ColType,
typename... Rest>
684struct RNeedJittingHelper {
685 static constexpr bool value = RNeedJittingHelper<Rest...>
::value;
688template <
typename... Rest>
690 static constexpr bool value =
true;
694struct RNeedJittingHelper<T> {
695 static constexpr bool value =
false;
700 static constexpr bool value =
true;
703template <
typename ...ColTypes>
705 static constexpr bool value = RNeedJittingHelper<ColTypes...>
::value;
709struct RNeedJitting<> {
710 static constexpr bool value =
false;
717template <
typename R,
typename Merge,
typename U,
typename T,
typename decayedU = std::decay_t<U>,
718 typename mergeArgsNoDecay_t =
typename CallableTraits<Merge>::arg_types_nodecay,
719 typename mergeArgs_t =
typename CallableTraits<Merge>::arg_types,
720 typename mergeRet_t =
typename CallableTraits<Merge>::ret_type>
723 constexpr bool isAggregatorOk =
724 (std::is_same<R, decayedU>::value) || (std::is_same<R, void>::value && std::is_lvalue_reference<U>::value);
725 static_assert(isAggregatorOk,
"aggregator function must have signature `U(U,T)` or `void(U&,T)`");
726 constexpr bool isMergeOk =
727 (std::is_same<TypeList<decayedU, decayedU>, mergeArgs_t>
::value && std::is_same<decayedU, mergeRet_t>::value) ||
728 (std::is_same<
TypeList<std::vector<decayedU> &>, mergeArgsNoDecay_t>
::value &&
729 std::is_same<void, mergeRet_t>::value);
730 static_assert(isMergeOk,
"merge function must have signature `U(U,U)` or `void(std::vector<U>&)`");
735template <
typename R,
typename T>
736void CheckAggregate(T)
738 static_assert(
sizeof(T) == 0,
"aggregator function must take exactly two arguments");
746const ColumnNames_t
SelectColumns(
unsigned int nArgs,
const ColumnNames_t &bl,
const ColumnNames_t &defBl);
749ColumnNames_t
FindUnknownColumns(
const ColumnNames_t &requiredCols,
const RColumnRegister &definedCols,
750 const ColumnNames_t &dataSourceColumns);
753std::vector<std::string>
GetFilterNames(
const std::shared_ptr<RLoopManager> &loopManager);
756template <
typename NodeType>
757std::vector<std::string>
GetFilterNames(
const std::shared_ptr<NodeType> &node)
759 std::vector<std::string> filterNames;
760 node->AddFilterName(filterNames);
764struct ParsedTreePath {
765 std::string fTreeName;
766 std::string fDirName;
776using IsTrueForAllImpl_t =
typename std::is_same<TBoolPack<bs...,
true>, TBoolPack<
true, bs...>>;
778template <
bool... Conditions>
780 static constexpr bool value = IsTrueForAllImpl_t<Conditions...>
::value;
787struct IsList_t : std::false_type {};
790struct IsList_t<std::list<T>> : std::true_type {};
793struct IsDeque_t : std::false_type {};
796struct IsDeque_t<std::deque<T>> : std::true_type {};
804struct InnerValueType {
808template <
typename Elem>
814using InnerValueType_t =
typename InnerValueType<T>::type;
816std::pair<std::vector<std::string>, std::vector<std::string>>
818 std::vector<std::string> &&colsWithAliases);
831using MinReturnType_t =
typename RDFInternal::RMinReturnType<T>::type;
834using MaxReturnType_t = MinReturnType_t<T>;
837using SumReturnType_t = MinReturnType_t<T>;
#define R(a, b, c, d, e, f, g, h, i)
Int_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
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 filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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
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.
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.
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.
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.
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.