Skip to content

Commit

Permalink
Refs #4202. Adjustment to cope with detector gaps.
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Jan 27, 2012
1 parent 87801b9 commit df140e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
18 changes: 15 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/SofQW2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,23 @@ namespace Mantid
{
continue;
}
double leftWidth(0.5*m_thetaWidth), rightWidth(0.5*m_thetaWidth);
// If the gap between this and the previous pixel is largest than
// the calculate width we need to enlarge the pixel
double gap(0.0);
if( i > 2 )
{
gap = theta - m_thetaPts[i-1];
if( gap > m_thetaWidth )
{
// Move the left boundary to encompass the gap
leftWidth = gap - 0.5*m_thetaWidth;
}
}

const double thetaLower = theta - leftWidth;
const double thetaUpper = theta + rightWidth;
const double efixed = getEFixed(inputWS->getDetector(i));
const double thetaLower = theta - 0.5*m_thetaWidth;
const double thetaUpper = theta + 0.5*m_thetaWidth;

for(size_t j = 0; j < nenergyBins; ++j)
{
m_progress->report("Computing polygon intersections");
Expand Down
10 changes: 5 additions & 5 deletions Code/Mantid/Framework/Algorithms/test/SofQW2Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ class SofQW2Test : public CxxTest::TestSuite
TS_ASSERT_DELTA( result->readY(2)[1200], 2.07634830425, delta);
TS_ASSERT_DELTA( result->readE(2)[1200], 0.0419839252961, delta);

TS_ASSERT_DELTA( result->readY(3)[99], 0.0417455762209, delta);
TS_ASSERT_DELTA( result->readE(3)[99], 0.0185049423467, delta);
TS_ASSERT_DELTA( result->readY(3)[99], 0.0421578372241, delta);
TS_ASSERT_DELTA( result->readE(3)[99], 0.0205020036326, delta);

TS_ASSERT_DELTA( result->readY(4)[1654], 0.0171141154986, delta);
TS_ASSERT_DELTA( result->readE(4)[1654], 0.005007299861, delta);
TS_ASSERT_DELTA( result->readY(4)[1654], 0.0171027307025, delta);
TS_ASSERT_DELTA( result->readE(4)[1654], 0.00517369024804, delta);

TS_ASSERT_DELTA( result->readY(5)[1025], 0.0808168496594, delta);
TS_ASSERT_DELTA( result->readE(5)[1025], 0.0102893133461, delta);
TS_ASSERT_DELTA( result->readE(5)[1025], 0.00769872580375, delta);

AnalysisDataService::Instance().remove(inputWS);
AnalysisDataService::Instance().remove(outputWS);
Expand Down

0 comments on commit df140e4

Please sign in to comment.