Outputting histograms to text files

Hi ROOTers,

I am wondering if there is an easy way to output a histogram to a text file.

What I mean is that I want to put the numeric values in a text file, perhaps like:

0.5 10.7
1.5 14.3
2.5 10.5

etc…

I’m very new to ROOT and C++ so explicit examples of command line arguments are very helpful.

Gracias,
Will

In your interactive session you can dump the histogram bin contents to a text file with

root > myhist.Print("all"); //will print in your terminal root > myhist.Print("all"); >myhist.txt //will print in file myhist.txt
Rene

Thanks Rene - That’s exactly what I was looking for!

Cheers,
Will

[quote=“brun”]In your interactive session you can dump the histogram bin contents to a text file with

root > myhist.Print("all"); //will print in your terminal root > myhist.Print("all"); >myhist.txt //will print in file myhist.txt
Rene[/quote]

Thank you very much.
I tried to do so, but I got an error, Syntax Error > Maybe missing ‘;’. I don’t know if there is a problem in cint or not. I am using root 5.32/01 on windows 7. So, I am kindly asking about solution to this issue.

Hi,

Were you able to resolved this problem?

Philippe.

Hi, i want to get number of rows and columns form data of each parameter of selected histogram. When i tried this method i got this data(see screenshot). From this, how can i make multiplicity plot?
Screenshot from 2020-11-03 22-12-21|690x387