private static double GetUncalibratedFullIsotopePatternMassEstimate(IsotopeCluster ic, int isotopePatternStart,
                                                                            out double intensity, double[] centerMz,
                                                                            float[] intensities)
        {
            double result = 0;

            intensity = 0;
            int charge = ic.Charge;

            for (int i = 0; i < ic.Count; i++)
            {
                if (i + isotopePatternStart >= 0)
                {
                    int    ind = ic.Members[i];
                    double mz  = centerMz[ind];
                    double m   = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - MolUtil.GetAverageDifferenceToMonoisotope(m, i + isotopePatternStart));
                    intensity += intensities[ind];
                }
            }
            if (intensity == 0)
            {
                for (int i = 0; i < ic.Count; i++)
                {
                    int    ind = ic.Members[i];
                    double mz  = centerMz[ind];
                    double m   = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - (i + isotopePatternStart) * MolUtil.GetAverageDifferenceToMonoisotope(m, 1));
                    intensity += intensities[ind];
                }
            }
            return(result / intensity);
        }
        private static double GetFullIsotopePatternMassEstimateNoBootstrapStat(IsotopeCluster ic, int isotopePatternStart,
                                                                               out double intensity,
                                                                               double[,] mzCalibrationPar,
                                                                               double[,] intensityCalibrationPar, bool discard,
                                                                               out int npoints, IPeakList peakList,
                                                                               float[] intensities)
        {
            double result = 0;

            intensity = 0;
            npoints   = 0;
            int charge = ic.Charge;

            for (int i = 0; i < ic.Count; i++)
            {
                if (i + isotopePatternStart >= 0)
                {
                    int    ind = ic.Members[i];
                    int    np;
                    double mz = discard
                                                        ? peakList.GetMzDiscard(ind, mzCalibrationPar, intensityCalibrationPar, out np)
                                                        :
                                peakList.GetMz(ind, mzCalibrationPar, intensityCalibrationPar, out np);
                    double m = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - MolUtil.GetAverageDifferenceToMonoisotope(m, i + isotopePatternStart));
                    intensity += intensities[ind];
                    npoints   += np;
                }
            }
            if (intensity == 0)
            {
                for (int i = 0; i < ic.Count; i++)
                {
                    int    ind = ic.Members[i];
                    int    np;
                    double mz = discard
                                                        ? peakList.GetMzDiscard(ind, mzCalibrationPar, intensityCalibrationPar, out np)
                                                        : peakList.GetMz(ind, mzCalibrationPar, intensityCalibrationPar, out np);
                    double m = (mz - MolUtil.MassProton) * charge;
                    result += intensities[ind] *
                              (m - (i + isotopePatternStart) * MolUtil.GetAverageDifferenceToMonoisotope(m, 1));
                    intensity += intensities[ind];
                    npoints   += np;
                }
            }
            return(result / intensity);
        }