I am trying to run the code below in PyROOT but it keeps on giving an error. I tried the same style code in ROOT and it worked fine.
My code:
3 import ROOT
4 import sys
5 import array as arr
6
7 file = ROOT.TFile("js2rt.root", "READ")
8 tree = file.Get("0")
9
10 chn0 = arr.array('i')
11 tree.SetBranchAddress("chn0", chn0)
13
14 hist = ROOT.TH2D("Chn_adc_hist", "Time ticks vs ADC; ADC; Time ticks", 1000, 1100, 1200 ,1000, 0, 750 )
15
16 entries = tree.GetEntries()
17
18 for i in range(entries):
19
20 tree.GetEntry(i)
21 ticks = i #timeticks
22 hist.Fill(chn0, ticks)
23
24 hist.Draw("COLZ2")
Error message:
Please help me fix it. Thank you.