Skip to content

Commit a23bdce

Browse files
committed
Refactor monoisotopic impl
1 parent 077920c commit a23bdce

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/IsoSpec++/marginalTrek++.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,8 @@ size_t Marginal::getMonoisotopicAtomIndex() const
280280

281281
double Marginal::getMonoisotopicConfMass() const
282282
{
283-
double found_prob = -std::numeric_limits<double>::infinity();
284-
double found_mass = 0.0; // to avoid uninitialized var warning
285-
for(unsigned int ii = 0; ii < isotopeNo; ii++)
286-
if( found_prob < atom_lProbs[ii] )
287-
{
288-
found_prob = atom_lProbs[ii];
289-
found_mass = atom_masses[ii];
290-
}
291-
return found_mass*atomCnt;
283+
size_t idx = getMonoisotopicAtomIndex();
284+
return atom_masses[idx]*atomCnt;
292285
}
293286

294287
double Marginal::getAtomAverageMass() const

0 commit comments

Comments
 (0)