Skip to content

Commit

Permalink
refs #8999. Don't use inst info if unfetchable.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Feb 12, 2014
1 parent 5ada934 commit 2f0f4af
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions Code/Mantid/MantidQt/SliceViewer/src/QPeaksTableModel.cpp
Expand Up @@ -328,29 +328,35 @@ namespace MantidQt

// only show bank name for SNS instruments
std::string instrName = instr->getName();
Mantid::Kernel::InstrumentInfo instrInfo
= Mantid::Kernel::ConfigService::Instance().getInstrument(instrName);
if (instrInfo.facility().name() != "SNS")
result.push_back(COL_BANKNAME);

// hide some columns based on the techniques
{ // shrink variable scope
std::set<std::string> techniques = instrInfo.techniques();
// required for showing final and delta energy
const std::string IGS("TOF Indirect Geometry Spectroscopy");
// required for showing initial and delta energy
const std::string DGS("TOF Direct Geometry Spectroscopy");
bool showEnergy(false);
if (techniques.find(DGS) == techniques.end())
result.push_back(COL_FINAL_ENERGY);
else
showEnergy = true;
if (techniques.find(IGS) == techniques.end())
result.push_back(COL_INITIAL_ENERGY);
else
showEnergy = true;
if (!showEnergy)
result.push_back(COL_ENERGY);
try
{
Mantid::Kernel::InstrumentInfo instrInfo =
Mantid::Kernel::ConfigService::Instance().getInstrument(instrName);
if (instrInfo.facility().name() != "SNS")
result.push_back(COL_BANKNAME);

// hide some columns based on the techniques
{ // shrink variable scope
std::set<std::string> techniques = instrInfo.techniques();
// required for showing final and delta energy
const std::string IGS("TOF Indirect Geometry Spectroscopy");
// required for showing initial and delta energy
const std::string DGS("TOF Direct Geometry Spectroscopy");
bool showEnergy(false);
if (techniques.find(DGS) == techniques.end())
result.push_back(COL_FINAL_ENERGY);
else
showEnergy = true;
if (techniques.find(IGS) == techniques.end())
result.push_back(COL_INITIAL_ENERGY);
else
showEnergy = true;
if (!showEnergy)
result.push_back(COL_ENERGY);
}
} catch (Mantid::Kernel::Exception::NotFoundError&)
{
/// Can't find the instrument IDF via the
}

return result;
Expand Down

0 comments on commit 2f0f4af

Please sign in to comment.