Skip to content

Commit 2519e72

Browse files
committed
[TDF] Add on-the-fly definition of datasource columns to Define
1 parent a262051 commit 2519e72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tree/treeplayer/inc/ROOT/TDFInterface.hxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,12 @@ public:
326326
auto loopManager = GetDataFrameChecked();
327327
TDFInternal::CheckCustomColumn(name, loopManager->GetTree(), loopManager->GetCustomColumnNames(),
328328
fDataSource ? fDataSource->GetColumnNames() : ColumnNames_t{});
329-
auto nColumns = TTraits::CallableTraits<F>::arg_types::list_size;
330-
if (ShouldPassSlotNumber)
331-
nColumns--;
329+
using ArgTypes_t = typename TTraits::CallableTraits<F>::arg_types;
330+
using ColTypes_t = typename TDFInternal::RemoveFirstParameterIf<ShouldPassSlotNumber, ArgTypes_t>::type;
331+
constexpr auto nColumns = ColTypes_t::list_size;
332332
const auto validColumnNames = GetValidatedColumnNames(*loopManager, nColumns, columns);
333+
if (fDataSource)
334+
DefineDataSourceColumns(validColumnNames, *loopManager, TDFInternal::GenStaticSeq_t<nColumns>(), ColTypes_t());
333335
using NewCol_t = TDFDetail::TCustomColumn<F, ShouldPassSlotNumber>;
334336
loopManager->Book(std::make_shared<NewCol_t>(name, std::move(expression), validColumnNames, loopManager.get()));
335337
TInterface<Proxied> newInterface(fProxiedPtr, fImplWeakPtr, fValidCustomColumns);

0 commit comments

Comments
 (0)