7 Methods to deserialise HLTResultMT using Python bindings of C++ classes
8 and reimplementing some logic from TriggerEDMDeserialiserAlg
11 from ROOT
import StringSerializer
12 from AthenaCommon.Logging
import logging
13 log = logging.getLogger(
'hltResultMT')
16 _string_serialiser = StringSerializer()
26 '''A python representation of a serialised EDM collection'''
28 def __init__(self, name_vec, size_words, words=None):
61 log.error(
'No payload stored, cannot deserialise')
69 from ctypes
import c_uint
72 cwords = [c_uint(w)
for w
in self.
words]
73 bwords = [struct.pack(
'@I',cw.value)
for cw
in cwords]
74 bwords_merged = b
''.
join(bwords)
75 bwords_array = array.array(
'b', bwords_merged)
79 buffer = ROOT.TBufferFile(ROOT.TBuffer.kRead, len(bwords_array), bwords_array,
False)
80 obj_ptr = buffer.ReadObjectAny(cltype.Class())
86 '''Extract type+name words from the full collection raw data and convert to string'''
92 nw = raw_data_words[NameLengthOffset]
93 name_words = tuple(raw_data_words[NameOffset:NameOffset+nw])
94 return _string_serialiser.deserialize(name_words)
98 '''Extract the serialised collection payload from the full collection raw data'''
100 name_size = raw_data_words[NameLengthOffset]
101 payload_start = NameOffset + name_size + 1
102 return raw_data_words[payload_start:]
107 Extract a list of EDMCollection objects from the HLT ROBFragment.
108 If skip_payload=True, only the information about type, name and size
109 are kept but the payload is discarded to improve performance.
115 rod_size = len(rob.rod_data())
116 while start < rod_size:
117 size = rob.rod_data()[start+SizeWord]
121 if coll.is_xAOD_aux_container():
123 if coll.is_xAOD_decoration():
124 coll.parent = last_aux_cont
125 collections.append(coll)