if (runError == null) {
throw new IllegalArgumentException("No m/z deviation statistics found for spectrum file " + fileName + ".");
}
MSnSpectrum spectrum = (MSnSpectrum) spectrumFactory.getSpectrum(fileName, spectrumTitle);
Precursor precursor = spectrum.getPrecursor();
double precursorMz = precursor.getMz();
double precursorRT = precursor.getRt();
double correction = 0.0;
if (recalibratePrecursor) {
correction = runError.getPrecursorMzCorrection(precursorMz, precursorRT);
}
Precursor newPrecursor = spectrum.getPrecursor().getRecalibratedPrecursor(correction, 0.0);
HashMap<Double, Peak> peakList = spectrum.getPeakMap();
if (recalibrateFragmentIons) {
peakList = runError.recalibratePeakList(precursorRT, spectrum.getPeakMap());
}