1. from ROOT import TFile,TH1F
    2. from array import array
    3. # read a root file named data.root
    4. # it's tree name is 'tr'
    5. # branch, strip_si, e_si/D
    6. # branch, e_si, e_si[16]/D
    7. h1 = TH1F('h1','',Nbins,xmin,xmax)
    8. e_si = array('d',[0]*16)
    9. h2 = [TH1F('h_{0}'.format(i),'',Nbins,xmin,xmax) for i in range(16)]
    10. f = TFile('data.root')
    11. tree = f.Get('tr')
    12. tree.GetBranch('e_si').SetAddress(e_si)
    13. entries = tree.GetEntries()
    14. for i in range(entries):
    15. tree.GetEntry(i)
    16. h1.Fill(tree.strip_si)
    17. for j in range(16):
    18. h2[j].Fill(e_si[j])
    19. tree.Draw('strip_si>>h1')