Hello All
Fairly new to ROOT
I want to be able to read individual leaves from a ROOT file so that I can work on the data myself in Python.
The ROOT file is organised as:
tree is called cbmsim
that contains three branches, the one of interest is called MCTrack
MCTrack contains lots of leaves, but I am interested in the one called MCTrack.fPdgCode for now.
I currently have a script
import ROOT
f =ROOT.TFile.Open("DEC_12pythia8_Geant4_1_0.5_ID_0.root");
for event in f.cbmsim:
for track in event.MCTrack:
#here I want to say... if MCTrack.fPdgCode == 13 -> do other stuff
#I want to save the values in leaves to python variable
How can I within these loops save the value stored in each leaf to a python variable so that I can play with it.
I have tried things like:
if track.fPdgCode == 13:
do_other_stuff()
It may add to the complication that the leaves I refer to in the file are actually TBranchElements or that they are called MCTrack.fPdgCode not just fPdgCode.
Any ideas?
Thanks a lot