Belle II Software development
ValueIndexPairSorting.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <utility>
12
13namespace Belle2 {
18 namespace ValueIndexPairSorting {
19
23 template <class T>
24 auto higherPair = [](const T& a, const T& b) -> bool
25 {
26 // always put NaN to the end
27 if (std::isnan(a.first)) return false;
28 if (std::isnan(b.first)) return true;
29 return a.first > b.first;
30 };
31
35 template <class T>
36 auto lowerPair = [](const T& a, const T& b) -> bool
37 {
38 // always put NaN to the end
39 if (std::isnan(a.first)) return false;
40 if (std::isnan(b.first)) return true;
41 return a.first < b.first;
42 };
43 }
45}
Abstract base class for different kinds of events.