So i’m still relatively new to root and was wondering how to go about plotting thousands of lines of data from a DAQ board we have set up in our research lab. I could go into more specifics but i guess my general questions would be; how do i go about plotting this information into a graph? Is there a specific format that root requires or can i just use this raw data without translating it? If I am required to translate it what are some tips to doing so?
(thats the link for the txt file with the raw data from the DAQ board.)
the class you are looking for is TGraph: root.cern.ch/doc/master/classTMultiGraph.html.
For what concerns the parsing of the ascci file, since it’s a custom format, I do not see how it could be used as is in ROOT but it’s going to be pretty straightforward to extract the relevant information from it.
Note that ROOT classes can be used from Python too: root.cern/doc/master/group__tut … yroot.html . This makes the “gluing” of different components even easier.
I completely agree with Danilo that there is no general way to extract data from
a custom formated file. I once made a little program which reads data
a la gnuplot. It treats however only floats/integers no hex.
This might give a hint how to do it, extension to e.g. hex should be straightforward.
This could also help for the case in this post (no sscanf):
[url]Cannot read a csv file containing more than 14 column
Hello, so i came back with a few more questions. Well the data is still a bit confusing because its supposedly compressed somehow and produces numbers i’m not well versed enough in c++ too understand how to translate the hex to decimal. Say for instance i ran the code you gave me, is it a matter of just copy pasting it into root itself or is there a process by which root uses code? Besides that, say i have a file such as 1drv.ms/t/s!AhBCKuphMeDlgWQsKOUQ9RMpBLhS
and i want to plot the voltage with respect to each channel, how do i make root read the first three columns as my x axis and the voltage as my y axis? I read some of the material you sent me but it went way over my head and i don’t understand how to use the commands that its giving me for TGraph.
I guess some effort is required on your side to understand well your data and its ingestion in C++. Once this is accomplished, ROOT will kick in, for example providing data visualisation utilities such as the TGraph.
If C++ is not an option for you, you can always resort to Python and use ROOT classes via PyROOT.