Skip to content

Commit 92c61a6

Browse files
fgrosaalibuild
andauthored
[ITS3] Improve transformation of coordinates and digitisation (#11965)
* [ITS3] Improve transformation of coordinates and digitisation * Please consider the following formatting changes --------- Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 08686ca commit 92c61a6

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ class SegmentationSuperAlpide
4040
}
4141
SegmentationSuperAlpide(int layer = 0) : SegmentationSuperAlpide(layer, SuperAlpideParams::Instance().mPitchCol, SuperAlpideParams::Instance().mPitchRow, SuperAlpideParams::Instance().mDetectorThickness, DescriptorInnerBarrelITS3Param::Instance().mLength, DescriptorInnerBarrelITS3Param::Instance().mRadii) {}
4242

43-
double mRadii[4] = {1.8f, 2.4f, 3.0f, 6.0f}; ///< radii for different layers
44-
const double mLength; ///< chip length
45-
const int mLayer; ///< chip layer
46-
const float mPitchCol; ///< pixel column size
47-
const float mPitchRow; ///< pixel row size
48-
const float mDetectorLayerThickness; ///< detector thickness
49-
const int mNCols{static_cast<int>(std::ceil(mLength / mPitchCol))}; ///< number of columns
50-
const int mNRows{static_cast<int>(std::ceil(double(mRadii[mLayer] + mDetectorLayerThickness - mSensorLayerThickness / 2.) * double(constants::math::PI) / double(mPitchRow) * (mLayer == 3 ? 0.5 : 1.)))}; ///< number of rows
51-
const int mNPixels{mNRows * mNCols}; ///< total number of pixels
52-
static constexpr float mPassiveEdgeReadOut = 0.; ///< width of the readout edge (Passive bottom)
53-
static constexpr float mPassiveEdgeTop = 0.; ///< Passive area on top
54-
static constexpr float mPassiveEdgeSide = 0.; ///< width of Passive area on left/right of the sensor
55-
const float mActiveMatrixSizeCols{mPitchCol * mNCols}; ///< Active size along columns
56-
const float mActiveMatrixSizeRows{mPitchRow * mNRows}; ///< Active size along rows
43+
double mRadii[4] = {1.8f, 2.4f, 3.0f, 6.0f}; ///< radii for different layers
44+
const double mLength; ///< chip length
45+
const int mLayer; ///< chip layer
46+
const float mPitchCol; ///< pixel column size at the external surface
47+
const float mPitchRow; ///< pixel row size at the external surface
48+
const float mDetectorLayerThickness; ///< detector thickness
49+
const int mNCols{static_cast<int>(std::floor(mLength / mPitchCol / 2) * 2)}; ///< number of columns (we force to have an even number)
50+
const int mNRows{static_cast<int>(std::floor(double(mRadii[mLayer] + mDetectorLayerThickness - mSensorLayerThicknessEff / 2.) * double(constants::math::PI) / double(mPitchRow) / 2 * (mLayer == 3 ? 0.5 : 1.)) * 2)}; ///< number of rows (we force to have an even number)
51+
const int mNPixels{mNRows * mNCols}; ///< total number of pixels
52+
static constexpr float mPassiveEdgeReadOut = 0.; ///< width of the readout edge (Passive bottom)
53+
static constexpr float mPassiveEdgeTop = 0.; ///< Passive area on top
54+
static constexpr float mPassiveEdgeSide = 0.; ///< width of Passive area on left/right of the sensor
55+
const float mActiveMatrixSizeCols{mPitchCol * mNCols}; ///< Active size along columns
56+
const float mActiveMatrixSizeRows{mPitchRow * mNRows}; ///< Active size along rows
5757

5858
// effective thickness of sensitive layer, accounting for charge collection non-uniformity, https://alice.its.cern.ch/jira/browse/AOC-46
5959
static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part
@@ -140,7 +140,7 @@ inline void SegmentationSuperAlpide::curvedToFlat(float xCurved, float yCurved,
140140
float dist = std::sqrt(xCurved * xCurved + yCurved * yCurved);
141141
yFlat = dist - (mRadii[mLayer] + mDetectorLayerThickness - mSensorLayerThickness / 2.);
142142
float phi = (double)constants::math::PI / 2 - std::atan2((double)yCurved, (double)xCurved);
143-
xFlat = dist * phi;
143+
xFlat = (mRadii[mLayer] + mDetectorLayerThickness - mSensorLayerThickness / 2.) * phi; // we bring everything to the upper surface to avoid effects due to the different length of upper and lower surfaces
144144
}
145145

146146
inline void SegmentationSuperAlpide::flatToCurved(float xFlat, float yFlat, float& xCurved, float& yCurved)
@@ -157,8 +157,8 @@ inline void SegmentationSuperAlpide::localToDetectorUnchecked(float xRow, float
157157
// convert to row/col w/o over/underflow check
158158
xRow = 0.5 * (mActiveMatrixSizeRows - mPassiveEdgeTop + mPassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix
159159
zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt left edge of Active matrix
160-
iRow = int(xRow / mPitchRow);
161-
iCol = int(zCol / mPitchCol);
160+
iRow = std::floor(xRow / mPitchRow);
161+
iCol = std::floor(zCol / mPitchCol);
162162
if (xRow < 0) {
163163
iRow -= 1;
164164
}
@@ -176,8 +176,8 @@ inline bool SegmentationSuperAlpide::localToDetector(float xRow, float zCol, int
176176
iRow = iCol = -1;
177177
return false;
178178
}
179-
iRow = int(xRow / mPitchRow);
180-
iCol = int(zCol / mPitchCol);
179+
iRow = std::floor(xRow / mPitchRow);
180+
iCol = std::floor(zCol / mPitchCol);
181181
return true;
182182
}
183183

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
231231
float nStepsInv = mParams.getNSimStepsInv();
232232
int nSteps = mParams.getNSimSteps();
233233
short detID{hit.GetDetectorID()};
234-
const auto& matrix = mGeometry->getMatrixL2G(detID); // <<<< ?????
234+
const auto& matrix = mGeometry->getMatrixL2G(detID);
235235
bool innerBarrel{detID < mSuperSegmentations.size()};
236236
math_utils::Vector3D<float> xyzLocS, xyzLocE;
237237
xyzLocS = matrix ^ (hit.GetPosStart());
@@ -331,12 +331,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
331331
// take into account that the AlpideSimResponse depth defintion has different min/max boundaries
332332
// although the max should coincide with the surface of the epitaxial layer, which in the chip
333333
// local coordinates has Y = +SensorLayerThickness/2
334-
float thickness = innerBarrel ? mSuperSegmentations[detID].mDetectorLayerThickness : Segmentation::SensorLayerThickness;
335-
if (!innerBarrel) {
336-
xyzLocS.SetY(xyzLocS.Y() + resp->getDepthMax() - Segmentation::SensorLayerThickness / 2.);
337-
} else {
338-
xyzLocS.SetY(xyzLocS.Y() * (mSuperSegmentations[detID].mSensorLayerThicknessEff / 2. / mSuperSegmentations[detID].mDetectorLayerThickness)); // to avoid holes in clusters // FIXME
339-
}
334+
float thickness = innerBarrel ? mSuperSegmentations[detID].mSensorLayerThicknessEff : Segmentation::SensorLayerThickness;
335+
xyzLocS.SetY(xyzLocS.Y() + resp->getDepthMax() - thickness / 2.);
340336

341337
// collect charge in evey pixel which might be affected by the hit
342338
for (int iStep = nSteps; iStep--;) {

0 commit comments

Comments
 (0)