public static double GetPValue(PSM psm, Tolerance prod_tolerance, double cutoff)
{
// Get the width of the product ion tolerance at the isolation mz;
double productToleranceWidth = prod_tolerance.GetRange(psm.IsolationMZ).Width;
double cutoffThreshold = psm.Spectrum.GetBasePeakIntensity()*cutoff;
return Math.Min(1.0, psm.Spectrum.Count(peak => peak.Intensity >= cutoffThreshold)*2*productToleranceWidth/psm.ScanWidth);
}