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