-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimMonCALO.py
executable file
·179 lines (133 loc) · 3.4 KB
/
SimMonCALO.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#! /bin/env python
'''
'''
import sys
#sys.path.append("/home.local/daqop/users/roma/lib/python2.4/site-packages")
from ctypes import *
from time import localtime,strftime
from Event import *
from BegSpill import *
from EndSpill import *
from Gorin import *
from Stat import *
from LE78 import *
from QDC import *
from TDC import *
from WideHead import *
from Hodos import *
from HodoMISS import *
from Drift import *
from PIM import *
from Hodoscopes import *
from BC import *
from DT import *
from SG import *
from GDA import *
from GAMS import *
from BGD import *
from QDCMix import *
from ROOT import TBrowser,TFile
import sys
if len(sys.argv) < 2:
print '''
Usage: SimMon source
'''
sys.exit(0)
arg = sys.argv[1]
print '''
SimMon: Monitor which is simple as it is possible ...
If You don't like it, Don't use it!
To STOP it - press ^C
'''
size = 1024*8
#d = "/".join(__file__.split("/")[:-1])
#lib = CDLL(d+"/datemon.so")
#status = lib.date_init(arg)
#print "Status %d"%status
lib = CDLL("/date/monitoring/Linux/libmonitor.so")
status = lib.monitorDeclareMp("SimMon")
print "Status %d"%status
status = lib.monitorSetDataSource(arg)
print "Status %d"%status
buff_type = c_ushort*size
buff = buff_type()
filename = "SimMonCALO.root"
#filename = strftime("SimMon_%d-%b-%Y_%H:%M:%S.root", localtime())
filename = "SimMon.root"
f = TFile(filename,"RECREATE")
methlist = []
methlist.append(Stat(f))
methlist.append(DecodeQDC(0))
methlist.append(DecodeQDC(1))
methlist.append(DecodeQDC(2))
methlist.append(DecodeQDC(3))
#methlist.append(DecodeTDC())
#methlist.append(DecodeLE78(10))
#ethlist.append(DecodeLE78(11))
#methlist.append(DecodeLE78(12))
#methlist.append(DecodeLE78(13))
#methlist.append(ViewLE78(f,10))
#methlist.append(ViewLE78(f,11))
#methlist.append(ViewLE78(f,12))
#methlist.append(ViewLE78(f,13))
#methlist.append(ViewDrift(f))
#methlist.append(ViewQDC(f,0))
#methlist.append(ViewQDC(f,1))
#methlist.append(ViewQDC(f,2))
#methlist.append(ViewQDC(f,3))
#methlist.append(ViewPIM(f))
#methlist.append(ViewHodos(f))
#methlist.append(ViewHodoMISS(f))
#methlist.append(ViewGorin(f))
#methlist.append(ViewTDC(f))
#methlist.append(TreeTDC(f))
#methlist.append(ViewWideHead(f))
#methlist.append(ViewHodoscopes(f))
#methlist.append(ViewBC(f))
#methlist.append(ViewDT(f))
methlist.append(ViewGDA(f))
methlist.append(ViewSG(f))
methlist.append(ViewGAMS(f))
methlist.append(ViewBGD(f))
methlist.append(ViewQDCMix(f))
ESmethlist = []
ESmethlist.append(DecodeQDCLED(2))
ESmethlist.append(DecodeQDCLED(3))
ESmethlist.append(ViewBGD_LED(f))
ESmethlist.append(ViewGDA_LED(f))
BS = BegSpill(f)
b = TBrowser()
skip_error = (0x400000,)
try:
while True:
# status = lib.date_getevent(byref(buff),size*2)
status = lib.monitorGetEvent(byref(buff),size*2)
if status:
print "Status %x"%(status&0x3FFFFFFF)
if status&0x3FFFFFFF in skip_error:
continue
else:
break
event = Event(buff)
# print "Type of ev. %d"%event.Type()
if event.Type()==5:
event.Decode()
BS.Execute(event)
if event.Type()==6:
event.Decode()
for m in ESmethlist:
m.Execute(event)
if event.Type()==7:
event.Decode()
for m in methlist:
m.Execute(event)
except KeyboardInterrupt:
print "KeyboardInterrupt"
else:
print "End of File?"
dummy = raw_input('Press Enter key.')
print '''
Saving Histograms,
Wait, Please.
'''
f.Write()