hello, I’m trying to create a ttree with PyRoot from a list but when I’m filling the tree ,only a part of the data are putted in the tree(the 20 first data only)
for example :
from ROOT import TFile, TTree
from array import array
L=[[1,2,[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]],[28,29,[30,32,33,43,54,23,67,64]],[2,4,[11,54,85,64,25,97,4,23]],[18,34,[98,468,43,86,98,29,57]],[74,58,[73,58,87,34,678,43,78]]]
f = TFile( 'test.root', 'recreate' )
t = TTree( 't1', 'tree ' )
maxn = 40
n = array( 'i', [ 0 ] )
m = array( 'i', [ 0 ] )
o = array( 'i', [ 0 ] )
d = array( 'i', maxn*[ 0] )
t.Branch( 'L1', n, 'L1/I' )
t.Branch( 'L2', m, 'L2/I' )
t.Branch( 'L4', o, 'L4/I' )
t.Branch( 'list', d, 'list[L4]/i' )
for k in range(0,len(L)):
n[0] = L[k][0]
m[0] =L[k][1]
o[0]=len(L[k][2])
for i in range(0,o[0]):
d[i] =L[k][2][i]
print(d)
t.Fill()
f.Write()
f.Close()
print("done")
the program run without problem but when I open the root file only a part is inside:
root [1] t1->Show(0)
======> EVENT:0
L1 = 1
L2 = 2
L4 = 25
list = 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22
Thanks,
Neimolim
ROOT Version: 6.16
Platform: Ubuntu 18.04