本文整理汇总了C++中api::MatrixWorkspace_sptr::instrumentParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixWorkspace_sptr::instrumentParameters方法的具体用法?C++ MatrixWorkspace_sptr::instrumentParameters怎么用?C++ MatrixWorkspace_sptr::instrumentParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api::MatrixWorkspace_sptr
的用法示例。
在下文中一共展示了MatrixWorkspace_sptr::instrumentParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
/** Executes the algorithm. Moving detectors of input workspace to positions indicated in table workspace
*
* @throw FileError Thrown if unable to get instrument from workspace,
* table workspace is incompatible with instrument
*/
void ApplyCalibration::exec()
{
// Get pointers to the workspace, parameter map and table
API::MatrixWorkspace_sptr inputWS = getProperty("Workspace");
m_pmap = &(inputWS->instrumentParameters()); // Avoids a copy if you get the reference before the instrument
API::ITableWorkspace_sptr PosTable = getProperty("PositionTable");
Geometry::Instrument_const_sptr instrument = inputWS->getInstrument();
if(!instrument)
{
throw std::runtime_error("Workspace to apply calibration to has no defined instrument");
}
size_t numDetector = PosTable->rowCount();
ColumnVector<int> detID = PosTable->getVector("Detector ID");
ColumnVector<V3D> detPos = PosTable->getVector("Detector Position");
// numDetector needs to be got as the number of rows in the table and the detID got from the (i)th row of table.
for (size_t i = 0; i < numDetector; ++i)
{
setDetectorPosition(instrument, detID[i], detPos[i], false );
}
// Ensure pointer is only valid for execution
m_pmap = NULL;
}
示例2: rotateComponent
void LoadHelper::rotateComponent(API::MatrixWorkspace_sptr ws, const std::string &componentName,
const Kernel::Quat & rot)
{
try
{
Geometry::Instrument_const_sptr instrument = ws->getInstrument();
Geometry::IComponent_const_sptr component = instrument->getComponentByName(componentName);
//g_log.debug() << tube->getName() << " : t = " << theta << " ==> t = " << newTheta << "\n";
Geometry::ParameterMap& pmap = ws->instrumentParameters();
Geometry::ComponentHelper::rotateComponent(*component, pmap, rot,
Geometry::ComponentHelper::Absolute);
} catch (Mantid::Kernel::Exception::NotFoundError&)
{
throw std::runtime_error("Error when trying to move the " + componentName + " : NotFoundError");
} catch (std::runtime_error &)
{
throw std::runtime_error("Error when trying to move the " + componentName + " : runtime_error");
}
}