Skip to content
Snippets Groups Projects
plot_offline_usr.py 953 B
Newer Older
Zineb Aly's avatar
Zineb Aly committed
"""
Reading usr data of events
==========================

To access the ``usr`` data of events, use the ``.usr`` property which behaves
like a dictionary and returns ``lazyarray``, compatible to the ``numpy.array``
interface. The available keys can be accessed either as attributes or via a
dictionary lookup:
"""
import km3io as ki
Tamas Gal's avatar
Tamas Gal committed
from km3net_testdata import data_path
Zineb Aly's avatar
Zineb Aly committed

#####################################################
# First, pass a filename to the `OfflineReader` class to open the file.
# Note that only some meta information is read into memory.

Tamas Gal's avatar
Tamas Gal committed
r = ki.OfflineReader(data_path("offline/usr-sample.root"))
Zineb Aly's avatar
Zineb Aly committed


#####################################################
# Accessing the usr data:

usr = r.events.usr
print(usr)


#####################################################
# to access data of a specific key, you can either do:

print(usr.DeltaPosZ)


#####################################################
# or

Tamas Gal's avatar
Tamas Gal committed
print(usr["RecoQuality"])