Skip to content

Commit 05b9fd9

Browse files
mpuccioshahor02
authored andcommitted
Hotfix check on the array boundaries
1 parent e46441c commit 05b9fd9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Detectors/ITSMFT/ITS/tracking/src/TrackerTraitsCPU.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ void TrackerTraitsCPU::computeLayerTracklets()
4040

4141
for (int rof0{0}; rof0 < tf->getNrof(); ++rof0) {
4242
gsl::span<const Vertex> primaryVertices = tf->getPrimaryVertices(rof0);
43+
int minRof = (rof0 >= mTrkParams.DeltaROF) ? rof0 - mTrkParams.DeltaROF : 0;
44+
int maxRof = (rof0 == tf->getNrof() - mTrkParams.DeltaROF) ? rof0 : rof0 + mTrkParams.DeltaROF;
4345
for (int iLayer{0}; iLayer < mTrkParams.TrackletsPerRoad(); ++iLayer) {
4446
gsl::span<const Cluster> layer0 = tf->getClustersOnLayer(rof0, iLayer);
4547
if (layer0.empty()) {
@@ -74,8 +76,6 @@ void TrackerTraitsCPU::computeLayerTracklets()
7476
phiBinsNum += mTrkParams.PhiBins;
7577
}
7678

77-
int minRof = (rof0 >= mTrkParams.DeltaROF) ? rof0 - mTrkParams.DeltaROF : 0;
78-
int maxRof = (rof0 == tf->getNrof() - mTrkParams.DeltaROF) ? rof0 : rof0 + mTrkParams.DeltaROF;
7979
for (int rof1{minRof}; rof1 <= maxRof; ++rof1) {
8080
gsl::span<const Cluster> layer1 = tf->getClustersOnLayer(rof1, iLayer + 1);
8181
if (layer1.empty()) {
@@ -100,7 +100,7 @@ void TrackerTraitsCPU::computeLayerTracklets()
100100
const int maxRowClusterIndex = tf->getIndexTables(rof1)[iLayer][maxBinIndex];
101101

102102
for (int iNextCluster{firstRowClusterIndex}; iNextCluster < maxRowClusterIndex; ++iNextCluster) {
103-
if (iNextCluster >= (int)tf->getClusters()[iLayer + 1].size()) {
103+
if (iNextCluster >= (int)layer1.size()) {
104104
break;
105105
}
106106
const Cluster& nextCluster{layer1[iNextCluster]};

0 commit comments

Comments
 (0)