void EnggDiffFittingModel::mergeTables( const API::ITableWorkspace_sptr tableToCopy, API::ITableWorkspace_sptr targetTable) const { for (size_t i = 0; i < tableToCopy->rowCount(); ++i) { API::TableRow rowToCopy = tableToCopy->getRow(i); API::TableRow newRow = targetTable->appendRow(); for (size_t j = 0; j < tableToCopy->columnCount(); ++j) { double valueToCopy; rowToCopy >> valueToCopy; newRow << valueToCopy; } } }
/** Load PhaseTable file to a vector of HistData. * @param phaseTable :: [input] phase table containing detector info * @param deadTimeTable :: [output] phase table containing dead times */ void PhaseQuadMuon::loadPhaseTable(API::ITableWorkspace_sptr phaseTable, API::ITableWorkspace_sptr deadTimeTable) { if ( phaseTable->rowCount() ) { if ( phaseTable->columnCount()<4 ) { throw std::invalid_argument("PhaseQuad: PhaseTable must contain at least four columns"); } // Check number of histograms in inputWs match number of detectors in phase table if (m_nHist != static_cast<int>(phaseTable->rowCount())) { throw std::runtime_error("PhaseQuad: Number of histograms in phase table does not match number of spectra in workspace"); } for (size_t i=0; i<phaseTable->rowCount(); ++i) { API::TableRow phaseRow = phaseTable->getRow(i); // The first three columns go to m_histData HistData tempHist; tempHist.detOK = phaseRow.Bool(0); tempHist.alpha = phaseRow.Double(1); tempHist.phi = phaseRow.Double(2); m_histData.push_back(tempHist); // The last column goes to deadTimeTable API::TableRow deadRow = deadTimeTable->appendRow(); deadRow << static_cast<int>(i)+1 << phaseRow.Double(3); } } else { throw std::invalid_argument("PhaseQuad: PhaseTable is empty"); } }