EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SelectorHelpers.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SelectorHelpers.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
13 
14 #include <functional>
15 #include <limits>
16 
17 namespace ActsFatras {
18 
20 template <typename cast_t>
21 struct Min {
22  double valMin = 0.;
23 
24  template <typename T>
25  bool operator()(const T &thing) const {
26  return (valMin <= cast_t()(thing));
27  }
28 };
29 
31 template <typename cast_t>
32 struct Max {
34 
35  template <typename T>
36  bool operator()(const T &thing) const {
37  return (cast_t()(thing) < valMax);
38  }
39 };
40 
44 template <typename cast_t>
45 struct Range {
46  double valMin = std::numeric_limits<double>::lowest();
48 
49  template <typename T>
50  bool operator()(const T &thing) const {
51  const auto val = cast_t()(thing);
52  return ((valMin <= val) and (val < valMax));
53  }
54 };
55 
57 template <typename... selectors_t>
58 using CombineAnd =
60 
62 template <typename... selectors_t>
63 using CombineOr =
65 
66 } // namespace ActsFatras