12 from __future__
import print_function
13 from PyUtils.fprint
import fprint
25 """Helper for doing formatting compatibly with py2.
27 Convert X to a string, but add a `L' to the ends of integers.
28 Can be used for formatting expressions that using longs in py2.
30 if isinstance (x, list):
31 sl = [formatItemUsingLong (xx)
for xx
in x]
32 return '[' +
', '.join (sl) +
']'
33 if isinstance (x, tuple):
34 sl = [formatItemUsingLong (xx)
for xx
in x]
35 return '(' +
', '.join (sl) +
')'
36 if isinstance (x, int):
42 fprint (f,
'%9d %9d %9d %9d %9d %9d' %
46 e.time_stamp_ns_offset(),
48 e.bunch_crossing_id()))
53 fprint (f, e.typeToString(), e.user_type(), e.mc_event_weight())
58 fprint (f, e.statusElement(), e.extendedLevel1ID(), e.level1TriggerType())
59 fprint (f,
'\n l2:', formatItemUsingLong ([x
for x
in e.level2TriggerInfo()]))
60 fprint (f,
'\n ef:', formatItemUsingLong ([x
for x
in e.eventFilterInfo()]))
61 fprint (f,
'\n st:', [(x.name(), x.type(), x.obeysLumiblock())
for x
in e.streamTags()])
67 dump_EventID (e.event_ID(), f)
69 fprint (f, e.actualInteractionsPerCrossing(), e.averageInteractionsPerCrossing())
70 for i
in range(ROOT.EventInfo.nDets):
71 fprint (f,
'\n det', i, e.eventFlags(i), e.errorState(i))
73 dump_EventType (e.event_type(), f)
75 dump_TriggerInfo (e.trigger_info(), f)
80 fprint (f,
'nevents: ', e.getNumberOfEvents())
83 fprint (f,
'\nproc tags: ',
list(e.getProcessingTags()))
84 fprint (f,
'\nitem list: ',
formatItemUsingLong([(p.first, p.second)
for p
in e.getItemList()]))
85 for typ
in list(e.getEventTypes()):
87 dump_EventType (typ, f)
93 for (i,s)
in enumerate (toiter (e.beginSubEvt(), e.endSubEvt())):
94 fprint (f,
'\n subevt', i, s.time(), s.index(), s.BCID(), s.type())
99 cname = klass.__name__
100 if cname ==
'EventInfo':
102 return dump_EventInfo (o, ofile)
104 elif cname ==
'EventStreamInfo':
106 return dump_EventStreamInfo (o, ofile)
108 elif cname ==
'PileUpEventInfo':
110 return dump_PileUpEventInfo (o, ofile)