From a91b75367530c75d01e169e6fdefefbbe4df55e2 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 26 Sep 2023 17:31:16 +0200 Subject: [PATCH 1/2] [ITS3] Improve transformation of coordinates and digitisation --- .../ITS3Base/SegmentationSuperAlpide.h | 50 +++++++++---------- .../ITS3/simulation/src/Digitizer.cxx | 12 ++--- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h index 810fa19e882fa..d0b01a1bbef7a 100644 --- a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h +++ b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h @@ -40,26 +40,26 @@ class SegmentationSuperAlpide } SegmentationSuperAlpide(int layer = 0) : SegmentationSuperAlpide(layer, SuperAlpideParams::Instance().mPitchCol, SuperAlpideParams::Instance().mPitchRow, SuperAlpideParams::Instance().mDetectorThickness, DescriptorInnerBarrelITS3Param::Instance().mLength, DescriptorInnerBarrelITS3Param::Instance().mRadii) {} - double mRadii[4] = {1.8f, 2.4f, 3.0f, 6.0f}; ///< radii for different layers - const double mLength; ///< chip length - const int mLayer; ///< chip layer - const float mPitchCol; ///< pixel column size - const float mPitchRow; ///< pixel row size - const float mDetectorLayerThickness; ///< detector thickness - const int mNCols{static_cast(std::ceil(mLength / mPitchCol))}; ///< number of columns - const int mNRows{static_cast(std::ceil(double(mRadii[mLayer] + mDetectorLayerThickness - mSensorLayerThickness / 2.) * double(constants::math::PI) / double(mPitchRow) * (mLayer == 3 ? 0.5 : 1.)))}; ///< number of rows - const int mNPixels{mNRows * mNCols}; ///< total number of pixels - static constexpr float mPassiveEdgeReadOut = 0.; ///< width of the readout edge (Passive bottom) - static constexpr float mPassiveEdgeTop = 0.; ///< Passive area on top - static constexpr float mPassiveEdgeSide = 0.; ///< width of Passive area on left/right of the sensor - const float mActiveMatrixSizeCols{mPitchCol * mNCols}; ///< Active size along columns - const float mActiveMatrixSizeRows{mPitchRow * mNRows}; ///< Active size along rows + double mRadii[4] = {1.8f, 2.4f, 3.0f, 6.0f}; ///< radii for different layers + const double mLength; ///< chip length + const int mLayer; ///< chip layer + const float mPitchCol; ///< pixel column size at the external surface + const float mPitchRow; ///< pixel row size at the external surface + const float mDetectorLayerThickness; ///< detector thickness + const int mNCols{static_cast(std::floor(mLength / mPitchCol / 2) * 2)}; ///< number of columns (we force to have an even number) + const int mNRows{static_cast(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) + const int mNPixels{mNRows * mNCols}; ///< total number of pixels + static constexpr float mPassiveEdgeReadOut = 0.; ///< width of the readout edge (Passive bottom) + static constexpr float mPassiveEdgeTop = 0.; ///< Passive area on top + static constexpr float mPassiveEdgeSide = 0.; ///< width of Passive area on left/right of the sensor + const float mActiveMatrixSizeCols{mPitchCol * mNCols}; ///< Active size along columns + const float mActiveMatrixSizeRows{mPitchRow * mNRows}; ///< Active size along rows // effective thickness of sensitive layer, accounting for charge collection non-uniformity, https://alice.its.cern.ch/jira/browse/AOC-46 - static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part - static constexpr float mSensorLayerThickness = 30.e-4; ///< physical thickness of sensitive part - const float mSensorSizeCols{mActiveMatrixSizeCols + mPassiveEdgeSide + mPassiveEdgeSide}; ///< SensorSize along columns - const float mSensorSizeRows{mActiveMatrixSizeRows + mPassiveEdgeTop + mPassiveEdgeReadOut}; ///< SensorSize along rows + static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part + static constexpr float mSensorLayerThickness = 30.e-4; ///< physical thickness of sensitive part + const float mSensorSizeCols{mActiveMatrixSizeCols + mPassiveEdgeSide + mPassiveEdgeSide}; ///< SensorSize along columns + const float mSensorSizeRows{mActiveMatrixSizeRows + mPassiveEdgeTop + mPassiveEdgeReadOut}; ///< SensorSize along rows ~SegmentationSuperAlpide() = default; @@ -140,7 +140,7 @@ inline void SegmentationSuperAlpide::curvedToFlat(float xCurved, float yCurved, float dist = std::sqrt(xCurved * xCurved + yCurved * yCurved); yFlat = dist - (mRadii[mLayer] + mDetectorLayerThickness - mSensorLayerThickness / 2.); float phi = (double)constants::math::PI / 2 - std::atan2((double)yCurved, (double)xCurved); - xFlat = dist * phi; + 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 } inline void SegmentationSuperAlpide::flatToCurved(float xFlat, float yFlat, float& xCurved, float& yCurved) @@ -156,9 +156,9 @@ inline void SegmentationSuperAlpide::localToDetectorUnchecked(float xRow, float { // convert to row/col w/o over/underflow check xRow = 0.5 * (mActiveMatrixSizeRows - mPassiveEdgeTop + mPassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix - zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt left edge of Active matrix - iRow = int(xRow / mPitchRow); - iCol = int(zCol / mPitchCol); + zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt left edge of Active matrix + iRow = std::floor(xRow / mPitchRow); + iCol = std::floor(zCol / mPitchCol); if (xRow < 0) { iRow -= 1; } @@ -171,13 +171,13 @@ inline bool SegmentationSuperAlpide::localToDetector(float xRow, float zCol, int { // convert to row/col xRow = 0.5 * (mActiveMatrixSizeRows - mPassiveEdgeTop + mPassiveEdgeReadOut) - xRow; // coordinate wrt left edge of Active matrix - zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt bottom edge of Active matrix + zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt bottom edge of Active matrix if (xRow < 0 || xRow >= mActiveMatrixSizeRows || zCol < 0 || zCol >= mActiveMatrixSizeCols) { iRow = iCol = -1; return false; } - iRow = int(xRow / mPitchRow); - iCol = int(zCol / mPitchCol); + iRow = std::floor(xRow / mPitchRow); + iCol = std::floor(zCol / mPitchCol); return true; } diff --git a/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx index d508458d92e54..181370f37f689 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx @@ -231,7 +231,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID float nStepsInv = mParams.getNSimStepsInv(); int nSteps = mParams.getNSimSteps(); short detID{hit.GetDetectorID()}; - const auto& matrix = mGeometry->getMatrixL2G(detID); // <<<< ????? + const auto& matrix = mGeometry->getMatrixL2G(detID); bool innerBarrel{detID < mSuperSegmentations.size()}; math_utils::Vector3D xyzLocS, xyzLocE; xyzLocS = matrix ^ (hit.GetPosStart()); @@ -331,12 +331,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID // take into account that the AlpideSimResponse depth defintion has different min/max boundaries // although the max should coincide with the surface of the epitaxial layer, which in the chip // local coordinates has Y = +SensorLayerThickness/2 - float thickness = innerBarrel ? mSuperSegmentations[detID].mDetectorLayerThickness : Segmentation::SensorLayerThickness; - if (!innerBarrel) { - xyzLocS.SetY(xyzLocS.Y() + resp->getDepthMax() - Segmentation::SensorLayerThickness / 2.); - } else { - xyzLocS.SetY(xyzLocS.Y() * (mSuperSegmentations[detID].mSensorLayerThicknessEff / 2. / mSuperSegmentations[detID].mDetectorLayerThickness)); // to avoid holes in clusters // FIXME - } + float thickness = innerBarrel ? mSuperSegmentations[detID].mSensorLayerThicknessEff : Segmentation::SensorLayerThickness; + xyzLocS.SetY(xyzLocS.Y() + resp->getDepthMax() - thickness / 2.); // collect charge in evey pixel which might be affected by the hit for (int iStep = nSteps; iStep--;) { @@ -413,7 +409,7 @@ void Digitizer::registerDigits(o2::itsmft::ChipDigitsContainer& chip, uint32_t r // multiple ROFrame. The signal starts at time tInROF wrt the start of provided roFrame // In every ROFrame we check the collected signal during strobe - float tStrobe = mParams.getStrobeDelay() - tInROF; // strobe start wrt signal start + float tStrobe = mParams.getStrobeDelay() - tInROF; // strobe start wrt signal start for (int i = 0; i < nROF; i++) { uint32_t roFr = roFrame + i; int nEleROF = mParams.getSignalShape().getCollectedCharge(nEle, tStrobe, tStrobe + mParams.getStrobeLength()); From 6e2d6f8644ede88415b2de23ef3725613b4f050d Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 26 Sep 2023 15:35:58 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- .../base/include/ITS3Base/SegmentationSuperAlpide.h | 12 ++++++------ Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h index d0b01a1bbef7a..fb888feb359ea 100644 --- a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h +++ b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h @@ -56,10 +56,10 @@ class SegmentationSuperAlpide const float mActiveMatrixSizeRows{mPitchRow * mNRows}; ///< Active size along rows // effective thickness of sensitive layer, accounting for charge collection non-uniformity, https://alice.its.cern.ch/jira/browse/AOC-46 - static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part - static constexpr float mSensorLayerThickness = 30.e-4; ///< physical thickness of sensitive part - const float mSensorSizeCols{mActiveMatrixSizeCols + mPassiveEdgeSide + mPassiveEdgeSide}; ///< SensorSize along columns - const float mSensorSizeRows{mActiveMatrixSizeRows + mPassiveEdgeTop + mPassiveEdgeReadOut}; ///< SensorSize along rows + static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part + static constexpr float mSensorLayerThickness = 30.e-4; ///< physical thickness of sensitive part + const float mSensorSizeCols{mActiveMatrixSizeCols + mPassiveEdgeSide + mPassiveEdgeSide}; ///< SensorSize along columns + const float mSensorSizeRows{mActiveMatrixSizeRows + mPassiveEdgeTop + mPassiveEdgeReadOut}; ///< SensorSize along rows ~SegmentationSuperAlpide() = default; @@ -156,7 +156,7 @@ inline void SegmentationSuperAlpide::localToDetectorUnchecked(float xRow, float { // convert to row/col w/o over/underflow check xRow = 0.5 * (mActiveMatrixSizeRows - mPassiveEdgeTop + mPassiveEdgeReadOut) - xRow; // coordinate wrt top edge of Active matrix - zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt left edge of Active matrix + zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt left edge of Active matrix iRow = std::floor(xRow / mPitchRow); iCol = std::floor(zCol / mPitchCol); if (xRow < 0) { @@ -171,7 +171,7 @@ inline bool SegmentationSuperAlpide::localToDetector(float xRow, float zCol, int { // convert to row/col xRow = 0.5 * (mActiveMatrixSizeRows - mPassiveEdgeTop + mPassiveEdgeReadOut) - xRow; // coordinate wrt left edge of Active matrix - zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt bottom edge of Active matrix + zCol += 0.5 * mActiveMatrixSizeCols; // coordinate wrt bottom edge of Active matrix if (xRow < 0 || xRow >= mActiveMatrixSizeRows || zCol < 0 || zCol >= mActiveMatrixSizeCols) { iRow = iCol = -1; return false; diff --git a/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx index 181370f37f689..cbad587f7cf7f 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx @@ -409,7 +409,7 @@ void Digitizer::registerDigits(o2::itsmft::ChipDigitsContainer& chip, uint32_t r // multiple ROFrame. The signal starts at time tInROF wrt the start of provided roFrame // In every ROFrame we check the collected signal during strobe - float tStrobe = mParams.getStrobeDelay() - tInROF; // strobe start wrt signal start + float tStrobe = mParams.getStrobeDelay() - tInROF; // strobe start wrt signal start for (int i = 0; i < nROF; i++) { uint32_t roFr = roFrame + i; int nEleROF = mParams.getSignalShape().getCollectedCharge(nEle, tStrobe, tStrobe + mParams.getStrobeLength());