How do I read data from a .dat file in root?


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22/00
Platform: Ubuntu 20.04.1 LTS (WSL2)
Compiler: GNU or GCC


Hello,

I have a .dat file with 11 rows and 42 columns that I want to read with ROOT and plot. Should I convert the .dat file to a .txt file, or to a .root file ? How do I plot analytical functions in ROOT ?

Hello,

If the .dat file is in simple text format, you can directly read it into ROOT as shown, e.g., in the tutorials.

For an introduction to plotting, have a look into the ROOT primer.

Cheers,
Jakob

But how to I create a root file from a .dat file, if the .dat file have 11 rows and 42 columns. There are 11 analytical functions that I want to plot. I want to start with the one in the first row. Should I write a Macro or using only root commandos ?

How do I import the .dat files into ROOT so that I can plot the analytical functions ?

Have you looked at TTree::ReadFile ?