Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/8629_remove_warning_when_…
Browse files Browse the repository at this point in the history
…loadcalfile_cannot_find_monitors'
  • Loading branch information
mantid-roman committed Aug 22, 2014
2 parents f406f1e + 79f2337 commit 18cb026
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Expand Up @@ -53,6 +53,9 @@ namespace DataHandling
void init();
/// Run the algorithm
void exec();

/// Checks if a detector ID is for a monitor on a given instrument
static bool idIsMonitor(Mantid::Geometry::Instrument_const_sptr inst, int detID);
};


Expand Down
33 changes: 23 additions & 10 deletions Code/Mantid/Framework/DataHandling/src/LoadCalFile.cpp
Expand Up @@ -21,8 +21,6 @@ namespace DataHandling
{
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(LoadCalFile)



//----------------------------------------------------------------------------------------------
/** Constructor
Expand All @@ -37,9 +35,6 @@ namespace DataHandling
LoadCalFile::~LoadCalFile()
{
}


//----------------------------------------------------------------------------------------------


//----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -258,7 +253,9 @@ namespace DataHandling
}
catch (std::invalid_argument &)
{
numErrors++;
// Ignore the error if the IS is actually for a monitor
if(!idIsMonitor(offsetsWS->getInstrument(), udet))
numErrors++;
}
}

Expand All @@ -272,7 +269,9 @@ namespace DataHandling
}
catch (std::invalid_argument &)
{
numErrors++;
// Ignore the error if the IS is actually for a monitor
if(!idIsMonitor(groupWS->getInstrument(), udet))
numErrors++;
}
}

Expand All @@ -296,12 +295,12 @@ namespace DataHandling
if (!hasUnmasked)
hasUnmasked = true;
}

}
else
{
// Could not find the UDET.
numErrors++;
// Ignore the error if the IS is actually for a monitor
if(!idIsMonitor(maskWS->getInstrument(), udet))
numErrors++;
}
}
}
Expand All @@ -316,6 +315,20 @@ namespace DataHandling
Logger("LoadCalFile").warning() << "'" << calFileName << "' masks all spectra\n";
}

/**
* Used to determine if a given detector ID is for a monitor.
*
* @param inst Pointer to the instrument
* @param detID Detector ID to check
* @return True if a monitor, false otherwise
*/
bool LoadCalFile::idIsMonitor(Instrument_const_sptr inst, int detID)
{
auto monitorList = inst->getMonitors();
auto it = std::find(monitorList.begin(), monitorList.end(), detID);
return (it != monitorList.end());
}


} // namespace Mantid
} // namespace DataHandling

0 comments on commit 18cb026

Please sign in to comment.