ATLAS Offline Software
Loading...
Searching...
No Matches
python.hltResultMT.EDMCollection Class Reference
Collaboration diagram for python.hltResultMT.EDMCollection:

Public Member Functions

 __init__ (self, name_vec, size_words, words=None)
 __str__ (self)
 name (self)
 is_xAOD_interface_container (self)
 is_xAOD_aux_container (self)
 is_xAOD_decoration (self)
 is_TP_container (self)
 deserialise (self)

Public Attributes

 name_persistent = name_vec[0]
 name_key = name_vec[1]
 size_words = size_words
int size_bytes = size_words*4
 words = words
 parent = None

Detailed Description

A python representation of a serialised EDM collection

Definition at line 25 of file hltResultMT.py.

Constructor & Destructor Documentation

◆ __init__()

python.hltResultMT.EDMCollection.__init__ ( self,
name_vec,
size_words,
words = None )

Definition at line 28 of file hltResultMT.py.

28 def __init__(self, name_vec, size_words, words=None):
29 self.name_persistent = name_vec[0]
30 self.name_key = name_vec[1]
31 self.size_words = size_words
32 self.size_bytes = size_words*4
33 self.words = words
34 self.parent = None
35

Member Function Documentation

◆ __str__()

python.hltResultMT.EDMCollection.__str__ ( self)

Definition at line 36 of file hltResultMT.py.

36 def __str__(self):
37 return '{:s}, Size: {:d} bytes'.format(self.name(), self.size_bytes)
38

◆ deserialise()

python.hltResultMT.EDMCollection.deserialise ( self)

Definition at line 59 of file hltResultMT.py.

59 def deserialise(self):
60 if not self.words:
61 log.error('No payload stored, cannot deserialise')
62 return None
63
64 # Lazily import modules needed for deserialisation
65 import cppyy
66 import ROOT
67 import array
68 import struct
69 from ctypes import c_uint
70
71 # Reinterpret words: Python int list -> C unsigned int list -> C char (Python bytes) array
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)
76
77 # ROOT deserialisation
78 cltype = ROOT.RootType.ByNameNoQuiet(self.name_persistent)
79 buffer = ROOT.TBufferFile(ROOT.TBuffer.kRead, len(bwords_array), bwords_array, False)
80 obj_ptr = buffer.ReadObjectAny(cltype.Class())
81 obj = cppyy.bind_object(obj_ptr, self.name_persistent)
82 return obj
83
84

◆ is_TP_container()

python.hltResultMT.EDMCollection.is_TP_container ( self)

Definition at line 56 of file hltResultMT.py.

56 def is_TP_container(self):
57 return '_p' in self.name_persistent
58

◆ is_xAOD_aux_container()

python.hltResultMT.EDMCollection.is_xAOD_aux_container ( self)

Definition at line 48 of file hltResultMT.py.

48 def is_xAOD_aux_container(self):
49 return self.name_persistent.startswith('xAOD') and self.name_key.endswith('Aux.')
50

◆ is_xAOD_decoration()

python.hltResultMT.EDMCollection.is_xAOD_decoration ( self)

Definition at line 51 of file hltResultMT.py.

51 def is_xAOD_decoration(self):
52 return 'vector' in self.name_persistent and \
53 not self.is_xAOD_interface_container() and \
54 not self.is_xAOD_aux_container()
55

◆ is_xAOD_interface_container()

python.hltResultMT.EDMCollection.is_xAOD_interface_container ( self)

Definition at line 45 of file hltResultMT.py.

45 def is_xAOD_interface_container(self):
46 return self.name_persistent.startswith('xAOD') and not self.name_key.endswith('Aux.')
47

◆ name()

python.hltResultMT.EDMCollection.name ( self)

Definition at line 39 of file hltResultMT.py.

39 def name(self):
40 if not self.parent:
41 return '{:s}#{:s}'.format(self.name_persistent, self.name_key)
42 else:
43 return '{:s}#{:s}{:s}'.format(self.name_persistent, self.parent.name_key, self.name_key)
44

Member Data Documentation

◆ name_key

python.hltResultMT.EDMCollection.name_key = name_vec[1]

Definition at line 30 of file hltResultMT.py.

◆ name_persistent

python.hltResultMT.EDMCollection.name_persistent = name_vec[0]

Definition at line 29 of file hltResultMT.py.

◆ parent

python.hltResultMT.EDMCollection.parent = None

Definition at line 34 of file hltResultMT.py.

◆ size_bytes

python.hltResultMT.EDMCollection.size_bytes = size_words*4

Definition at line 32 of file hltResultMT.py.

◆ size_words

python.hltResultMT.EDMCollection.size_words = size_words

Definition at line 31 of file hltResultMT.py.

◆ words

python.hltResultMT.EDMCollection.words = words

Definition at line 33 of file hltResultMT.py.


The documentation for this class was generated from the following file: