Hi,
I want define a new RDataFrame column using the values (bin contents) from a TH1 I have loaded from a .root file.
The problem is similar to the one described here
but I don’t really understand the syntax used there and the solution does not work for me. I was thinking in something like
ROOT::RDataFrame d("myHisto", "myFile.root");
d.Define("h_bin", "myHisto->GetBinContent(15)");
However, this obviously does not work because RDataFrame expect to have a tree as input.
Would it even be possible to store the contents of the bins in a vector? something like
.Define("a_vector", [](float a) {
std::vector<float> vec;
for (int i = 0; i < myHisto->GetNbinsX(); i++)
a = myHisto->GetBinContent(i);
vec.push_back(a);
return vec;
},
);
Thanks,
Jordi
_ROOT Version: 6.19/01
Platform: Not Provided
Compiler: Not Provided