11#ifndef ROOT_RDF_TINTERFACE_UTILS
12#define ROOT_RDF_TINTERFACE_UTILS
31#include <RConfigure.h>
53template <
typename Proxied>
72ConvertRegexToColumns(
const ColumnNames_t &colNames, std::string_view columnNameRegexp, std::string_view callerName);
75class RIgnoreErrorLevelRAII {
80 RIgnoreErrorLevelRAII(
int errorIgnoreLevel) {
gErrorIgnoreLevel = errorIgnoreLevel; }
93struct HistoNSparseD{};
95struct HistWithWeight{};
97struct GraphAsymmErrors{};
113template <
typename T,
bool ISV6HISTO = std::is_base_of<TH1, std::decay_t<T>>::value>
115 static bool HasAxisLimits(T &
h)
117 auto xaxis =
h.GetXaxis();
118 return !(xaxis->GetXmin() == 0. && xaxis->GetXmax() == 0.);
123struct HistoUtils<T, false> {
124 static bool HasAxisLimits(T &) {
return true; }
128template <
typename... ColTypes,
typename ActionTag,
typename ActionResultType,
typename PrevNodeType>
129std::unique_ptr<RActionBase>
130BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
131 std::shared_ptr<PrevNodeType> prevNode, ActionTag,
const RColumnRegister &colRegister)
133 using Helper_t = FillHelper<ActionResultType>;
134 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
135 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
139template <
typename... ColTypes,
typename PrevNodeType>
140std::unique_ptr<RActionBase>
141BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<::TH1D> &
h,
const unsigned int nSlots,
142 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo1D,
const RColumnRegister &colRegister)
144 auto hasAxisLimits = HistoUtils<::TH1D>::HasAxisLimits(*
h);
147 using Helper_t = FillHelper<::TH1D>;
148 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
149 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
151 using Helper_t = BufferedFillHelper;
152 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
153 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
158template <
typename... ColTypes,
typename ActionResultType,
typename PrevNodeType>
159std::unique_ptr<RActionBase>
160BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
161 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo3D,
const RColumnRegister &colRegister)
164 using Helper_t = FillHelper<ActionResultType>;
165 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
166 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
168 using Helper_t = ThreadSafeFillHelper<ActionResultType>;
169 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
170 if constexpr (
sizeof...(ColTypes) > 3) {
174 return std::make_unique<Action_t>(Helper_t(
h, histoSlots), bl, std::move(prevNode), colRegister);
180template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
181std::unique_ptr<RActionBase>
183 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Hist,
184 const RColumnRegister &colRegister)
186 using Helper_t = RHistFillHelper<BinContentType>;
187 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
188 return std::make_unique<Action_t>(Helper_t(
h, nSlots), columnList, std::move(prevNode), colRegister);
192template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
193std::unique_ptr<RActionBase>
195 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::HistWithWeight,
196 const RColumnRegister &colRegister)
198 using Helper_t = RHistFillHelper<BinContentType, true>;
199 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
200 return std::make_unique<Action_t>(Helper_t(
h, nSlots), columnList, std::move(prevNode), colRegister);
204template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
205std::unique_ptr<RActionBase>
207 const unsigned int, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Hist,
208 const RColumnRegister &colRegister)
210 using Helper_t = RHistEngineFillHelper<BinContentType>;
211 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
212 return std::make_unique<Action_t>(Helper_t(
h), columnList, std::move(prevNode), colRegister);
216template <
typename... ColTypes,
typename BinContentType,
typename PrevNodeType>
217std::unique_ptr<RActionBase>
219 const unsigned int, std::shared_ptr<PrevNodeType> prevNode, ActionTags::HistWithWeight,
220 const RColumnRegister &colRegister)
222 using Helper_t = RHistEngineFillHelper<BinContentType, true>;
223 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
224 return std::make_unique<Action_t>(Helper_t(
h), columnList, std::move(prevNode), colRegister);
228template <
typename... ColTypes,
typename PrevNodeType>
229std::unique_ptr<RActionBase>
230BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraph> &
g,
const unsigned int nSlots,
231 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Graph,
const RColumnRegister &colRegister)
233 using Helper_t = FillTGraphHelper;
234 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
235 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
238template <
typename... ColTypes,
typename PrevNodeType>
239std::unique_ptr<RActionBase>
240BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraphAsymmErrors> &
g,
const unsigned int nSlots,
241 std::shared_ptr<PrevNodeType> prevNode, ActionTags::GraphAsymmErrors,
const RColumnRegister &colRegister)
243 using Helper_t = FillTGraphAsymmErrorsHelper;
244 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
245 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
249template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
250std::unique_ptr<RActionBase>
251BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &minV,
const unsigned int nSlots,
252 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Min,
const RColumnRegister &colRegister)
254 using Helper_t = MinHelper<ActionResultType>;
255 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
256 return std::make_unique<Action_t>(Helper_t(minV, nSlots), bl, std::move(prevNode), colRegister);
260template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
261std::unique_ptr<RActionBase>
262BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &maxV,
const unsigned int nSlots,
263 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Max,
const RColumnRegister &colRegister)
265 using Helper_t = MaxHelper<ActionResultType>;
266 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
267 return std::make_unique<Action_t>(Helper_t(maxV, nSlots), bl, std::move(prevNode), colRegister);
271template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
272std::unique_ptr<RActionBase>
273BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &sumV,
const unsigned int nSlots,
274 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Sum,
const RColumnRegister &colRegister)
276 using Helper_t = SumHelper<ActionResultType>;
277 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
278 return std::make_unique<Action_t>(Helper_t(sumV, nSlots), bl, std::move(prevNode), colRegister);
282template <
typename ColType,
typename PrevNodeType>
283std::unique_ptr<RActionBase>
284BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &meanV,
const unsigned int nSlots,
285 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Mean,
const RColumnRegister &colRegister)
287 using Helper_t = MeanHelper;
288 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
289 return std::make_unique<Action_t>(Helper_t(meanV, nSlots), bl, std::move(prevNode), colRegister);
293template <
typename ColType,
typename PrevNodeType>
294std::unique_ptr<RActionBase>
295BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &stdDeviationV,
const unsigned int nSlots,
296 std::shared_ptr<PrevNodeType> prevNode, ActionTags::StdDev,
const RColumnRegister &colRegister)
298 using Helper_t = StdDevHelper;
299 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
300 return std::make_unique<Action_t>(Helper_t(stdDeviationV, nSlots), bl, prevNode, colRegister);
304template <
typename ColType,
typename PrevNodeType>
305std::unique_ptr<RActionBase>
306BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &meanV,
const unsigned int nSlots,
307 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Median,
const RColumnRegister &colRegister)
309 using Helper_t = MedianHelper;
310 using Action_t = RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColType>>;
311 return std::make_unique<Action_t>(Helper_t(meanV, nSlots), bl, std::move(prevNode), colRegister);
314using displayHelperArgs_t = std::pair<size_t, std::shared_ptr<ROOT::RDF::RDisplay>>;
317template <
typename... ColTypes,
typename PrevNodeType>
318std::unique_ptr<RActionBase>
319BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<displayHelperArgs_t> &helperArgs,
const unsigned int,
320 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Display,
const RColumnRegister &colRegister)
322 using Helper_t = DisplayHelper<PrevNodeType>;
323 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
324 return std::make_unique<Action_t>(Helper_t(helperArgs->first, helperArgs->second, prevNode), bl, prevNode,
328struct SnapshotHelperArgs {
329 std::string fFileName;
330 std::string fDirName;
331 std::string fTreeName;
332 std::vector<std::string> fOutputColNames;
337 bool fIncludeVariations;
340template <
typename PrevNodeType>
341std::unique_ptr<RActionBase>
342BuildAction(
const ColumnNames_t &colNames,
const std::shared_ptr<SnapshotHelperArgs> &snapHelperArgs,
343 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode,
const RColumnRegister &colRegister,
344 const std::vector<const std::type_info *> &colTypeIDs)
346 const auto &
filename = snapHelperArgs->fFileName;
347 const auto &dirname = snapHelperArgs->fDirName;
348 const auto &treename = snapHelperArgs->fTreeName;
349 const auto &outputColNames = snapHelperArgs->fOutputColNames;
350 const auto &options = snapHelperArgs->fOptions;
351 const auto &outputLM = snapHelperArgs->fOutputLoopManager;
352 const auto &inputLM = snapHelperArgs->fInputLoopManager;
354 auto sz = colNames.size();
355 std::vector<bool> isDefine(sz);
356 for (
auto i = 0u; i < sz; ++i)
357 isDefine[i] = colRegister.IsDefineOrAlias(colNames[i]);
359 std::unique_ptr<RActionBase> actionPtr;
360 if (snapHelperArgs->fToNTuple) {
362 using Helper_t = UntypedSnapshotRNTupleHelper;
363 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
365 actionPtr.reset(
new Action_t(Helper_t(nSlots,
filename, dirname, treename, colNames, outputColNames, options,
366 inputLM, outputLM, colTypeIDs),
367 colNames, colTypeIDs, prevNode, colRegister));
371 if (snapHelperArgs->fIncludeVariations) {
372 using Helper_t = SnapshotHelperWithVariations;
373 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
374 actionPtr.reset(
new Action_t(Helper_t(
filename, dirname, treename, colNames, outputColNames, options,
375 std::move(isDefine), outputLM, inputLM, colTypeIDs),
376 colNames, colTypeIDs, prevNode, colRegister));
378 using Helper_t = UntypedSnapshotTTreeHelper;
379 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
380 actionPtr.reset(
new Action_t(Helper_t(
filename, dirname, treename, colNames, outputColNames, options,
381 std::move(isDefine), outputLM, inputLM, colTypeIDs),
382 colNames, colTypeIDs, prevNode, colRegister));
385 if (snapHelperArgs->fIncludeVariations) {
386 throw std::invalid_argument(
"Multi-threaded snapshot with variations is not supported yet.");
389 using Helper_t = UntypedSnapshotTTreeHelperMT;
390 using Action_t = RActionSnapshot<Helper_t, PrevNodeType>;
391 actionPtr.reset(
new Action_t(Helper_t(nSlots,
filename, dirname, treename, colNames, outputColNames, options,
392 std::move(isDefine), outputLM, inputLM, colTypeIDs),
393 colNames, colTypeIDs, prevNode, colRegister));
401template <
typename... ColTypes,
typename PrevNodeType,
typename Helper_t>
402std::unique_ptr<RActionBase>
403BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<Helper_t> &
h,
const unsigned int ,
404 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Book,
const RColumnRegister &colRegister)
406 using Action_t = RAction<Helper_t, PrevNodeType,
TTraits::TypeList<ColTypes...>>;
407 return std::make_unique<Action_t>(Helper_t(std::move(*
h)), bl, std::move(prevNode), colRegister);
412template <
typename Filter>
413void CheckFilter(Filter &)
415 using FilterRet_t =
typename RDF::CallableTraits<Filter>::ret_type;
416 static_assert(std::is_convertible<FilterRet_t, bool>::value,
417 "filter expression returns a type that is not convertible to bool");
424void CheckForRedefinition(
const std::string &where, std::string_view definedCol,
const RColumnRegister &colRegister,
425 const ColumnNames_t &dataSourceColumns);
427void CheckForDefinition(
const std::string &where, std::string_view definedColView,
const RColumnRegister &colRegister,
428 const ColumnNames_t &dataSourceColumns);
431 const RColumnRegister &colRegister);
435std::shared_ptr<RJittedFilter>
BookFilterJit(std::shared_ptr<RNodeBase> prevNode, std::string_view
name,
436 std::string_view expression,
const RColumnRegister &colRegister,
440 RDataSource *ds,
const RColumnRegister &colRegister);
445std::shared_ptr<RJittedVariation>
446BookVariationJit(
const std::vector<std::string> &colNames, std::string_view variationName,
447 const std::vector<std::string> &variationTags, std::string_view expression,
RLoopManager &lm,
448 RDataSource *ds,
const RColumnRegister &colRegister,
bool isSingleColumn,
449 const std::string &varyColType);
451std::string
JitBuildAction(
const ColumnNames_t &bl,
const std::type_info &art,
const std::type_info &at,
TTree *tree,
452 const unsigned int nSlots,
const RColumnRegister &colRegister,
RDataSource *ds,
453 const bool vector2RVec =
true);
459std::shared_ptr<RNodeBase>
UpcastNode(std::shared_ptr<RNodeBase> ptr);
462 const RColumnRegister &validDefines,
RDataSource *ds);
464std::vector<std::string>
GetValidatedArgTypes(
const ColumnNames_t &colNames,
const RColumnRegister &colRegister,
469void AddDSColumnsHelper(
const std::string &colName,
RLoopManager &lm,
RDataSource &ds, RColumnRegister &colRegister)
472 if (colRegister.IsDefineOrAlias(colName))
483 std::vector<std::unique_ptr<RColumnReaderBase>> colReaders;
484 colReaders.reserve(nSlots);
487 if (!valuePtrs.empty()) {
488 for (
auto *ptr : valuePtrs)
489 colReaders.emplace_back(
new RDSColumnReader<T>(ptr));
493 for (
auto slot = 0u; slot < lm.
GetNSlots(); ++slot)
494 colReaders.emplace_back(
503template <
typename... ColumnTypes>
508 using expander =
int[];
510 (void)expander{(AddDSColumnsHelper<ColumnTypes>(requiredCols[i], lm, ds, colRegister), ++i)..., 0};
519void JitFilterHelper(F &&
f,
const ColumnNames_t &cols, RColumnRegister &colRegister,
529 using Callable_t = std::decay_t<F>;
531 using PrevNode_t =
typename decltype(prevNode)::element_type;
533 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
534 constexpr auto nColumns = ColTypes_t::list_size;
539 if (ds !=
nullptr && !cols.empty())
540 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
543 std::unique_ptr<RFilterBase>(
new F_t(std::forward<F>(
f), cols, prevNode, colRegister, jittedFilter->
GetName())));
546namespace DefineTypes {
548struct RDefinePerSampleTag {};
552auto MakeDefineNode(DefineTypes::RDefineTag, std::string_view
name, std::string_view dummyType, F &&
f,
553 const ColumnNames_t &cols, RColumnRegister &colRegister,
RLoopManager &lm)
556 name, dummyType, std::forward<F>(
f), cols, colRegister, lm));
560auto MakeDefineNode(DefineTypes::RDefinePerSampleTag, std::string_view
name, std::string_view dummyType, F &&
f,
561 const ColumnNames_t &, RColumnRegister &,
RLoopManager &lm)
563 return std::unique_ptr<RDefineBase>(
570template <
typename RDefineTypeTag,
typename F>
571void JitDefineHelper(F &&
f,
const ColumnNames_t &cols, RColumnRegister &colRegister,
581 using Callable_t = std::decay_t<F>;
582 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
585 if (ds !=
nullptr && !cols.empty())
586 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
590 const auto dummyType =
"jittedCol_t";
592 std::unique_ptr<RDefineBase> newCol{
593 MakeDefineNode(RDefineTypeTag{}, jittedDefine->
GetName(), dummyType, std::forward<F>(
f), cols, colRegister, lm)};
594 jittedDefine->
SetDefine(std::move(newCol));
597template <
bool IsSingleColumn,
typename F>
598void JitVariationHelper(F &&
f,
const ColumnNames_t &inputColNames, RColumnRegister &colRegister,
600 const ColumnNames_t &variedColNames,
const ColumnNames_t &variationTags)
noexcept
603 if (!jittedVariation) {
609 using Callable_t = std::decay_t<F>;
610 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
613 if (ds !=
nullptr && !inputColNames.empty())
614 AddDSColumns(inputColNames, lm, *ds, ColTypes_t(), colRegister);
617 std::unique_ptr<RVariationBase> newVariation{
new RVariation<std::decay_t<F>, IsSingleColumn>(
618 variedColNames, jittedVariation->GetVariationName(), std::forward<F>(
f), variationTags,
619 jittedVariation->GetTypeName(), colRegister, lm, inputColNames)};
620 jittedVariation->SetVariation(std::move(newVariation));
624template <
typename ActionTag,
typename... ColTypes,
typename HelperArgType>
626 RJittedAction *jittedAction,
unsigned int nSlots,
627 std::shared_ptr<HelperArgType> *helperArg)
noexcept
635 using ColTypes_t =
TypeList<ColTypes...>;
636 constexpr auto nColumns = ColTypes_t::list_size;
638 if (ds !=
nullptr && !cols.empty())
639 AddDSColumns(cols, lm, *ds, ColTypes_t(), colRegister);
642 BuildAction<ColTypes...>(cols, *helperArg, nSlots, jittedAction->MoveOutPrevNode(), ActionTag{}, colRegister);
643 jittedAction->SetAction(std::move(actionPtr));
647template <typename T, bool Container = IsDataContainer<T>::value && !std::is_same<T, std::string>::value>
648struct RMinReturnType {
658struct RMinReturnType<T, true> {
659 using type = TTraits::TakeFirstParameter_t<T>;
663template <
typename R,
typename F,
typename... Args>
666 return [
f](
unsigned int, Args...
a)
mutable ->
R {
return f(
a...); };
669template <
typename ColType,
typename... Rest>
670struct RNeedJittingHelper {
671 static constexpr bool value = RNeedJittingHelper<Rest...>
::value;
674template <
typename... Rest>
676 static constexpr bool value =
true;
680struct RNeedJittingHelper<T> {
681 static constexpr bool value =
false;
686 static constexpr bool value =
true;
689template <
typename ...ColTypes>
691 static constexpr bool value = RNeedJittingHelper<ColTypes...>
::value;
695struct RNeedJitting<> {
696 static constexpr bool value =
false;
703template <
typename R,
typename Merge,
typename U,
typename T,
typename decayedU = std::decay_t<U>,
704 typename mergeArgsNoDecay_t =
typename CallableTraits<Merge>::arg_types_nodecay,
705 typename mergeArgs_t =
typename CallableTraits<Merge>::arg_types,
706 typename mergeRet_t =
typename CallableTraits<Merge>::ret_type>
709 constexpr bool isAggregatorOk =
710 (std::is_same<R, decayedU>::value) || (std::is_same<R, void>::value && std::is_lvalue_reference<U>::value);
711 static_assert(isAggregatorOk,
"aggregator function must have signature `U(U,T)` or `void(U&,T)`");
712 constexpr bool isMergeOk =
713 (std::is_same<TypeList<decayedU, decayedU>, mergeArgs_t>
::value && std::is_same<decayedU, mergeRet_t>::value) ||
714 (std::is_same<
TypeList<std::vector<decayedU> &>, mergeArgsNoDecay_t>
::value &&
715 std::is_same<void, mergeRet_t>::value);
716 static_assert(isMergeOk,
"merge function must have signature `U(U,U)` or `void(std::vector<U>&)`");
721template <
typename R,
typename T>
722void CheckAggregate(T)
724 static_assert(
sizeof(T) == 0,
"aggregator function must take exactly two arguments");
732const ColumnNames_t
SelectColumns(
unsigned int nArgs,
const ColumnNames_t &bl,
const ColumnNames_t &defBl);
735ColumnNames_t
FindUnknownColumns(
const ColumnNames_t &requiredCols,
const RColumnRegister &definedCols,
736 const ColumnNames_t &dataSourceColumns);
739std::vector<std::string>
GetFilterNames(
const std::shared_ptr<RLoopManager> &loopManager);
742template <
typename NodeType>
743std::vector<std::string>
GetFilterNames(
const std::shared_ptr<NodeType> &node)
745 std::vector<std::string> filterNames;
746 node->AddFilterName(filterNames);
750struct ParsedTreePath {
751 std::string fTreeName;
752 std::string fDirName;
762using IsTrueForAllImpl_t =
typename std::is_same<TBoolPack<bs...,
true>, TBoolPack<
true, bs...>>;
764template <
bool... Conditions>
766 static constexpr bool value = IsTrueForAllImpl_t<Conditions...>
::value;
773struct IsList_t : std::false_type {};
776struct IsList_t<std::list<T>> : std::true_type {};
779struct IsDeque_t : std::false_type {};
782struct IsDeque_t<std::deque<T>> : std::true_type {};
790struct InnerValueType {
794template <
typename Elem>
800using InnerValueType_t =
typename InnerValueType<T>::type;
802std::pair<std::vector<std::string>, std::vector<std::string>>
804 std::vector<std::string> &&colsWithAliases);
817using MinReturnType_t =
typename RDFInternal::RMinReturnType<T>::type;
820using MaxReturnType_t = MinReturnType_t<T>;
823using 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.