Skip to content
Snippets Groups Projects
Commit 7e110f6f authored by Shreya Roy's avatar Shreya Roy Committed by Volker Friese
Browse files

fix event time boundaries

parent 4fe0c0a2
No related branches found
No related tags found
1 merge request!658fix event time boundaries
Pipeline #15198 passed
...@@ -101,9 +101,11 @@ namespace cbm ...@@ -101,9 +101,11 @@ namespace cbm
template<typename Data> template<typename Data>
static typename std::vector<Data> CopyRange(const std::vector<Data>& source, double tMin, double tMax) 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 comp = [](const Data& obj, double value) { return obj.GetTime() < value; };
auto lower = std::lower_bound(source.begin(), source.end(), tMin, comp); auto comp1 = [](const Data& obj, double value) { return obj.GetTime() < value; };
auto upper = std::lower_bound(lower, source.end(), tMax, comp); 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); return std::vector<Data>(lower, upper);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment