diff --git a/tree/treeplayer/inc/ROOT/TDFActionHelpers.hxx b/tree/treeplayer/inc/ROOT/TDFActionHelpers.hxx index ee1b18ab48cb8..118ee5ec5e6b9 100644 --- a/tree/treeplayer/inc/ROOT/TDFActionHelpers.hxx +++ b/tree/treeplayer/inc/ROOT/TDFActionHelpers.hxx @@ -52,7 +52,7 @@ public: }; class CountHelper { - std::shared_ptr fResultCount; + const std::shared_ptr fResultCount; std::vector fCounts; public: @@ -71,7 +71,7 @@ class FillHelper { std::vector fBuffers; std::vector fWBuffers; - std::shared_ptr fResultHist; + const std::shared_ptr fResultHist; unsigned int fNSlots; unsigned int fBufSize; Buf_t fMin; @@ -318,7 +318,7 @@ public: template class ReduceHelper { F fReduceFun; - std::shared_ptr fReduceRes; + const std::shared_ptr fReduceRes; std::vector fReduceObjs; public: @@ -339,7 +339,7 @@ public: }; class MinHelper { - std::shared_ptr fResultMin; + const std::shared_ptr fResultMin; std::vector fMins; public: @@ -365,7 +365,7 @@ extern template void MinHelper::Exec(unsigned int, const std::vector &); extern template void MinHelper::Exec(unsigned int, const std::vector &); class MaxHelper { - std::shared_ptr fResultMax; + const std::shared_ptr fResultMax; std::vector fMaxs; public: @@ -389,7 +389,7 @@ extern template void MaxHelper::Exec(unsigned int, const std::vector &); extern template void MaxHelper::Exec(unsigned int, const std::vector &); class MeanHelper { - std::shared_ptr fResultMean; + const std::shared_ptr fResultMean; std::vector fCounts; std::vector fSums; diff --git a/tree/treeplayer/inc/ROOT/TDFInterface.hxx b/tree/treeplayer/inc/ROOT/TDFInterface.hxx index ab0edbc9d016c..38bd76ddec2f5 100644 --- a/tree/treeplayer/inc/ROOT/TDFInterface.hxx +++ b/tree/treeplayer/inc/ROOT/TDFInterface.hxx @@ -178,15 +178,7 @@ public: /// Refer to the first overload of this method for the full documentation. TInterface Filter(std::string_view expression, std::string_view name = "") { - auto df = GetDataFrameChecked(); - auto tree = df->GetTree(); - auto branches = tree ? tree->GetListOfBranches() : nullptr; - auto tmpBranches = fProxiedPtr->GetTmpBranches(); - auto tmpBookedBranches = df->GetBookedBranches(); - const std::string expressionInt(expression); - const std::string nameInt(name); - auto retVal = TDFInternal::JitTransformation(this, "Filter", GetNodeTypeName(), nameInt, expressionInt, branches, - tmpBranches, tmpBookedBranches, tree); + auto retVal = CallJitTransformation("Filter", name, expression); return *(TInterface *)retVal; } @@ -239,14 +231,7 @@ public: /// Refer to the first overload of this method for the full documentation. TInterface Define(std::string_view name, std::string_view expression) { - auto df = GetDataFrameChecked(); - auto tree = df->GetTree(); - auto branches = tree->GetListOfBranches(); - auto tmpBranches = fProxiedPtr->GetTmpBranches(); - auto tmpBookedBranches = df->GetBookedBranches(); - const std::string expressionInt(expression); - const std::string nameInt(name); - auto retVal = TDFInternal::JitTransformation(this, "Define", GetNodeTypeName(), nameInt, expressionInt, branches,tmpBranches, tmpBookedBranches, tree); + auto retVal = CallJitTransformation("Define", name, expression); return *(TInterface *)retVal; } @@ -908,6 +893,20 @@ public: } private: + Long_t CallJitTransformation(std::string_view transformation, std::string_view nodeName, std::string_view expression) + { + auto df = GetDataFrameChecked(); + auto tree = df->GetTree(); + auto branches = tree ? tree->GetListOfBranches() : nullptr; + auto tmpBranches = fProxiedPtr->GetTmpBranches(); + auto tmpBookedBranches = df->GetBookedBranches(); + const std::string transformInt(transformation); + const std::string nameInt(nodeName); + const std::string expressionInt(expression); + return TDFInternal::JitTransformation(this, transformInt, GetNodeTypeName(), nameInt, expressionInt, branches, + tmpBranches, tmpBookedBranches, tree); + } + inline const char *GetNodeTypeName() { return ""; }; /// Returns the default branches if needed, takes care of the error handling. @@ -1216,7 +1215,7 @@ protected: { } - std::shared_ptr fProxiedPtr; + const std::shared_ptr fProxiedPtr; std::weak_ptr fImplWeakPtr; }; diff --git a/tree/treeplayer/inc/ROOT/TResultProxy.hxx b/tree/treeplayer/inc/ROOT/TResultProxy.hxx index 20db9135cd513..b39e97a89fc34 100644 --- a/tree/treeplayer/inc/ROOT/TResultProxy.hxx +++ b/tree/treeplayer/inc/ROOT/TResultProxy.hxx @@ -83,10 +83,10 @@ class TResultProxy { template friend TResultProxy TDFDetail::MakeResultProxy(const std::shared_ptr &, const SPTLM_t &); - ShrdPtrBool_t fReadiness = + const ShrdPtrBool_t fReadiness = std::make_shared(false); ///< State registered also in the TLoopManager until the event loop is executed WPTLM_t fImplWeakPtr; ///< Points to the TLoopManager at the root of the functional graph - SPT_t fObjPtr; ///< Shared pointer encapsulating the wrapped result + const SPT_t fObjPtr; ///< Shared pointer encapsulating the wrapped result /// Triggers the event loop in the TLoopManager instance to which it's associated via the fImplWeakPtr void TriggerRun();