144def my_dump(bsfile):
145 """Runs the dumping routines"""
146
147 global smk
148
149
151 print(
"Opening", bsfile)
152
153 input = eformat.istream(bsfile)
154
155 if args.interactive:
156 import code
157 code.interact(local=locals())
158
159 event_count = 0
160 l2_event_count = 0
161 ef_event_count = 0
162 offset = args.skip if args.skip else 0
163 for event in input:
164 if offset>0:
165 offset -= 1
166 continue
167
168 event_count += 1
169
170 if args.events is not None and event_count>args.events:
171 break
172
173 print(
"======================= RunNumber : %d , Event: %d, LB: %d, LVL1_ID: %d, Global_ID: %d bunch-x: %d TT: x%x =========================="
174 % ( event.run_no(), event_count, event.lumi_block(), event.lvl1_id(), event.global_id(), event.bc_id(), event.lvl1_trigger_type()))
175
176 smk = args.smk
177 if args.decodeItems and args.smk==0:
178 hltrob = [f for f in event.children() if f.source_id().subdetector_id() in [eformat.helper.SubDetector.TDAQ_LVL2,eformat.helper.SubDetector.TDAQ_EVENT_FILTER] ]
179 if len(hltrob)==0:
180 print(
"ERROR: Cannot find HLT result. Will not decode trigger item names.")
181 args.decodeItems = False
182 else:
183 res.load(hltrob[0])
184 smk = res.getConfigSuperMasterKey()
185 if smk==0:
186 print(
"ERROR: No SMK stored in HLT result. Will not decode trigger item names.")
187 args.decodeItems = False
188
189 if args.l1:
190
191 words = Lvl1_Info(event)
192 print(
"L1 CTP IDs - TBP: ", printL1Items(words[0],smk))
193 print(
"L1 CTP IDs - TAP: ", printL1Items(words[1],smk))
194 print(
"L1 CTP IDs - TAV: ", printL1Items(words[2],smk))
195
196 if args.ctp:
197 CTP_Info(event,int(args.ctp))
198
199 if args.l2:
200 print(
"L2 TriggerInfo: ", [
"0x%x"%i
for i
in event.lvl2_trigger_info() ])
201
202
203 if args.l2res or args.sizeSummary:
204 found=False
205 for f in event.children():
206 if f.source_id().subdetector_id() == eformat.helper.SubDetector.TDAQ_LVL2:
207 print(
'.. %s %s %s bytes' % (f.__class__.__name__, f.source_id(), f.fragment_size_word()*4))
208 res.load(f)
209 found=True
210 l2_event_count += 1
211
212 if args.l2res:
213 print_HLTResult(res, args)
214 if args.sizeSummary:
215 collect_feature_sizes(featureSizes, res)
216 print(
".. EOF HLTResult for L2")
217 if not found:
218 print(
".. No HLTResult for L2")
219
220
221 if args.ef:
222 print(
"EF TriggerInfo: ", [
"0x%x"%i
for i
in event.event_filter_info()])
223
224
225
226 if args.efres or args.sizeSummary:
227 found=False
228 for f in event.children():
229 if f.source_id().subdetector_id() == eformat.helper.SubDetector.TDAQ_EVENT_FILTER:
230 print(
'.. %s %s %s bytes' % (f.__class__.__name__, f.source_id(), f.fragment_size_word()*4))
231 try:
232 res.load(f)
233 found = True
234 ef_event_count += 1
235
236 if args.efres:
237 print_HLTResult(res, args)
238 if args.sizeSummary:
239 collect_feature_sizes(featureSizes, res)
240 except Exception as ex:
241 print(
'... **** problems in analyzing payload', ex)
242 print(
'... **** raw data[:10]', list(f.rod_data())[:10])
243 print(
".. EOF HLTResult for EF")
244 if not found:
245 print(
".. No HLTResult for EF")
246
247 if args.stag:
248 print(
"StreamTag: ", [(s.name, s.type)
for s
in event.stream_tag()])
249
250 event_count =
max(l2_event_count, ef_event_count)
251 if args.sizeSummary:
252 print(
'... '+20*
'-'+
'sizes by type')
253 for f,s in sorted(featureSizes.items(),key=operator.itemgetter(1),reverse=True):
254 if '#' not in f:
255 print(
".... %-70s %6d B %6d B/ev" %(f, s, (1.*s)/event_count))
256 print(
'... '+20*
'-'+
'sizes by type#key')
257 for f,s in sorted(featureSizes.items(),key=operator.itemgetter(1),reverse=True):
258 if '#' in f:
259 print(
".... %-70s %6d B %6d B/ev" %(f, s, (1.*s)/event_count))
260
261