ATLAS Offline Software
EventAthenaPoolTestDump.py
Go to the documentation of this file.
1 
10 
11 
12 from __future__ import print_function
13 from PyUtils.fprint import fprint
14 import ROOT
15 
16 
17 def toiter (beg, end):
18  while beg != end:
19  yield beg.__deref__()
20  beg.__preinc__()
21  return
22 
23 
25  """Helper for doing formatting compatibly with py2.
26 
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.
29 """
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):
37  return str(x) + 'L'
38  return repr(x)
39 
40 
41 def dump_EventID (e, f):
42  fprint (f, '%9d %9d %9d %9d %9d %9d' %
43  (e.run_number(),
44  e.event_number(),
45  e.time_stamp(),
46  e.time_stamp_ns_offset(),
47  e.lumi_block(),
48  e.bunch_crossing_id()))
49  return
50 
51 
52 def dump_EventType (e, f):
53  fprint (f, e.typeToString(), e.user_type(), e.mc_event_weight())
54  return
55 
56 
57 def dump_TriggerInfo (e, f):
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()])
62  return
63 
64 
65 def dump_EventInfo (e, f):
66  fprint (f, e.clID())
67  dump_EventID (e.event_ID(), f)
68  fprint (f, '\n ')
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))
72  fprint (f, '\n ')
73  dump_EventType (e.event_type(), f)
74  fprint (f, '\n tg')
75  dump_TriggerInfo (e.trigger_info(), f)
76  return
77 
78 
80  fprint (f, 'nevents: ', e.getNumberOfEvents())
81  fprint (f, '\nrun numbers: ', formatItemUsingLong(list(e.getRunNumbers())))
82  fprint (f, '\nlb numbers: ', formatItemUsingLong(list(e.getLumiBlockNumbers())))
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()):
86  fprint (f, '\n ')
87  dump_EventType (typ, f)
88  return
89 
90 
92  dump_EventInfo (e, 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())
95  return
96 
97 
98 def get_dumper_fct(klass, ofile, nmax):
99  cname = klass.__name__
100  if cname == 'EventInfo':
101  def dumper (o):
102  return dump_EventInfo (o, ofile)
103  return dumper
104  elif cname == 'EventStreamInfo':
105  def dumper (o):
106  return dump_EventStreamInfo (o, ofile)
107  return dumper
108  elif cname == 'PileUpEventInfo':
109  def dumper (o):
110  return dump_PileUpEventInfo (o, ofile)
111  return dumper
112  else:
113  print ('xxx', cname)
114  assert 0
EventAthenaPoolTestDump.dump_EventStreamInfo
def dump_EventStreamInfo(e, f)
Definition: EventAthenaPoolTestDump.py:79
EventAthenaPoolTestDump.dump_EventID
def dump_EventID(e, f)
Definition: EventAthenaPoolTestDump.py:41
EventAthenaPoolTestDump.dump_EventType
def dump_EventType(e, f)
Definition: EventAthenaPoolTestDump.py:52
EventAthenaPoolTestDump.toiter
def toiter(beg, end)
Definition: EventAthenaPoolTestDump.py:17
EventAthenaPoolTestDump.dump_TriggerInfo
def dump_TriggerInfo(e, f)
Definition: EventAthenaPoolTestDump.py:57
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
EventAthenaPoolTestDump.get_dumper_fct
def get_dumper_fct(klass, ofile, nmax)
Definition: EventAthenaPoolTestDump.py:98
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
EventAthenaPoolTestDump.dump_EventInfo
def dump_EventInfo(e, f)
Definition: EventAthenaPoolTestDump.py:65
str
Definition: BTagTrackIpAccessor.cxx:11
EventAthenaPoolTestDump.dump_PileUpEventInfo
def dump_PileUpEventInfo(e, f)
Definition: EventAthenaPoolTestDump.py:91
EventAthenaPoolTestDump.formatItemUsingLong
def formatItemUsingLong(x)
Definition: EventAthenaPoolTestDump.py:24