Converting .root file to ascii file

I have a .root file which contains histograms I would like to get a .text file from a .root file. I search online but didn’t find a suitable solution. please help me in this.

root[0] .ls
TFile** gammaSpectrum.root
TFile* gammaSpectrum.root
KEY: TH1D h3;1 energy of neutral secondaries at creation
KEY: TH1D h5;1 energy of neutral at creation (log scale)
KEY: TH1D h20;1 (transmit, neutral) : kinetic energy at exit
KEY: TH1D h22;1 (transmit, neutral) : space angle: dN/dOmega
KEY: TH1D h23;1 (transmit, neutral) : projected angle at exit
KEY: TH1D h24;1 (transmit, neutral) : y projected position at exit
KEY: TH1D h25;1 (transmit, neutral) : z projected position at exit
KEY: TH1D h40;1 (reflect , neutral) : ener fluence: dE(MeV)/dOmega

Have you tried the following?



Thank you for the reply. I have tried this, it prints the total entries, and the .txt file is empty.
Please give me some suggestions.

TH1.Print Name = h3, Entries= 3241085, Total sum= 3.22728e+06

Did you read the documentation? I clearly didn’t.



Thank you, Smith. Problem solved

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.