// We need to find a normalization factor for the new isotope
// pattern, to show meaningful intensity range
double mz = newPattern.getHighestIsotope().getMZ();
Range searchMZRange = new Range(mz - 0.5, mz + 0.5);
ScanDataSet scanDataSet = spectrumPlot.getMainScanDataSet();
double normalizationFactor = scanDataSet
.getHighestIntensity(searchMZRange);
// If normalization factor is 0, it means there were no data points
// in given m/z range. In such case we use the max intensity of
// whole scan as normalization factor.
if (normalizationFactor == 0) {
searchMZRange = new Range(0, Double.MAX_VALUE);
normalizationFactor = scanDataSet
.getHighestIntensity(searchMZRange);
}
IsotopePattern normalizedPattern = IsotopePatternCalculator
.normalizeIsotopePattern(newPattern, normalizationFactor);