@@ -251,8 +251,6 @@ def nuke_offset_table(offset_id):
251
251
252
252
:param offset_id: tuple - (arrayId, eventId)
253
253
"""
254
- T2K .OFFSET_TABLE = offset_id
255
- T2K .read_offset_table ()
256
254
if offset_id [0 ] == 0 :
257
255
table_type = 'Offset_t'
258
256
if table_type in T2K .OFFSET_T :
@@ -278,6 +276,34 @@ def nuke_offset_table(offset_id):
278
276
print "{0} Not found." .format (OFFSET_TABLE )
279
277
280
278
279
+ def nuke_event_table (event_id ):
280
+ """
281
+ Delete event_table form Experiment EX.
282
+
283
+ :param event_id: tuple - (arrayId, eventId)
284
+ """
285
+ if event_id == 0 :
286
+ table_type = 'Event_t'
287
+ if table_type in T2K .EVENT_T :
288
+ backup (table_type , '/Experiment_g/Sorts_g/Event_t' ,
289
+ T2K .EVENT_T [table_type ])
290
+ if EX .ph5_g_sorts .nuke_event_t ():
291
+ exclaim (0 )
292
+ else :
293
+ print ("0 Not found." )
294
+ else :
295
+ table_type = "Event_t_{0:03d}" .format (event_id )
296
+ if table_type in T2K .EVENT_T :
297
+ backup (
298
+ table_type , '/Experiment_g/Sorts_g/{0}' .format (table_type ),
299
+ T2K .EVENT_T [table_type ])
300
+ if EX .ph5_g_sorts .nuke_event_t (
301
+ "Event_t_{0:03d}" .format (event_id )):
302
+ exclaim (event_id )
303
+ else :
304
+ print "{0} Not found." .format (event_id )
305
+
306
+
281
307
def main ():
282
308
global EXPERIMENT_TABLE , SORT_TABLE , OFFSET_TABLE , ALL_OFFSETS , TRUNC ,\
283
309
EVENT_TABLE , ALL_EVENTS , ARRAY_TABLE , ALL_ARRAYS , RESPONSE_TABLE ,\
@@ -307,6 +333,8 @@ def main():
307
333
308
334
# /Experiment_g/Sorts_g/Offset_t
309
335
if OFFSET_TABLE :
336
+ T2K .OFFSET_TABLE = OFFSET_TABLE
337
+ T2K .read_offset_table ()
310
338
nuke_offset_table (OFFSET_TABLE )
311
339
312
340
elif ALL_OFFSETS :
@@ -321,55 +349,20 @@ def main():
321
349
322
350
# /Experiment_g/Sorts_g/Event_t
323
351
if EVENT_TABLE is not None :
324
- print ("EVENT_TABLE:" , EVENT_TABLE )
325
352
T2K .EVENT_TABLE = EVENT_TABLE
326
353
T2K .read_event_table ()
327
- if EVENT_TABLE == 0 :
328
- table_type = 'Event_t'
329
- if table_type in T2K .EVENT_T :
330
- backup (table_type , '/Experiment_g/Sorts_g/Event_t' ,
331
- T2K .EVENT_T [table_type ])
332
- if EX .ph5_g_sorts .nuke_event_t ():
333
- exclaim (0 )
334
- else :
335
- print ("0 Not found." )
336
- else :
337
- table_type = "Event_t_{0:03d}" .format (EVENT_TABLE )
338
- if table_type in T2K .EVENT_T :
339
- backup (
340
- table_type , '/Experiment_g/Sorts_g/{0}' .format (table_type ),
341
- T2K .EVENT_T [table_type ])
342
- if EX .ph5_g_sorts .nuke_event_t (
343
- "Event_t_{0:03d}" .format (EVENT_TABLE )):
344
- exclaim (EVENT_TABLE )
345
- else :
346
- print "{0} Not found." .format (EVENT_TABLE )
354
+ nuke_event_table (EVENT_TABLE )
347
355
elif ALL_EVENTS :
348
- print ("ALL_EVENTS" )
349
- T2K .read_all_event_table ()
350
- for table_type in T2K .EVENT_T :
351
- backup (
352
- table_type , '/Experiment_g/Sorts_g/{0}' .format (table_type ),
353
- T2K .EVENT_T [table_type ])
354
- if table_type == "Event_t" :
355
- if table_type in T2K .EVENT_T :
356
- backup (table_type , '/Experiment_g/Sorts_g/Event_t' ,
357
- T2K .EVENT_T [table_type ])
358
- if EX .ph5_g_sorts .nuke_event_t ():
359
- exclaim (0 )
360
- else :
361
- print ("0 Not found." )
356
+ T2K .read_all_event_tables ()
357
+ for event_name in T2K .EVENT_T :
358
+ if event_name == "Event_t" :
359
+ EVENT_TABLE = 0
362
360
else :
363
- EVENT_TABLE = int (table_type .replace ('Event_t_' , '' ))
364
- if EX .ph5_g_sorts .nuke_event_t (
365
- "Event_t_{0:03d}" .format (EVENT_TABLE )):
366
- exclaim (EVENT_TABLE )
367
- else :
368
- print "{0} Not found." .format (EVENT_TABLE )
361
+ EVENT_TABLE = int (event_name .replace ("Event_t_" , "" ))
362
+ nuke_event_table (EVENT_TABLE )
369
363
370
364
# /Experiment_g/Sorts_g/Array_t_[n]
371
365
if ARRAY_TABLE :
372
- print ("ARRAY_TABLE:" , ARRAY_TABLE )
373
366
T2K .ARRAY_TABLE = ARRAY_TABLE
374
367
T2K .read_sort_arrays ()
375
368
table_type = 'Array_t_{0:03d}' .format (ARRAY_TABLE )
@@ -385,7 +378,6 @@ def main():
385
378
386
379
# /Experiment_g/Sorts_g/Array_t_xxx
387
380
elif ALL_ARRAYS :
388
- print ("ALL_ARRAY" )
389
381
T2K .read_sort_arrays ()
390
382
391
383
for table_type in T2K .ARRAY_T :
0 commit comments