Skip to content

Commit

Permalink
refs #8752. Fix single cpp check issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Jan 27, 2014
1 parent 3ca63d7 commit 6df745a
Showing 1 changed file with 44 additions and 41 deletions.
85 changes: 44 additions & 41 deletions Code/Mantid/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp
Expand Up @@ -59,8 +59,9 @@ namespace Mantid
new PropertyWithValue<int>("I0MonitorIndex", Mantid::EMPTY_INT(), mandatoryWorkspaceIndex),
"I0 monitor index");

declareProperty(new PropertyWithValue<std::string>("ProcessingInstructions", "",
boost::make_shared<MandatoryValidator<std::string> >(), Direction::Input),
declareProperty(
new PropertyWithValue<std::string>("ProcessingInstructions", "",
boost::make_shared<MandatoryValidator<std::string> >(), Direction::Input),
"Processing instructions on workspace indexes to yield only the detectors of interest. See [[PerformIndexOperations]] for details.");
}

Expand Down Expand Up @@ -119,8 +120,7 @@ namespace Mantid
new PropertyWithValue<double>("StartOverlap", Mantid::EMPTY_DBL(), Direction::Input),
"Start wavelength for stitching transmission runs together");

declareProperty(
new PropertyWithValue<double>("EndOverlap", Mantid::EMPTY_DBL(), Direction::Input),
declareProperty(new PropertyWithValue<double>("EndOverlap", Mantid::EMPTY_DBL(), Direction::Input),
"End wavelength (angstroms) for stitching transmission runs together");

}
Expand Down Expand Up @@ -228,7 +228,8 @@ namespace Mantid
* Throws if any of the property values do not make sense.
* @param firstTransmissionInWavelength: Indicates that the first transmission run is in units of wavlength.
*/
void ReflectometryWorkflowBase::validateSecondTransmissionInputs(const bool firstTransmissionInWavelength) const
void ReflectometryWorkflowBase::validateSecondTransmissionInputs(
const bool firstTransmissionInWavelength) const
{
// Verify that all the required inputs for the second transmission run are now given.
if (isPropertyDefault("FirstTransmissionRun"))
Expand All @@ -241,41 +242,44 @@ namespace Mantid
"The first transmission run is in wavelength so is assumed to be correctly stitched in wavelength. "
"The second transmission run and associated inputs will be ignored."
"Run CreateTransmissionWorkspace to create a transmission workspace from TOF runs.");
return;
}
}
if (isPropertyDefault("Params"))
{
throw std::invalid_argument(
"If a SecondTransmissionRun has been given, then stitching Params for the transmission runs are also required.");
}
if (isPropertyDefault("StartOverlap"))
{
throw std::invalid_argument(
"If a SecondTransmissionRun has been given, then a stitching StartOverlap for the transmission runs is also required.");
}
if (isPropertyDefault("EndOverlap"))
{
throw std::invalid_argument(
"If a SecondTransmissionRun has been given, then a stitching EndOverlap for the transmission runs is also required.");
}
const double startOverlap = this->getProperty("StartOverlap");
const double endOverlap = this->getProperty("EndOverlap");
if (startOverlap >= endOverlap)
{
throw std::invalid_argument("EndOverlap must be > StartOverlap");
}

if( !isPropertyDefault("SecondTransmissionRun") )
else
{
MatrixWorkspace_sptr trans1 = this->getProperty("FirstTransmissionRun");
MatrixWorkspace_sptr trans2 = this->getProperty("SecondTransmissionRun");
if (isPropertyDefault("Params"))
{
throw std::invalid_argument(
"If a SecondTransmissionRun has been given, then stitching Params for the transmission runs are also required.");
}
if (isPropertyDefault("StartOverlap"))
{
throw std::invalid_argument(
"If a SecondTransmissionRun has been given, then a stitching StartOverlap for the transmission runs is also required.");
}
if (isPropertyDefault("EndOverlap"))
{
throw std::invalid_argument(
"If a SecondTransmissionRun has been given, then a stitching EndOverlap for the transmission runs is also required.");
}
const double startOverlap = this->getProperty("StartOverlap");
const double endOverlap = this->getProperty("EndOverlap");
if (startOverlap >= endOverlap)
{
throw std::invalid_argument("EndOverlap must be > StartOverlap");
}

auto firstMap = trans1->getSpectrumToWorkspaceIndexMap();
auto secondMap = trans2->getSpectrumToWorkspaceIndexMap();
if(firstMap != secondMap)
if (!isPropertyDefault("SecondTransmissionRun"))
{
throw std::invalid_argument("Spectrum maps differ between the transmission runs. They must be the same.");
MatrixWorkspace_sptr trans1 = this->getProperty("FirstTransmissionRun");
MatrixWorkspace_sptr trans2 = this->getProperty("SecondTransmissionRun");

auto firstMap = trans1->getSpectrumToWorkspaceIndexMap();
auto secondMap = trans2->getSpectrumToWorkspaceIndexMap();
if (firstMap != secondMap)
{
throw std::invalid_argument(
"Spectrum maps differ between the transmission runs. They must be the same.");
}
}
}

Expand Down Expand Up @@ -386,9 +390,9 @@ namespace Mantid
* @param wavelengthStep : Wavelength step for rebinning
* @return Detector workspace in wavelength
*/
MatrixWorkspace_sptr ReflectometryWorkflowBase::toLamDetector(
const std::string& processingCommands, const MatrixWorkspace_sptr& toConvert,
const MinMax& wavelengthMinMax, const double& wavelengthStep)
MatrixWorkspace_sptr ReflectometryWorkflowBase::toLamDetector(const std::string& processingCommands,
const MatrixWorkspace_sptr& toConvert, const MinMax& wavelengthMinMax,
const double& wavelengthStep)
{
// Process the input workspace according to the processingCommands to get a detector workspace
auto performIndexAlg = this->createChildAlgorithm("PerformIndexOperations");
Expand Down Expand Up @@ -438,9 +442,8 @@ namespace Mantid
* @return Tuple of detector and monitor workspaces
*/
ReflectometryWorkflowBase::DetectorMonitorWorkspacePair ReflectometryWorkflowBase::toLam(
MatrixWorkspace_sptr toConvert, const std::string& processingCommands,
const int monitorIndex, const MinMax& wavelengthMinMax, const MinMax& backgroundMinMax,
const double& wavelengthStep)
MatrixWorkspace_sptr toConvert, const std::string& processingCommands, const int monitorIndex,
const MinMax& wavelengthMinMax, const MinMax& backgroundMinMax, const double& wavelengthStep)
{
// Detector Workspace Processing
MatrixWorkspace_sptr detectorWS = toLamDetector(processingCommands, toConvert, wavelengthMinMax,
Expand Down

0 comments on commit 6df745a

Please sign in to comment.