From 8752bc098bb276abf2765422741ff09de4b004bf Mon Sep 17 00:00:00 2001
From: Tamas Gal <tgal@km3net.de>
Date: Wed, 30 Sep 2020 13:47:09 +0200
Subject: [PATCH] Add Branch.is_single

---
 km3io/rootio.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/km3io/rootio.py b/km3io/rootio.py
index ce03603..a5e4856 100644
--- a/km3io/rootio.py
+++ b/km3io/rootio.py
@@ -187,6 +187,15 @@ class Branch:
                     self._branch[self._keymap['id']].lazyarray(
                         basketcache=BASKET_CACHE), self._index_chain))
 
+    @property
+    def is_single(self):
+        """Returns True when a single branch is selected."""
+        if len(self._index_chain) > 0:
+            if isinstance(self._index_chain[-1], (int, np.int32, np.int64)):
+                return True
+        return False
+
+
     def __iter__(self):
         self._iterator_index = 0
         return self
-- 
GitLab