From 646718d6b16591ec3917be6e2fb4cf29bb37a60d Mon Sep 17 00:00:00 2001 From: maciacco Date: Mon, 21 Sep 2026 22:31:31 +0200 Subject: [PATCH 1/2] fix stepping for both passive and active pixel edges + revert change in central framework + add macro test in cmake list --- .../base/include/IOTOFBase/Segmentation.h | 2 ++ .../ALICE3/IOTOF/macros/CMakeLists.txt | 3 ++ .../ALICE3/IOTOF/simulation/src/Digitizer.cxx | 34 ++++++++++--------- Framework/Core/src/CommonServices.cxx | 2 +- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h b/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h index c726998fcd4bc..650b6a5faf913 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h @@ -178,6 +178,7 @@ inline void Segmentation::localToDetectorUnchecked(float xRow, float zCol, int& iRow = iCol = -1; return; } + if (xRow < 0) { iRow -= 1; } @@ -208,6 +209,7 @@ inline bool Segmentation::localToDetector(float xRow, float zCol, int& iRow, int iRow = iCol = -1; return false; } + return true; } diff --git a/Detectors/Upgrades/ALICE3/IOTOF/macros/CMakeLists.txt b/Detectors/Upgrades/ALICE3/IOTOF/macros/CMakeLists.txt index efca7b8de1a9f..8b08fabf6f477 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/macros/CMakeLists.txt +++ b/Detectors/Upgrades/ALICE3/IOTOF/macros/CMakeLists.txt @@ -28,3 +28,6 @@ o2_add_test_root_macro(CheckDigitsIOTOF.C o2_add_test_root_macro(CheckClustersIOTOF.C LABELS iotof COMPILE_ONLY) + +o2_add_test_root_macro(CheckTopologiesIOTOF.C + LABELS iotof COMPILE_ONLY) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx index 913e7bcdf0865..90578c08a2f1e 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx @@ -221,6 +221,12 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, float* } LOG(debug) << "Hit end position in sensor frame after adjustment: (" << xyzPositionEnd.X() << ", " << xyzPositionEnd.Y() << ", " << xyzPositionEnd.Z() << ")"; + LOG(debug) << "Starting stepping through the hit with " << nSteps << " steps"; + if (nSkip) { + nSteps -= nSkip; + } + LOG(debug) << "Adjusted number of steps after skipping: " << nSteps; + std::set crossedRows, crossedCols; for (int iStep = nSteps; iStep--;) { auto pixelCurrentPosLocal = xyzPositionStart + stepVector * iStep; @@ -276,21 +282,17 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, float* if (!respMatrix || !avgHitLocalX || !avgHitLocalZ) { return; } - LOG(debug) << "Starting stepping through the hit with " << nSteps << " steps"; - if (nSkip) { - nSteps -= nSkip; - } - LOG(debug) << "Adjusted number of steps after skipping: " << nSteps; - int rowPrev = -1, colPrev = -1, row = 0, col = 0; - auto pixelCurrentPosLocal = xyzPositionStart; + int rowPrev = -1, colPrev = -1, row = 0, col = 0, nSkipPassive = 0; auto pixelStartPosLocal = xyzPositionStart; - for (int iStep = nSteps; iStep--;) { + auto pixelCurrentPosLocal = xyzPositionStart; + for (int iStep{0}; iStep < nSteps; ++iStep) { + pixelCurrentPosLocal = xyzPositionStart + iStep * stepVector; // Step does not contribute if it is in the passive area if (!sSegmentation->localToDetector(pixelCurrentPosLocal.X(), pixelCurrentPosLocal.Z(), row, col, subdetectorID)) { LOG(debug) << "Step is in passive area: (" << pixelCurrentPosLocal.X() << ", " << pixelCurrentPosLocal.Z() << ") is outside the active area of chip " << subdetectorID; - pixelCurrentPosLocal += stepVector; + nSkipPassive++; continue; } @@ -303,18 +305,18 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, float* if (rowPrev != -1 && colPrev != -1) { const int irow = rowPrev - rowStart; const int icol = colPrev - colStart; - avgHitLocalX[irow][icol] = 0.5f * (pixelStartPosLocal.X() + pixelCurrentPosLocal.X() - stepVector.X()); - avgHitLocalZ[irow][icol] = 0.5f * (pixelStartPosLocal.Z() + pixelCurrentPosLocal.Z() - stepVector.Z()); + avgHitLocalX[irow][icol] = 0.5f * (pixelStartPosLocal.X() + pixelCurrentPosLocal.X() - (nSkipPassive + 1) * stepVector.X()); + avgHitLocalZ[irow][icol] = 0.5f * (pixelStartPosLocal.Z() + pixelCurrentPosLocal.Z() - (nSkipPassive + 1) * stepVector.Z()); + LOG(debug) << "avgHitLocalX = " << avgHitLocalX[irow][icol] << ", avgHitLocalZ = " << avgHitLocalZ[irow][icol]; + pixelStartPosLocal = pixelCurrentPosLocal; + nSkipPassive = 0; } // Start the new pixel rowPrev = row; colPrev = col; - pixelStartPosLocal = pixelCurrentPosLocal; } - pixelCurrentPosLocal += stepVector; // Move to the next step position - for (int irow = digitizerParams.responseMatrixSize; irow--;) { int rowDest = row + irow - (digitizerParams.responseMatrixSize / 2) - rowStart; // destination row in the respMatrix if (rowDest < 0 || rowDest >= rowSpan) { @@ -340,8 +342,8 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, float* LOG(debug) << "avgHitLocalX dimensions: " << rowSpan << " x " << colSpan; LOG(debug) << "avgHitLocalZ dimensions: " << rowSpan << " x " << colSpan; LOG(debug) << "Finalizing last pixel at (row,col) = (" << rowPrev << ", " << colPrev << ") with indices (irow,icol) = (" << irow << ", " << icol << ")"; - avgHitLocalX[irow][icol] = 0.5f * (pixelStartPosLocal.X() + pixelCurrentPosLocal.X() - stepVector.X()); - avgHitLocalZ[irow][icol] = 0.5f * (pixelStartPosLocal.Z() + pixelCurrentPosLocal.Z() - stepVector.Z()); + avgHitLocalX[irow][icol] = 0.5f * (pixelStartPosLocal.X() + pixelCurrentPosLocal.X() - nSkipPassive * stepVector.X()); + avgHitLocalZ[irow][icol] = 0.5f * (pixelStartPosLocal.Z() + pixelCurrentPosLocal.Z() - nSkipPassive * stepVector.Z()); LOG(debug) << "Finalized last pixel average positions: avgHitLocalX = " << avgHitLocalX[irow][icol] << ", avgHitLocalZ = " << avgHitLocalZ[irow][icol]; } LOG(debug) << "Finalized last pixel for detector ID: " << chipID; diff --git a/Framework/Core/src/CommonServices.cxx b/Framework/Core/src/CommonServices.cxx index 2b6d6023ac7d5..c36a102bde80d 100644 --- a/Framework/Core/src/CommonServices.cxx +++ b/Framework/Core/src/CommonServices.cxx @@ -143,7 +143,7 @@ o2::framework::ServiceSpec CommonServices::monitoringSpec() // covers devices that quit themselves via readyToQuit(). .stop = [](ServiceRegistryRef, void* service) { auto* monitoring = reinterpret_cast(service); - monitoring->enableProcessMonitoring(); }, + monitoring->finalizeProcessMonitoring(); }, .exit = [](ServiceRegistryRef registry, void* service) { auto* monitoring = reinterpret_cast(service); monitoring->flushBuffer(); From 0c29c73360491998dabcafb84ae65bf300c81738 Mon Sep 17 00:00:00 2001 From: maciacco Date: Mon, 21 Sep 2026 22:34:33 +0200 Subject: [PATCH 2/2] remove empty lines --- .../Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h b/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h index 650b6a5faf913..c726998fcd4bc 100644 --- a/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h +++ b/Detectors/Upgrades/ALICE3/IOTOF/base/include/IOTOFBase/Segmentation.h @@ -178,7 +178,6 @@ inline void Segmentation::localToDetectorUnchecked(float xRow, float zCol, int& iRow = iCol = -1; return; } - if (xRow < 0) { iRow -= 1; } @@ -209,7 +208,6 @@ inline bool Segmentation::localToDetector(float xRow, float zCol, int& iRow, int iRow = iCol = -1; return false; } - return true; }