Skip to content

Commit 3183ac7

Browse files
committed
ITS3 D2L supports floating row and column numbers
1 parent 9e64146 commit 3183ac7

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationMosaix.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,25 +168,26 @@ class SegmentationMosaix
168168
/// center of the sensitive volume.
169169
/// If iRow and or iCol is outside of the segmentation range a value of -0.5*Dx()
170170
/// or -0.5*Dz() is returned.
171-
constexpr bool detectorToLocal(int const iRow, int const iCol, float& xRow, float& zCol) const noexcept
172-
{
173-
if (!isValid(iRow, iCol)) {
171+
template <typename T>
172+
constexpr bool detectorToLocal(T const row, T const col, float& xRow, float& zCol) const noexcept {
173+
if (!isValid(row, col)) {
174174
return false;
175175
}
176-
detectorToLocalUnchecked(iRow, iCol, xRow, zCol);
176+
detectorToLocalUnchecked(row, col, xRow, zCol);
177177
return isValid(xRow, zCol);
178178
}
179179

180180
// Same as detectorToLocal w.o. checks.
181181
// We position ourself in the middle of the pixel.
182-
constexpr void detectorToLocalUnchecked(int const iRow, int const iCol, float& xRow, float& zCol) const noexcept
183-
{
184-
xRow = -(static_cast<float>(iRow) + 0.5f) * PitchRow + WidthH;
185-
zCol = (static_cast<float>(iCol) + 0.5f) * PitchCol - LengthH;
182+
template <typename T>
183+
constexpr void detectorToLocalUnchecked(T const row, T const col, float& xRow, float& zCol) const noexcept {
184+
xRow = -(static_cast<float>(row) + 0.5f) * PitchRow + WidthH;
185+
zCol = (static_cast<float>(col) + 0.5f) * PitchCol - LengthH;
186186
}
187187

188-
constexpr bool detectorToLocal(int const row, int const col, math_utils::Point3D<float>& loc) const noexcept
189-
{
188+
189+
template <typename T>
190+
constexpr bool detectorToLocal(T const row, T const col, math_utils::Point3D<float>& loc) const noexcept {
190191
float xRow{0.}, zCol{0.};
191192
if (!detectorToLocal(row, col, xRow, zCol)) {
192193
return false;
@@ -195,8 +196,8 @@ class SegmentationMosaix
195196
return true;
196197
}
197198

198-
constexpr void detectorToLocalUnchecked(int const row, int const col, math_utils::Point3D<float>& loc) const noexcept
199-
{
199+
template <typename T>
200+
constexpr void detectorToLocalUnchecked(T const row, T const col, math_utils::Point3D<float>& loc) const noexcept {
200201
float xRow{0.}, zCol{0.};
201202
detectorToLocalUnchecked(row, col, xRow, zCol);
202203
loc.SetCoordinates(xRow, NominalYShift, zCol);

0 commit comments

Comments
 (0)