To read file.Root created by Geant4

Dear ROOT Users,

I have created Root file (M1.root) as output using geant4 code
I want to open and see the output in this file but I do not know how to do so
as I have low background in programming .

I have tried to open it as root form the terminal and I got ,
in command .ls I got this information

KEY: TH1D 1;1 step number
KEY: TH1D 2;1 X-Position
KEY: TH1D 3;1 Y-Position
KEY: TH1D 4;1 Z-Position
KEY: TH1D 5;1 Kin-Energy

and stuck here #-o

Please assist me on this. =D>

thanks

Hi,

there are several ways to increase your level of ROOT expertise, from root.cern.ch/courses .
For quick answers, you can consult root.cern.ch/howtos , in particular, the answer to your question is in this howto: “How to Read Objects from a File?”.

TFile inputFile ("inputFile.root");
TH1F* h = nullptr;
inputFile.GetObject("myHisto",h);

or in Python

inputFile = ROOT.TFile("inputFile.root")
h = inputFile.myHisto

or at the prompt

root inputFile.root
root [0] myHisto.Draw()

or if you don’t even want to open the prompt, in your shell:

rootbrowse inputFile.root
rootprint inputFile.root

Danilo

Thank you so much Danilo

I do appreciate your assistance