Skip to content

Commit 83bb4aa

Browse files
authored
fix: select binning dimension in cuboid volume builder (#3463)
This lets us set in the config also other dimension than the previous `BinningValue::binX`. This is necessary, if we want to build a detector that is not parallel to the x-axis. The default value stays `BinningValue::binX` to not break anything. ### Note Volumes will be connected only in X-direction, since `BoundarySurfaceFace::positiveFaceYZ` is hardcoded. It might be possible to generalise this, but I didn't need that feature and it might overcomplicate the builder.
1 parent e10a868 commit 83bb4aa

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Core/include/Acts/Geometry/CuboidVolumeBuilder.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder {
8181
std::array<ActsScalar, 2u> envelopeZ{0, 0};
8282
// An optional rotation for this
8383
std::optional<RotationMatrix3> rotation{std::nullopt};
84+
// Dimension for the binning
85+
Acts::BinningValue binningDimension = Acts::BinningValue::binX;
8486
};
8587

8688
/// @brief This struct stores the data for the construction of a cuboid
@@ -102,6 +104,8 @@ class CuboidVolumeBuilder : public ITrackingVolumeBuilder {
102104
std::string name = "Volume";
103105
// Material
104106
std::shared_ptr<const IVolumeMaterial> volumeMaterial = nullptr;
107+
// Dimension for the binning
108+
Acts::BinningValue binningDimension = Acts::BinningValue::binX;
105109
};
106110

107111
/// @brief This struct stores the configuration of the tracking geometry

Core/src/Geometry/CuboidVolumeBuilder.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ std::shared_ptr<const Acts::Layer> Acts::CuboidVolumeBuilder::buildLayer(
9797
pl.envelope[BinningValue::binY] = cfg.envelopeY;
9898
pl.envelope[BinningValue::binZ] = cfg.envelopeZ;
9999
return layerCreator.planeLayer(gctx, cfg.surfaces, cfg.binsY, cfg.binsZ,
100-
BinningValue::binX, pl, trafo);
100+
cfg.binningDimension, pl, trafo);
101101
}
102102

103103
std::pair<double, double> Acts::CuboidVolumeBuilder::binningRange(
@@ -121,10 +121,10 @@ std::pair<double, double> Acts::CuboidVolumeBuilder::binningRange(
121121
for (const auto& layercfg : cfg.layerCfg) {
122122
// recreating the protolayer for each layer => slow, but only few sensors
123123
ProtoLayer pl{gctx, layercfg.surfaces};
124-
pl.envelope[BinningValue::binX] = layercfg.envelopeX;
124+
pl.envelope[cfg.binningDimension] = layercfg.envelopeX;
125125

126-
double surfacePosMin = pl.min(BinningValue::binX);
127-
double surfacePosMax = pl.max(BinningValue::binX);
126+
double surfacePosMin = pl.min(cfg.binningDimension);
127+
double surfacePosMax = pl.max(cfg.binningDimension);
128128

129129
// Test if new extreme is found and set it
130130
if (surfacePosMin < minMax.first) {
@@ -137,9 +137,9 @@ std::pair<double, double> Acts::CuboidVolumeBuilder::binningRange(
137137

138138
// Use the volume boundaries as limits for the binning
139139
minMax.first = std::min(
140-
minMax.first, minVolumeBoundaries(toUnderlying(BinningValue::binX)));
140+
minMax.first, minVolumeBoundaries(toUnderlying(cfg.binningDimension)));
141141
minMax.second = std::max(
142-
minMax.second, maxVolumeBoundaries(toUnderlying(BinningValue::binX)));
142+
minMax.second, maxVolumeBoundaries(toUnderlying(cfg.binningDimension)));
143143

144144
return minMax;
145145
}
@@ -176,7 +176,7 @@ std::shared_ptr<Acts::TrackingVolume> Acts::CuboidVolumeBuilder::buildVolume(
176176
lacCnf, getDefaultLogger("LayerArrayCreator", Logging::INFO));
177177
std::unique_ptr<const LayerArray> layArr(
178178
layArrCreator.layerArray(gctx, layVec, minMax.first, minMax.second,
179-
BinningType::arbitrary, BinningValue::binX));
179+
BinningType::arbitrary, cfg.binningDimension));
180180

181181
// Build confined volumes
182182
if (cfg.trackingVolumes.empty()) {

0 commit comments

Comments
 (0)