I am fairly new to using ROOT, so please bear with me.
Currently, I am trying to comb through the data from a ROOT file and access the particular entries of a tree. The issue I am having is that I don’t know how to interface with std.vector data types in PyROOT.
Here is my code:
f = TFile.Open("/Users/user/work/GEMC_Sim/GEMC_Simulation/clas12Tags/config/Trials.root")
#f.ls()
tree = f.Get('flux')
tree.Print()
for idx,event in enumerate(tree):
print(idx,event.pid)
{}
{ 11 }
{}
{ 11,11 }
…
In this output, there are either these empty braces or they are filled with individual particle index values or they are grouped together with multiple entries. What I want is to create a separate index that increases by one every time that one 11 is identified in each brace. For instance, {11,11,11} would increase the index by one. Similarly, {11} would also increase the index by one.
If this was a normal python data type I would know how to work with this, but I am a bit confused as to how to work with the std.vector data type. Any insight or suggestions is greatly appreciated.
ROOT Version: ROOT 6.24/06