Skip to content
Snippets Groups Projects

Resolve "Missing status and mother_id in offline reader"

Merged Tamas Gal requested to merge 80-missing-methods into master
1 unresolved thread
+ 12
7
@@ -18,7 +18,10 @@ OFFLINE_MC_TRACK_USR = OfflineReader(
)
)
OFFLINE_NUMUCC = OfflineReader(data_path("offline/numucc.root")) # with mc data
OFFLINE_MC_TRACK = OfflineReader(data_path("gseagen/gseagen_v7.0.0_numuCC_diffuse.aa.root"))
OFFLINE_MC_TRACK = OfflineReader(
data_path("gseagen/gseagen_v7.0.0_numuCC_diffuse.aa.root")
)
class TestOfflineReader(unittest.TestCase):
def setUp(self):
@@ -185,7 +188,7 @@ class TestOfflineEvents(unittest.TestCase):
500000000,
400000000,
]
def test_len(self):
assert self.n_events == len(self.events)
@@ -412,7 +415,7 @@ class TestOfflineTracks(unittest.TestCase):
self.f = OFFLINE_FILE
self.tracks = OFFLINE_FILE.events.tracks
self.tracks_numucc = OFFLINE_NUMUCC
self.mc_tracks = OFFLINE_MC_TRACK
self.mc_tracks = OFFLINE_MC_TRACK.mc_tracks
self.n_events = 10
self.status = [100, 5, 11, 15, 1, 12, 12, 12, 12, 12]
self.mother_id = [-1, -1, 1, 1, 0, 2, 5, 5, 6, 8]
@@ -433,17 +436,19 @@ class TestOfflineTracks(unittest.TestCase):
"rec_type",
"rec_stages",
"fitinf",
"status",
"mother_id",
]:
getattr(self.tracks, field)
def test_status(self):
assert np.allclose(self.status, self.mc_tracks[1].status[:10].tolist())
def test_mother_id(self):
assert np.allclose(self.mother_id, self.mc_tracks[1].mother_id[:10].tolist())
def test_attribute_error_raised_for_older_files(self):
with self.assertRaises(AttributeError):
self.tracks[1].mother_id
def test_item_selection(self):
self.assertListEqual(
list(self.tracks[0].dir_z[:2]), [-0.872885221293917, -0.872885221293917]
Loading