From 7e110f6f57a1913f690c3795481047047482a646 Mon Sep 17 00:00:00 2001
From: Shreya Roy <shreyaroy@jcbose.ac.in>
Date: Tue, 11 Jan 2022 11:49:00 +0000
Subject: [PATCH] fix event time boundaries

---
 algo/evbuild/EventBuilder.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/algo/evbuild/EventBuilder.h b/algo/evbuild/EventBuilder.h
index 948956f3aa..94f3d94d92 100644
--- a/algo/evbuild/EventBuilder.h
+++ b/algo/evbuild/EventBuilder.h
@@ -101,9 +101,11 @@ namespace cbm
       template<typename Data>
       static typename std::vector<Data> CopyRange(const std::vector<Data>& source, double tMin, double tMax)
       {
-        auto comp  = [](const Data& obj, double value) { return obj.GetTime() < value; };
-        auto lower = std::lower_bound(source.begin(), source.end(), tMin, comp);
-        auto upper = std::lower_bound(lower, source.end(), tMax, comp);
+        //auto comp  = [](const Data& obj, double value) { return obj.GetTime() < value; };
+        auto comp1 = [](const Data& obj, double value) { return obj.GetTime() < value; };
+        auto comp2 = [](double value, const Data& obj) { return value < obj.GetTime(); };
+        auto lower = std::lower_bound(source.begin(), source.end(), tMin, comp1);
+        auto upper = std::upper_bound(lower, source.end(), tMax, comp2);
         return std::vector<Data>(lower, upper);
       }
 
-- 
GitLab