Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:23:58

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 // Project include(s)
0012 #include "detray/definitions/detail/qualifiers.hpp"
0013 
0014 // System include(s)
0015 #include <ostream>
0016 
0017 namespace detray::axis {
0018 
0019 /// axis bounds names.
0020 ///
0021 /// open: adds additional over-/underflow bins.
0022 /// closed: over-/underflow values are mapped into the bin range.
0023 /// circular: over-/underflow values wrap around.
0024 enum class bounds {
0025   e_open = 0,
0026   e_closed = 1,
0027   e_circular = 2,
0028 };
0029 
0030 /// axis coordinate names. Used to get a specific axes from an axes collection.
0031 ///
0032 /// x, y, z: cartesian coordinate axes.
0033 /// r, phi: polar coordinate axes.
0034 /// rphi, cyl_z: 2D cylinder axes (3D cylinder uses r, phi, z).
0035 enum class label {
0036   e_x = 0,
0037   e_y = 1,
0038   e_z = 2,
0039   e_r = 0,
0040   e_phi = 1,
0041   e_rphi = 0,
0042   e_cyl_z = 1,
0043 };
0044 
0045 /// axis binning type names.
0046 ///
0047 /// regular: same sized bins along the axis.
0048 /// irregular: every bin can have a different size along the axis.
0049 enum class binning {
0050   e_regular = 0,
0051   e_irregular = 1,
0052 };
0053 
0054 // Print the values of an enum by identifier
0055 #define ENUM_PRINT(x) \
0056   case x:             \
0057     os << #x;         \
0058     break
0059 
0060 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, bounds b) {
0061   switch (b) {
0062     using enum bounds;
0063     ENUM_PRINT(e_open);
0064     ENUM_PRINT(e_closed);
0065     ENUM_PRINT(e_circular);
0066   }
0067   return os;
0068 }
0069 
0070 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, label l) {
0071   switch (l) {
0072     using enum label;
0073     case e_x:
0074       // e_r and e_rphi have same value (0)
0075       os << "e_x/e_r/e_rphi";
0076       break;
0077     case e_y:
0078       // e_phi and e_cyl_z have same value (1)
0079       os << "e_y/e_phi/e_cyl_z";
0080       break;
0081       ENUM_PRINT(e_z);
0082   }
0083   return os;
0084 }
0085 
0086 DETRAY_HOST inline std::ostream& operator<<(std::ostream& os, binning b) {
0087   switch (b) {
0088     using enum binning;
0089     ENUM_PRINT(e_regular);
0090     ENUM_PRINT(e_irregular);
0091   }
0092   return os;
0093 }
0094 
0095 #undef ENUM_PRINT
0096 
0097 }  // namespace detray::axis