From 72a9ef617dd4b185ab5d597ddc6b2b9928e1402a Mon Sep 17 00:00:00 2001
From: zineb aly <aly.zineb.az@gmail.com>
Date: Mon, 29 Jun 2020 14:53:09 +0200
Subject: [PATCH] git add get_multiplicity

---
 km3io/tools.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/km3io/tools.py b/km3io/tools.py
index 6f7343f..22bf1e6 100644
--- a/km3io/tools.py
+++ b/km3io/tools.py
@@ -329,4 +329,20 @@ def best_track(events, strategy="default", rec_type=None, rec_stages=None):
     return out
 
 
+def get_multiplicity(tracks, rec_stages):
+    """tracks selection based on specific reconstruction stages (for multiplicity
+    calculations).
 
+    Parameters
+    ----------
+    tracks : class km3io.offline.OfflineBranch
+        tracks or a subste of tracks. 
+    rec_stages : list
+        the reconstruction stages of interest. Examle: [1, 2, 3, 4, 5].
+
+    Returns
+    -------
+    class km3io.offline.OfflineBranch
+        tracks branch with the desired reconstruction stages only.
+    """
+    return tracks[mask(tracks.rec_stages, rec_stages)]
-- 
GitLab