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();