Example #1
0
  /** Get set of spectra of the input table workspace
    * Spectra is set to the column named 'spectrum'.
    * Algorithm supports multiple peaks in multiple spectra
    */
  void GeneratePeaks::getSpectraSet(DataObjects::TableWorkspace_const_sptr peakParmsWS)
  {
    size_t numpeaks = peakParmsWS->rowCount();
    API::Column_const_sptr col = peakParmsWS->getColumn("spectrum");

    for (size_t ipk = 0; ipk < numpeaks; ipk ++)
    {
      // Spectrum
      specid_t specid = static_cast<specid_t>((*col)[ipk]);
      m_spectraSet.insert(specid);

      std::stringstream outss;
      outss << "Peak " << ipk << ": specid = " << specid;
      g_log.debug(outss.str());
    }

    std::set<specid_t>::iterator pit;
    specid_t icount = 0;
    for (pit = m_spectraSet.begin(); pit != m_spectraSet.end(); ++pit)
    {
      m_SpectrumMap.insert(std::make_pair(*pit, icount));
      ++ icount;
    }

    return;
  }
Example #2
0
/** Get set of spectra of the input table workspace
  * Spectra is set to the column named 'spectrum'.
  * Algorithm supports multiple peaks in multiple spectra
  */
void GeneratePeaks::getSpectraSet(
    DataObjects::TableWorkspace_const_sptr peakParmsWS) {
  size_t numpeaks = peakParmsWS->rowCount();
  API::Column_const_sptr col = peakParmsWS->getColumn("spectrum");

  for (size_t ipk = 0; ipk < numpeaks; ipk++) {
    // Spectrum
    specnum_t specid = static_cast<specnum_t>((*col)[ipk]);
    m_spectraSet.insert(specid);

    std::stringstream outss;
    outss << "Peak " << ipk << ": specid = " << specid;
    g_log.debug(outss.str());
  }

  specnum_t icount = 0;
  for (const auto specnum : m_spectraSet) {
    m_SpectrumMap.emplace(specnum, icount);
    ++icount;
  }
}