scikit-hep / pyhepmc

Easy-to-use Python bindings for HepMC3
https://scikit-hep.org/pyhepmc/
BSD 3-Clause "New" or "Revised" License
21 stars 11 forks source link

Support GenEventData #59

Closed HDembinski closed 1 year ago

HDembinski commented 1 year ago

The GenEventData class is an alternative representation of the GenEvent. It is a different data structure, so converting between the two objects is not free of cost, but the cost is moderate.

The GenEventData class was introduced by the HepMC3 devs, because it has a simple layout that allows one to store the instances in ROOT trees. From the perspective of a Python user is also interesting, because it allows one to access and manipulate the particles and vertices in an event in form of numpy arrays, which are views into the memory of the GenEventData object. This is cheap and processing numpy arrays is fast.

In case of read-only access, one can do better than converting GenEvents to GenEventData objects. An alternative Numpy API was added to the GenEvent, which provides faster read-only access to particle and vertex data members.

If you need to process events in Python, you now have several options, see docs/examples/processing.ipynb

coveralls commented 1 year ago

Coverage Status

coverage: 99.125%. remained the same when pulling f038305cf05ccf3a5474dfc0d1ae85ab5e2f210d on geneventdata into 6866c8b8ca6057e9323c9f1cada411adf835548b on main.

coveralls commented 5 days ago

Coverage Status

coverage: 99.125%. remained the same when pulling 4e1f588287d0e9d49652ec5fc6e113690f3c748f on geneventdata into 6866c8b8ca6057e9323c9f1cada411adf835548b on main.

coveralls commented 5 days ago

Coverage Status

coverage: 99.125%. remained the same when pulling 4e1f588287d0e9d49652ec5fc6e113690f3c748f on geneventdata into 6866c8b8ca6057e9323c9f1cada411adf835548b on main.