本文整理汇总了C++中geometry::Instrument_const_sptr::getParameterMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Instrument_const_sptr::getParameterMap方法的具体用法?C++ Instrument_const_sptr::getParameterMap怎么用?C++ Instrument_const_sptr::getParameterMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry::Instrument_const_sptr
的用法示例。
在下文中一共展示了Instrument_const_sptr::getParameterMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: ApplyCalibInfo
std::string LoadIsawPeaks::ApplyCalibInfo(std::ifstream & in, std::string startChar,Geometry::Instrument_const_sptr instr_old, Geometry::Instrument_const_sptr instr,
double &T0)
{
ParameterMap_sptr parMap1= instr_old->getParameterMap();
ParameterMap_sptr parMap= instr->getParameterMap();
while( in.good() && (startChar.size() <1 || startChar !="7") )
{
readToEndOfLine( in, true);
startChar = getWord(in, false);
}
if( !(in.good()))
{
//g_log.error()<<"Peaks file has no time shift and L0 info"<<std::endl;
throw std::invalid_argument("Peaks file has no time shift and L0 info");
}
std::string L1s= getWord(in,false);
std::string T0s =getWord(in, false);
if( L1s.length() < 1 || T0s.length() < 1)
{
g_log.error()<<"Missing L1 or Time offset"<<std::endl;
throw std::invalid_argument("Missing L1 or Time offset");
}
double L1;
try
{
std::istringstream iss( L1s+" "+T0s, std::istringstream::in);
iss>>L1;
iss>>T0;
V3D sampPos=instr->getSample()->getPos();
SCDCalibratePanels::FixUpSourceParameterMap(instr, L1/100, sampPos,parMap1);
}catch(...)
{
g_log.error()<<"Invalid L1 or Time offset"<<std::endl;
throw std::invalid_argument("Invalid L1 or Time offset");
}
readToEndOfLine( in, true);
startChar = getWord(in , false);
while( in.good() && (startChar.size() <1 || startChar !="5") )
{
readToEndOfLine( in, true);
startChar = getWord(in, false);
}
if( !(in.good()))
{
g_log.error()<<"Peaks file has no detector panel info"<<std::endl;
throw std::invalid_argument("Peaks file has no detector panel info");
}
while( startChar =="5")
{
std::string line;
for( int i=0; i<16;i++)
{
std::string s= getWord(in, false);
if( s.size() < 1)
{
g_log.error()<<"Not enough info to describe panel "<<std::endl;
throw std::length_error("Not enough info to describe panel ");
}
line +=" "+s;;
}
readToEndOfLine(in, true);
startChar = getWord( in, false);// blank lines ?? and # lines ignore
std::istringstream iss( line, std::istringstream::in);
int bankNum,nrows,ncols;
double width,height,depth,detD,Centx,Centy,Centz,Basex,Basey,Basez,
Upx,Upy,Upz;
try
{
iss>>bankNum>>nrows>>ncols>>width>>height>>depth>>detD
>>Centx>>Centy>>Centz>>Basex>>Basey>>Basez
>>Upx>>Upy>>Upz;
}catch(...)
{
g_log.error()<<"incorrect type of data for panel "<<std::endl;
throw std::length_error("incorrect type of data for panel ");
}
std::string SbankNum = boost::lexical_cast<std::string>(bankNum);
std::string bankName = "bank"+SbankNum;
boost::shared_ptr<const Geometry::IComponent> bank =instr_old->getComponentByName( bankName );
if( !bank)
{
g_log.error()<<"There is no bank "<< bankName<<" in the instrument"<<std::endl;
throw std::length_error("There is no bank "+ bankName+" in the instrument");
}
//.........这里部分代码省略.........