Skip to content

Commit

Permalink
refs #8591. Move helper and apply warning fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Dec 11, 2013
1 parent 8857e24 commit 72cb56f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
Expand Up @@ -65,7 +65,7 @@ namespace Mantid
const MinMax& wavelengthMinMax, const MinMax& backgroundMinMax, const double& wavelengthStep);

/// Convert to an IvsQ workspace. Performs detector positional corrections based on the component name and the theta value.
Mantid::API::MatrixWorkspace_sptr toIvsQ(API::MatrixWorkspace_sptr toConvert, const bool correctPosition, const bool isPointDetector,
Mantid::API::MatrixWorkspace_sptr toIvsQ(API::MatrixWorkspace_sptr toConvert, const bool correctPosition,
OptionalDouble& thetaInDeg, Geometry::IComponent_const_sptr sample, Geometry::IComponent_const_sptr detector);

private:
Expand Down
29 changes: 14 additions & 15 deletions Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOne.cpp
Expand Up @@ -81,8 +81,8 @@ namespace Mantid
* @param originIndexes : Indexes in terms of the origin workspace
* @return WorkspaceIndexes in terms of the host workspace
*/
ReflectometryReductionOne::WorkspaceIndexList getIndexesInTermsOf(MatrixWorkspace_const_sptr hostWS,
MatrixWorkspace_sptr originWS,
ReflectometryReductionOne::WorkspaceIndexList getIndexesInTermsOf(
MatrixWorkspace_const_sptr hostWS, MatrixWorkspace_sptr originWS,
const ReflectometryReductionOne::WorkspaceIndexList& originIndexes)
{
auto spectrumMap = hostWS->getSpectrumToWorkspaceIndexMap();
Expand All @@ -95,6 +95,16 @@ namespace Mantid
return translatedIndexList;
}

/**
* Helper method used with the stl to determine whether values are negative
* @param value : Value to check
* @return : True if negative.
*/
bool checkNotPositive(const int value)
{
return value < 0;
}

const std::string multiDetectorAnalysis = "MultiDetectorAnalysis";
const std::string pointDetectorAnalysis = "PointDetectorAnalysis";
}
Expand Down Expand Up @@ -292,16 +302,6 @@ namespace Mantid
return property->isDefault();
}

/**
* Helper method used with the stl to determine whether values are negative
* @param value : Value to check
* @return : True if negative.
*/
bool checkNotPositive(const int value)
{
return value < 0;
}

/**
* Get the workspace index list
* @return Workspace index list.
Expand Down Expand Up @@ -765,14 +765,13 @@ namespace Mantid
*
* @param toConvert : Workspace to convert
* @param bCorrectPosition : Flag to indicate that detector positions should be corrected based on the input theta values.
* @param isPointDetector : Flag to indicate that this is a point detector reduction run.
* @param thetaInDeg : Theta in Degrees. Used for correction.
* @param sample : Sample component
* @param detector : Detector component
* @return
*/
Mantid::API::MatrixWorkspace_sptr ReflectometryReductionOne::toIvsQ(API::MatrixWorkspace_sptr toConvert, const bool bCorrectPosition,
const bool isPointDetector, OptionalDouble& thetaInDeg, Geometry::IComponent_const_sptr sample, Geometry::IComponent_const_sptr detector)
OptionalDouble& thetaInDeg, Geometry::IComponent_const_sptr sample, Geometry::IComponent_const_sptr detector)
{
/*
* Can either calculate a missing theta value for the purposes of reporting, or correct positions based on a theta value,
Expand Down Expand Up @@ -973,7 +972,7 @@ namespace Mantid
IvsLam = regionOfInterestWS / regionOfDirectBeamWS; // TODO. This needs checking.
}

IvsQ = this->toIvsQ(IvsLam, correctDetctorPositions, isPointDetector, theta, sample, detector);
IvsQ = this->toIvsQ(IvsLam, correctDetctorPositions, theta, sample, detector);

setProperty("ThetaOut", theta.get());
setProperty("OutputWorkspaceWavelength", IvsLam);
Expand Down
Expand Up @@ -108,8 +108,7 @@ class ReflectometryReductionOneTest: public CxxTest::TestSuite

boost::optional<double> theta = 0.7;

MatrixWorkspace_const_sptr inQ = alg.toIvsQ(toConvert, true /*correct position*/,
true /*is point detector*/, theta, sample, detector);
MatrixWorkspace_const_sptr inQ = alg.toIvsQ(toConvert, true /*correct position*/, theta, sample, detector);

TS_ASSERT_EQUALS("MomentumTransfer", inQ->getAxis(0)->unit()->unitID());

Expand Down

0 comments on commit 72cb56f

Please sign in to comment.