private void CleanSpectrum(Spectrum spectrum) { List<MzRange> ranges = new List<MzRange>(); double precursor_mz = spectrum.PrecursorMZ.Value; if (cleanPrecursor || (enableEtdPreProcessing && (spectrum.ScanType == ScanType.ETD || spectrum.ScanType == ScanType.ECD))) { double half_width = spectrum.Parent.GetIsolationWidth(spectrum.ScanNumber) / 2.0; MzRange range = new MzRange(precursor_mz - half_width, precursor_mz + half_width); ranges.Add(range); } if (enableEtdPreProcessing && (spectrum.ScanType == ScanType.ETD || spectrum.ScanType == ScanType.ECD)) { if (spectrum.Charge.HasValue) { int charge = spectrum.Charge.Value; if (charge < 0) { // NETD TODO } else { // ETD for (int reduced_precursor_charge = 1; reduced_precursor_charge < charge; reduced_precursor_charge++) { double cr_mz = MZFromMass(precursor_mz, reduced_precursor_charge); double min = cr_mz - 2; // TODO make variable double max = cr_mz + 2; ranges.Add(new MzRange(min, max)); } } } } spectrum.CleanSpectrum(ranges); }