Skip to content

Commit 7194b30

Browse files
matthias-kleinerdavidrohr
authored andcommitted
TPC: Add boundary check for histogram filling
1 parent e968aea commit 7194b30

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • Detectors/TPC/calibration/include/TPCCalibration

Detectors/TPC/calibration/include/TPCCalibration/FastHisto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ template <class T>
175175
inline void FastHisto<T>::fill(const float val, T weight)
176176
{
177177
const int indexBin = findBin(val);
178-
if (indexBin == -1) { // if no underflow/overflow bin is used, but the value should be in the underflow/overflow bin return
178+
if ((indexBin < 0) || (indexBin > static_cast<int>(mBinCont.size()) - 1)) { // if no underflow/overflow bin is used, but the value should be in the underflow/overflow bin return
179179
return;
180180
}
181181
fillBin(indexBin, weight); // fill the correct index with given weight

0 commit comments

Comments
 (0)