public IResult Match(IGlycanPeak glycan, SortedDictionary <int, List <IPeak> > cluster) { List <SortedDictionary <int, IPeak> > clustered = Combinator(cluster); List <double> distr = glycan.GetDistrib(); double maxScore = -1; List <IPeak> bestPeaks = new List <IPeak>(); foreach (SortedDictionary <int, IPeak> sequence in clustered) { double score = Fit(distr, sequence); if (score >= maxScore) { maxScore = score; bestPeaks = sequence.Select(s => s.Value).ToList(); } } return(factory.Produce(glycan, maxScore, bestPeaks)); }