本文整理汇总了C++中geometry::Instrument_const_sptr::baseInstrument方法的典型用法代码示例。如果您正苦于以下问题:C++ Instrument_const_sptr::baseInstrument方法的具体用法?C++ Instrument_const_sptr::baseInstrument怎么用?C++ Instrument_const_sptr::baseInstrument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry::Instrument_const_sptr
的用法示例。
在下文中一共展示了Instrument_const_sptr::baseInstrument方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invalid_argument
/**
* Creates a new parameterized instrument for which the parameter values can be
*changed
*
* @param Peaks - a PeaksWorkspace used to get the original instrument. The
*instrument from the 0th peak is
* the one that is used.
*
* NOTE: All the peaks in the PeaksWorkspace must use the same instrument.
*/
boost::shared_ptr<Geometry::Instrument>
PeakHKLErrors::getNewInstrument(PeaksWorkspace_sptr Peaks) const {
Geometry::Instrument_const_sptr instSave = Peaks->getPeak(0).getInstrument();
auto pmap = boost::make_shared<Geometry::ParameterMap>();
if (!instSave) {
g_log.error(" Peaks workspace does not have an instrument");
throw std::invalid_argument(" Not all peaks have an instrument");
}
if (!hasParameterMap) {
pmapSv = instSave->getParameterMap();
hasParameterMap = true;
if (!instSave->isParametrized()) {
boost::shared_ptr<Geometry::Instrument> instClone(instSave->clone());
auto Pinsta = boost::make_shared<Geometry::Instrument>(instSave, pmap);
instChange = Pinsta;
IComponent_const_sptr sample = instChange->getSample();
sampPos = sample->getRelativePos();
} else // catch(... )
{
auto P1 = boost::make_shared<Geometry::Instrument>(
instSave->baseInstrument(), instSave->makeLegacyParameterMap());
instChange = P1;
IComponent_const_sptr sample = instChange->getSample();
sampPos = sample->getRelativePos();
}
}
if (!instChange) {
g_log.error("Cannot 'clone' instrument");
throw std::logic_error("Cannot clone instrument");
}
//------------------"clone" orig instruments pmap -------------------
cLone(pmap, instSave, pmapSv);
V3D sampOffsets(getParameter("SampleXOffset"), getParameter("SampleYOffset"),
getParameter("SampleZOffset"));
IComponent_const_sptr sample = instChange->getSample();
pmap->addPositionCoordinate(sample.get(), std::string("x"),
sampPos.X() + sampOffsets.X());
pmap->addPositionCoordinate(sample.get(), std::string("y"),
sampPos.Y() + sampOffsets.Y());
pmap->addPositionCoordinate(sample.get(), std::string("z"),
sampPos.Z() + sampOffsets.Z());
return instChange;
}