Skip to content

Commit

Permalink
and yet another protection
Browse files Browse the repository at this point in the history
  • Loading branch information
Salavat committed Mar 7, 2019
1 parent c8d212f commit 3bf3d7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions RecoLocalCalo/HcalRecAlgos/src/SimpleHBHEPhase1Algo.cc
Expand Up @@ -207,7 +207,7 @@ float SimpleHBHEPhase1Algo::m0Time(const HBHEChannelInfo& info,
int ibeg = soi + firstSampleShift_;
if (ibeg < 0)
ibeg = 0;
const int iend = std::min(ibeg + nSamplesToExamine, (int)nSamples); // actual array
const int iend = std::min(ibeg + nSamplesToExamine, (int)nSamples - 1); // actual array

unsigned maxI = info.peakEnergyTS((unsigned)ibeg, (unsigned)iend); // requires unsigned params
if (maxI < HBHEChannelInfo::MAXSAMPLES)
Expand All @@ -217,7 +217,8 @@ float SimpleHBHEPhase1Algo::m0Time(const HBHEChannelInfo& info,

// Simplified evaluation for Phase1
float emax0 = info.tsEnergy(maxI);
float emax1 = info.tsEnergy(maxI + 1U);
float emax1 = 0.;
if(maxI < (nSamples - 1U)) emax1 = info.tsEnergy(maxI + 1U);

// consider soi reference for collisions
int position = (int)maxI;
Expand Down

0 comments on commit 3bf3d7b

Please sign in to comment.