File indexing completed on 2025-01-18 09:11:10
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Utilities/Axis.hpp"
0012 #include "Acts/Utilities/Grid.hpp"
0013 #include "Acts/Utilities/TypeList.hpp"
0014
0015 #include <array>
0016 #include <tuple>
0017 #include <vector>
0018
0019
0020
0021
0022
0023
0024
0025 namespace Acts::GridAxisGenerators {
0026
0027
0028
0029
0030 template <Acts::AxisBoundaryType aType>
0031 struct Eq {
0032
0033 using return_type =
0034 std::tuple<Acts::Axis<Acts::AxisType::Equidistant, aType>>;
0035
0036
0037 template <typename T>
0038 using grid_type =
0039 Acts::Grid<T, Acts::Axis<Acts::AxisType::Equidistant, aType>>;
0040
0041 std::array<double, 2u> range = {};
0042 std::size_t nBins = 0u;
0043
0044
0045 return_type operator()() const {
0046 Acts::Axis<Acts::AxisType::Equidistant, aType> eAxis(range[0u], range[1u],
0047 nBins);
0048 return {eAxis};
0049 }
0050 };
0051
0052
0053 using EqBound = Eq<Acts::AxisBoundaryType::Bound>;
0054 using EqOpen = Eq<Acts::AxisBoundaryType::Open>;
0055 using EqClosed = Eq<Acts::AxisBoundaryType::Closed>;
0056
0057
0058
0059
0060 template <Acts::AxisBoundaryType aType>
0061 struct Var {
0062
0063 using return_type = std::tuple<Acts::Axis<Acts::AxisType::Variable, aType>>;
0064
0065
0066 template <typename T>
0067 using grid_type = Acts::Grid<T, Acts::Axis<Acts::AxisType::Variable, aType>>;
0068
0069 std::vector<double> edges = {};
0070
0071
0072 return_type operator()() const {
0073 Acts::Axis<Acts::AxisType::Variable, aType> vAxis(edges);
0074 return {vAxis};
0075 }
0076 };
0077
0078
0079 using VarBound = Var<Acts::AxisBoundaryType::Bound>;
0080 using VarOpen = Var<Acts::AxisBoundaryType::Open>;
0081 using VarClosed = Var<Acts::AxisBoundaryType::Closed>;
0082
0083
0084
0085
0086
0087
0088 template <Acts::AxisBoundaryType aType, Acts::AxisBoundaryType bType>
0089 struct EqEq {
0090
0091 using return_type =
0092 std::tuple<Acts::Axis<Acts::AxisType::Equidistant, aType>,
0093 Acts::Axis<Acts::AxisType::Equidistant, bType>>;
0094
0095
0096 template <typename T>
0097 using grid_type =
0098 Acts::Grid<T, Acts::Axis<Acts::AxisType::Equidistant, aType>,
0099 Acts::Axis<Acts::AxisType::Equidistant, bType>>;
0100
0101 std::array<double, 2u> range0 = {};
0102 std::size_t nBins0 = 0u;
0103 std::array<double, 2u> range1 = {};
0104 std::size_t nBins1 = 1u;
0105
0106
0107 return_type operator()() const {
0108
0109 Acts::Axis<Acts::AxisType::Equidistant, aType> aEq(range0[0u], range0[1u],
0110 nBins0);
0111 Acts::Axis<Acts::AxisType::Equidistant, bType> bEq(range1[0u], range1[1u],
0112 nBins1);
0113 return {aEq, bEq};
0114 }
0115 };
0116
0117
0118 using EqBoundEqBound =
0119 EqEq<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Bound>;
0120 using EqBoundEqOpen =
0121 EqEq<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Open>;
0122 using EqBoundEqClosed =
0123 EqEq<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Closed>;
0124 using EqOpenEqBound =
0125 EqEq<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Bound>;
0126 using EqOpenEqOpen =
0127 EqEq<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Open>;
0128 using EqOpenEqClosed =
0129 EqEq<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Closed>;
0130 using EqClosedEqBound =
0131 EqEq<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Bound>;
0132 using EqClosedEqOpen =
0133 EqEq<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Open>;
0134 using EqClosedEqClosed =
0135 EqEq<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Closed>;
0136
0137
0138
0139
0140
0141
0142 template <Acts::AxisBoundaryType aType, Acts::AxisBoundaryType bType>
0143 struct EqVar {
0144
0145 using return_type = std::tuple<Acts::Axis<Acts::AxisType::Equidistant, aType>,
0146 Acts::Axis<Acts::AxisType::Variable, bType>>;
0147
0148
0149 template <typename T>
0150 using grid_type =
0151 Acts::Grid<T, Acts::Axis<Acts::AxisType::Equidistant, aType>,
0152 Acts::Axis<Acts::AxisType::Variable, bType>>;
0153
0154 std::array<double, 2u> range = {};
0155 std::size_t nBins = 0u;
0156 std::vector<double> edges = {};
0157
0158
0159 return_type operator()() const {
0160 Acts::Axis<Acts::AxisType::Equidistant, aType> eqA(range[0u], range[1u],
0161 nBins);
0162 Acts::Axis<Acts::AxisType::Variable, bType> varB(edges);
0163 return {eqA, varB};
0164 }
0165 };
0166
0167
0168 using EqBoundVarBound =
0169 EqVar<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Bound>;
0170 using EqBoundVarOpen =
0171 EqVar<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Open>;
0172 using EqBoundVarClosed =
0173 EqVar<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Closed>;
0174 using EqOpenVarBound =
0175 EqVar<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Bound>;
0176 using EqOpenVarOpen =
0177 EqVar<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Open>;
0178 using EqOpenVarClosed =
0179 EqVar<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Closed>;
0180 using EqClosedVarBound =
0181 EqVar<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Bound>;
0182 using EqClosedVarOpen =
0183 EqVar<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Open>;
0184 using EqClosedVarClosed =
0185 EqVar<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Closed>;
0186
0187
0188
0189
0190
0191
0192 template <Acts::AxisBoundaryType aType, Acts::AxisBoundaryType bType>
0193 struct VarEq {
0194
0195 using return_type =
0196 std::tuple<Acts::Axis<Acts::AxisType::Variable, aType>,
0197 Acts::Axis<Acts::AxisType::Equidistant, bType>>;
0198
0199
0200 template <typename T>
0201 using grid_type = Acts::Grid<T, Acts::Axis<Acts::AxisType::Variable, aType>,
0202 Acts::Axis<Acts::AxisType::Equidistant, bType>>;
0203
0204 std::vector<double> edges = {};
0205 std::array<double, 2u> range = {};
0206 std::size_t nBins = 0u;
0207
0208
0209 return_type operator()() const {
0210 Acts::Axis<Acts::AxisType::Variable, aType> varA(edges);
0211 Acts::Axis<Acts::AxisType::Equidistant, bType> eqB(range[0u], range[1u],
0212 nBins);
0213 return {varA, eqB};
0214 }
0215 };
0216
0217
0218 using VarBoundEqBound =
0219 VarEq<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Bound>;
0220 using VarBoundEqOpen =
0221 VarEq<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Open>;
0222 using VarBoundEqClosed =
0223 VarEq<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Closed>;
0224 using VarOpenEqBound =
0225 VarEq<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Bound>;
0226 using VarOpenEqOpen =
0227 VarEq<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Open>;
0228 using VarOpenEqClosed =
0229 VarEq<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Closed>;
0230 using VarClosedEqBound =
0231 VarEq<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Bound>;
0232 using VarClosedEqOpen =
0233 VarEq<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Open>;
0234 using VarClosedEqClosed =
0235 VarEq<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Closed>;
0236
0237
0238
0239
0240
0241
0242 template <Acts::AxisBoundaryType aType, Acts::AxisBoundaryType bType>
0243 struct VarVar {
0244
0245 using return_type = std::tuple<Acts::Axis<Acts::AxisType::Variable, aType>,
0246 Acts::Axis<Acts::AxisType::Variable, bType>>;
0247
0248
0249 template <typename T>
0250 using grid_type = Acts::Grid<T, Acts::Axis<Acts::AxisType::Variable, aType>,
0251 Acts::Axis<Acts::AxisType::Variable, bType>>;
0252
0253 std::vector<double> edges0 = {};
0254 std::vector<double> edges1 = {};
0255
0256
0257 return_type operator()() const {
0258 Acts::Axis<Acts::AxisType::Variable, aType> varA(edges0);
0259 Acts::Axis<Acts::AxisType::Variable, bType> varB(edges1);
0260 return {varA, varB};
0261 }
0262 };
0263
0264
0265 using VarBoundVarBound =
0266 VarVar<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Bound>;
0267 using VarBoundVarOpen =
0268 VarVar<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Open>;
0269 using VarBoundVarClosed =
0270 VarVar<Acts::AxisBoundaryType::Bound, Acts::AxisBoundaryType::Closed>;
0271 using VarOpenVarBound =
0272 VarVar<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Bound>;
0273 using VarOpenVarOpen =
0274 VarVar<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Open>;
0275 using VarOpenVarClosed =
0276 VarVar<Acts::AxisBoundaryType::Open, Acts::AxisBoundaryType::Closed>;
0277 using VarClosedVarBound =
0278 VarVar<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Bound>;
0279 using VarClosedVarOpen =
0280 VarVar<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Open>;
0281 using VarClosedVarClosed =
0282 VarVar<Acts::AxisBoundaryType::Closed, Acts::AxisBoundaryType::Closed>;
0283
0284
0285 using PossibleAxes =
0286 TypeList<EqBound, EqOpen, EqClosed,
0287
0288 VarBound, VarOpen, VarClosed,
0289
0290 EqBoundEqBound, EqBoundEqOpen, EqBoundEqClosed, EqOpenEqBound,
0291 EqOpenEqOpen, EqOpenEqClosed, EqClosedEqBound, EqClosedEqOpen,
0292 EqClosedEqClosed,
0293
0294 EqBoundVarBound, EqBoundVarOpen, EqBoundVarClosed, EqOpenVarBound,
0295 EqOpenVarOpen, EqOpenVarClosed, EqClosedVarBound, EqClosedVarOpen,
0296 EqClosedVarClosed,
0297
0298 VarBoundEqBound, VarBoundEqOpen, VarBoundEqClosed, VarOpenEqBound,
0299 VarOpenEqOpen, VarOpenEqClosed, VarClosedEqBound, VarClosedEqOpen,
0300 VarClosedEqClosed,
0301
0302 VarBoundVarBound, VarBoundVarOpen, VarBoundVarClosed,
0303 VarOpenVarBound, VarOpenVarOpen, VarOpenVarClosed,
0304 VarClosedVarBound, VarClosedVarOpen, VarClosedVarClosed>;
0305
0306 }