|
|
|||
File indexing completed on 2025-11-05 08:54:55
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "ActsFatras/EventData/Particle.hpp" 0012 #include "ActsFatras/Selectors/detail/combine_selectors.hpp" 0013 0014 #include <functional> 0015 #include <limits> 0016 0017 namespace ActsFatras { 0018 0019 /// Select all objects with an extracted value equal or larger than the cut. 0020 template <typename cast_t> 0021 struct Min { 0022 /// Minimum value threshold for selection 0023 double valMin = 0.; 0024 0025 /// Check if object meets minimum value requirement 0026 /// @param thing The object to evaluate using cast_t 0027 /// @return true if extracted value is at least valMin, false otherwise 0028 template <typename T> 0029 bool operator()(const T &thing) const { 0030 return (valMin <= cast_t()(thing)); 0031 } 0032 }; 0033 0034 /// Select all objects with an extracted value below the cut. 0035 template <typename cast_t> 0036 struct Max { 0037 /// Maximum value threshold for selection 0038 double valMax = std::numeric_limits<double>::max(); 0039 0040 /// Check if object meets maximum value requirement 0041 /// @param thing The object to evaluate using cast_t 0042 /// @return true if extracted value is below valMax, false otherwise 0043 template <typename T> 0044 bool operator()(const T &thing) const { 0045 return (cast_t()(thing) < valMax); 0046 } 0047 }; 0048 0049 /// Select all objects with an extracted value within the range. 0050 /// 0051 /// The range is defined as the left, half-open interval within the cuts. 0052 template <typename cast_t> 0053 struct Range { 0054 /// Minimum value threshold for range selection 0055 double valMin = std::numeric_limits<double>::lowest(); 0056 /// Maximum value threshold for range selection 0057 double valMax = std::numeric_limits<double>::max(); 0058 0059 /// Check if object meets range value requirement 0060 /// @param thing The object to evaluate using cast_t 0061 /// @return true if extracted value is within [valMin, valMax), false otherwise 0062 template <typename T> 0063 bool operator()(const T &thing) const { 0064 const auto val = cast_t()(thing); 0065 return ((valMin <= val) && (val < valMax)); 0066 } 0067 }; 0068 0069 /// Select objects that fulfill all selectors. 0070 template <typename... selectors_t> 0071 using CombineAnd = 0072 detail::CombineSelectors<true, std::logical_and<bool>, selectors_t...>; 0073 0074 /// Select objects that fulfill at least one selector. 0075 template <typename... selectors_t> 0076 using CombineOr = 0077 detail::CombineSelectors<false, std::logical_or<bool>, selectors_t...>; 0078 0079 } // namespace ActsFatras
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|