Skip to content
Snippets Groups Projects
Commit dc28da25 authored by Sebastien Ponce's avatar Sebastien Ponce Committed by Christopher Rob Jones
Browse files

Adapt python code to new ROOT and its different handling of std::byte

parent f8e979f9
No related branches found
No related tags found
2 merge requests!4987Ignore: merge master into run5 branch,!4900Adaptations for LCG106
......@@ -16,6 +16,7 @@ from pprint import pformat
import cppyy
import cppyy.ll
import GaudiPython
import numpy as np
from DDDB.CheckDD4Hep import UseDD4Hep
from PRConfig.TestFileDB import test_file_db
......@@ -74,7 +75,11 @@ def events(appmgr):
def _RawBank_bytes(self):
"""Return the RawBank payload as a bytes object."""
data = bytes(self.range[cppyy.gbl.std.byte]())
data = bytes(
np.frombuffer(
self.range[cppyy.gbl.std.byte]().data(), dtype=np.uint8, count=self.size()
)
)
assert len(data) == self.size()
return data
......@@ -82,9 +87,7 @@ def _RawBank_bytes(self):
def _RawBank_padding(self):
"""Return the padding bytes in a raw bank."""
full_data_size = self.totalSize() - self.hdrSize() # incl. padding bytes
data = cppyy.ll.cast["std::byte*"](self.data())
data.reshape((full_data_size,))
data = bytes(data)
data = bytes(np.frombuffer(self.data(), dtype=np.uint8, count=full_data_size))
return data[self.size() :]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment