Skip to content

Commit 292e51a

Browse files
committed
Properly calculate the index into a compacted symmetric array
1 parent cc24620 commit 292e51a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CondFormats/EcalObjects/interface/EcalPulseSymmCovariances.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct EcalPulseSymmCovariance {
1717
int indexFor(int i, int j) const {
1818
int m = std::min(i, j);
1919
int n = std::max(i, j);
20-
return n + (EcalPulseShape::TEMPLATESAMPLES - 1) * m;
20+
return n + EcalPulseShape::TEMPLATESAMPLES * m - m * (m + 1) / 2;
2121
}
2222

2323
float val(int i, int j) const { return covval[indexFor(i, j)]; }

0 commit comments

Comments
 (0)