diff --git a/tree/treeplayer/inc/ROOT/TDFInterface.hxx b/tree/treeplayer/inc/ROOT/TDFInterface.hxx index 18608fff0574b..ced134dae62f7 100644 --- a/tree/treeplayer/inc/ROOT/TDFInterface.hxx +++ b/tree/treeplayer/inc/ROOT/TDFInterface.hxx @@ -101,7 +101,6 @@ void BuildAndBook(const ColumnNames_t &bl, const std::shared_ptr &meanV, loopManager.Book(std::make_shared(Helper_t(meanV, nSlots), bl, prevNode)); } /****** end BuildAndBook ******/ -/// \endcond template void CallBuildAndBook(PrevNodeType &prevNode, const ColumnNames_t &bl, const unsigned int nSlots, @@ -117,7 +116,7 @@ std::vector FindUsedColumnNames(const std::string, TObjArray *, con using TmpBranchBasePtr_t = std::shared_ptr; -Long_t JitTransformation(void *thisPtr, const std::string &methodName, const std::string &nodeTypeName, +Long_t JitTransformation(void *thisPtr, const std::string &methodName, const std::string &interfaceTypeName, const std::string &name, const std::string &expression, TObjArray *branches, const std::vector &tmpBranches, const std::map &tmpBookedBranches, TTree *tree); @@ -179,6 +178,8 @@ class TInterface { template friend class TInterface; + const std::shared_ptr fProxiedPtr; ///< Smart pointer to the graph node encapsulated by this TInterface. + const std::weak_ptr fImplWeakPtr; ///< Weak pointer to the TLoopManager at the root of the graph. public: //////////////////////////////////////////////////////////////////////////// /// \brief Append a filter to the call graph. @@ -206,8 +207,8 @@ public: auto loopManager = GetDataFrameChecked(); const auto nColumns = TTraits::CallableTraits::arg_types::list_size; const auto validColumnNames = GetValidatedColumnNames(*loopManager, nColumns, columns); - using loopManagerF_t = TDFDetail::TFilter; - auto FilterPtr = std::make_shared(std::move(f), validColumnNames, *fProxiedPtr, name); + using F_t = TDFDetail::TFilter; + auto FilterPtr = std::make_shared(std::move(f), validColumnNames, *fProxiedPtr, name); loopManager->Book(FilterPtr); return TInterface(FilterPtr, fImplWeakPtr); } @@ -283,9 +284,9 @@ public: TDFInternal::CheckTmpBranch(name, loopManager->GetTree()); auto nColumns = TTraits::CallableTraits::arg_types::list_size; const auto validColumnNames = GetValidatedColumnNames(*loopManager, nColumns, columns); - using loopManagerB_t = TDFDetail::TCustomColumn; + using B_t = TDFDetail::TCustomColumn; const std::string nameInt(name); - auto BranchPtr = std::make_shared(nameInt, std::move(expression), validColumnNames, *fProxiedPtr); + auto BranchPtr = std::make_shared(nameInt, std::move(expression), validColumnNames, *fProxiedPtr); loopManager->Book(BranchPtr); return TInterface(BranchPtr, fImplWeakPtr); } @@ -338,7 +339,7 @@ public: std::stringstream snapCall; // build a string equivalent to // "reinterpret_cast(this)->Snapshot(treename,filename,*reinterpret_cast(&columnList))" - snapCall << "if (gROOTMutex) gROOTMutex->UnLock();"; + snapCall << "if (gROOTMutex) gROOTMutex->UnLock();"; // black magic: avoids a deadlock in the interpreter snapCall << "reinterpret_cast*>(" << this << ")->Snapshot<"; bool first = true; @@ -1201,8 +1202,7 @@ protected: { } - const std::shared_ptr fProxiedPtr; - std::weak_ptr fImplWeakPtr; + const std::shared_ptr& GetProxiedPtr() const { return fProxiedPtr; } }; template <> diff --git a/tree/treeplayer/inc/ROOT/TDataFrame.hxx b/tree/treeplayer/inc/ROOT/TDataFrame.hxx index 9725ffbaf571e..3472fcd99b8f0 100644 --- a/tree/treeplayer/inc/ROOT/TDataFrame.hxx +++ b/tree/treeplayer/inc/ROOT/TDataFrame.hxx @@ -67,7 +67,7 @@ TDataFrame::TDataFrame(std::string_view treeName, const FILENAMESCOLL &filenames std::string treeNameInt(treeName); auto chain = std::make_shared(treeNameInt.c_str()); for (auto &fileName : filenamescoll) chain->Add(TDFInternal::ToConstCharPtr(fileName)); - fProxiedPtr->SetTree(chain); + GetProxiedPtr()->SetTree(chain); } } // end NS Experimental diff --git a/tree/treeplayer/src/TDFInterface.cxx b/tree/treeplayer/src/TDFInterface.cxx index 49976233dd6ce..1e087af4aaba6 100644 --- a/tree/treeplayer/src/TDFInterface.cxx +++ b/tree/treeplayer/src/TDFInterface.cxx @@ -64,7 +64,7 @@ std::vector FindUsedColumnNames(const std::string expression, TObjA // Jit a string filter or a string temporary column, call this->Define or this->Filter as needed // Return pointer to the new functional chain node returned by the call, cast to Long_t -Long_t JitTransformation(void *thisPtr, const std::string &methodName, const std::string &nodeTypeName, +Long_t JitTransformation(void *thisPtr, const std::string &methodName, const std::string &interfaceTypeName, const std::string &name, const std::string &expression, TObjArray *branches, const std::vector &tmpBranches, const std::map &tmpBookedBranches, TTree *tree) @@ -133,7 +133,7 @@ Long_t JitTransformation(void *thisPtr, const std::string &methodName, const std // Here we have two cases: filter and column ss.str(""); - ss << "((" << nodeTypeName << "*)" << thisPtr << ")->" << methodName << "("; + ss << "((" << interfaceTypeName << "*)" << thisPtr << ")->" << methodName << "("; if (methodName == "Define") { ss << "\"" << name << "\", "; } diff --git a/tree/treeplayer/src/TDataFrame.cxx b/tree/treeplayer/src/TDataFrame.cxx index 67a68bd406535..50023f47397c4 100644 --- a/tree/treeplayer/src/TDataFrame.cxx +++ b/tree/treeplayer/src/TDataFrame.cxx @@ -584,7 +584,7 @@ TDataFrame::TDataFrame(std::string_view treeName, TDirectory *dirPtr, const Colu auto msg = "Tree \"" + treeNameInt + "\" cannot be found!"; throw std::runtime_error(msg); } - fProxiedPtr->SetTree(std::shared_ptr(tree, [](TTree *) {})); + GetProxiedPtr()->SetTree(std::shared_ptr(tree, [](TTree *) {})); } //////////////////////////////////////////////////////////////////////////// @@ -604,7 +604,7 @@ TDataFrame::TDataFrame(std::string_view treeName, std::string_view filenameglob, const std::string filenameglobInt(filenameglob); auto chain = std::make_shared(treeNameInt.c_str()); chain->Add(filenameglobInt.c_str()); - fProxiedPtr->SetTree(chain); + GetProxiedPtr()->SetTree(chain); } ////////////////////////////////////////////////////////////////////////////