Skip to content

Commit 3e84071

Browse files
matthias-kleinerclaude
authored andcommitted
TPC SCD: TrackResiduals y/x grid edge from the pad plane
The y/x range of the voxel grid was x tan(10 deg) - 1.5 cm (a fixed dead zone) per x bin. It does not follow the pad plane (the number of pads per row grows in steps, the pad width changes per region): relative to the outer side of the row's last pad it ends -0.83 to +0.33 pads off (negative: inside the pad plane), inside in 112 of 152 rows, in 36 of them by more than half a pad (the last pad's centre outside the grid), outside (in the gap to the next sector) in 40. Bins refined at the sector edges therefore covered a different part of the pad plane in each row. Now y/x = +-maxY2X is half the row's pads times its pad width (Mapper), for uniform X-binning the pad row closest to the bin centre. Unit test: the edge in every row. Maps binned with the old definition are to be read with an O2 version from before this change (their trees store bin indices and mean positions, the bin centres come from TrackResiduals). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d7ded9d commit 3e84071

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

‎Detectors/TPC/calibration/SpacePoints/include/SpacePoints/TrackResiduals.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ class TrackResiduals
460460

461461
// some constants
462462
static constexpr float sFloatEps{1.e-7f}; ///< float epsilon for robust linear fitting
463-
static constexpr float sDeadZone{1.5f}; ///< dead zone for TPC in between sectors
464463
static constexpr int sSmtLinDim{4}; ///< max matrix size for smoothing (pol1)
465464
static constexpr int sMaxSmtDim{7}; ///< max matrix size for smoothing (pol2)
466465

@@ -483,7 +482,7 @@ class TrackResiduals
483482
int mNVoxPerSector{}; ///< number of voxels per sector
484483
float mDX{}; ///< x bin size
485484
float mDXI{}; ///< inverse of x bin size
486-
std::vector<float> mMaxY2X{}; ///< max y/x at each x bin, accounting dead zones
485+
std::vector<float> mMaxY2X{}; ///< max y/x at each x bin: the pad plane's edge in its pad row
487486
std::vector<float> mDY2X{}; ///< y/x bin size at given x bin
488487
std::vector<float> mDY2XI{}; ///< inverse y/x bin size at given x bin
489488
std::vector<float> mY2XBinsDH{}; ///< half width in y/x within the interval [-1..1]

‎Detectors/TPC/calibration/SpacePoints/src/TrackResiduals.cxx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
///
1818

1919
#include "SpacePoints/TrackResiduals.h"
20+
#include "TPCBase/Mapper.h"
2021
#include "CommonConstants/MathConstants.h"
2122
#include "ReconstructionDataFormats/Track.h"
2223
#include "MathUtils/fit.h"
@@ -164,14 +165,21 @@ void TrackResiduals::initBinning()
164165
mDXI = 1.f / mDX; // should not be used
165166
}
166167
//
167-
// Y/X binning
168+
// Y/X binning: y/x = +-mMaxY2X is the pad plane's edge in the pad row of the x bin (the outer edge of its outermost pads; with uniform
169+
// X-binning the pad row closest to the bin centre), so the outermost y/x bins end with the row's last pads
168170
mMaxY2X.resize(mNXBins);
169171
mDY2XI.resize(mNXBins);
170172
mDY2X.resize(mNXBins);
171173
//
174+
const auto& mapper = Mapper::instance();
172175
for (int ix = 0; ix < mNXBins; ++ix) {
173176
float x = getX(ix);
174-
mMaxY2X[ix] = tan(.5f * SECPHIWIDTH) - sDeadZone / x;
177+
int row = ix;
178+
if (mUniformBins[VoxX]) {
179+
row = int(std::min_element(param::RowX, param::RowX + param::NPadRows, [x](float a, float b) { return std::abs(a - x) < std::abs(b - x); }) - param::RowX);
180+
}
181+
const float halfWidth = 0.5f * mapper.getNumberOfPadsInRowSector(row) * mapper.getPadRegionInfo(Mapper::REGION[row]).getPadWidth();
182+
mMaxY2X[ix] = halfWidth / x;
175183
mDY2XI[ix] = mNY2XBins / (2.f * mMaxY2X[ix]);
176184
mDY2X[ix] = 1.f / mDY2XI[ix];
177185
}

‎Detectors/TPC/calibration/SpacePoints/test/testTrackResiduals.cxx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define BOOST_TEST_DYN_LINK
2020
#include <boost/test/unit_test.hpp>
2121
#include "SpacePoints/TrackResiduals.h"
22+
#include "TPCBase/Mapper.h"
2223

2324
namespace o2::tpc
2425
{
@@ -58,4 +59,16 @@ BOOST_AUTO_TEST_CASE(TrackResidualsBinning_test)
5859
}
5960
}
6061

62+
// the y/x grid ends at the pad plane's edge of each pad row
63+
BOOST_AUTO_TEST_CASE(TrackResidualsY2XEdge_test)
64+
{
65+
TrackResiduals resid;
66+
resid.initBinning();
67+
const auto& mapper = Mapper::instance();
68+
for (int ix = 0; ix < resid.getNXBins(); ++ix) {
69+
const float halfWidth = 0.5f * mapper.getNumberOfPadsInRowSector(ix) * mapper.getPadRegionInfo(Mapper::REGION[ix]).getPadWidth();
70+
BOOST_CHECK_CLOSE(resid.getMaxY2X(ix) * resid.getX(ix), halfWidth, 1e-3);
71+
}
72+
}
73+
6174
} // namespace o2::tpc

0 commit comments

Comments
 (0)