Skip to content

Commit

Permalink
Re #10894 Removing try blocks that hide actual error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Feb 5, 2015
1 parent d8a5f96 commit fe24fcd
Showing 1 changed file with 26 additions and 45 deletions.
71 changes: 26 additions & 45 deletions Code/Mantid/Framework/Algorithms/src/PlotAsymmetryByLogValue.cpp
Expand Up @@ -304,16 +304,11 @@ void PlotAsymmetryByLogValue::exec() {
*/
void PlotAsymmetryByLogValue::loadCorrectionsFromFile (Workspace_sptr &customDeadTimes, std::string deadTimeFile )
{
try{
IAlgorithm_sptr loadDeadTimes = createChildAlgorithm("LoadNexusProcessed");
loadDeadTimes->setPropertyValue("Filename", deadTimeFile);
loadDeadTimes->setProperty("OutputWorkspace", customDeadTimes);
loadDeadTimes->executeAsChildAlg();
customDeadTimes = loadDeadTimes->getProperty("OutputWorkspace");
}
catch (...){
throw std::runtime_error("Unable to load corrections from specified file\n");
}
IAlgorithm_sptr loadDeadTimes = createChildAlgorithm("LoadNexusProcessed");
loadDeadTimes->setPropertyValue("Filename", deadTimeFile);
loadDeadTimes->setProperty("OutputWorkspace", customDeadTimes);
loadDeadTimes->executeAsChildAlg();
customDeadTimes = loadDeadTimes->getProperty("OutputWorkspace");
}
/** Populate output workspace with results
* @param outWS :: [input/output] Output workspace to populate
Expand Down Expand Up @@ -397,24 +392,17 @@ void PlotAsymmetryByLogValue::applyDeadtimeCorr (Workspace_sptr &loadedWs, Works
ScopedWorkspace ws(loadedWs);
ScopedWorkspace dt(deadTimes);

try
{
IAlgorithm_sptr applyCorr = AlgorithmManager::Instance().create("ApplyDeadTimeCorr");
applyCorr->setLogging(false);
applyCorr->setRethrows(true);
applyCorr->setPropertyValue("InputWorkspace", ws.name());
applyCorr->setPropertyValue("OutputWorkspace", ws.name());
applyCorr->setProperty("DeadTimeTable", dt.name());
applyCorr->execute();
// Workspace should've been replaced in the ADS by ApplyDeadTimeCorr, so
// need to
// re-assign it
loadedWs = ws.retrieve();
}
catch (...)
{
throw std::runtime_error("Unable to apply corrections\n");
}
IAlgorithm_sptr applyCorr = AlgorithmManager::Instance().create("ApplyDeadTimeCorr");
applyCorr->setLogging(false);
applyCorr->setRethrows(true);
applyCorr->setPropertyValue("InputWorkspace", ws.name());
applyCorr->setPropertyValue("OutputWorkspace", ws.name());
applyCorr->setProperty("DeadTimeTable", dt.name());
applyCorr->execute();
// Workspace should've been replaced in the ADS by ApplyDeadTimeCorr, so
// need to
// re-assign it
loadedWs = ws.retrieve();
}

/** Group detectors from specified file
Expand All @@ -429,23 +417,16 @@ void PlotAsymmetryByLogValue::groupDetectors (Workspace_sptr &loadedWs, Workspac
ScopedWorkspace grouping(loadedDetGrouping);
ScopedWorkspace outWS;

try
{
IAlgorithm_sptr applyGrouping = AlgorithmManager::Instance().create("MuonGroupDetectors");
applyGrouping->setLogging(false);
applyGrouping->setRethrows(true);

applyGrouping->setPropertyValue("InputWorkspace", inWS.name());
applyGrouping->setPropertyValue("DetectorGroupingTable", grouping.name());
applyGrouping->setPropertyValue("OutputWorkspace", outWS.name());
applyGrouping->execute();

loadedWs = outWS.retrieve();
}
catch (...)
{
throw std::runtime_error("Unable to group detectors.\n\nPlease specify grouping manually.");
}
IAlgorithm_sptr applyGrouping = AlgorithmManager::Instance().create("MuonGroupDetectors");
applyGrouping->setLogging(false);
applyGrouping->setRethrows(true);

applyGrouping->setPropertyValue("InputWorkspace", inWS.name());
applyGrouping->setPropertyValue("DetectorGroupingTable", grouping.name());
applyGrouping->setPropertyValue("OutputWorkspace", outWS.name());
applyGrouping->execute();

loadedWs = outWS.retrieve();
}
/** Calculate the integral asymmetry for a workspace.
* The calculation is done by MuonAsymmetryCalc and SimpleIntegration
Expand Down

0 comments on commit fe24fcd

Please sign in to comment.