49 if 'simpleDisplay' not in h: ut.bookCanvas(h,key=
'simpleDisplay',title=
'simple event display',nx=1200,ny=1600,cx=1,cy=2)
50 h[
'simpleDisplay'].cd(1)
52 ut.bookHist(h,
'xz',
'x vs z',500,zStart,zStart+250.,100,-100.,10.)
53 ut.bookHist(h,
'yz',
'y vs z',500,zStart,zStart+250.,100,0.,80.)
54 proj = {1:
'xz',2:
'yz'}
60 A,B = ROOT.TVector3(),ROOT.TVector3()
61 ptext={0:
' Y projection',1:
' X projection'}
64 Nev = eventTree.GetEntries()
65 eventTree.GetEvent(start)
66 T = eventTree.EventHeader.GetEventTime()
70 for N
in range(Nstart,Nev):
71 rc = eventTree.GetEvent(N)
72 if eventTree.EventHeader.GetEventTime() != T:
break
73 for aHit
in eventTree.Digi_MuFilterHit:
74 bigContainer.append( aHit.Clone() )
75 T = eventTree.EventHeader.GetEventTime()
77 if len(bigContainer)==0:
continue
79 for d
in bigContainer:
80 plane = 100*(d.GetDetectorID()//1000)
82 if len(stations) <selection:
continue
84 h[
'hitCollectionX']= {
'Scifi':[0,ROOT.TGraph()],
'US':[0,ROOT.TGraph()],
'DS':[0,ROOT.TGraph()]}
85 h[
'hitCollectionY']= {
'Veto':[0,ROOT.TGraph()],
'Scifi':[0,ROOT.TGraph()],
'US':[0,ROOT.TGraph()],
'DS':[0,ROOT.TGraph()]}
86 systems = {1:
'Veto',2:
'US',3:
'DS'}
87 for collection
in [
'hitCollectionX',
'hitCollectionY']:
88 for c
in h[collection]:
89 rc=h[collection][c][1].SetName(c)
90 rc=h[collection][c][1].Set(0)
92 rc = h[
'simpleDisplay'].cd(p)
93 h[proj[p]].SetStats(0)
96 for digi
in bigContainer:
97 detID = digi.GetDetectorID()
98 if digi.GetName() ==
'MuFilterHit':
99 system = digi.GetSystem()
100 modules[
'MuFilter'].GetPosition(detID,A,B)
101 globA,locA = array(
'd',[A[0],A[1],A[2]]),array(
'd',[A[0],A[1],A[2]])
102 if trans2local: nav.MasterToLocal(globA,locA)
104 if digi.isVertical():
105 collection =
'hitCollectionX'
108 collection =
'hitCollectionY'
110 c = h[collection][systems[system]]
111 rc = c[1].SetPoint(c[0],Z,Y)
113 h[
'hitCollectionY'][
'Veto'][1].SetMarkerColor(ROOT.kRed)
114 h[
'hitCollectionY'][
'Scifi'][1].SetMarkerColor(ROOT.kBlue)
115 h[
'hitCollectionX'][
'Scifi'][1].SetMarkerColor(ROOT.kBlue)
116 h[
'hitCollectionY'][
'US'][1].SetMarkerColor(ROOT.kGreen)
117 h[
'hitCollectionY'][
'DS'][1].SetMarkerColor(ROOT.kCyan)
118 h[
'hitCollectionX'][
'DS'][1].SetMarkerColor(ROOT.kCyan)
120 for collection
in [
'hitCollectionX',
'hitCollectionY']:
121 h[
'simpleDisplay'].cd(k)
123 for c
in h[collection]:
124 print(collection.split(
'ion')[1],c, h[collection][c][1].GetN())
125 if h[collection][c][1].GetN()<1:
continue
126 h[collection][c][1].SetMarkerStyle(29+k)
127 rc=h[collection][c][1].Draw(
'sameP')
128 h[
'display:'+c]=h[collection][c][1]
129 h[
'simpleDisplay'].Update()
130 if save: h[
'simpleDisplay'].Print(
'event_'+
"{:04d}".format(N)+
'.png')
131 rc = input(
"hit return for next event or q for quit: ")
133 if save: os.system(
"convert -delay 60 -loop 0 *.png animated.gif")