11#ifndef ROOT_RDF_TINTERFACE_UTILS
12#define ROOT_RDF_TINTERFACE_UTILS
42#include <unordered_map>
55template<
typename T,
typename V>
78class RIgnoreErrorLevelRAII {
83 RIgnoreErrorLevelRAII(
int errorIgnoreLevel) {
gErrorIgnoreLevel = errorIgnoreLevel; }
112template <
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 void SetCanExtendAllAxes(T &) {}
125 static bool HasAxisLimits(T &) {
return true; }
129template <
typename... ColTypes,
typename ActionTag,
typename ActionResultType,
typename PrevNodeType>
130std::unique_ptr<RActionBase>
131BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &
h,
const unsigned int nSlots,
132 std::shared_ptr<PrevNodeType> prevNode, ActionTag,
const RColumnRegister &colRegister)
134 using Helper_t = FillHelper<ActionResultType>;
135 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
136 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
140template <
typename... ColTypes,
typename PrevNodeType>
141std::unique_ptr<RActionBase>
142BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<::TH1D> &
h,
const unsigned int nSlots,
143 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Histo1D,
const RColumnRegister &colRegister)
145 auto hasAxisLimits = HistoUtils<::TH1D>::HasAxisLimits(*
h);
148 using Helper_t = FillHelper<::TH1D>;
149 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
150 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
152 using Helper_t = BufferedFillHelper;
153 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
154 return std::make_unique<Action_t>(Helper_t(
h, nSlots), bl, std::move(prevNode), colRegister);
158template <
typename... ColTypes,
typename PrevNodeType>
159std::unique_ptr<RActionBase>
160BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraph> &
g,
const unsigned int nSlots,
161 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Graph,
const RColumnRegister &colRegister)
163 using Helper_t = FillTGraphHelper;
164 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
165 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
168template <
typename... ColTypes,
typename PrevNodeType>
169std::unique_ptr<RActionBase>
170BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<TGraphAsymmErrors> &
g,
const unsigned int nSlots,
171 std::shared_ptr<PrevNodeType> prevNode, ActionTags::GraphAsymmErrors,
const RColumnRegister &colRegister)
173 using Helper_t = FillTGraphAsymmErrorsHelper;
174 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
175 return std::make_unique<Action_t>(Helper_t(
g, nSlots), bl, std::move(prevNode), colRegister);
179template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
180std::unique_ptr<RActionBase>
181BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &minV,
const unsigned int nSlots,
182 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Min,
const RColumnRegister &colRegister)
184 using Helper_t = MinHelper<ActionResultType>;
186 return std::make_unique<Action_t>(Helper_t(minV, nSlots), bl, std::move(prevNode), colRegister);
190template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
191std::unique_ptr<RActionBase>
192BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &maxV,
const unsigned int nSlots,
193 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Max,
const RColumnRegister &colRegister)
195 using Helper_t = MaxHelper<ActionResultType>;
197 return std::make_unique<Action_t>(Helper_t(maxV, nSlots), bl, std::move(prevNode), colRegister);
201template <
typename ColType,
typename PrevNodeType,
typename ActionResultType>
202std::unique_ptr<RActionBase>
203BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<ActionResultType> &sumV,
const unsigned int nSlots,
204 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Sum,
const RColumnRegister &colRegister)
206 using Helper_t = SumHelper<ActionResultType>;
208 return std::make_unique<Action_t>(Helper_t(sumV, nSlots), bl, std::move(prevNode), colRegister);
212template <
typename ColType,
typename PrevNodeType>
213std::unique_ptr<RActionBase>
214BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &meanV,
const unsigned int nSlots,
215 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Mean,
const RColumnRegister &colRegister)
217 using Helper_t = MeanHelper;
219 return std::make_unique<Action_t>(Helper_t(meanV, nSlots), bl, std::move(prevNode), colRegister);
223template <
typename ColType,
typename PrevNodeType>
224std::unique_ptr<RActionBase>
225BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<double> &stdDeviationV,
const unsigned int nSlots,
226 std::shared_ptr<PrevNodeType> prevNode, ActionTags::StdDev,
const RColumnRegister &colRegister)
228 using Helper_t = StdDevHelper;
230 return std::make_unique<Action_t>(Helper_t(stdDeviationV, nSlots), bl, prevNode, colRegister);
233using displayHelperArgs_t = std::pair<size_t, std::shared_ptr<ROOT::RDF::RDisplay>>;
236template <
typename... ColTypes,
typename PrevNodeType>
237std::unique_ptr<RActionBase>
238BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<displayHelperArgs_t> &helperArgs,
const unsigned int,
239 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Display,
const RColumnRegister &colRegister)
242 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
243 return std::make_unique<Action_t>(Helper_t(helperArgs->first, helperArgs->second, prevNode), bl, prevNode,
247struct SnapshotHelperArgs {
248 std::string fFileName;
249 std::string fDirName;
250 std::string fTreeName;
251 std::vector<std::string> fOutputColNames;
252 ROOT::RDF::RSnapshotOptions fOptions;
256template <
typename... ColTypes,
typename PrevNodeType>
257std::unique_ptr<RActionBase>
258BuildAction(
const ColumnNames_t &colNames,
const std::shared_ptr<SnapshotHelperArgs> &snapHelperArgs,
259 const unsigned int nSlots, std::shared_ptr<PrevNodeType> prevNode, ActionTags::Snapshot,
262 const auto &
filename = snapHelperArgs->fFileName;
263 const auto &dirname = snapHelperArgs->fDirName;
264 const auto &treename = snapHelperArgs->fTreeName;
265 const auto &outputColNames = snapHelperArgs->fOutputColNames;
266 const auto &options = snapHelperArgs->fOptions;
268 auto makeIsDefine = [&] {
269 std::vector<bool> isDef;
270 isDef.reserve(
sizeof...(ColTypes));
271 for (
auto i = 0u;
i <
sizeof...(ColTypes); ++
i)
272 isDef.push_back(colRegister.IsDefineOrAlias(colNames[
i]));
275 std::vector<bool> isDefine = makeIsDefine();
277 std::unique_ptr<RActionBase> actionPtr;
280 using Helper_t = SnapshotHelper<ColTypes...>;
283 new Action_t(Helper_t(
filename, dirname, treename, colNames, outputColNames, options, std::move(isDefine)),
284 colNames, prevNode, colRegister));
287 using Helper_t = SnapshotHelperMT<ColTypes...>;
289 actionPtr.reset(
new Action_t(
290 Helper_t(nSlots,
filename, dirname, treename, colNames, outputColNames, options, std::move(isDefine)),
291 colNames, prevNode, colRegister));
297template <
typename... ColTypes,
typename PrevNodeType,
typename Helper_t>
298std::unique_ptr<RActionBase>
299BuildAction(
const ColumnNames_t &bl,
const std::shared_ptr<Helper_t> &
h,
const unsigned int ,
300 std::shared_ptr<PrevNodeType> prevNode, ActionTags::Book,
const RColumnRegister &colRegister)
302 using Action_t =
RAction<Helper_t, PrevNodeType, TTraits::TypeList<ColTypes...>>;
303 return std::make_unique<Action_t>(Helper_t(std::move(*
h)), bl, std::move(prevNode), colRegister);
308template <
typename Filter>
311 using FilterRet_t =
typename RDF::CallableTraits<Filter>::ret_type;
312 static_assert(std::is_convertible<FilterRet_t, bool>::value,
313 "filter expression returns a type that is not convertible to bool");
331std::shared_ptr<RJittedFilter>
BookFilterJit(std::shared_ptr<RNodeBase> *prevNodeOnHeap, std::string_view
name,
337 const ColumnNames_t &branches, std::shared_ptr<RNodeBase> *prevNodeOnHeap);
341 std::shared_ptr<RNodeBase> *upcastNodeOnHeap);
343std::shared_ptr<RJittedVariation>
344BookVariationJit(
const std::vector<std::string> &colNames, std::string_view variationName,
345 const std::vector<std::string> &variationTags, std::string_view expression,
RLoopManager &lm,
347 std::shared_ptr<RNodeBase> *upcastNodeOnHeap,
bool isSingleColumn);
350 const std::type_info &art,
const std::type_info &at,
void *rOnHeap, TTree *tree,
352 std::weak_ptr<RJittedAction> *jittedActionOnHeap);
361std::weak_ptr<T> *MakeWeakOnHeap(
const std::shared_ptr<T> &shPtr)
363 return new std::weak_ptr<T>(shPtr);
368std::shared_ptr<T> *MakeSharedOnHeap(
const std::shared_ptr<T> &shPtr)
370 return new std::shared_ptr<T>(shPtr);
377std::shared_ptr<RNodeBase>
UpcastNode(std::shared_ptr<RNodeBase> ptr);
383 TTree *tree,
RDataSource *ds,
const std::string &context,
391 if (colRegister.IsDefineOrAlias(colName) || !ds.
HasColumn(colName) ||
396 std::vector<std::unique_ptr<RColumnReaderBase>> colReaders;
397 colReaders.reserve(nSlots);
400 if (!valuePtrs.empty()) {
401 for (
auto *ptr : valuePtrs)
406 for (
auto slot = 0u; slot < lm.
GetNSlots(); ++slot)
415template <
typename... ColumnTypes>
420 using expander =
int[];
422 (
void)expander{(AddDSColumnsHelper<ColumnTypes>(requiredCols[
i], lm, ds, colRegister), ++
i)..., 0};
426template <
typename F,
typename PrevNode>
427void JitFilterHelper(
F &&
f,
const char **colsPtr, std::size_t colsSize, std::string_view
name,
428 std::weak_ptr<RJittedFilter> *wkJittedFilter, std::shared_ptr<PrevNode> *prevNodeOnHeap,
431 if (wkJittedFilter->expired()) {
434 delete wkJittedFilter;
436 delete prevNodeOnHeap;
443 const auto jittedFilter = wkJittedFilter->lock();
446 using Callable_t = std::decay_t<F>;
448 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
449 constexpr auto nColumns = ColTypes_t::list_size;
456 AddDSColumns(cols, lm, *ds, ColTypes_t(), *colRegister);
458 jittedFilter->SetFilter(
459 std::unique_ptr<RFilterBase>(
new F_t(std::forward<F>(
f), cols, *prevNodeOnHeap, *colRegister,
name)));
463 delete prevNodeOnHeap;
464 delete wkJittedFilter;
467namespace DefineTypes {
469struct RDefinePerSampleTag {};
473auto MakeDefineNode(DefineTypes::RDefineTag, std::string_view
name, std::string_view dummyType,
F &&
f,
476 return std::unique_ptr<RDefineBase>(
new RDefine<std::decay_t<F>, ExtraArgsForDefine::None>(
477 name, dummyType, std::forward<F>(
f), cols, colRegister, lm));
481auto MakeDefineNode(DefineTypes::RDefinePerSampleTag, std::string_view
name, std::string_view dummyType,
F &&
f,
484 return std::unique_ptr<RDefineBase>(
491template <
typename RDefineTypeTag,
typename F>
492void JitDefineHelper(
F &&
f,
const char **colsPtr, std::size_t colsSize, std::string_view
name,
RLoopManager *lm,
493 std::weak_ptr<RJittedDefine> *wkJittedDefine,
RColumnRegister *colRegister,
494 std::shared_ptr<RNodeBase> *prevNodeOnHeap)
noexcept
497 auto doDeletes = [&] {
498 delete wkJittedDefine;
500 delete prevNodeOnHeap;
504 if (wkJittedDefine->expired()) {
513 auto jittedDefine = wkJittedDefine->lock();
515 using Callable_t = std::decay_t<F>;
516 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
520 AddDSColumns(cols, *lm, *ds, ColTypes_t(), *colRegister);
524 const auto dummyType =
"jittedCol_t";
526 std::unique_ptr<RDefineBase> newCol{
527 MakeDefineNode(RDefineTypeTag{},
name, dummyType, std::forward<F>(
f), cols, *colRegister, *lm)};
528 jittedDefine->SetDefine(std::move(newCol));
533template <
bool IsSingleColumn,
typename F>
534void JitVariationHelper(
F &&
f,
const char **colsPtr, std::size_t colsSize,
const char **variedCols,
535 std::size_t variedColsSize,
const char **variationTags, std::size_t variationTagsSize,
537 std::weak_ptr<RJittedVariation> *wkJittedVariation,
RColumnRegister *colRegister,
538 std::shared_ptr<RNodeBase> *prevNodeOnHeap)
noexcept
541 auto doDeletes = [&] {
544 delete[] variationTags;
546 delete wkJittedVariation;
548 delete prevNodeOnHeap;
551 if (wkJittedVariation->expired()) {
558 const ColumnNames_t inputColNames(colsPtr, colsPtr + colsSize);
559 std::vector<std::string> variedColNames(variedCols, variedCols + variedColsSize);
560 std::vector<std::string> tags(variationTags, variationTags + variationTagsSize);
562 auto jittedVariation = wkJittedVariation->lock();
564 using Callable_t = std::decay_t<F>;
565 using ColTypes_t =
typename TTraits::CallableTraits<Callable_t>::arg_types;
569 AddDSColumns(inputColNames, *lm, *ds, ColTypes_t(), *colRegister);
573 std::move(variedColNames), variationName, std::forward<F>(
f), std::move(tags), jittedVariation->GetTypeName(),
574 *colRegister, *lm, inputColNames)};
575 jittedVariation->SetVariation(std::move(newVariation));
581template <
typename ActionTag,
typename... ColTypes,
typename PrevNodeType,
typename HelperArgType>
582void CallBuildAction(std::shared_ptr<PrevNodeType> *prevNodeOnHeap,
const char **colsPtr, std::size_t colsSize,
583 const unsigned int nSlots, std::shared_ptr<HelperArgType> *helperArgOnHeap,
584 std::weak_ptr<RJittedAction> *wkJittedActionOnHeap,
RColumnRegister *colRegister)
noexcept
587 auto doDeletes = [&] {
589 delete helperArgOnHeap;
590 delete wkJittedActionOnHeap;
594 delete prevNodeOnHeap;
597 if (wkJittedActionOnHeap->expired()) {
606 auto jittedActionOnHeap = wkJittedActionOnHeap->lock();
609 auto &prevNodePtr = *prevNodeOnHeap;
610 auto &loopManager = *prevNodePtr->GetLoopManagerUnchecked();
611 using ColTypes_t =
TypeList<ColTypes...>;
612 constexpr auto nColumns = ColTypes_t::list_size;
613 auto ds = loopManager.GetDataSource();
615 AddDSColumns(cols, loopManager, *ds, ColTypes_t(), *colRegister);
617 auto actionPtr = BuildAction<ColTypes...>(cols, std::move(*helperArgOnHeap), nSlots, std::move(prevNodePtr),
618 ActionTag{}, *colRegister);
619 jittedActionOnHeap->SetAction(std::move(actionPtr));
625template <typename T, bool Container = IsDataContainer<T>::value && !std::is_same<T, std::string>::value>
626struct RMinReturnType {
636struct RMinReturnType<
T,
true> {
637 using type = TTraits::TakeFirstParameter_t<T>;
641template <
typename R,
typename F,
typename... Args>
644 return [
f](
unsigned int, Args...
a)
mutable -> R {
return f(
a...); };
647template <
typename ColType,
typename... Rest>
648struct RNeedJittingHelper {
649 static constexpr bool value = RNeedJittingHelper<Rest...>
::value;
652template <
typename... Rest>
654 static constexpr bool value =
true;
658struct RNeedJittingHelper<
T> {
659 static constexpr bool value =
false;
664 static constexpr bool value =
true;
667template <
typename ...ColTypes>
669 static constexpr bool value = RNeedJittingHelper<ColTypes...>
::value;
673struct RNeedJitting<> {
674 static constexpr bool value =
false;
681template <
typename R,
typename Merge,
typename U,
typename T,
typename decayedU = std::decay_t<U>,
682 typename mergeArgsNoDecay_t =
typename CallableTraits<Merge>::arg_types_nodecay,
683 typename mergeArgs_t =
typename CallableTraits<Merge>::arg_types,
684 typename mergeRet_t =
typename CallableTraits<Merge>::ret_type>
687 constexpr bool isAggregatorOk =
688 (std::is_same<R, decayedU>::value) || (std::is_same<R, void>::value && std::is_lvalue_reference<U>::value);
689 static_assert(isAggregatorOk,
"aggregator function must have signature `U(U,T)` or `void(U&,T)`");
690 constexpr bool isMergeOk =
691 (std::is_same<TypeList<decayedU, decayedU>, mergeArgs_t>
::value && std::is_same<decayedU, mergeRet_t>::value) ||
692 (std::is_same<
TypeList<std::vector<decayedU> &>, mergeArgsNoDecay_t>
::value &&
693 std::is_same<void, mergeRet_t>::value);
694 static_assert(isMergeOk,
"merge function must have signature `U(U,U)` or `void(std::vector<U>&)`");
699template <
typename R,
typename T>
700void CheckAggregate(T)
702 static_assert(
sizeof(
T) == 0,
"aggregator function must take exactly two arguments");
717std::vector<std::string>
GetFilterNames(
const std::shared_ptr<RLoopManager> &loopManager);
720template <
typename NodeType>
721std::vector<std::string>
GetFilterNames(
const std::shared_ptr<NodeType> &node)
723 std::vector<std::string> filterNames;
724 node->AddFilterName(filterNames);
728struct ParsedTreePath {
729 std::string fTreeName;
730 std::string fDirName;
740using IsTrueForAllImpl_t =
typename std::is_same<TBoolPack<bs...,
true>, TBoolPack<
true, bs...>>;
742template <
bool... Conditions>
744 static constexpr bool value = IsTrueForAllImpl_t<Conditions...>
::value;
751struct IsList_t : std::false_type {};
754struct IsList_t<std::list<T>> : std::true_type {};
757struct IsDeque_t : std::false_type {};
760struct IsDeque_t<std::deque<T>> : std::true_type {};
766struct InnerValueType {
770template <
typename Elem>
771struct InnerValueType<ROOT::
VecOps::RVec<ROOT::VecOps::RVec<Elem>>> {
776using InnerValueType_t =
typename InnerValueType<T>::type;
778std::pair<std::vector<std::string>, std::vector<std::string>>
779AddSizeBranches(
const std::vector<std::string> &branches, TTree *tree, std::vector<std::string> &&colsWithoutAliases,
780 std::vector<std::string> &&colsWithAliases);
792using MinReturnType_t =
typename RDFInternal::RMinReturnType<T>::type;
795using MaxReturnType_t = MinReturnType_t<T>;
798using SumReturnType_t = MinReturnType_t<T>;
true
Register systematic variations for multiple existing columns using auto-generated tags.
RInterface< RDFDetail::RFilter< F, Proxied >, DS_t > Filter(F f, const ColumnNames_t &columns={}, std::string_view name="")
Append a filter to the call graph.
#define R(a, b, c, d, e, f, g, h, i)
externInt_t gErrorIgnoreLevel
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
void AddDataSourceColumnReaders(const std::string &col, std::vector< std::unique_ptr< RColumnReaderBase > > &&readers, const std::type_info &ti)
RDataSource * GetDataSource() const
unsigned int GetNSlots() const
RLoopManager * GetLoopManagerUnchecked() final
bool HasDataSourceColumnReaders(const std::string &col, const std::type_info &ti) const
Return true if AddDataSourceColumnReaders was called for column name col.
The head node of a RDF computation graph.
Base class for non-leaf nodes of the computational graph.
A RDataFrame node that produces a result.
A binder for user-defined columns, variations and aliases.
Column reader type that deals with values read from RDataSources.
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.
Smart pointer for the return type of actions.
A TTree represents a columnar dataset.
T Sum(const RVec< T > &v, const T zero=T(0))
Sum elements of an RVec.
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)
void CheckForRedefinition(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister, const ColumnNames_t &treeColumns, const ColumnNames_t &dataSourceColumns)
Throw if column definedColView is already there.
void CheckForDefinition(const std::string &where, std::string_view definedColView, const RColumnRegister &colRegister, const ColumnNames_t &treeColumns, const ColumnNames_t &dataSourceColumns)
Throw if column definedColView is not already there.
std::shared_ptr< RJittedDefine > BookDefineJit(std::string_view name, std::string_view expression, RLoopManager &lm, RDataSource *ds, const RColumnRegister &colRegister, const ColumnNames_t &branches, std::shared_ptr< RNodeBase > *upcastNodeOnHeap)
Book the jitting of a Define 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)
std::string PrettyPrintAddr(const void *const addr)
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::shared_ptr< RDFDetail::RJittedFilter > BookFilterJit(std::shared_ptr< RDFDetail::RNodeBase > *prevNodeOnHeap, std::string_view name, std::string_view expression, const ColumnNames_t &branches, const RColumnRegister &colRegister, TTree *tree, RDataSource *ds)
Book the jitting of a Filter call.
std::string JitBuildAction(const ColumnNames_t &cols, std::shared_ptr< RDFDetail::RNodeBase > *prevNode, const std::type_info &helperArgType, const std::type_info &at, void *helperArgOnHeap, TTree *tree, const unsigned int nSlots, const RColumnRegister &colRegister, RDataSource *ds, std::weak_ptr< RJittedAction > *jittedActionOnHeap)
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::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, const ColumnNames_t &branches, std::shared_ptr< RNodeBase > *upcastNodeOnHeap, bool isSingleColumn)
Book the jitting of a Vary call.
void CheckForDuplicateSnapshotColumns(const ColumnNames_t &cols)
ColumnNames_t ConvertRegexToColumns(const ColumnNames_t &colNames, std::string_view columnNameRegexp, std::string_view callerName)
std::pair< std::vector< std::string >, std::vector< std::string > > AddSizeBranches(const std::vector< std::string > &branches, TTree *tree, std::vector< std::string > &&colsWithoutAliases, std::vector< std::string > &&colsWithAliases)
Return copies of colsWithoutAliases and colsWithAliases with size branches for variable-sized array b...
std::vector< bool > FindUndefinedDSColumns(const ColumnNames_t &requestedCols, const ColumnNames_t &definedCols)
Return a bitset each element of which indicates whether the corresponding element in selectedColumns ...
std::shared_ptr< RJittedDefine > BookDefinePerSampleJit(std::string_view name, std::string_view expression, RLoopManager &lm, const RColumnRegister &colRegister, std::shared_ptr< RNodeBase > *upcastNodeOnHeap)
Book the jitting of a DefinePerSample call.
std::vector< std::string > GetValidatedArgTypes(const ColumnNames_t &colNames, const RColumnRegister &colRegister, TTree *tree, RDataSource *ds, const std::string &context, bool vector2rvec)
ColumnNames_t FindUnknownColumns(const ColumnNames_t &requiredCols, const ColumnNames_t &datasetColumns, const RColumnRegister &definedCols, const ColumnNames_t &dataSourceColumns)
void(off) SmallVectorTemplateBase< T
ROOT::VecOps::RVec< T > RVec
RResultPtr<::TGraph > Graph(std::string_view x="", std::string_view y="")
Fill and return a TGraph object (lazy action).
RResultPtr<::TH2D > Histo2D(const TH2DModel &model, std::string_view v1Name="", std::string_view v2Name="")
Fill and return a two-dimensional histogram (lazy action).
RResultPtr<::TGraphAsymmErrors > GraphAsymmErrors(std::string_view x="", std::string_view y="", std::string_view exl="", std::string_view exh="", std::string_view eyl="", std::string_view eyh="")
Fill and return a TGraphAsymmErrors object (lazy action).
RInterface<::ROOT::Detail::RDF::RNodeBase, void > RNode
RResultPtr< RDisplay > Display(const ColumnNames_t &columnList, size_t nRows=5, size_t nMaxCollectionElements=10)
Provides a representation of the columns in the dataset.
RResultPtr<::TProfile > Profile1D(const TProfile1DModel &model, std::string_view v1Name="", std::string_view v2Name="")
Fill and return a one-dimensional profile (lazy action).
RResultPtr< std::decay_t< T > > Fill(T &&model, const ColumnNames_t &columnList)
Return an object of type T on which T::Fill will be called once per event (lazy action).
std::vector< std::string > GetFilterNames()
Returns the names of the filters created.
RResultPtr< RInterface< RLoopManager > > Snapshot(std::string_view treename, std::string_view filename, const ColumnNames_t &columnList, const RSnapshotOptions &options=RSnapshotOptions())
Save selected columns to disk, in a new TTree treename in file filename.
RResultPtr<::TH3D > Histo3D(const TH3DModel &model, std::string_view v1Name="", std::string_view v2Name="", std::string_view v3Name="")
Fill and return a three-dimensional histogram (lazy action).
RResultPtr<::TProfile2D > Profile2D(const TProfile2DModel &model, std::string_view v1Name="", std::string_view v2Name="", std::string_view v3Name="")
Fill and return a two-dimensional profile (lazy action).
RResultPtr<::THnD > HistoND(const THnDModel &model, const ColumnNames_t &columnList)
Fill and return an N-dimensional histogram (lazy action).
RResultPtr<::TH1D > Histo1D(const TH1DModel &model={"", "", 128u, 0., 0.}, std::string_view vName="")
Fill and return a one-dimensional histogram with the values of a column (lazy action).
std::vector< std::string > ColumnNames_t
RResultPtr< typename std::decay_t< Helper >::Result_t > Book(Helper &&helper, const ColumnNames_t &columns={})
Book execution of a custom action using a user-defined helper object.
ROOT type_traits extensions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Mean(Long64_t n, const T *a, const Double_t *w=nullptr)
Returns the weighted mean of an array a with length n.
Double_t StdDev(Long64_t n, const T *a, const Double_t *w=nullptr)
Lightweight storage for a collection of types.