peak = p;
name = id;
final int[] scanNumbers = peak.getScanNumbers();
final RawDataFile dataFile = peak.getDataFile();
final int peakScanNumber = peak.getRepresentativeScanNumber();
// Copy peak data.
final int scanCount = scanNumbers.length;
retentionTimes = new double[scanCount];
intensities = new double[scanCount];
mzValues = new double[scanCount];
int peakIndex = -1;
for (int i = 0; i < scanCount; i++) {
// Representative scan number?
final int scanNumber = scanNumbers[i];
if (peakIndex < 0 && scanNumber == peakScanNumber) {
peakIndex = i;
}
// Copy RT and m/z.
retentionTimes[i] = dataFile.getScan(scanNumber).getRetentionTime();
final DataPoint dataPoint = peak.getDataPoint(scanNumber);
if (dataPoint == null) {
mzValues[i] = 0.0;
intensities[i] = 0.0;