void QPeaksTableModel::updateDataCache(const Mantid::Geometry::IPeak& peak, const int row) const { // if the index is what is already cached just return if (row == m_dataCachePeakIndex) return; // generate the cache m_dataCache.clear(); m_dataCache.push_back(QString::number(peak.getRunNumber())); m_dataCache.push_back(QString::number(peak.getDetectorID())); m_dataCache.push_back(QString::number(peak.getH(), 'f', m_hklPrec)); m_dataCache.push_back(QString::number(peak.getK(), 'f', m_hklPrec)); m_dataCache.push_back(QString::number(peak.getL(), 'f', m_hklPrec)); m_dataCache.push_back(QString::number(peak.getWavelength(), 'f', 4)); double eI = peak.getInitialEnergy(); double eF = peak.getFinalEnergy(); m_dataCache.push_back(QString::number(eI, 'f', 4)); m_dataCache.push_back(QString::number(eF, 'f', 4)); m_dataCache.push_back(QString::number(eI - eF, 'f', 4)); m_dataCache.push_back(QString::number(peak.getTOF(), 'f', 1)); m_dataCache.push_back(QString::number(peak.getDSpacing(), 'f', 4)); double intensity = peak.getIntensity(); double sigma = peak.getSigmaIntensity(); m_dataCache.push_back(QString::number(intensity, 'f', 1)); m_dataCache.push_back(QString::number(sigma, 'f', 1)); m_dataCache.push_back(QString::number(intensity/sigma, 'f', 2)); m_dataCache.push_back(QString::number(peak.getBinCount(), 'g', 2)); m_dataCache.push_back(QString(peak.getBankName().c_str())); m_dataCache.push_back(QString::number(peak.getRow())); m_dataCache.push_back(QString::number(peak.getCol())); const QString COMMA(","); const Mantid::Kernel::V3D qlab = peak.getQLabFrame(); m_dataCache.push_back(QString::number(qlab.X(), 'f', 4) + COMMA + QString::number(qlab.Y(), 'f', 4) + COMMA + QString::number(qlab.Z(), 'f', 4)); const Mantid::Kernel::V3D qsample = peak.getQSampleFrame(); m_dataCache.push_back(QString::number(qsample.X(), 'f', 4) + COMMA + QString::number(qsample.Y(), 'f', 4) + COMMA + QString::number(qsample.Z(), 'f', 4)); }
/** Transform peak. @param peak : peak to transform according to internal mapping. @return re-mapped coordinates. */ Mantid::Kernel::V3D PeakTransformQSample::transformPeak(const Mantid::Geometry::IPeak &peak) const { return PeakTransform::transform(peak.getQSampleFrame()); }