Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/8280_overlapping_peaks'
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Dec 18, 2013
2 parents 923f3e4 + f096104 commit 1700786
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Expand Up @@ -51,6 +51,10 @@ namespace MDAlgorithms
/// Instrument reference
Geometry::Instrument_const_sptr inst;

/// Check if peaks overlap
void checkOverlap(int i,
Mantid::DataObjects::PeaksWorkspace_sptr peakWS, int CoordinatesToUse, double radius);

};


Expand Down
33 changes: 32 additions & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/IntegratePeaksMD2.cpp
Expand Up @@ -593,6 +593,8 @@ namespace MDAlgorithms
}
}
}
checkOverlap (i, peakWS, CoordinatesToUse,
2.0 * std::max(PeakRadiusVector[i],BackgroundOuterRadiusVector[i]));
// Save it back in the peak object.
if (signal != 0. || replaceIntensity)
{
Expand Down Expand Up @@ -676,7 +678,36 @@ namespace MDAlgorithms
}
return in;
}

void IntegratePeaksMD2::checkOverlap(int i,
Mantid::DataObjects::PeaksWorkspace_sptr peakWS, int CoordinatesToUse, double radius)
{
// Get a direct ref to that peak.
IPeak & p1 = peakWS->getPeak(i);
V3D pos1;
if (CoordinatesToUse == 1) //"Q (lab frame)"
pos1 = p1.getQLabFrame();
else if (CoordinatesToUse == 2) //"Q (sample frame)"
pos1 = p1.getQSampleFrame();
else if (CoordinatesToUse == 3) //"HKL"
pos1 = p1.getHKL();
for (int j=i+1; j < peakWS->getNumberPeaks(); ++j)
{
// Get a direct ref to rest of peaks peak.
IPeak & p2 = peakWS->getPeak(j);
V3D pos2;
if (CoordinatesToUse == 1) //"Q (lab frame)"
pos2 = p2.getQLabFrame();
else if (CoordinatesToUse == 2) //"Q (sample frame)"
pos2 = p2.getQSampleFrame();
else if (CoordinatesToUse == 3) //"HKL"
pos2 = p2.getHKL();
if (pos1.distance(pos2) < radius)
{
g_log.warning() << " Warning: Peak integration spheres for peaks "
<< i << " and " << j <<" overlap. Distance between peaks is "<< pos1.distance(pos2)<<std::endl;
}
}
}
//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
Expand Down

0 comments on commit 1700786

Please sign in to comment.