Skip to content

Commit

Permalink
Merge pull request #11204 from bendavid/multifitloopfix_76x
Browse files Browse the repository at this point in the history
add protection for rare infinite loop in ecal multifit (76X)
  • Loading branch information
cmsbuild committed Sep 15, 2015
2 parents 0a6bc35 + ef9303b commit 608fea7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions RecoLocalCalo/EcalRecAlgos/src/PulseChiSqSNNLS.cc
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 608fea7

Please sign in to comment.