Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:08

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2018 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <climits>
0012 
0013 namespace Fatras {
0014 
0015 // static selectors
0016 template <typename cast_t> struct Min {
0017 
0018   cast_t cast;
0019   double valMin = 0.;
0020 
0021   /// Return true for all particles with transverse momentum
0022   /// bigger than the specified minimum value
0023   template <typename detector_t, typename particle_t>
0024   bool operator()(const detector_t &, const particle_t &particle) const {
0025     double val = cast(particle);
0026     return (val >= valMin);
0027   }
0028 };
0029 
0030 template <typename cast_t> struct Max {
0031 
0032   cast_t cast;
0033   double valMax = std::numeric_limits<double>::max();
0034 
0035   /// Return true for all particles with transverse momentum
0036   /// bigger than the specified minimum value
0037   template <typename detector_t, typename particle_t>
0038   bool operator()(const detector_t &, const particle_t &particle) const {
0039     double val = cast(particle);
0040     return (val <= valMax);
0041   }
0042 };
0043 
0044 template <typename cast_t> struct Range {
0045 
0046   cast_t cast;
0047   double valMin = 0.;
0048   double valMax = std::numeric_limits<double>::max();
0049 
0050   /// Return true for all particles with transverse momentum
0051   /// within the specified range
0052   template <typename detector_t, typename particle_t>
0053   bool operator()(const detector_t &, const particle_t &particle) const {
0054     double val = cast(particle);
0055     return (val >= valMin && val <= valMax);
0056   }
0057 };
0058 } // namespace Fatras