File indexing completed on 2025-10-22 07:51:59
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
0039 std::array<double, 2u> range = {};
0040
0041 std::size_t nBins = 0u;
0042
0043
0044
0045 return_type operator()() const {
0046 Axis<AxisType::Equidistant, aType> eAxis(range[0u], range[1u], nBins);
0047 return {eAxis};
0048 }
0049 };
0050
0051
0052
0053 using EqBound = Eq<AxisBoundaryType::Bound>;
0054
0055 using EqOpen = Eq<AxisBoundaryType::Open>;
0056
0057 using EqClosed = Eq<AxisBoundaryType::Closed>;
0058
0059
0060
0061
0062 template <AxisBoundaryType aType>
0063 struct Var {
0064
0065 using return_type = std::tuple<Axis<AxisType::Variable, aType>>;
0066
0067
0068 template <typename T>
0069 using grid_type = Grid<T, Axis<AxisType::Variable, aType>>;
0070
0071
0072 std::vector<double> edges = {};
0073
0074
0075
0076 return_type operator()() const {
0077 Axis<AxisType::Variable, aType> vAxis(edges);
0078 return {vAxis};
0079 }
0080 };
0081
0082
0083
0084 using VarBound = Var<AxisBoundaryType::Bound>;
0085
0086 using VarOpen = Var<AxisBoundaryType::Open>;
0087
0088 using VarClosed = Var<AxisBoundaryType::Closed>;
0089
0090
0091
0092
0093
0094
0095 template <AxisBoundaryType aType, AxisBoundaryType bType>
0096 struct EqEq {
0097
0098 using return_type = std::tuple<Axis<AxisType::Equidistant, aType>,
0099 Axis<AxisType::Equidistant, bType>>;
0100
0101
0102 template <typename T>
0103 using grid_type = Grid<T, Axis<AxisType::Equidistant, aType>,
0104 Axis<AxisType::Equidistant, bType>>;
0105
0106
0107 std::array<double, 2u> range0 = {};
0108
0109 std::size_t nBins0 = 0u;
0110
0111 std::array<double, 2u> range1 = {};
0112
0113 std::size_t nBins1 = 1u;
0114
0115
0116
0117 return_type operator()() const {
0118
0119 Axis<AxisType::Equidistant, aType> aEq(range0[0u], range0[1u], nBins0);
0120 Axis<AxisType::Equidistant, bType> bEq(range1[0u], range1[1u], nBins1);
0121 return {aEq, bEq};
0122 }
0123 };
0124
0125
0126
0127 using EqBoundEqBound = EqEq<AxisBoundaryType::Bound, AxisBoundaryType::Bound>;
0128
0129 using EqBoundEqOpen = EqEq<AxisBoundaryType::Bound, AxisBoundaryType::Open>;
0130
0131
0132 using EqBoundEqClosed = EqEq<AxisBoundaryType::Bound, AxisBoundaryType::Closed>;
0133
0134 using EqOpenEqBound = EqEq<AxisBoundaryType::Open, AxisBoundaryType::Bound>;
0135
0136 using EqOpenEqOpen = EqEq<AxisBoundaryType::Open, AxisBoundaryType::Open>;
0137
0138 using EqOpenEqClosed = EqEq<AxisBoundaryType::Open, AxisBoundaryType::Closed>;
0139
0140
0141 using EqClosedEqBound = EqEq<AxisBoundaryType::Closed, AxisBoundaryType::Bound>;
0142
0143 using EqClosedEqOpen = EqEq<AxisBoundaryType::Closed, AxisBoundaryType::Open>;
0144
0145
0146 using EqClosedEqClosed =
0147 EqEq<AxisBoundaryType::Closed, AxisBoundaryType::Closed>;
0148
0149
0150
0151
0152
0153
0154 template <AxisBoundaryType aType, AxisBoundaryType bType>
0155 struct EqVar {
0156
0157 using return_type = std::tuple<Axis<AxisType::Equidistant, aType>,
0158 Axis<AxisType::Variable, bType>>;
0159
0160
0161 template <typename T>
0162 using grid_type = Grid<T, Axis<AxisType::Equidistant, aType>,
0163 Axis<AxisType::Variable, bType>>;
0164
0165
0166 std::array<double, 2u> range = {};
0167
0168 std::size_t nBins = 0u;
0169
0170 std::vector<double> edges = {};
0171
0172
0173
0174 return_type operator()() const {
0175 Axis<AxisType::Equidistant, aType> eqA(range[0u], range[1u], nBins);
0176 Axis<AxisType::Variable, bType> varB(edges);
0177 return {eqA, varB};
0178 }
0179 };
0180
0181
0182
0183
0184 using EqBoundVarBound = EqVar<AxisBoundaryType::Bound, AxisBoundaryType::Bound>;
0185
0186
0187 using EqBoundVarOpen = EqVar<AxisBoundaryType::Bound, AxisBoundaryType::Open>;
0188
0189
0190 using EqBoundVarClosed =
0191 EqVar<AxisBoundaryType::Bound, AxisBoundaryType::Closed>;
0192
0193
0194 using EqOpenVarBound = EqVar<AxisBoundaryType::Open, AxisBoundaryType::Bound>;
0195
0196
0197 using EqOpenVarOpen = EqVar<AxisBoundaryType::Open, AxisBoundaryType::Open>;
0198
0199
0200 using EqOpenVarClosed = EqVar<AxisBoundaryType::Open, AxisBoundaryType::Closed>;
0201
0202
0203 using EqClosedVarBound =
0204 EqVar<AxisBoundaryType::Closed, AxisBoundaryType::Bound>;
0205
0206
0207 using EqClosedVarOpen = EqVar<AxisBoundaryType::Closed, AxisBoundaryType::Open>;
0208
0209
0210 using EqClosedVarClosed =
0211 EqVar<AxisBoundaryType::Closed, AxisBoundaryType::Closed>;
0212
0213
0214
0215
0216
0217
0218 template <AxisBoundaryType aType, AxisBoundaryType bType>
0219 struct VarEq {
0220
0221 using return_type = std::tuple<Axis<AxisType::Variable, aType>,
0222 Axis<AxisType::Equidistant, bType>>;
0223
0224
0225 template <typename T>
0226 using grid_type = Grid<T, Axis<AxisType::Variable, aType>,
0227 Axis<AxisType::Equidistant, bType>>;
0228
0229
0230 std::vector<double> edges = {};
0231
0232 std::array<double, 2u> range = {};
0233
0234 std::size_t nBins = 0u;
0235
0236
0237
0238 return_type operator()() const {
0239 Axis<AxisType::Variable, aType> varA(edges);
0240 Axis<AxisType::Equidistant, bType> eqB(range[0u], range[1u], nBins);
0241 return {varA, eqB};
0242 }
0243 };
0244
0245
0246
0247
0248 using VarBoundEqBound = VarEq<AxisBoundaryType::Bound, AxisBoundaryType::Bound>;
0249
0250
0251 using VarBoundEqOpen = VarEq<AxisBoundaryType::Bound, AxisBoundaryType::Open>;
0252
0253
0254 using VarBoundEqClosed =
0255 VarEq<AxisBoundaryType::Bound, AxisBoundaryType::Closed>;
0256
0257
0258 using VarOpenEqBound = VarEq<AxisBoundaryType::Open, AxisBoundaryType::Bound>;
0259
0260
0261 using VarOpenEqOpen = VarEq<AxisBoundaryType::Open, AxisBoundaryType::Open>;
0262
0263
0264 using VarOpenEqClosed = VarEq<AxisBoundaryType::Open, AxisBoundaryType::Closed>;
0265
0266
0267 using VarClosedEqBound =
0268 VarEq<AxisBoundaryType::Closed, AxisBoundaryType::Bound>;
0269
0270
0271 using VarClosedEqOpen = VarEq<AxisBoundaryType::Closed, AxisBoundaryType::Open>;
0272
0273
0274 using VarClosedEqClosed =
0275 VarEq<AxisBoundaryType::Closed, AxisBoundaryType::Closed>;
0276
0277
0278
0279
0280
0281
0282 template <AxisBoundaryType aType, AxisBoundaryType bType>
0283 struct VarVar {
0284
0285 using return_type = std::tuple<Axis<AxisType::Variable, aType>,
0286 Axis<AxisType::Variable, bType>>;
0287
0288
0289 template <typename T>
0290 using grid_type =
0291 Grid<T, Axis<AxisType::Variable, aType>, Axis<AxisType::Variable, bType>>;
0292
0293
0294 std::vector<double> edges0 = {};
0295
0296 std::vector<double> edges1 = {};
0297
0298
0299
0300 return_type operator()() const {
0301 Axis<AxisType::Variable, aType> varA(edges0);
0302 Axis<AxisType::Variable, bType> varB(edges1);
0303 return {varA, varB};
0304 }
0305 };
0306
0307
0308
0309
0310 using VarBoundVarBound =
0311 VarVar<AxisBoundaryType::Bound, AxisBoundaryType::Bound>;
0312
0313
0314 using VarBoundVarOpen = VarVar<AxisBoundaryType::Bound, AxisBoundaryType::Open>;
0315
0316
0317 using VarBoundVarClosed =
0318 VarVar<AxisBoundaryType::Bound, AxisBoundaryType::Closed>;
0319
0320
0321 using VarOpenVarBound = VarVar<AxisBoundaryType::Open, AxisBoundaryType::Bound>;
0322
0323
0324 using VarOpenVarOpen = VarVar<AxisBoundaryType::Open, AxisBoundaryType::Open>;
0325
0326
0327 using VarOpenVarClosed =
0328 VarVar<AxisBoundaryType::Open, AxisBoundaryType::Closed>;
0329
0330
0331 using VarClosedVarBound =
0332 VarVar<AxisBoundaryType::Closed, AxisBoundaryType::Bound>;
0333
0334
0335 using VarClosedVarOpen =
0336 VarVar<AxisBoundaryType::Closed, AxisBoundaryType::Open>;
0337
0338
0339 using VarClosedVarClosed =
0340 VarVar<AxisBoundaryType::Closed, AxisBoundaryType::Closed>;
0341
0342
0343
0344 using PossibleAxes =
0345 TypeList<EqBound, EqOpen, EqClosed,
0346
0347 VarBound, VarOpen, VarClosed,
0348
0349 EqBoundEqBound, EqBoundEqOpen, EqBoundEqClosed, EqOpenEqBound,
0350 EqOpenEqOpen, EqOpenEqClosed, EqClosedEqBound, EqClosedEqOpen,
0351 EqClosedEqClosed,
0352
0353 EqBoundVarBound, EqBoundVarOpen, EqBoundVarClosed, EqOpenVarBound,
0354 EqOpenVarOpen, EqOpenVarClosed, EqClosedVarBound, EqClosedVarOpen,
0355 EqClosedVarClosed,
0356
0357 VarBoundEqBound, VarBoundEqOpen, VarBoundEqClosed, VarOpenEqBound,
0358 VarOpenEqOpen, VarOpenEqClosed, VarClosedEqBound, VarClosedEqOpen,
0359 VarClosedEqClosed,
0360
0361 VarBoundVarBound, VarBoundVarOpen, VarBoundVarClosed,
0362 VarOpenVarBound, VarOpenVarOpen, VarOpenVarClosed,
0363 VarClosedVarBound, VarClosedVarOpen, VarClosedVarClosed>;
0364
0365 }