How might i write a root file to a text file ?
Thanks for your help
in general it’s not an advantage to migrate from an optimised binary format to a ASCII. In general it’s not even a well defined operation (You may have collections of collections of complex objects in your trees, assuming you want to transform trees into ASCII columns).
I think we do not provide anything out of the box. Pehaps the TTree::Scan method may be of help if not I am afraid custom code, not that difficult anyway, must be written.
I was wondering if there is an elegant way of dumping the contents of a histogramm to a plain ascii file.
I know about the TH1::Print() function, where I can get this, but there I always have the format of sumw[i]=…, x=…, y=… .
What I would like to have is a plain ascii print without any formatting.
Any hints appreciated.
stackoverflow.com/questions/2897 … plain-text
I’d like to be able dump all the entries from a TTree in a root file to an ASCII file. I’ve been using PyRoot for a while now, so I’d like to keep it in that format if possible.
However, I find that for a TTree with ~150 branches it takes about 1/3 second to read out. This seems long to me since on the same machine all of my other PyRoot activities run fast.
I fear I’m doing something silly in how I access the Leaf/Branches (I can never keep this straight) and maybe this is more a gen…
Dear root users and developers,
I’m surprised that there is no standard feature in root of converting at least 1d histograms into plain ascii file. I would expect that such a feature would be very much appreciated by many physicists especially of old generation who are not familiar with C++ and with root itself, but may still use it for simple analysis by dumping histograms into an ascii file and then processing it as they are used to with gnuplot or Origin or whatever other data plotting progr…
I have written a command line executable that can quickly dump the contents of a root file to the screen w/o having to open a root session. I have placed a tarball of the code in my cern afs space:
One can simply unpack the tarball and issue make and then throw the executable into a bin directory.
Most everything that lsRoot does can be done w/i root cint, I just found some basic things could be done faster on the command line.
Let’s say I have a .root file with one TTree. Inside the tree, there are multiple leaves -> each leaf is an histogram. Is there a way to export all the (x,y) of a particular histogram to an ascii file?
I successfully exported TH1D histograms to .dat files with the macro provided in this post:[url]
TH1 to ascii question but I didn’t succeed in exporting histograms that are leaves. After building a TFile, I used a command like this to access the wanted TH1D :
Then, I ran the macro and ev…