Example #1
0
/**
 * Construct a DataSource object around the specifed MatrixWorkspace.
 *
 * @param matWs  Shared pointer to the matrix workspace being "wrapped"
 */
MatrixWSDataSource::MatrixWSDataSource( MatrixWorkspace_const_sptr matWs ) :
  SpectrumDataSource( 0.0, 1.0, 0.0, 1.0, 0, 0 ),
  m_matWs(matWs),
  m_emodeHandler(NULL)
{
  m_totalXMin = matWs->getXMin();
  m_totalXMax = matWs->getXMax();

  m_totalYMin = 0;  // Y direction is spectrum index
  m_totalYMax = (double)matWs->getNumberHistograms();

  m_totalRows = matWs->getNumberHistograms();
  m_totalCols = 1000000;  // Default data resolution

  m_instrument = m_matWs->getInstrument();
  if ( m_instrument )
  {
    m_source = m_instrument->getSource();
    if ( !m_source )
    {
      g_log.debug("No SOURCE on instrument in MatrixWorkspace");
    }

    m_sample = m_instrument->getSample();
    if ( !m_sample )
    {
      g_log.debug("No SAMPLE on instrument in MatrixWorkspace");
    }
  }
  else
  {
    g_log.debug("No INSTRUMENT on MatrixWorkspace");
  }
}