Hi,
I have a ttree. I want to export a particular branch (need to have the X and Y data points) inside the TTree say “Mass” into a txt file.
Can someone tell me how to do this ?
Thanks in advance !
Hi,
I have a ttree. I want to export a particular branch (need to have the X and Y data points) inside the TTree say “Mass” into a txt file.
Can someone tell me how to do this ?
Thanks in advance !
Hi @gini ,
with RDataFrame it’s pretty easy (I haven’t tested the code but it should give you an idea):
ROOT::RDataFrame("Mass", "inputfile.root")
.Foreach([](float x, float y) { std::cout << x << "," << y << '\n'; },
{"x", "y"});
Cheers,
Enrico
That code was meant to be written all in one statement, it’s not valid C++ if you split it in two.
See also the RDataFrame user guide and the corresponding tutorials.
Cheers,
Enrico
Also, this post explains how to do it with TTree::Scan.