diff --git a/Code/Mantid/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp b/Code/Mantid/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp index 13069ee81da7..730048998cfa 100644 --- a/Code/Mantid/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp +++ b/Code/Mantid/Framework/Algorithms/src/ReflectometryWorkflowBase.cpp @@ -59,8 +59,9 @@ namespace Mantid new PropertyWithValue("I0MonitorIndex", Mantid::EMPTY_INT(), mandatoryWorkspaceIndex), "I0 monitor index"); - declareProperty(new PropertyWithValue("ProcessingInstructions", "", - boost::make_shared >(), Direction::Input), + declareProperty( + new PropertyWithValue("ProcessingInstructions", "", + boost::make_shared >(), Direction::Input), "Processing instructions on workspace indexes to yield only the detectors of interest. See [[PerformIndexOperations]] for details."); } @@ -119,8 +120,7 @@ namespace Mantid new PropertyWithValue("StartOverlap", Mantid::EMPTY_DBL(), Direction::Input), "Start wavelength for stitching transmission runs together"); - declareProperty( - new PropertyWithValue("EndOverlap", Mantid::EMPTY_DBL(), Direction::Input), + declareProperty(new PropertyWithValue("EndOverlap", Mantid::EMPTY_DBL(), Direction::Input), "End wavelength (angstroms) for stitching transmission runs together"); } @@ -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")) @@ -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."); + } } } @@ -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"); @@ -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,