Commit 90c300d8 authored by Alex Buts's avatar Alex Buts
Browse files

refs #5955 Moved IntegratePeaksMD and CentroidPeaksMD

parent c51bf104
......@@ -5,8 +5,9 @@ set ( SRC_FILES
src/BinaryOperationMD.cpp
src/BinMD.cpp
src/BinToMDHistoWorkspace.cpp
src/CloneMDWorkspace.cpp
src/BooleanBinaryOperationMD.cpp
src/CentroidPeaksMD.cpp
src/CloneMDWorkspace.cpp
src/CobaltSpinWaveDSHO.cpp
src/CompareMDWorkspaces.cpp
src/ConvertToDetectorFaceMD.cpp
......@@ -20,6 +21,7 @@ set ( SRC_FILES
src/FakeMDEventData.cpp
src/GreaterThanMD.cpp
src/IDynamicRebinning.cpp
src/IntegratePeaksMD.cpp
src/InvalidParameter.cpp
src/InvalidParameterParser.cpp
src/LessThanMD.cpp
......@@ -84,6 +86,7 @@ set ( INC_FILES
inc/MantidMDAlgorithms/BinMD.h
inc/MantidMDAlgorithms/BinToMDHistoWorkspace.h
inc/MantidMDAlgorithms/BooleanBinaryOperationMD.h
inc/MantidMDAlgorithms/CentroidPeaksMD.h
inc/MantidMDAlgorithms/CloneMDWorkspace.h
inc/MantidMDAlgorithms/CobaltSpinWaveDSHO.h
inc/MantidMDAlgorithms/CompareMDWorkspaces.h
......@@ -99,6 +102,7 @@ set ( INC_FILES
inc/MantidMDAlgorithms/FakeMDEventData.h
inc/MantidMDAlgorithms/GreaterThanMD.h
inc/MantidMDAlgorithms/IDynamicRebinning.h
inc/MantidMDAlgorithms/IntegratePeaksMD.h
inc/MantidMDAlgorithms/InvalidParameter.h
inc/MantidMDAlgorithms/InvalidParameterParser.h
inc/MantidMDAlgorithms/LessThanMD.h
......@@ -174,6 +178,7 @@ set ( TEST_FILES
BinToMDHistoWorkspaceTest.h
BooleanBinaryOperationMDTest.h
CachedExperimentInfoTest.h
CentroidPeaksMDTest.h
CloneMDWorkspaceTest.h
CobaltSWDTest.h
CompareMDWorkspacesTest.h
......@@ -192,6 +197,7 @@ set ( TEST_FILES
FitResolutionConvolvedModelTest.h
ForegroundModelTest.h
GreaterThanMDTest.h
IntegratePeaksMDTest.h
InvalidParameterParserTest.h
InvalidParameterTest.h
LessThanMDTest.h
......
#ifndef MANTID_MDEVENTS_CENTROIDPEAKSMD_H_
#define MANTID_MDEVENTS_CENTROIDPEAKSMD_H_
#ifndef MANTID_MDALGORITHMS_CENTROIDPEAKSMD_H_
#define MANTID_MDALGORITHMS_CENTROIDPEAKSMD_H_
#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidKernel/System.h"
#include "MantidMDEvents/MDEventWorkspace.h"
namespace Mantid
{
namespace MDEvents
namespace MDAlgorithms
{
/** Find the centroid of single-crystal peaks in a MDEventWorkspace, in order to refine their positions.
......@@ -39,7 +39,7 @@ namespace MDEvents
void exec();
template<typename MDE, size_t nd>
void integrate(typename MDEventWorkspace<MDE, nd>::sptr ws);
void integrate(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws);
/// Input MDEventWorkspace
Mantid::API::IMDEventWorkspace_sptr inWS;
......
#ifndef MANTID_MDEVENTS_INTEGRATEPEAKSMD_H_
#define MANTID_MDEVENTS_INTEGRATEPEAKSMD_H_
#ifndef MANTID_MDALGORITHMS_INTEGRATEPEAKSMD_H_
#define MANTID_MDALGORITHMS_INTEGRATEPEAKSMD_H_
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IMDEventWorkspace.h"
......@@ -9,7 +9,7 @@
namespace Mantid
{
namespace MDEvents
namespace MDAlgorithms
{
/** Integrate single-crystal peaks in reciprocal-space.
......@@ -39,7 +39,7 @@ namespace MDEvents
void exec();
template<typename MDE, size_t nd>
void integrate(typename MDEventWorkspace<MDE, nd>::sptr ws);
void integrate(typename MDEvents::MDEventWorkspace<MDE, nd>::sptr ws);
/// Input MDEventWorkspace
Mantid::API::IMDEventWorkspace_sptr inWS;
......@@ -56,4 +56,4 @@ namespace MDEvents
} // namespace Mantid
} // namespace MDEvents
#endif /* MANTID_MDEVENTS_INTEGRATEPEAKSMD_H_ */
#endif /* MANTID_MDALGORITHMS_INTEGRATEPEAKSMD_H_ */
/*WIKI*
This algorithm starts with a PeaksWorkspace containing the expected positions of peaks in reciprocal space. It calculates the centroid of the peak by calculating the average of the coordinates of all events within a given radius of the peak, weighted by the weight (signal) of the event.
*WIKI*/
#include "MantidKernel/System.h"
#include "MantidKernel/ListValidator.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidKernel/System.h"
#include "MantidMDEvents/CoordTransformDistance.h"
#include "MantidMDEvents/CentroidPeaksMD.h"
#include "MantidMDEvents/MDEventFactory.h"
#include "MantidMDEvents/IntegratePeaksMD.h"
#include "MantidKernel/ListValidator.h"
#include "MantidMDAlgorithms/IntegratePeaksMD.h"
#include "MantidMDAlgorithms/CentroidPeaksMD.h"
using Mantid::DataObjects::PeaksWorkspace;
namespace Mantid
{
namespace MDEvents
namespace MDAlgorithms
{
// Register the algorithm into the AlgorithmFactory
......
......@@ -69,13 +69,13 @@ IntegratePeaksMD(InputWorkspace='TOPAZ_3131_md', PeaksWorkspace='peaks',
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidKernel/System.h"
#include "MantidMDEvents/MDEventFactory.h"
#include "MantidMDEvents/IntegratePeaksMD.h"
#include "MantidMDAlgorithms/IntegratePeaksMD.h"
#include "MantidMDEvents/CoordTransformDistance.h"
#include "MantidKernel/ListValidator.h"
namespace Mantid
{
namespace MDEvents
namespace MDAlgorithms
{
// Register the algorithm into the AlgorithmFactory
......@@ -217,7 +217,7 @@ namespace MDEvents
// Do not integrate if sphere is off edge of detector
if (BackgroundOuterRadius > PeakRadius)
{
if (!detectorQ(p.getQLabFrame(), BackgroundOuterRadius))
if (!detectorQ(p.getQLabFrame(), BackgroundOuterRadius))
{
g_log.warning() << "Warning: sphere for integration is off edge of detector for peak " << i << std::endl;
if (!integrateEdge)continue;
......@@ -225,7 +225,7 @@ namespace MDEvents
}
else
{
if (!detectorQ(p.getQLabFrame(), PeakRadius))
if (!detectorQ(p.getQLabFrame(), PeakRadius))
{
g_log.warning() << "Warning: sphere for integration is off edge of detector for peak " << i << std::endl;
if (!integrateEdge)continue;
......@@ -334,19 +334,19 @@ namespace MDEvents
double theta = 6.28318531/dAngles * i;
for (int j=0; j < nAngles; ++j)
{
double phi = 6.28318531/dAngles * j;
double phi = 6.28318531/dAngles * j;
V3D edge = V3D(QLabFrame.X()+r*std::cos(theta)*std::sin(phi),
QLabFrame.Y()+r*std::sin(theta)*std::sin(phi), QLabFrame.Z()+r*std::cos(phi));
// Create the peak using the Q in the lab frame with all its info:
try
{
Peak p(inst, edge);
in = (in && p.findDetector());
if (!in) return in;
Peak p(inst, edge);
in = (in && p.findDetector());
if (!in) return in;
}
catch (...)
{
return false;
return false;
}
}
}
......
#ifndef MANTID_MDEVENTS_MDCENTROIDPEAKSTEST_H_
#define MANTID_MDEVENTS_MDCENTROIDPEAKSTEST_H_
#include "MantidMDEvents/CentroidPeaksMD.h"
#include "MantidMDAlgorithms/CentroidPeaksMD.h"
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidAPI/FrameworkManager.h"
......@@ -10,7 +10,6 @@
#include "MantidKernel/System.h"
#include "MantidKernel/Timer.h"
#include "MantidMDEvents/MDEventFactory.h"
#include "MantidMDEvents/CentroidPeaksMD.h"
#include "MantidTestHelpers/ComponentCreationHelper.h"
#include <boost/math/distributions/normal.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
......@@ -30,6 +29,7 @@ using namespace Mantid::API;
using namespace Mantid::DataObjects;
using namespace Mantid::Geometry;
using namespace Mantid::MDEvents;
using namespace Mantid::MDAlgorithms;
using Mantid::Kernel::V3D;
......
#ifndef MANTID_MDEVENTS_MDEWPEAKINTEGRATIONTEST_H_
#define MANTID_MDEVENTS_MDEWPEAKINTEGRATIONTEST_H_
#ifndef MANTID_MDAGORITHMS_MDEWPEAKINTEGRATIONTEST_H_
#define MANTID_MDAGORITHMS_MDEWPEAKINTEGRATIONTEST_H_
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/IMDEventWorkspace.h"
......@@ -9,7 +9,7 @@
#include "MantidKernel/System.h"
#include "MantidKernel/Timer.h"
#include "MantidMDEvents/MDEventFactory.h"
#include "MantidMDEvents/IntegratePeaksMD.h"
#include "MantidMDAlgorithms/IntegratePeaksMD.h"
#include "MantidTestHelpers/ComponentCreationHelper.h"
#include <boost/math/distributions/normal.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
......@@ -29,6 +29,7 @@ using namespace Mantid::API;
using namespace Mantid::DataObjects;
using namespace Mantid::Geometry;
using namespace Mantid::MDEvents;
using namespace Mantid::MDAlgorithms;
using Mantid::Kernel::V3D;
......
......@@ -4,7 +4,6 @@ set ( SRC_FILES
src/AffineMatrixParameter.cpp
src/AffineMatrixParameterParser.cpp
src/BoxControllerSettingsAlgorithm.cpp
src/CentroidPeaksMD.cpp
src/ConvToMDBase.cpp
src/ConvToMDEventsWS.cpp
src/ConvToMDHistoWS.cpp
......@@ -22,7 +21,6 @@ set ( SRC_FILES
src/ImportMDEventWorkspace.cpp
src/ImportMDHistoWorkspace.cpp
src/ImportMDHistoWorkspaceBase.cpp
src/IntegratePeaksMD.cpp
src/MDBin.cpp
src/MDBox.cpp
src/MDBoxToChange.cpp
......@@ -68,7 +66,6 @@ set ( INC_FILES
inc/MantidMDEvents/AffineMatrixParameter.h
inc/MantidMDEvents/AffineMatrixParameterParser.h
inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h
inc/MantidMDEvents/CentroidPeaksMD.h
inc/MantidMDEvents/ConvToMDBase.h
inc/MantidMDEvents/ConvToMDEventsWS.h
inc/MantidMDEvents/ConvToMDHistoWS.h
......@@ -86,7 +83,6 @@ set ( INC_FILES
inc/MantidMDEvents/ImportMDEventWorkspace.h
inc/MantidMDEvents/ImportMDHistoWorkspace.h
inc/MantidMDEvents/ImportMDHistoWorkspaceBase.h
inc/MantidMDEvents/IntegratePeaksMD.h
inc/MantidMDEvents/MDBin.h
inc/MantidMDEvents/MDBox.h
inc/MantidMDEvents/MDBoxToChange.h
......@@ -129,7 +125,6 @@ set ( TEST_FILES
AffineMatrixParameterParserTest.h
AffineMatrixParameterTest.h
BoxControllerSettingsAlgorithmTest.h
CentroidPeaksMDTest.h
ConvertToDiffractionMDWorkspaceTest.h
ConvertToReflectometryQTest.h
ConvToMDBaseTest.h
......@@ -144,7 +139,6 @@ set ( TEST_FILES
FitMDTest.h
ImportMDEventWorkspaceTest.h
ImportMDHistoWorkspaceTest.h
IntegratePeaksMDTest.h
MDBinTest.h
MDBoxBaseTest.h
MDBoxIteratorTest.h
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment