Home | News | Documentation | Download

RDataFrame::Foreach with array branch


#1

_ROOT Version:6.15


Hi all;

if aTree with Branch array.
TTree::Branch(“a”, “&a”, “a[30]/D”);

RDataFrame aData("…","…");
aData.ForEach([](double * a){cout<<a<<endl;}, “a”)

error
Error in TTreeReaderValueBase::GetBranchDataType(): Must use TTreeReaderArray to read branch fptcl_r: it contains an array or a collection.
Error in TTreeReaderValueBase::CreateProxy(): The template argument type T of double* accessing branch fptcl_r (which contains data of type (null)) is not known to ROOT. You will need to create a dictionary for it.

how should I do?


#2

using RVec solve this problem


#3

Yep, that’s it, you have to use RVec to read arrays from RDataFrame.

Cheers,
Enrico