@@ -259,7 +259,7 @@ public:
259
259
// / \param[in] name The name of the temporary branch.
260
260
// / \param[in] expression Function, lambda expression, functor class or any other callable object producing the
261
261
// / temporary value. Returns the value that will be assigned to the temporary branch.
262
- // / \param[in] bl Names of the branches in input to the producer function.
262
+ // / \param[in] columns Names of the branches in input to the producer function.
263
263
// /
264
264
// / Create a temporary branch that will be visible from all subsequent nodes
265
265
// / of the functional chain. The `expression` is only evaluated for entries that pass
@@ -276,19 +276,17 @@ public:
276
276
// / An exception is thrown if the name of the new branch is already in use
277
277
// / for another branch in the TTree.
278
278
template <typename F, typename std::enable_if<!std::is_convertible<F, std::string>::value, int >::type = 0 >
279
- TInterface<TCustomColumnBase> Define (std::string_view name, F expression, const ColumnNames_t &bl = {})
279
+ TInterface<TCustomColumnBase> Define (std::string_view name, F expression, const ColumnNames_t &columns = {})
280
280
{
281
- auto df = GetDataFrameChecked ();
282
- TDFInternal::CheckTmpBranch (name, df->GetTree ());
283
- const ColumnNames_t &defBl = df->GetDefaultColumnNames ();
284
- auto nArgs = TTraits::CallableTraits<F>::arg_types::list_size;
285
- const auto actualBl = TDFInternal::SelectColumns (nArgs, bl, defBl);
286
- using DFB_t = TDFDetail::TCustomColumn<F, Proxied>;
281
+ auto loopManager = GetDataFrameChecked ();
282
+ TDFInternal::CheckTmpBranch (name, loopManager->GetTree ());
283
+ auto nColumns = TTraits::CallableTraits<F>::arg_types::list_size;
284
+ const auto validColumnNames = GetValidatedColumnNames (*loopManager, nColumns, columns);
285
+ using loopManagerB_t = TDFDetail::TCustomColumn<F, Proxied>;
287
286
const std::string nameInt (name);
288
- auto BranchPtr = std::make_shared<DFB_t>(nameInt, std::move (expression), actualBl, *fProxiedPtr );
289
- df->Book (BranchPtr);
290
- TInterface<TCustomColumnBase> tdf_b (BranchPtr, fImplWeakPtr );
291
- return tdf_b;
287
+ auto BranchPtr = std::make_shared<loopManagerB_t>(nameInt, std::move (expression), validColumnNames, *fProxiedPtr );
288
+ loopManager->Book (BranchPtr);
289
+ return TInterface<TCustomColumnBase>(BranchPtr, fImplWeakPtr );
292
290
}
293
291
294
292
// //////////////////////////////////////////////////////////////////////////
0 commit comments