How to extract histogram data from .root file

Hi experts,

How can I extract data from a .root file to a .dat file in terminal Ubuntu?


Thanks!


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi,

For sure!

ROOT::RDataFrame d("ntuple_A", "_BGO_foo_bar_.root");
d.Foreach([](double col_0, double col_1){ std::cout << col_0 << " " << col_1 << std::endl;}, {"col0", "col_1"});

Then it’s just a matter of adapting to your column names and types. here I assume you have two columns of type double.

Cheers,
D

You can also right-click on the histogram, SaveAs, file.csv

Hi Eyvaz,

Did you do what Danilo suggested?