Skip to content

Commit

Permalink
Merge pull request #11205 from bendavid/multifitloopfix_74x
Browse files Browse the repository at this point in the history
add protection for rare infinite loop in ecal multifit (74X)
  • Loading branch information
davidlange6 committed Sep 15, 2015
2 parents c9a9acb + 1861d89 commit eac8218
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions RecoLocalCalo/EcalRecAlgos/src/PulseChiSqSNNLS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ bool PulseChiSqSNNLS::NNLS() {
aTbvec = invcovp.transpose()*_covdecomp.matrixL().solve(_sampvec);

int iter = 0;
Index idxwmax;
Index idxwmax = 0;
double wmax = 0.0;
//work = PulseVector::zeros();
while (true) {
Expand All @@ -311,10 +311,12 @@ bool PulseChiSqSNNLS::NNLS() {
const unsigned int nActive = npulse - _nP;

updatework = aTbvec - aTamat*_ampvec;
Index idxwmaxprev = idxwmax;
double wmaxprev = wmax;
wmax = updatework.tail(nActive).maxCoeff(&idxwmax);

//convergence
if (wmax<1e-11) break;
if (wmax<1e-11 || (idxwmax==idxwmaxprev && wmax==wmaxprev)) break;

//unconstrain parameter
Index idxp = _nP + idxwmax;
Expand Down

0 comments on commit eac8218

Please sign in to comment.