Skip to content

Commit

Permalink
Re #8627. Catch the exception if encountering an unknown monitor.
Browse files Browse the repository at this point in the history
ADARA files have been seen to occasionally contain 'phantom' monitors that
aren't in the IDF. This was causing the algorithm to fail, but this change
defends against that by catching the exception and then ignoring those
spectra.
  • Loading branch information
RussellTaylor committed Dec 16, 2013
1 parent 64aac06 commit 85e6e9a
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions Code/Mantid/Framework/Algorithms/src/SumEventsByLogValue.cpp
Expand Up @@ -331,17 +331,22 @@ namespace Algorithms
// Loop over the spectra - there will be one per monitor
for ( std::size_t spec = 0; spec < monitorWorkspace->getNumberHistograms(); ++spec )
{
// Create a column for this monitor
const std::string monitorName = monitorWorkspace->getDetector(spec)->getName();
auto monitorCounts = outputWorkspace->addColumn("int",monitorName);
const IEventList & eventList = monitorWorkspace->getEventList(spec);
// Accumulate things in a local vector before transferring to the table workspace
std::vector<int> Y(xLength);
filterEventList(eventList, minVal, maxVal, log, Y);
// Transfer the results to the table
for ( int i = 0; i < xLength; ++i )
{
monitorCounts->cell<int>(i) = Y[i];
try {
// Create a column for this monitor
const std::string monitorName = monitorWorkspace->getDetector(spec)->getName();
auto monitorCounts = outputWorkspace->addColumn("int",monitorName);
const IEventList & eventList = monitorWorkspace->getEventList(spec);
// Accumulate things in a local vector before transferring to the table workspace
std::vector<int> Y(xLength);
filterEventList(eventList, minVal, maxVal, log, Y);
// Transfer the results to the table
for ( int i = 0; i < xLength; ++i )
{
monitorCounts->cell<int>(i) = Y[i];
}
} catch (Exception::NotFoundError&) {
// ADARA-generated nexus files have sometimes been seen to contain 'phantom' monitors that aren't in the IDF.
// This handles that by ignoring those spectra.
}
}
}
Expand Down

0 comments on commit 85e6e9a

Please sign in to comment.