Skip to content

Commit

Permalink
Move version check into cython
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Aug 31, 2023
1 parent cd998c7 commit 93ba61a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/eventio/simtel/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,10 +1413,8 @@ def __str__(self):
)

def parse(self):
''' '''
assert_version_in(self, (1, 2))
''''''
self.seek(0)

d = MCEvent.parse_mc_event(self.read(), self.header.version)
d['event_id'] = self.header.id
return d
Expand Down
6 changes: 6 additions & 0 deletions src/eventio/simtel/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ cpdef dict parse_mc_event(
const uint8_t[:] data,
uint32_t version
):
if version > 2:
raise NotImplementedError(
'Unsupported version of MCEvent:'
' only versions up to 2 supported,'
f' got: {version} '
)

cdef uint64_t pos = 0
cdef float xcore, ycore, aweight
Expand Down

0 comments on commit 93ba61a

Please sign in to comment.