diff --git a/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt b/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt index 766b4662b698479587eef8505788d989d3612e5c..58e0c63e7afe12742c831c23ec77931cf4f7d18b 100644 --- a/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt +++ b/Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt @@ -101,10 +101,10 @@ set ( TEST_FILES test/BooleanBinaryOperationMDTest.h test/CobaltSWDTest.h test/CompareMDWorkspacesTest.h - test/ConvertEventsToMDEventsTest.h + test/ConvertEventsToMDTest.h test/ConvertToDetectorFaceMDTest.h - test/ConvertToMDEventsTest.h - test/ConvertToMDEventsTestPerformance.h + test/ConvertToMDTest.h + test/ConvertToMDTestPerformance.h test/ConvertToQ3DdETest.h test/DampedHisenbergFMSWTest.h test/DivideMDTest.h diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h index 2ac8fa5836dbd97b6e6b0bd937c5fd53573a4a7a..2b99f69fee50c92ad18625d6a1b94725d98a1046 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h @@ -15,7 +15,7 @@ namespace Mantid namespace MDAlgorithms { -/** ConvertToMDEvents : +/** ConvertToMD : * Transfrom a workspace into MD workspace with components defined by user. * * Gateway for number of subalgorithms, some are very important, some are questionable @@ -46,14 +46,14 @@ namespace MDAlgorithms /// Convert to MD Events class itself: - class DLLExport ConvertToMDEvents : public MDEvents::BoxControllerSettingsAlgorithm, public API::DeprecatedAlgorithm + class DLLExport ConvertToMD : public MDEvents::BoxControllerSettingsAlgorithm { public: - ConvertToMDEvents(); - ~ConvertToMDEvents(); + ConvertToMD(); + ~ConvertToMD(); /// Algorithm's name for identification - virtual const std::string name() const { return "ConvertToMDEvents";}; + virtual const std::string name() const { return "ConvertToMD";}; /// Algorithm's version for identification virtual int version() const { return 1;}; /// Algorithm's category for identification diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDEvents.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDEvents.h index 2ac8fa5836dbd97b6e6b0bd937c5fd53573a4a7a..47788e5fde2bb0f205139b426bf79fb764c7d356 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDEvents.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMDEvents.h @@ -15,7 +15,7 @@ namespace Mantid namespace MDAlgorithms { -/** ConvertToMDEvents : +/** ConvertToMD : * Transfrom a workspace into MD workspace with components defined by user. * * Gateway for number of subalgorithms, some are very important, some are questionable diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp index 64fe101f1f93a86913ebdf14b4c3a69e43101291..4c32169b07ed2046f323588ff35e4b76b3d729a7 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp @@ -9,7 +9,7 @@ Depending on the user input and the data, find in the input workspace, the algor *WIKI*/ -#include "MantidMDAlgorithms/ConvertToMDEvents.h" +#include "MantidMDAlgorithms/ConvertToMD.h" #include "MantidKernel/PhysicalConstants.h" #include "MantidKernel/ProgressText.h" @@ -37,26 +37,26 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::ConvertToMD; +using namespace Mantid::MDEvents::CnvrtToMD; namespace Mantid { namespace MDAlgorithms { // logger for the algorithm workspaces -Kernel::Logger& ConvertToMDEvents::convert_log =Kernel::Logger::get("MD-Algorithms"); +Kernel::Logger& ConvertToMD::convert_log =Kernel::Logger::get("MD-Algorithms"); // the variable describes the locations of the preprocessed detectors, which can be stored and reused if the algorithm runs more then once; -MDEvents::ConvToMDPreprocDet ConvertToMDEvents::det_loc; +MDEvents::ConvToMDPreprocDet ConvertToMD::det_loc; // Mantid::Kernel::Logger & -ConvertToMDEvents::getLogger(){return convert_log;} +ConvertToMD::getLogger(){return convert_log;} // // Register the algorithm into the AlgorithmFactory -DECLARE_ALGORITHM(ConvertToMDEvents) +DECLARE_ALGORITHM(ConvertToMD) // Sets documentation strings for this algorithm -void ConvertToMDEvents::initDocs() +void ConvertToMD::initDocs() { this->setWikiSummary("Create a MDEventWorkspace with selected dimensions, e.g. the reciprocal space of momentums (Qx, Qy, Qz) or momentums modules |Q|, energy transfer dE if availible and any other user specified log values which can be treated as dimensions. If the OutputWorkspace exists, it will be replaced"); this->setOptionalMessage("Create a MDEventWorkspace with selected dimensions, e.g. the reciprocal space of momentums (Qx, Qy, Qz) or momentums modules |Q|, energy transfer dE if availible and any other user specified log values which can be treated as dimensions. If the OutputWorkspace exists, it will be replaced"); @@ -65,7 +65,7 @@ void ConvertToMDEvents::initDocs() //---------------------------------------------------------------------------------------------- /** Destructor */ -ConvertToMDEvents::~ConvertToMDEvents() +ConvertToMD::~ConvertToMD() { // if the algorithm has gone, then the preprocessed detectors should probably too det_loc.clearAll(); @@ -76,7 +76,7 @@ ConvertToMDEvents::~ConvertToMDEvents() /** Initialize the algorithm's properties. */ void -ConvertToMDEvents::init() +ConvertToMD::init() { auto ws_valid = boost::make_shared<CompositeValidator>(); // @@ -108,7 +108,7 @@ ConvertToMDEvents::init() MDEvents::MDWSTransform QScl; std::vector<std::string> QScales = QScl.getQScalings(); - declareProperty("QConversionScales",QScales[ConvertToMD::NoScaling], boost::make_shared<StringListValidator>(QScales), + declareProperty("QConversionScales",QScales[CnvrtToMD::NoScaling], boost::make_shared<StringListValidator>(QScales), "This property to normalize three momentums obtained in Q3D mode. Possible values are:\n" " No Scaling, -- momentums in Momentum or MomentumTransfer units A^-1\n" " Q in lattice units -- single scale, where all momentums are divided by the minimal reciprocal lattice vector 2*Pi/Max(a_latt)\n" @@ -119,7 +119,7 @@ ConvertToMDEvents::init() /// temporary MDEvents::MDTransfDEHelper AlldEModes; std::vector<std::string> dE_modes = AlldEModes.getEmodes(); - declareProperty("dEAnalysisMode",dE_modes[ConvertToMD::Direct],boost::make_shared<StringListValidator>(dE_modes), + declareProperty("dEAnalysisMode",dE_modes[CnvrtToMD::Direct],boost::make_shared<StringListValidator>(dE_modes), "You can analyse neutron energy transfer in direct, indirect or elastic mode. The analysis mode has to correspond to experimental set up.\n" " Selecting inelastic mode increases the number of the target workspace dimensions by one. (by DeltaE -- the energy transfer)\n" """NoDE"" choice corresponds to ""CopyToMD"" analysis mode and is selected automatically if the QDimensions is set to ""CopyToMD""",Direction::InOut); @@ -183,7 +183,7 @@ ConvertToMDEvents::init() //---------------------------------------------------------------------------------------------- /* Execute the algorithm. */ -void ConvertToMDEvents::exec() +void ConvertToMD::exec() { // initiate class which would deal with any dimension workspaces, handling if(!pWSWrapper) @@ -348,12 +348,8 @@ void ConvertToMDEvents::exec() } /** Constructor */ -ConvertToMDEvents::ConvertToMDEvents() -{ - this->useAlgorithm("ConvertToMD"); - this->deprecatedDate("2012-07-01"); - -} +ConvertToMD::ConvertToMD() +{} } // namespace Mantid diff --git a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp index 64fe101f1f93a86913ebdf14b4c3a69e43101291..a4cbd67c9dacd91e135c071589b53d7f53c0c2db 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp @@ -37,7 +37,7 @@ using namespace Mantid::API; using namespace Mantid::DataObjects; using namespace Mantid::Geometry; using namespace Mantid::MDEvents; -using namespace Mantid::MDEvents::ConvertToMD; +using namespace Mantid::MDEvents::CnvrtToMD; namespace Mantid { namespace MDAlgorithms @@ -108,7 +108,7 @@ ConvertToMDEvents::init() MDEvents::MDWSTransform QScl; std::vector<std::string> QScales = QScl.getQScalings(); - declareProperty("QConversionScales",QScales[ConvertToMD::NoScaling], boost::make_shared<StringListValidator>(QScales), + declareProperty("QConversionScales",QScales[CnvrtToMD::NoScaling], boost::make_shared<StringListValidator>(QScales), "This property to normalize three momentums obtained in Q3D mode. Possible values are:\n" " No Scaling, -- momentums in Momentum or MomentumTransfer units A^-1\n" " Q in lattice units -- single scale, where all momentums are divided by the minimal reciprocal lattice vector 2*Pi/Max(a_latt)\n" @@ -119,7 +119,7 @@ ConvertToMDEvents::init() /// temporary MDEvents::MDTransfDEHelper AlldEModes; std::vector<std::string> dE_modes = AlldEModes.getEmodes(); - declareProperty("dEAnalysisMode",dE_modes[ConvertToMD::Direct],boost::make_shared<StringListValidator>(dE_modes), + declareProperty("dEAnalysisMode",dE_modes[CnvrtToMD::Direct],boost::make_shared<StringListValidator>(dE_modes), "You can analyse neutron energy transfer in direct, indirect or elastic mode. The analysis mode has to correspond to experimental set up.\n" " Selecting inelastic mode increases the number of the target workspace dimensions by one. (by DeltaE -- the energy transfer)\n" """NoDE"" choice corresponds to ""CopyToMD"" analysis mode and is selected automatically if the QDimensions is set to ""CopyToMD""",Direction::InOut); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDEventsTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDEventsTest.h deleted file mode 100644 index 58a2c5c04c9b4222d4da3e1ddc5169b825ee9bad..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertEventsToMDEventsTest.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef MANTID_MD_CONVEVENTS2_Q_NDANY_TEST_H_ -#define MANTID_MD_CONVEVENTS2_Q_NDANY_TEST_H_ - -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidKernel/Timer.h" -#include "MantidAPI/TextAxis.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidMDAlgorithms/ConvertToMDEvents.h" -#include "MantidTestHelpers/ComponentCreationHelper.h" -#include "MantidTestHelpers/MDEventsTestHelper.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidKernel/UnitFactory.h" -#include "MantidMDEvents/MDTransfFactory.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> - -using namespace Mantid; -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::DataObjects; -using namespace Mantid::MDAlgorithms; -using namespace Mantid::MDEvents; - -class ConvertEvents2MDEvTestHelper: public ConvertToMDEvents -{ -public: - ConvertEvents2MDEvTestHelper(){}; -}; - -// -class ConvertEventsToMDEventsTest : public CxxTest::TestSuite -{ - std::auto_ptr<ConvertEvents2MDEvTestHelper> pAlg; -public: -static ConvertEventsToMDEventsTest *createSuite() { return new ConvertEventsToMDEventsTest(); } -static void destroySuite(ConvertEventsToMDEventsTest * suite) { delete suite; } - - -void testEventWS() -{ -// set up algorithm - TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("InputWorkspace","testEvWS")); - TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("OutputWorkspace","testMDEvWorkspace")); - TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("OtherDimensions","")); - TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("QDimensions", "Q3D")); - pAlg->setPropertyValue("UsePreprocessedDetectors","0"); - TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("dEAnalysisMode", "Elastic")); - pAlg->setPropertyValue("MinValues","-10,-10,-10"); - pAlg->setPropertyValue("MaxValues"," 10, 10, 10"); - - pAlg->setRethrows(false); - pAlg->execute(); - TSM_ASSERT("Shoud finish succesfully",pAlg->isExecuted()); - Mantid::API::Workspace_sptr spws; - TS_ASSERT_THROWS_NOTHING(spws = AnalysisDataService::Instance().retrieve("testMDEvWorkspace")); - TSM_ASSERT(" Worskpace should be retrieved",spws.get()); - - boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<3>,3> > ws = boost::dynamic_pointer_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<3>,3> >(spws); - TSM_ASSERT("It shoudl be 3D MD workspace",ws.get()); - //boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<2>,2> > ws = boost::dynamic_pointer_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<2>,2> >(spws); - //TSM_ASSERT("It shoudl be 2D MD workspace",ws.get()); - - - if(ws.get()){ - TS_ASSERT_EQUALS(900,ws->getNPoints()); - }else{ - TS_FAIL("event workspace has not beed build"); - } - AnalysisDataService::Instance().remove("testMDEvWorkspace"); - - -} - -ConvertEventsToMDEventsTest(){ - FrameworkManager::Instance(); - - pAlg = std::auto_ptr<ConvertEvents2MDEvTestHelper>(new ConvertEvents2MDEvTestHelper()); - pAlg->initialize(); - - int numHist=10; - Mantid::API::MatrixWorkspace_sptr wsEv = boost::dynamic_pointer_cast<MatrixWorkspace>(WorkspaceCreationHelper::CreateRandomEventWorkspace(100, numHist, 0.1)); - wsEv->setInstrument( ComponentCreationHelper::createTestInstrumentCylindrical(numHist) ); - // any inelastic units or unit conversion using TOF needs Ei to be present among properties. -//wsEv->mutableRun().addProperty("Ei",13.,"meV",true); - - AnalysisDataService::Instance().addOrReplace("testEvWS", wsEv); - -} - -}; - - -#endif /* MANTID_MDEVENTS_MAKEDIFFRACTIONMDEVENTWORKSPACETEST_H_ */ - diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h index efee691703468e241be9a402e670528cf0a3efb4..c2e683df30d98e07c562ab41a4de071bebd2b34a 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h @@ -5,7 +5,7 @@ #include "MantidKernel/System.h" #include "MantidKernel/Timer.h" #include "MantidAPI/TextAxis.h" -#include "MantidMDAlgorithms/ConvertToMDEvents.h" +#include "MantidMDAlgorithms/ConvertToMD.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -21,7 +21,7 @@ using namespace Mantid::DataObjects; using namespace Mantid::MDAlgorithms; using namespace Mantid::MDEvents; -class Convert2AnyTestHelper: public ConvertToMDEvents +class Convert2AnyTestHelper: public ConvertToMD { public: Convert2AnyTestHelper(){}; @@ -39,12 +39,12 @@ std::vector<std::string> dim_availible() return data_names_in_WS; } // -class ConvertToMDEventsTest : public CxxTest::TestSuite +class ConvertToMDTest : public CxxTest::TestSuite { std::auto_ptr<Convert2AnyTestHelper> pAlg; public: -static ConvertToMDEventsTest *createSuite() { return new ConvertToMDEventsTest(); } -static void destroySuite(ConvertToMDEventsTest * suite) { delete suite; } +static ConvertToMDTest *createSuite() { return new ConvertToMDTest(); } +static void destroySuite(ConvertToMDTest * suite) { delete suite; } void testInit(){ @@ -157,7 +157,7 @@ void testAlgorithmProperties() 3) Finally this unit test should be updated so that the tests pass. */ - ConvertToMDEvents alg; + ConvertToMD alg; alg.initialize(); Mantid::Kernel::Property *QDimProperty; @@ -185,7 +185,7 @@ void testAlgorithmProperties() } -ConvertToMDEventsTest(){ +ConvertToMDTest(){ pAlg = std::auto_ptr<Convert2AnyTestHelper>(new Convert2AnyTestHelper()); Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(4,10,true); // rotate the crystal by twenty degrees back; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTestPerformance.h b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTestPerformance.h index 7c08e52af765bf709a6f560ed7da4b5612368158..6e099b1659562dfa9c41823ab71fa16a719b836c 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTestPerformance.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTestPerformance.h @@ -12,7 +12,7 @@ #include "MantidKernel/CPUTimer.h" #include "MantidAPI/TextAxis.h" -#include "MantidMDAlgorithms/ConvertToMDEvents.h" +#include "MantidMDAlgorithms/ConvertToMD.h" #include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidTestHelpers/MDEventsTestHelper.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -29,7 +29,7 @@ using namespace Mantid::MDEvents; using namespace Mantid::MDAlgorithms; -class ConvertToMDEventsTestPerformance : public CxxTest::TestSuite +class ConvertToMDTestPerformance : public CxxTest::TestSuite { Kernel::CPUTimer Clock; time_t start,end; @@ -50,8 +50,8 @@ class ConvertToMDEventsTestPerformance : public CxxTest::TestSuite boost::shared_ptr<MDEvents::MDEventWSWrapper> pTargWS; public: -static ConvertToMDEventsTestPerformance *createSuite() { return new ConvertToMDEventsTestPerformance(); } -static void destroySuite(ConvertToMDEventsTestPerformance * suite) { delete suite; } +static ConvertToMDTestPerformance *createSuite() { return new ConvertToMDTestPerformance(); } +static void destroySuite(ConvertToMDTestPerformance * suite) { delete suite; } @@ -195,7 +195,7 @@ void test_HistoNoUnitsConv() } -ConvertToMDEventsTestPerformance(): +ConvertToMDTestPerformance(): Rot(3,3) { numHist=100*100; diff --git a/Code/Mantid/Framework/MDAlgorithms/test/PrecompiledHeader.cpp b/Code/Mantid/Framework/MDAlgorithms/test/PrecompiledHeader.cpp deleted file mode 100644 index f07790a0658793d9236511801b885b4526ebe662..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDAlgorithms/test/PrecompiledHeader.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "PrecompiledHeader.h" \ No newline at end of file diff --git a/Code/Mantid/Framework/MDEvents/CMakeLists.txt b/Code/Mantid/Framework/MDEvents/CMakeLists.txt index b8331272c90e8e136c77b11a6dd4d0687dfeb7d6..bb65ec39bc8f7abc9a3bc7640547f1aaf5fb769f 100644 --- a/Code/Mantid/Framework/MDEvents/CMakeLists.txt +++ b/Code/Mantid/Framework/MDEvents/CMakeLists.txt @@ -144,10 +144,10 @@ set ( TEST_FILES test/CentroidPeaksMDTest.h test/CloneMDWorkspaceTest.h test/ConvertToDiffractionMDWorkspaceTest.h - test/ConvertToMDEventsParamsTest.h - test/ConvertToMDEventsSubalgFactoryTest.h - test/ConvertToMDEventsUnitsConvTest.h - test/ConvertToMDEventsWSTest.h + test/ConvertToMDParamsTest.h + test/ConvertToMDFactoryTest.h + test/ConvertToMDUnitsConvTest.h + test/ConvertToMDWSTest.h test/ConvertToReflectometryQTest.h test/CoordTransformAffineParserTest.h test/CoordTransformAffineTest.h diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h index a7f81614eee66cfc32fd638a20e4b5ac31a1eee5..85be646d7395e4f81f3e0c0c9b9e443d22cdedc1 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfAxisNames.h @@ -37,7 +37,7 @@ namespace MDEvents * * DimensionID is the short name which used to retrieve this dimesnion from MD workspace. * The names themself are defined in constructor */ -namespace ConvertToMD +namespace CnvrtToMD { enum defaultDimID { @@ -54,8 +54,8 @@ class DLLExport MDTransfAxisNames { public: /// function returns default dimension id-s for different Q and dE modes, defined by this class - std::vector<std::string> getDefaultDimIDQ3D(ConvertToMD::EModes dEmode)const; - std::vector<std::string> getDefaultDimIDModQ(ConvertToMD::EModes dEmode)const; + std::vector<std::string> getDefaultDimIDQ3D(CnvrtToMD::EModes dEmode)const; + std::vector<std::string> getDefaultDimIDModQ(CnvrtToMD::EModes dEmode)const; // constructor MDTransfAxisNames(); diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfDEHelper.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfDEHelper.h index 7c26d226c1d188fd9780e317a838549581c8f2c5..997285b6129b89b64d880af361c34a5bdfc07ae6 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfDEHelper.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfDEHelper.h @@ -35,7 +35,7 @@ namespace MDEvents Code Documentation is available at: <http://doxygen.mantidproject.org> */ -namespace ConvertToMD +namespace CnvrtToMD { /* enum describes known eneergy conversion/analysis modes * It is important to assign enums proper numbers, as direct correspondence between enums and their emodes @@ -59,9 +59,9 @@ class DLLExport MDTransfDEHelper // energy conversion modes supported by this class std::vector<std::string> getEmodes()const{return EmodesList;} /// string presentation of emode - std::string getEmode(ConvertToMD::EModes Mode)const; + std::string getEmode(CnvrtToMD::EModes Mode)const; /// convert string presentation of emode into nimerical one - ConvertToMD::EModes getEmode(const std::string &Mode)const; + CnvrtToMD::EModes getEmode(const std::string &Mode)const; // constructor MDTransfDEHelper(); private: diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h index 12387740bb721b2b7a338ef23790dc806718294c..72a5f576f153f52326737be5ffb558e967c9d173 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfInterface.h @@ -10,7 +10,7 @@ namespace Mantid { namespace MDEvents { -/** Interface to set of sub-classes used by ConvertToMDEvents algorithm and responsible for conversion of input workspace +/** Interface to set of sub-classes used by ConvertToMD algorithm and responsible for conversion of input workspace * data into MD events. * The inferface provide information for two tasks. * 1) Definition of target MD workspace properties and @@ -126,17 +126,17 @@ public: /** returns the unit ID for the input units, the particular transformation expects. if one wants the transformation to be meaningful, the X-coordinates of input workspace used by the transformation have to be expressed in the uinits with ID, returned by this method */ - virtual const std::string inputUnitID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const=0; + virtual const std::string inputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const=0; /** The transformation generates output MD events in particular units. This method returns these Units ID-s */ - virtual std::vector<std::string> outputUnitID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const = 0; + virtual std::vector<std::string> outputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const = 0; /** when one builds MD workspace, he needs a dimension names/ID-s which can be different for different Q-transformatons and in different E-mode The position of each dimID in the output vector should correspond the position of each coordinate in the Coord vector */ - virtual std::vector<std::string> getDefaultDimID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const = 0; + virtual std::vector<std::string> getDefaultDimID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const = 0; /** return the number of dimensions, calculated by the transformation from the workspace. This number is usually varies from 1 to 4 * and depends on emode and possibly on some WS parameters. */ - virtual unsigned int getNMatrixDimensions(ConvertToMD::EModes mode,API::MatrixWorkspace_const_sptr inWS)const=0; + virtual unsigned int getNMatrixDimensions(CnvrtToMD::EModes mode,API::MatrixWorkspace_const_sptr inWS)const=0; }; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h index fb8c8e32aac6d8ecba4008abbfe7b633cd8f3511..7260c5d1efba1f6b20ce95c3b11a36c66f942272 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfModQ.h @@ -64,17 +64,17 @@ public: // WARNING!!!! THESE METHODS ARE USED BEFORE INITIALIZE IS EXECUTED SO THEY CAN NOT RELY ON THE CONTENTS OF THE CLASS TO BE DEFINED (THEY ARE VIRTUAL STATIC METHODS) /** return the number of dimensions, calculated by the transformation from the workspace. Depending on EMode, this numebr here is either 1 or 2 and do not depend on input workspace*/ - unsigned int getNMatrixDimensions(ConvertToMD::EModes mode, + unsigned int getNMatrixDimensions(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; /**function returns units ID-s which this transformation prodiuces its ouptut. It is Momentum and Momentum and DelteE in inelastic modes */ - std::vector<std::string> outputUnitID(ConvertToMD::EModes dEmode, + std::vector<std::string> outputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; /**the default dimID-s in ModQ mode are |Q| and dE if necessary */ - std::vector<std::string> getDefaultDimID(ConvertToMD::EModes dEmode, + std::vector<std::string> getDefaultDimID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; /** returns the units, the transformation expects for input workspace to be expressed in. */ - const std::string inputUnitID(ConvertToMD::EModes dEmode, + const std::string inputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; @@ -92,7 +92,7 @@ protected: // number of dimensions, calculated from a matrix workspace, which is one in elastic and two in inelastic mode here. unsigned int nMatrixDim; // the variable which describes current conversion mode: - ConvertToMD::EModes emode; + CnvrtToMD::EModes emode; /** the vector of the additional coordinates which define additional MD dimensions. For implemented ModQ case, these dimensions do not depend on matrix coordinates and are determined by WS properties */ std::vector<coord_t> addDimCoordinates; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h index a0582bfcfacc7cd3665de87b494cb6c295ceeeea..3ab418c61af1aa459b3f5d158744715de7def672 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfNoQ.h @@ -63,12 +63,12 @@ public: //***** output WS definition interface: /** return the number of dimensions, calculated by the transformation from the workspace. Depending on ws axis units, the numebr here is either 1 or 2* and is independent on emode*/ - unsigned int getNMatrixDimensions(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; + unsigned int getNMatrixDimensions(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; /**function returns units ID-s which this transformation prodiuces its ouptut. here it is usually input ws units, which are independent on emode */ - std::vector<std::string> outputUnitID(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; - std::vector<std::string> getDefaultDimID(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; - const std::string inputUnitID(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; + std::vector<std::string> outputUnitID(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; + std::vector<std::string> getDefaultDimID(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; + const std::string inputUnitID(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const; private: unsigned int nMatrixDim; // the variables used for exchange data between different specific parts of the generic ND algorithm: diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h index a73a3c978b9c38dec5c138170c0afd54c7faaa20..10edaa476a98b87a3f18987a3d4af94225f8fc07 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDTransfQ3D.h @@ -63,14 +63,14 @@ public: // WARNING!!!! THESE METHODS ARE USED BEFORE INITIALIZE IS EXECUTED SO THEY CAN NOT RELY ON THE CONTENTS OF THE CLASS (THEY ARE VIRTUAL STATIC METHODS) /** return the number of dimensions, calculated by the transformation from the workspace. Depending on EMode, this numebr here is either 3 or 4 and do not depend on input workspace*/ - unsigned int getNMatrixDimensions(ConvertToMD::EModes mode, + unsigned int getNMatrixDimensions(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; /**function returns units ID-s which this transformation prodiuces its ouptut. It is Momentum and Momentum and DelteE in inelastic modes */ - std::vector<std::string> outputUnitID(ConvertToMD::EModes dEmode, + std::vector<std::string> outputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; /**the default dimID-s in Q3D mode are Q1,Q2,Q3 and dE if necessary */ - std::vector<std::string> getDefaultDimID(ConvertToMD::EModes dEmode, + std::vector<std::string> getDefaultDimID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr Sptr = API::MatrixWorkspace_const_sptr())const; protected: // all variables are the same as in ModQ diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h index 251b04a83e5f653581ece07c4e5d1240cfdcbccb..621991a07f4fdf6d09813e33498c8b03ff845dc8 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSDescription.h @@ -73,7 +73,7 @@ public: // for the time being std::vector<double> getDimMax()const{return dimMax;} std::vector<size_t> getNBins()const{return nBins;} std::vector<coord_t> getAddCoord()const{return AddCoord;} - ConvertToMD::EModes getEMode()const{return emode;} + CnvrtToMD::EModes getEMode()const{return emode;} void getMinMax(std::vector<double> &min,std::vector<double> &max)const; std::vector<double> getTransfMatrix()const{return this->rotMatrix;} @@ -131,7 +131,7 @@ private: // pointer to the array of detector's directions in the reciprocal space ConvToMDPreprocDet const * pDetLocations; /// energy transfer analysis mode - ConvertToMD::EModes emode; + CnvrtToMD::EModes emode; /// the vector of MD coordinates, which are obtained from workspace properties. std::vector<coord_t> AddCoord; /// the names for the target workspace dimensions and properties of input MD workspace diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h index 151a94001a7b0f0d6e4abc9bcf2eaa9e903cc806..ec639956209fbaf1b95a72bb9d58e73f74d81178 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDWSTransform.h @@ -10,7 +10,7 @@ namespace Mantid { namespace MDEvents { - /*** The class responsible for building Momentums Transformation Matrix for ConvertToMDEvents algorithm + /*** The class responsible for building Momentums Transformation Matrix for CnvrtToMD algorithm * from the input parameters of the algorithm and parameters, retrieved from input and * (if availible) output MD workspace * @@ -38,7 +38,7 @@ namespace MDEvents File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ -namespace ConvertToMD +namespace CnvrtToMD { /// enum descrines availble momentum scalings, interpreted by this class enum CoordScaling @@ -63,16 +63,16 @@ public: /** function provides the linear representation for the transformation matrix, which translate momentums from laboratory to crystal cartezian (C)- Busing, Levi 1967 coordinate system */ std::vector<double> getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription,const std::string &QScaleRequested)const; - std::vector<double> getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription,ConvertToMD::CoordScaling scaling)const; + std::vector<double> getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription,CnvrtToMD::CoordScaling scaling)const; /// construct meaningful dimension names for Q3D case and different transformation types defined by the class void setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescription,const std::string &QScaleRequested)const; - void setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescription,ConvertToMD::CoordScaling scaling)const; + void setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescription,CnvrtToMD::CoordScaling scaling)const; /// construct meaningful dimension names for ModQ case and different transformation types defined by the class; void setModQDimensionsNames(MDEvents::MDWSDescription &TargWSDescription,const std::string &QScaleRequested)const; /// return the list of possible scalings for momentums std::vector<std::string> getQScalings()const{return QScalingID;} - ConvertToMD::CoordScaling getQScaling(const std::string &ScID)const; + CnvrtToMD::CoordScaling getQScaling(const std::string &ScID)const; private: bool is_uv_default; /** vectors, which describe the projection plain the target ws is based on (notional or cryst cartezian coordinate system). The transformation matrix below @@ -86,7 +86,7 @@ private: std::vector<std::string> QScalingID; protected: // for testing /// function generates "Kind of" W transformation matrix for different Q-conversion modes; - Kernel::DblMatrix buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription,ConvertToMD::CoordScaling scaling)const; + Kernel::DblMatrix buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription,CnvrtToMD::CoordScaling scaling)const; /// build orthogonal coordinate around two input vecotors u and v expressed in rlu; //std::vector<Kernel::V3D> buildOrtho3D(const Kernel::DblMatrix &BM,const Kernel::V3D &u, const Kernel::V3D &v)const; diff --git a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h index aacd2877652f34f38ce26cf256a16747e26ddee1..b2f43e7813174342d1a1b9d4ea6978ddd9d381a6 100644 --- a/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h +++ b/Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h @@ -38,7 +38,7 @@ namespace MDEvents File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ -namespace ConvertToMD +namespace CnvrtToMD { // possible situations with unit conversion enum ConvertUnits @@ -58,7 +58,7 @@ class DLLExport UnitsConversionHelper Kernel::Unit_sptr pTargetUnit; // the ID, which specifies what kind of unit conversion should be used. - ConvertToMD::ConvertUnits UnitCnvrsn; + CnvrtToMD::ConvertUnits UnitCnvrsn; // these variables needed and used in the case of fast units conversion double factor, power; @@ -77,7 +77,7 @@ public: UnitsConversionHelper(const UnitsConversionHelper &another); protected: // for testing /// establish and initialize proper units conversion from input to output units; - ConvertToMD::ConvertUnits analyzeUnitsConversion(const std::string &UnitsFrom,const std::string &UnitsTo); + CnvrtToMD::ConvertUnits analyzeUnitsConversion(const std::string &UnitsFrom,const std::string &UnitsTo); }; diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp b/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp index dbb65ed051df2385f00762736ef21be97e250814..d38c20b353a2e55c8cc3f6632c48797c1a5fa7d3 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ConvToMDBase.cpp @@ -39,7 +39,7 @@ size_t ConvToMDBase::initialize(const MDEvents::MDWSDescription &WSD, boost::sh // initialize the MD coordinates conversion class pQConverter->initialize(WSD); // initialize units conversion which can/or can not be necessary depending on input ws/converter requested units; - ConvertToMD::EModes emode = WSD.getEMode(); + CnvrtToMD::EModes emode = WSD.getEMode(); UnitConversion.initialize(WSD,pQConverter->inputUnitID(emode,inWS2D)); diff --git a/Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp b/Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp index 9d21b61559c9ead08ad345d964f150664d418b71..6701af54396647bc5fd02ceff35c6903e0a1b0aa 100644 --- a/Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp @@ -96,7 +96,7 @@ size_t ConvToMDEventsWS::initialize(const MDEvents::MDWSDescription &WSD, boost pEventWS = boost::dynamic_pointer_cast<const DataObjects::EventWorkspace>(inWS2D); if(!pEventWS.get()){ - throw(std::logic_error(" ConvertToMDEvensEventWS should work with defined event workspace")); + throw(std::logic_error(" ConvertToMDEventWS should work with defined event workspace")); } return numSpec; diff --git a/Code/Mantid/Framework/MDEvents/src/CreateMDHistoWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/CreateMDHistoWorkspace.cpp index d79b6c424cacabf60e4894371b91471a56654667..bac7d23849620ac1742820fb5d95455310e1d021 100644 --- a/Code/Mantid/Framework/MDEvents/src/CreateMDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/CreateMDHistoWorkspace.cpp @@ -25,7 +25,7 @@ The following example creates a 1D sine function CreateMDHistoWorkspace(SignalInput=signals,ErrorInput=errors,Dimensionality=dimensionality,Extents=extents,NumberOfBins=nbins,Names='x',Units='dimensionless',OutputWorkspace='demo') == Alternatives == -A very similar algorithm to this is [[ImportMDHistoWorkspace]], which takes it's input signal and error values from a text file rather than from arrays. Another alternative is to use [[ConvertToMDEvents]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality. +A very similar algorithm to this is [[ImportMDHistoWorkspace]], which takes it's input signal and error values from a text file rather than from arrays. Another alternative is to use [[CnvrtToMD]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality. [[Category:MDAlgorithms]] diff --git a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp b/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp index f2f788fd2146970de7eededf5f1af180473ae96f..c3c07692de51687982ea55e1e33558370434551a 100644 --- a/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp +++ b/Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp @@ -39,7 +39,7 @@ And here's the corresponding contents of ''demo.txt'': 16 16.1 == Alternatives == -A very similar algorithm to this is [[CreateMDHistoWorkspace]], which takes it's input signal and error values from arrays rather than a text file. Another alternative is to use [[ConvertToMDEvents]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality. +A very similar algorithm to this is [[CreateMDHistoWorkspace]], which takes it's input signal and error values from arrays rather than a text file. Another alternative is to use [[ConvertToMD]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality. [[Category:MDAlgorithms]] diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp index 6183b30884711160c8ae33ad1c43c34b4f0f12c6..934a03ab3375b8f23320f0c3e1b3cb48f6824fdf 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfAxisNames.cpp @@ -7,57 +7,57 @@ namespace MDEvents { MDTransfAxisNames::MDTransfAxisNames(): -default_dim_ID(ConvertToMD::nDefaultID) +default_dim_ID(CnvrtToMD::nDefaultID) { // this defines default dimension ID-s which are used to indentify dimensions when using the target MD workspace later // for ModQ transformation: - default_dim_ID[ConvertToMD::ModQ_ID]="|Q|"; + default_dim_ID[CnvrtToMD::ModQ_ID]="|Q|"; // for Q3D transformation - default_dim_ID[ConvertToMD::Q1_ID]="Q1"; - default_dim_ID[ConvertToMD::Q2_ID]="Q2"; - default_dim_ID[ConvertToMD::Q3_ID]="Q3"; - default_dim_ID[ConvertToMD::dE_ID]="DeltaE"; + default_dim_ID[CnvrtToMD::Q1_ID]="Q1"; + default_dim_ID[CnvrtToMD::Q2_ID]="Q2"; + default_dim_ID[CnvrtToMD::Q3_ID]="Q3"; + default_dim_ID[CnvrtToMD::dE_ID]="DeltaE"; } // -std::vector<std::string> MDTransfAxisNames::getDefaultDimIDQ3D(ConvertToMD::EModes dEMode)const +std::vector<std::string> MDTransfAxisNames::getDefaultDimIDQ3D(CnvrtToMD::EModes dEMode)const { std::vector<std::string> rez; - if(dEMode==ConvertToMD::Elastic) + if(dEMode==CnvrtToMD::Elastic) { rez.resize(3); }else{ - if (dEMode==ConvertToMD::Direct||dEMode==ConvertToMD::Indir) + if (dEMode==CnvrtToMD::Direct||dEMode==CnvrtToMD::Indir) { rez.resize(4); - rez[3]=default_dim_ID[ConvertToMD::dE_ID]; + rez[3]=default_dim_ID[CnvrtToMD::dE_ID]; }else{ throw(std::invalid_argument("Unknown dE mode provided")); } } - rez[0]=default_dim_ID[ConvertToMD::Q1_ID]; - rez[1]=default_dim_ID[ConvertToMD::Q2_ID]; - rez[2]=default_dim_ID[ConvertToMD::Q3_ID]; + rez[0]=default_dim_ID[CnvrtToMD::Q1_ID]; + rez[1]=default_dim_ID[CnvrtToMD::Q2_ID]; + rez[2]=default_dim_ID[CnvrtToMD::Q3_ID]; return rez; } -std::vector<std::string> MDTransfAxisNames::getDefaultDimIDModQ(ConvertToMD::EModes dEMode)const +std::vector<std::string> MDTransfAxisNames::getDefaultDimIDModQ(CnvrtToMD::EModes dEMode)const { std::vector<std::string> rez; - if(dEMode==ConvertToMD::Elastic){ + if(dEMode==CnvrtToMD::Elastic){ rez.resize(1); }else{ - if (dEMode==ConvertToMD::Direct||dEMode==ConvertToMD::Indir){ + if (dEMode==CnvrtToMD::Direct||dEMode==CnvrtToMD::Indir){ rez.resize(2); - rez[1]=default_dim_ID[ConvertToMD::dE_ID]; + rez[1]=default_dim_ID[CnvrtToMD::dE_ID]; }else{ throw(std::invalid_argument("Unknown dE mode provided")); } } - rez[0]=default_dim_ID[ConvertToMD::ModQ_ID]; + rez[0]=default_dim_ID[CnvrtToMD::ModQ_ID]; return rez; } diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfDEHelper.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfDEHelper.cpp index 9ad39f790f27eb1b82c2e315393cafb06e15d2db..a89f3542f532654b48dd53c71eb7160a85074cfe 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfDEHelper.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfDEHelper.cpp @@ -9,27 +9,27 @@ namespace MDEvents { MDTransfDEHelper::MDTransfDEHelper(): -EmodesList(ConvertToMD::No_DE,"") +EmodesList(CnvrtToMD::No_DE,"") { - EmodesList[ConvertToMD::Elastic]="Elastic"; - EmodesList[ConvertToMD::Direct] ="Direct"; - EmodesList[ConvertToMD::Indir] ="Indirect"; + EmodesList[CnvrtToMD::Elastic]="Elastic"; + EmodesList[CnvrtToMD::Direct] ="Direct"; + EmodesList[CnvrtToMD::Indir] ="Indirect"; } -ConvertToMD::EModes MDTransfDEHelper::getEmode(const std::string &Mode)const +CnvrtToMD::EModes MDTransfDEHelper::getEmode(const std::string &Mode)const { int nMode = Kernel::Strings::isMember(EmodesList,Mode); if(nMode<0){ std::string ERR= "MDTransfDEHelper::getEmode: Unknown energy conversion mode "+ Mode+" requested\n"; throw(std::invalid_argument(ERR)); } - return ConvertToMD::EModes(nMode); + return CnvrtToMD::EModes(nMode); } /**return string representation of correspondend enum mode */ -std::string MDTransfDEHelper::getEmode(ConvertToMD::EModes Mode)const +std::string MDTransfDEHelper::getEmode(CnvrtToMD::EModes Mode)const { - if(Mode>ConvertToMD::No_DE) throw(std::invalid_argument(" Can not convert into string undefined emode")); + if(Mode>CnvrtToMD::No_DE) throw(std::invalid_argument(" Can not convert into string undefined emode")); return EmodesList[Mode]; } diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp index 2e260bab9803c086d969641d8dcba1e73550a0e1..0599902effa618961127f71b6f8c1119c3f8e099 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp @@ -11,14 +11,14 @@ DECLARE_MD_TRANSFID(MDTransfModQ,|Q|); /** method calculates the unigs, the transformation expects input ws to be in. If input ws is in different units, the WS data will be converted into the units requested on-fly. */ -const std::string MDTransfModQ::inputUnitID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const +const std::string MDTransfModQ::inputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); switch(dEmode) { - case(ConvertToMD::Elastic): return "Momentum"; - case(ConvertToMD::Direct): - case(ConvertToMD::Indir): + case(CnvrtToMD::Elastic): return "Momentum"; + case(CnvrtToMD::Direct): + case(CnvrtToMD::Indir): return "DeltaE"; default: throw(std::invalid_argument(" MDTransfModQ::inputUnitID: this class supports only conversion in Elastic and Inelastic energy transfer modes")); @@ -26,14 +26,14 @@ const std::string MDTransfModQ::inputUnitID(ConvertToMD::EModes dEmode, API::Mat } /** method returns number of matrix dimensions calculated by this class * as function of energy analysis mode */ -unsigned int MDTransfModQ::getNMatrixDimensions(ConvertToMD::EModes mode,API::MatrixWorkspace_const_sptr inWS)const +unsigned int MDTransfModQ::getNMatrixDimensions(CnvrtToMD::EModes mode,API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); switch(mode) { - case(ConvertToMD::Direct): return 2; - case(ConvertToMD::Indir): return 2; - case(ConvertToMD::Elastic): return 1; + case(CnvrtToMD::Direct): return 2; + case(CnvrtToMD::Indir): return 2; + case(CnvrtToMD::Elastic): return 1; default: throw(std::invalid_argument("Unknow or unsupported energy conversion mode")); } } @@ -42,7 +42,7 @@ unsigned int MDTransfModQ::getNMatrixDimensions(ConvertToMD::EModes mode,API::Ma bool MDTransfModQ::calcMatrixCoord(const double& x,std::vector<coord_t> &Coord)const { - if(emode == ConvertToMD::Elastic){ + if(emode == CnvrtToMD::Elastic){ return calcMatrixCoordElastic(x,Coord); }else{ return calcMatrixCoordInelastic(x,Coord); @@ -108,7 +108,7 @@ bool MDTransfModQ::calcMatrixCoordInelastic(const double& E_tr,std::vector<coord Coord[1] =(coord_t)E_tr; double k_tr; // get module of the wavevector for scattered neutrons - if(this->emode==ConvertToMD::Direct){ + if(this->emode==CnvrtToMD::Direct){ k_tr=sqrt((Ei-E_tr)/PhysicalConstants::E_mev_toNeutronWavenumberSq); }else{ k_tr=sqrt((Ei+E_tr)/PhysicalConstants::E_mev_toNeutronWavenumberSq); @@ -190,13 +190,13 @@ void MDTransfModQ::initialize(const MDWSDescription &ConvParams) //************ specific part of the initialization, dependent on emode: emode = ConvParams.getEMode(); nMatrixDim = getNMatrixDimensions(emode); - if(emode == ConvertToMD::Direct||emode == ConvertToMD::Indir){ + if(emode == CnvrtToMD::Direct||emode == CnvrtToMD::Indir){ // energy needed in inelastic case Ei = ConvParams.getEi(); // the wave vector of incident neutrons; ki=sqrt(Ei/PhysicalConstants::E_mev_toNeutronWavenumberSq); }else{ - if (emode != ConvertToMD::Elastic){ + if (emode != CnvrtToMD::Elastic){ throw(std::invalid_argument("MDTransfModQ::initialize::Unknown energy conversion mode")); } } @@ -209,19 +209,19 @@ void MDTransfModQ::initialize(const MDWSDescription &ConvParams) *@returns -- vector of default dimension ID-s for correspondent energy conversion mode. The position of each dimID in the vector corresponds to the position of each MD coordinate in the Coord vector */ -std::vector<std::string> MDTransfModQ::getDefaultDimID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const +std::vector<std::string> MDTransfModQ::getDefaultDimID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); std::vector<std::string> default_dim_ID; switch(dEmode) { - case(ConvertToMD::Elastic): + case(CnvrtToMD::Elastic): { default_dim_ID.resize(1); break; } - case(ConvertToMD::Direct): - case(ConvertToMD::Indir): + case(CnvrtToMD::Direct): + case(CnvrtToMD::Indir): { default_dim_ID.resize(2); default_dim_ID[1]= "DeltaE"; @@ -240,12 +240,12 @@ std::vector<std::string> MDTransfModQ::getDefaultDimID(ConvertToMD::EModes dEmod * @param Emode -- energy conversion mode * * It is Momentum and DelteE in inelastic modes */ -std::vector<std::string> MDTransfModQ::outputUnitID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const +std::vector<std::string> MDTransfModQ::outputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); std::vector<std::string> UnitID = this->getDefaultDimID(dEmode,inWS); //TODO: is it really momentum transfer, as MomentumTransfer units are seems bound to elastic mode only (at least accorting to Units description on Wiki)? - if(dEmode==ConvertToMD::Elastic){ + if(dEmode==CnvrtToMD::Elastic){ UnitID[0] = "Momentum"; }else{ UnitID[0] = "MomentumTransfer"; diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp index 23d09cef994d8ca6e9bf568f472c4558e7f3388b..8e481080617308492f99cd28dd60b59a889a8dfd 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfNoQ.cpp @@ -46,7 +46,7 @@ void MDTransfNoQ::initialize(const MDWSDescription &ConvParams) // get min and max values defined by the algorithm. ConvParams.getMinMax(dim_min,dim_max); - nMatrixDim = getNMatrixDimensions(ConvertToMD::Undef,ConvParams.getInWS()); + nMatrixDim = getNMatrixDimensions(CnvrtToMD::Undef,ConvParams.getInWS()); this->addDimCoordinates = ConvParams.getAddCoord(); API::NumericAxis *pXAx; this->getAxes(ConvParams.getInWS(),pXAx,pYAxis); @@ -75,7 +75,7 @@ bool MDTransfNoQ::calcMatrixCoord(const double& X,std::vector<coord_t> &Coord)co /** return the number of dimensions, calculated by the transformation from the workspace. Depending on ws axis units, the numebr here is either 1 or 2* and is independent on emode*/ -unsigned int MDTransfNoQ::getNMatrixDimensions(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const +unsigned int MDTransfNoQ::getNMatrixDimensions(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(mode); @@ -107,7 +107,7 @@ void MDTransfNoQ::getAxes(API::MatrixWorkspace_const_sptr inWS,API::NumericAxis * @param inWS -- input matrix workspace shared pointer * */ -std::vector<std::string> MDTransfNoQ::outputUnitID(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const +std::vector<std::string> MDTransfNoQ::outputUnitID(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(mode); @@ -126,12 +126,12 @@ std::vector<std::string> MDTransfNoQ::outputUnitID(ConvertToMD::EModes mode, API return rez; } /**the default dimID-s in noQ mode equal to input WS dim-id-s */ -std::vector<std::string> MDTransfNoQ::getDefaultDimID(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const +std::vector<std::string> MDTransfNoQ::getDefaultDimID(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const { return this->outputUnitID(mode,inWS); } /** returns the units, the input ws is actually in as they coinside with input units for this class */ -const std::string MDTransfNoQ::inputUnitID(ConvertToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const +const std::string MDTransfNoQ::inputUnitID(CnvrtToMD::EModes mode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(mode); API::NumericAxis *pXAxis; diff --git a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp b/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp index 3f35efd725b7497b2af3ca6d9f1a8c61d786bee1..8a80cc959aad7c87ff49a2d82e1e117e4bcbcd75 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDTransfQ3D.cpp @@ -10,14 +10,14 @@ DECLARE_MD_TRANSFID(MDTransfQ3D,Q3D); /** method returns number of matrix dimensions calculated by this class * as function of energy analysis mode */ -unsigned int MDTransfQ3D::getNMatrixDimensions(ConvertToMD::EModes mode,API::MatrixWorkspace_const_sptr inWS)const +unsigned int MDTransfQ3D::getNMatrixDimensions(CnvrtToMD::EModes mode,API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); switch(mode) { - case(ConvertToMD::Direct): return 4; - case(ConvertToMD::Indir): return 4; - case(ConvertToMD::Elastic): return 3; + case(CnvrtToMD::Direct): return 4; + case(CnvrtToMD::Indir): return 4; + case(CnvrtToMD::Elastic): return 3; default: throw(std::invalid_argument("Unknow or unsupported energy conversion mode")); } } @@ -25,7 +25,7 @@ unsigned int MDTransfQ3D::getNMatrixDimensions(ConvertToMD::EModes mode,API::Mat bool MDTransfQ3D::calcMatrixCoord(const double& x,std::vector<coord_t> &Coord)const { - if(emode == ConvertToMD::Elastic){ + if(emode == CnvrtToMD::Elastic){ return calcMatrixCoord3DElastic(x,Coord); }else{ return calcMatrixCoord3DInelastic(x,Coord); @@ -50,7 +50,7 @@ bool MDTransfQ3D::calcMatrixCoord3DInelastic(const double& E_tr,std::vector<coor // get module of the wavevector for scattered neutrons double k_tr; - if(this->emode==ConvertToMD::Direct){ + if(this->emode==CnvrtToMD::Direct){ k_tr=sqrt((Ei-E_tr)/PhysicalConstants::E_mev_toNeutronWavenumberSq); }else{ k_tr=sqrt((Ei+E_tr)/PhysicalConstants::E_mev_toNeutronWavenumberSq); @@ -115,13 +115,13 @@ void MDTransfQ3D::initialize(const MDWSDescription &ConvParams) //************ specific part of the initialization, dependent on emode: emode = ConvParams.getEMode(); nMatrixDim = getNMatrixDimensions(emode); - if(emode == ConvertToMD::Direct||emode == ConvertToMD::Indir){ + if(emode == CnvrtToMD::Direct||emode == CnvrtToMD::Indir){ // energy needed in inelastic case Ei = ConvParams.getEi(); // the wave vector of incident neutrons; ki=sqrt(Ei/PhysicalConstants::E_mev_toNeutronWavenumberSq); }else{ - if (emode != ConvertToMD::Elastic){ + if (emode != CnvrtToMD::Elastic){ throw(std::invalid_argument("MDTransfModQ::initialize::Unknown or unsupported energy conversion mode")); } } @@ -134,19 +134,19 @@ void MDTransfQ3D::initialize(const MDWSDescription &ConvParams) *@returns -- vector of default dimension ID-s for correspondent energy conversion mode. The position of each dimID in the vector corresponds to the position of each MD coordinate in the Coord vector */ -std::vector<std::string> MDTransfQ3D::getDefaultDimID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const +std::vector<std::string> MDTransfQ3D::getDefaultDimID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); std::vector<std::string> default_dim_ID; switch(dEmode) { - case(ConvertToMD::Elastic): + case(CnvrtToMD::Elastic): { default_dim_ID.resize(3); break; } - case(ConvertToMD::Direct): - case(ConvertToMD::Indir): + case(CnvrtToMD::Direct): + case(CnvrtToMD::Indir): { default_dim_ID.resize(4); default_dim_ID[3]= "DeltaE"; @@ -167,13 +167,13 @@ std::vector<std::string> MDTransfQ3D::getDefaultDimID(ConvertToMD::EModes dEmode * @param Emode -- energy conversion mode * * It is Momentum and DelteE in inelastic modes */ -std::vector<std::string> MDTransfQ3D::outputUnitID(ConvertToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const +std::vector<std::string> MDTransfQ3D::outputUnitID(CnvrtToMD::EModes dEmode, API::MatrixWorkspace_const_sptr inWS)const { UNUSED_ARG(inWS); std::vector<std::string> UnitID = this->getDefaultDimID(dEmode,inWS); //TODO: is it really momentum transfer, as MomentumTransfer units are seems bound to elastic mode only (at least accorting to Units description on Wiki)? std::string kUnits("MomentumTransfer"); - if(dEmode==ConvertToMD::Elastic){ + if(dEmode==CnvrtToMD::Elastic){ kUnits= "Momentum"; } diff --git a/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp b/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp index 0b799b7ed03aa6bed2a50b0acc8e797276768ace..ea2481df186cb233ba8f78a504c998b58d3672d4 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDWSDescription.cpp @@ -109,7 +109,7 @@ void MDWSDescription::buildFromMatrixWS(const API::MatrixWorkspace_const_sptr &p // in direct or indirect mode input ws has to have input energy - if(emode==ConvertToMD::Direct||emode==ConvertToMD::Indir){ + if(emode==CnvrtToMD::Direct||emode==CnvrtToMD::Indir){ if(isNaN(getEi(inWS)))throw(std::invalid_argument("Input neutron's energy has to be defined in inelastic mode ")); } @@ -196,7 +196,7 @@ void MDWSDescription::checkWSCorresponsMDWorkspace(MDEvents::MDWSDescription &N boost::lexical_cast<std::string>(NewMDWorkspaceD.nDims); throw(std::invalid_argument(ERR)); } - if(this->emode==ConvertToMD::Undef) + if(this->emode==CnvrtToMD::Undef) { throw(std::invalid_argument("Workspace description has not been correctly defined, as emode has not been defined")); } @@ -211,7 +211,7 @@ MDWSDescription::MDWSDescription(unsigned int nDimensions): Wtransf(3,3,true), GoniomMatr(3,3,true), rotMatrix(9,0), // set transformation matrix to 0 to certainly see rubbish if error later -emode(ConvertToMD::Undef) +emode(CnvrtToMD::Undef) { this->resizeDimDescriptions(nDimensions); diff --git a/Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp b/Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp index c041520bba8571fadcbf9f63109beb26fc4e32de..94ef28e887f9850ac7e39cc9732b769f73d22744 100644 --- a/Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp +++ b/Code/Mantid/Framework/MDEvents/src/MDWSTransform.cpp @@ -9,7 +9,7 @@ namespace MDEvents { // logger for the algorithm workspaces Kernel::Logger& MDWSTransform::convert_log =Kernel::Logger::get("MD-Algorithms"); -using namespace ConvertToMD; +using namespace CnvrtToMD; std::vector<double> MDWSTransform::getTransfMatrix(MDEvents::MDWSDescription &TargWSDescription,const std::string &QScaleRequested)const { @@ -60,7 +60,7 @@ std::vector<double> MDWSTransform::getTransfMatrix(MDEvents::MDWSDescription &Ta } -Kernel::DblMatrix MDWSTransform::buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription,ConvertToMD::CoordScaling ScaleID)const +Kernel::DblMatrix MDWSTransform::buildQTrahsf(MDEvents::MDWSDescription &TargWSDescription,CnvrtToMD::CoordScaling ScaleID)const { //implements strategy Q=R*U*B*W*h where W-transf is W or WB or W*Unit*Lattice_param depending on inputs: if(!TargWSDescription.hasLattice()){ @@ -138,7 +138,7 @@ void MDWSTransform::setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescr } -void MDWSTransform::setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescription,ConvertToMD::CoordScaling ScaleID)const +void MDWSTransform::setQ3DDimensionsNames(MDEvents::MDWSDescription &TargWSDescription,CnvrtToMD::CoordScaling ScaleID)const { std::vector<Kernel::V3D> dim_directions; diff --git a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp b/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp index 41ca307f5a779285a584b54dbd35696ad0472e14..6b334712c320b954a113a03ac17047a8e8f3ded5 100644 --- a/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp +++ b/Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp @@ -16,12 +16,12 @@ namespace MDEvents if necessary, also sets up the proper units convertor pointers which do the actual conversion. */ -ConvertToMD::ConvertUnits UnitsConversionHelper::analyzeUnitsConversion(const std::string &UnitsFrom,const std::string &UnitsTo) +CnvrtToMD::ConvertUnits UnitsConversionHelper::analyzeUnitsConversion(const std::string &UnitsFrom,const std::string &UnitsTo) { // if units are equal, no conversion is necessary; if(UnitsFrom.compare(UnitsTo)==0) { - return ConvertToMD::ConvertNo; + return CnvrtToMD::ConvertNo; } @@ -46,14 +46,14 @@ ConvertToMD::ConvertUnits UnitsConversionHelper::analyzeUnitsConversion(const st pSourceWSUnit=Kernel::UnitFactory::Instance().create(UnitsFrom); if(pSourceWSUnit->quickConversion(UnitsTo,factor,power)) { - return ConvertToMD::ConvertFast; + return CnvrtToMD::ConvertFast; }else{ // is the input unts are TOF? if(UnitsFrom.compare("TOF")==0){ - return ConvertToMD::ConvertFromTOF; + return CnvrtToMD::ConvertFromTOF; }else{ // convert using TOF pTargetUnit =Kernel::UnitFactory::Instance().create(UnitsTo); - return ConvertToMD::ConvertByTOF; + return CnvrtToMD::ConvertByTOF; } } @@ -100,9 +100,9 @@ void UnitsConversionHelper::updateConversion(size_t i) { switch(UnitCnvrsn) { - case(ConvertToMD::ConvertNo): return; - case(ConvertToMD::ConvertFast): return; - case(ConvertToMD::ConvertFromTOF): + case(CnvrtToMD::ConvertNo): return; + case(CnvrtToMD::ConvertFast): return; + case(CnvrtToMD::ConvertFromTOF): { double delta; twoTheta = (*pTwoTheta)[i]; @@ -110,7 +110,7 @@ void UnitsConversionHelper::updateConversion(size_t i) pTargetUnit->initialize(L1,L2,twoTheta,emode,efix,delta); return; } - case(ConvertToMD::ConvertByTOF): + case(CnvrtToMD::ConvertByTOF): { double delta; twoTheta = (*pTwoTheta)[i]; @@ -129,19 +129,19 @@ double UnitsConversionHelper::convertUnits(double val) { switch(UnitCnvrsn) { - case(ConvertToMD::ConvertNo): + case(CnvrtToMD::ConvertNo): { return val; } - case(ConvertToMD::ConvertFast): + case(CnvrtToMD::ConvertFast): { return factor*std::pow(val,power); } - case(ConvertToMD::ConvertFromTOF): + case(CnvrtToMD::ConvertFromTOF): { return pTargetUnit->singleFromTOF(val); } - case(ConvertToMD::ConvertByTOF): + case(CnvrtToMD::ConvertByTOF): { double tof = pSourceWSUnit->singleToTOF(val); return pTargetUnit->singleFromTOF(tof); diff --git a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsParamsTest.h b/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsParamsTest.h deleted file mode 100644 index 99ed0529947c7df618ce76a9340f678905e23ecd..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsParamsTest.h +++ /dev/null @@ -1,368 +0,0 @@ -#ifndef MANTID_MD_CONVEVENTS_PARAMS_TEST_H_ -#define MANTID_MD_CONVEVENTS_PARAMS_TEST_H_ - - -#include "MantidAPI/TextAxis.h" -#include "MantidAPI/NumericAxis.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidMDEvents/MDWSDescription.h" - -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> - -using namespace Mantid; -using namespace Mantid::Kernel; -using namespace Mantid::API; - -using namespace Mantid::MDEvents; - -class ConvertToMDEventsParamsTest : public CxxTest::TestSuite -{ -public: -static ConvertToMDEventsParamsTest *createSuite() { return new ConvertToMDEventsParamsTest(); } -static void destroySuite(ConvertToMDEventsParamsTest * suite) { delete suite; } - -// --> GET DIMENSIONS FROM WS MATRIX: -//--> this test should go on unit conversion -//void testNeedsNumericAxis() -//{ -// MDEvents::MDWSDescription TWS; -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// ws2D->replaceAxis(0,new API::TextAxis(3)); -// std::vector<std::string> add_dim_names; -// std::vector<double> min(3,-10),max(3,10); -// TWS.setMinMax(min,max); -// -// TS_ASSERT_THROWS(TWS.buildFromMatrixWS(ws2D,"Q3D","Elastic",add_dim_names),std::invalid_argument); -//} -void testGetWS4DimIDFine() -{ - Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(4,10,true); - ws2D->mutableRun().addProperty("Ei",12.,"meV",true); - - MDEvents::MDWSDescription TWS; - std::vector<double> min(4,-10),max(4,10); - TWS.setMinMax(min,max); - - std::vector<std::string> other_dim_names; - - - TS_ASSERT_THROWS_NOTHING(TWS.buildFromMatrixWS(ws2D,"Q3D","Direct",other_dim_names)); - - TSM_ASSERT_EQUALS("Inelastic workspace will produce 4 dimensions",4,TWS.nDimensions()); - std::vector<std::string> dim_units = TWS.getDimUnits(); - TSM_ASSERT_EQUALS("Last dimension of Inelastic transformation should be DeltaE","DeltaE",dim_units[3]); - TSM_ASSERT_EQUALS("Alg ID would be: ","Q3D",TWS.AlgID); - TSM_ASSERT("detector infromation should be present in the workspace ",!TWS.isDetInfoLost()); - - TS_ASSERT_THROWS_NOTHING(TWS.buildFromMatrixWS(ws2D,TWS.AlgID,"Indirect",other_dim_names)); - - - - //std::vector<std::string> dimID= TWS.getDefaultDimIDQ3D(1); - //for(size_t i=0;i<4;i++) - //{ - // TS_ASSERT_EQUALS(dimID[i],TWS.dimIDs[i]); - // TS_ASSERT_EQUALS(dimID[i],TWS.dimNames[i]); - //} - - -} - -//void testGetWSDimNames2AxisNoQ() -//{ -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// MDEvents::MDWSDescription TWS; -// -// API::NumericAxis *pAx = new API::NumericAxis(3); -// pAx->title() = "Dim1"; -// pAx->setUnit("dSpacing"); -// ws2D->replaceAxis(0,pAx); -// -// pAx = new API::NumericAxis(3); -// pAx->title() = "Dim2"; -// pAx->setUnit("QSquared"); -// ws2D->replaceAxis(1,pAx); -// -// std::vector<std::string> dim_units; -// std::string AlgID; -// ConvertToMDEventsParams params; -// -// TS_ASSERT_THROWS_NOTHING(AlgID=params.identifyMatrixAlg(ws2D,"CopyToMD","NoDE",dim_units,TWS)); -// -// TS_ASSERT_EQUALS(2,dim_units.size()); -// TS_ASSERT_EQUALS("dSpacing",dim_units[0]); -// TS_ASSERT_EQUALS("QSquared",dim_units[1]); -// -// TSM_ASSERT("Det info should be undefined an an numeric axis is along axis 2",TWS.detInfoLost); -// -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,AlgID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("This NoQ workspace will produce 2 dimensions",2,TWS.nDims); -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// TS_ASSERT_EQUALS("Dim1",TWS.dimIDs[0]); -// TS_ASSERT_EQUALS("Dim2",TWS.dimIDs[1]); -// TS_ASSERT_EQUALS("Dim1",TWS.dimNames[0]); -// TS_ASSERT_EQUALS("Dim2",TWS.dimNames[1]); -// -//} -/////------------------------------------------------------------------ -// -//void testIdentifyMatrixAlg_1() -//{ -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// MDEvents::MDWSDescription TWS; -// -// std::vector<std::string> ws_dim_names(2); -// std::vector<std::string> dim_names,dim_units; -// ws_dim_names[0]="A"; -// ws_dim_names[1]="B"; -// -// API::NumericAxis *pAx = new API::NumericAxis(3); -// pAx->title() = ws_dim_names[0]; -// pAx->setUnit("dSpacing"); -// ws2D->replaceAxis(0,pAx); -// pAx = new API::NumericAxis(3); -// pAx->title() = ws_dim_names[1]; -// pAx->setUnit("QSquared"); -// ws2D->replaceAxis(1,pAx); -// ConvertToMDEventsParams params; -// std::string Alg_ID; -// -// TS_ASSERT_THROWS_NOTHING(Alg_ID=params.identifyMatrixAlg(ws2D,"CopyToMD","NoDE",dim_units,TWS)); -// TS_ASSERT_EQUALS("WS2DHistoCopyToMDNoDECnvNo",Alg_ID); -// TSM_ASSERT("Det info should be undefined an an numeric axis is along axis 2",TWS.detInfoLost); -// -// // -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,Alg_ID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("This NoQ workspace should produce 2 dimensions",2,TWS.nDims); -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// for(size_t i=0;i<TWS.dimNames.size();i++) -// { -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimIDs[i]); -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimNames[i]); -// } -// -// -// -//} -// -// -//void testIdentifyMatrixAlg_2() -//{ -// ConvertToMDEventsParams params; -// -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// std::vector<std::string> dim_names,dim_units; -// MDEvents::MDWSDescription TWS; -// -// API::NumericAxis * -// pAx = new API::NumericAxis(3); -// pAx->setUnit("TOF"); -// ws2D->replaceAxis(0,pAx); -// -// TSM_ASSERT_THROWS_NOTHING("Elastic conversion needs X-axis to be in an Energy-related units",params.identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_units,TWS)); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// pAx = new API::NumericAxis(3); -// pAx->setUnit("Wavelength"); -// ws2D->replaceAxis(0,pAx); -// // This is probably bug in conversion --> does not work in elastic mode -// TSM_ASSERT_THROWS_NOTHING("Elastic conversion needs X-axis to be in an Energy-related units",params.identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_units,TWS)); -// //TSM_ASSERT_THROWS("Can not convert wavelength to momentum transfer in elastic mode ",pAlg->identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_names,dim_units),std::invalid_argument); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// pAx = new API::NumericAxis(3); -// pAx->setUnit("Energy"); -// ws2D->replaceAxis(0,pAx); -// // This is probably bug in conversion --> does not work in elastic mode -// TSM_ASSERT_THROWS_NOTHING("Elastic conversion needs X-axis to be in an Energy-related units",params.identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_units,TWS)); -// // TSM_ASSERT_THROWS("Can not convert Energy to momentum transfer in elastic mode ",pAlg->identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_names,dim_units),std::invalid_argument); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// pAx = new API::NumericAxis(3); -// pAx->setUnit("dSpacing"); -// ws2D->replaceAxis(0,pAx); -// TSM_ASSERT_THROWS_NOTHING("Elastic conversion needs X-axis to be in an Energy-related units",params.identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_units,TWS)); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// pAx = new API::NumericAxis(3); -// pAx->setUnit("TOF"); -// ws2D->replaceAxis(0,pAx); -// -// std::string Alg_ID; -// TS_ASSERT_THROWS_NOTHING(Alg_ID=params.identifyMatrixAlg(ws2D,"|Q|","Elastic",dim_units,TWS)); -// TS_ASSERT_EQUALS("WS2DHisto|Q|PowdElasticCnvFromTOF",Alg_ID); -// -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// -// // -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,Alg_ID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("This ModQ workspace should produce 1 dimensions",1,TWS.nDims); -// -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// std::vector<std::string> ws_dim_names = TWS.getDefaultDimIDModQ(0); -// for(size_t i=0;i<TWS.dimNames.size();i++) -// { -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimIDs[i]); -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimNames[i]); -// } -// -//} -// -//void testIdentifyMatrixAlg_3() -//{ -// ConvertToMDEventsParams params; -// -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// std::vector<std::string> dim_names,dim_units; -// MDEvents::MDWSDescription TWS; -// -// API::NumericAxis *pAx = new API::NumericAxis(3); -// pAx->title()="A"; -// pAx->setUnit("DeltaE"); -// ws2D->replaceAxis(0,pAx); -// -// std::string Alg_ID; -// TS_ASSERT_THROWS_NOTHING(Alg_ID=params.identifyMatrixAlg(ws2D,"|Q|","Direct",dim_units,TWS)); -// -// -// TS_ASSERT_EQUALS("WS2DHisto|Q|PowdDirectCnvNo",Alg_ID); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// // Dim ID &Names -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,Alg_ID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("Inelastic ModQ workspace should produce 2 dimensions",2,TWS.nDims); -// -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// std::vector<std::string> ws_dim_names = TWS.getDefaultDimIDModQ(2); -// for(size_t i=0;i<TWS.dimNames.size();i++) -// { -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimIDs[i]); -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimNames[i]); -// } -// -//} -// -//void testIdentifyMatrixAlg_4() -//{ -// ConvertToMDEventsParams params; -// -// std::vector<std::string> dim_names,dim_units; -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// MDEvents::MDWSDescription TWS; -// -// -// API::NumericAxis *pAx = new API::NumericAxis(3); -// pAx->title()="A"; -// pAx->setUnit("DeltaE"); -// ws2D->replaceAxis(0,pAx); -// -// std::string Alg_ID; -// TS_ASSERT_THROWS_NOTHING(Alg_ID=params.identifyMatrixAlg(ws2D,"|Q|","Indirect",dim_units,TWS)); -// -// -// TS_ASSERT_EQUALS("WS2DHisto|Q|PowdIndirectCnvNo",Alg_ID); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// // Dim ID &Names -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,Alg_ID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("Inelastic ModQ workspace should produce 2 dimensions",2,TWS.nDims); -// -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// std::vector<std::string> ws_dim_names = TWS.getDefaultDimIDModQ(2); -// for(size_t i=0;i<TWS.dimNames.size();i++) -// { -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimIDs[i]); -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimNames[i]); -// } -// -//} -//void testIdentifyMatrixAlg_5() -//{ -// ConvertToMDEventsParams params; -// -// std::vector<std::string> dim_names,dim_units; -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// MDEvents::MDWSDescription TWS; -// -// API::NumericAxis *pAx = new API::NumericAxis(3); -// pAx->title()="A"; -// pAx->setUnit("DeltaE"); -// ws2D->replaceAxis(0,pAx); -// -// std::string Alg_ID; -// TS_ASSERT_THROWS_NOTHING(Alg_ID=params.identifyMatrixAlg(ws2D,"Q3D","Indirect",dim_units,TWS)); -// -// TS_ASSERT_EQUALS("WS2DHistoQ3DPowdIndirectCnvNo",Alg_ID); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// -// // Dim ID &Names -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,Alg_ID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("Inelastic Q3D workspace should produce 4 dimensions",4,TWS.nDims); -// -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// std::vector<std::string> ws_dim_names = TWS.getDefaultDimIDQ3D(2); -// for(size_t i=0;i<TWS.dimNames.size();i++) -// { -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimIDs[i]); -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimNames[i]); -// } -// -//} -//void testIdentifyMatrixAlg_LatticeSet() -//{ -// ConvertToMDEventsParams params; -// -// std::vector<std::string> dim_names,dim_units; -// Mantid::API::MatrixWorkspace_sptr ws2D =WorkspaceCreationHelper::Create2DWorkspace(4,10); -// ws2D->mutableSample().setOrientedLattice(new Mantid::Geometry::OrientedLattice()); -// -// MDEvents::MDWSDescription TWS; -// -// API::NumericAxis *pAx = new API::NumericAxis(3); -// pAx->title()="A"; -// pAx->setUnit("DeltaE"); -// ws2D->replaceAxis(0,pAx); -// -// std::string Alg_ID; -// TS_ASSERT_THROWS_NOTHING(Alg_ID=params.identifyMatrixAlg(ws2D,"Q3D","Indirect",dim_units,TWS)); -// -// TS_ASSERT_EQUALS("WS2DHistoQ3DCrystIndirectCnvNo",Alg_ID); -// TSM_ASSERT("Det info should be defined for conversion",!TWS.detInfoLost); -// -// // Dim ID &Names -// std::vector<std::string> other_dim_names; -// TS_ASSERT_THROWS_NOTHING(params.buildMDDimDescription(ws2D,Alg_ID,other_dim_names,TWS)); -// TSM_ASSERT_EQUALS("Inelastic Q3D workspace should produce 4 dimensions",4,TWS.nDims); -// -// TS_ASSERT_EQUALS(TWS.dimIDs.size(),TWS.dimNames.size()); -// -// std::vector<std::string> ws_dim_names = TWS.getDefaultDimIDQ3D(1); -// for(size_t i=0;i<TWS.dimNames.size();i++) -// { -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimIDs[i]); -// TS_ASSERT_EQUALS(ws_dim_names[i],TWS.dimNames[i]); -// } -// -//} - - -}; - -// -#endif diff --git a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsSubalgFactoryTest.h b/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsSubalgFactoryTest.h deleted file mode 100644 index 64d2184160b19464c7e3dd11929740cb7de30b87..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsSubalgFactoryTest.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef MANTID_MD_CONVERT2_MDEV_SUBALGFACTORY_TEST_H_ -#define MANTID_MD_CONVERT2_MDEV_SUBALGFACTORY_TEST_H_ - -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidKernel/System.h" -#include "MantidAPI/FrameworkManager.h" -#include "MantidMDEvents/MDTransfFactory.h" -#include <cxxtest/TestSuite.h> -#include <iomanip> -#include <iostream> - -#include "MantidMDEvents/MDTransfNoQ.h" -#include "MantidMDEvents/MDTransfModQ.h" -#include "MantidMDEvents/MDTransfQ3D.h" - - -using namespace Mantid; -using namespace Mantid::MDEvents; - - -// -class ConvertToMDEventsSubalgFactoryTest : public CxxTest::TestSuite -{ -public: -static ConvertToMDEventsSubalgFactoryTest *createSuite() { return new ConvertToMDEventsSubalgFactoryTest(); } -static void destroySuite(ConvertToMDEventsSubalgFactoryTest * suite) { delete suite; } - -void testInit() -{ - std::vector<std::string> keys; - - TS_ASSERT_THROWS_NOTHING(keys = MDTransfFactory::Instance().getKeys()); - // we already have three transformation defined. It can be only more in a future; - TS_ASSERT(keys.size()>2); -} - -void testWrongAlgThrows() -{ - TS_ASSERT_THROWS(MDTransfFactory::Instance().create("Non_existing_subalgorithm"),Kernel::Exception::NotFoundError); -} - -void testGetAlg() -{ - MDTransf_sptr transf; - - TS_ASSERT_THROWS_NOTHING(transf=MDTransfFactory::Instance().create("CopyToMD")); - TS_ASSERT(dynamic_cast<MDTransfNoQ *>(transf.get())); - - TS_ASSERT_THROWS_NOTHING(transf=MDTransfFactory::Instance().create("|Q|")); - TS_ASSERT(dynamic_cast<MDTransfModQ *>(transf.get())); - - TS_ASSERT_THROWS_NOTHING(transf=MDTransfFactory::Instance().create("Q3D")); - TS_ASSERT(dynamic_cast<MDTransfQ3D *>(transf.get())); - -} - -// -ConvertToMDEventsSubalgFactoryTest() -{ - API::FrameworkManager::Instance(); -} - -}; - - -#endif /* MANTID_MD_CONVERT2_MDEV_SUBALGFACTORY_TEST_H_ */ - diff --git a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsUnitsConvTest.h b/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsUnitsConvTest.h deleted file mode 100644 index 3f19d67b1358be7846700876fcbed164696a19b0..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsUnitsConvTest.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef CONVERT2_MDEVENTS_UNITS_CONVERSION_TEST_H_ -#define CONVERT2_MDEVENTS_UNITS_CONVERSION_TEST_H_ - -#include <cxxtest/TestSuite.h> -#include "MantidAPI/FrameworkManager.h" -#include "MantidKernel/UnitFactory.h" - -#include "MantidAPI/NumericAxis.h" -#include "MantidMDEvents/ConvToMDPreprocDet.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidAPI/Progress.h" - -#include "MantidMDEvents/UnitsConversionHelper.h" -#include "MantidMDEvents/MDWSDescription.h" - -using namespace Mantid; -using namespace Mantid::API; -using namespace Mantid::Geometry; -using namespace Mantid::MDEvents; - - - -class ConvertToMDEventsUnitsConvTest : public CxxTest::TestSuite -{ - Mantid::API::MatrixWorkspace_sptr ws2D; - ConvToMDPreprocDet det_loc; - -public: -static ConvertToMDEventsUnitsConvTest *createSuite() { - return new ConvertToMDEventsUnitsConvTest(); -} -static void destroySuite(ConvertToMDEventsUnitsConvTest * suite) { delete suite; } - -void testSpecialConversionTOF() -{ - double factor,power; - - const Kernel::Unit_sptr pThisUnit=Kernel::UnitFactory::Instance().create("Wavelength"); - TS_ASSERT(!pThisUnit->quickConversion("MomentumTransfer",factor,power)); -} - -void testTOFConversionRuns() -{ - - Kernel::Unit_sptr pSourceWSUnit = Kernel::UnitFactory::Instance().create("Wavelength"); - Kernel::Unit_sptr pWSUnit = Kernel::UnitFactory::Instance().create("MomentumTransfer"); - double delta; - double L1(10),L2(10),TwoTheta(0.1),efix(10); - int emode(0); - TS_ASSERT_THROWS_NOTHING(pWSUnit->initialize(L1,L2,TwoTheta,emode,efix,delta)); - TS_ASSERT_THROWS_NOTHING(pSourceWSUnit->initialize(L1,L2,TwoTheta,emode,efix,delta)); - - double X0(5); - double tof(0) ,k_tr(0); - TS_ASSERT_THROWS_NOTHING(tof = pSourceWSUnit->singleToTOF(X0)); - TS_ASSERT_THROWS_NOTHING(k_tr = pWSUnit->singleFromTOF(tof)); -} - - - -void testConvertFastFromInelasticWS() -{ - UnitsConversionHelper Conv; - MDWSDescription WSD; - - // ws description currently needs min/max to be set properly - std::vector<double> min(2,-10),max(2,10); - WSD.setMinMax(min,max); - - WSD.buildFromMatrixWS(ws2D,"|Q|","Direct"); - WSD.setDetectors(det_loc); - - - // initialize peculiar conversion from ws units to DeltaE_inWavenumber - TS_ASSERT_THROWS_NOTHING(Conv.initialize(WSD,"DeltaE_inWavenumber")); - - const MantidVec& X = ws2D->readX(0); - size_t n_bins = X.size()-1; - for(size_t i=0;i<n_bins;i++){ - TS_ASSERT_DELTA(X[i]*8.06554465,Conv.convertUnits(X[i]),1.e-4); - } - -} -void testConvertToTofInelasticWS() -{ - UnitsConversionHelper Conv; - MDWSDescription WSD; - - // ws description currently needs min/max to be set properly - std::vector<double> min(2,-10),max(2,10); - WSD.setMinMax(min,max); - - WSD.buildFromMatrixWS(ws2D,"|Q|","Direct"); - WSD.setDetectors(det_loc); - - // initalize Convert to TOF - TS_ASSERT_THROWS_NOTHING(Conv.initialize(WSD,"TOF")); - - - const MantidVec& X = ws2D->readX(0); - MantidVec E_storage(X.size()); - TS_ASSERT_THROWS_NOTHING(Conv.updateConversion(0)); - - size_t n_bins = X.size(); - std::vector<double> TOFS(n_bins); - for(size_t i=0;i<n_bins;i++){ - E_storage[i]=X[i]; - TOFS[i] =Conv.convertUnits(X[i]); - } - - // Let WS know that it is in TOF now (one column) - MantidVec& T = ws2D->dataX(0); - - NumericAxis *pAxis0 = new NumericAxis(n_bins-1); - for(size_t i=0; i < n_bins-1; i++){ - double Tm =0.5*(TOFS[i]+TOFS[i+1]); - pAxis0->setValue(i,Tm); - T[i]=TOFS[i]; - } - T[n_bins-1]=TOFS[n_bins-1]; - - pAxis0->setUnit("TOF"); - ws2D->replaceAxis(0,pAxis0); - - // initialize matrix ws description, to the same number of dimensions as before - WSD.buildFromMatrixWS(ws2D,"|Q|","Direct"); - - //initialize Convert back; - TS_ASSERT_THROWS_NOTHING(Conv.initialize(WSD,"DeltaE")); - TS_ASSERT_THROWS_NOTHING(Conv.updateConversion(0)); - - for(size_t i=0;i<n_bins;i++){ - TS_ASSERT_DELTA(E_storage[i],Conv.convertUnits(TOFS[i]),1.e-5); - } -} - - -ConvertToMDEventsUnitsConvTest () -{ - - API::FrameworkManager::Instance(); - - std::vector<double> L2(5,5); - std::vector<double> polar(5,(30./180.)*3.1415926); - polar[0]=0; - std::vector<double> azimutal(5,0); - azimutal[1]=(45./180.)*3.1415936; - azimutal[2]=(90./180.)*3.1415936; - azimutal[3]=(135./180.)*3.1415936; - azimutal[4]=(180./180.)*3.1415936; - - int numBins=10; - ws2D =WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar, azimutal,numBins,-1,3,3); - - det_loc.buildFakeDetectorsPositions(ws2D); - - -} -}; -#endif diff --git a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsWSTest.h b/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsWSTest.h deleted file mode 100644 index 0b07c1dc5f3d9f972b09c06df675045f01586c93..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/MDEvents/test/ConvertToMDEventsWSTest.h +++ /dev/null @@ -1,323 +0,0 @@ -#ifndef CONVERT2_MDEVENTS_METHODS_TEST_H_ -#define CONVERT2_MDEVENTS_METHODS_TEST_H_ - -#include <cxxtest/TestSuite.h> - -#include "MantidKernel/UnitFactory.h" -#include "MantidTestHelpers/WorkspaceCreationHelper.h" -#include "MantidAPI/Progress.h" -#include "MantidAPI/FrameworkManager.h" - -#include "MantidMDEvents/MDBoxIterator.h" - -// stuff for convertToEventWorkspace subalgorithm -#include "MantidDataObjects/Events.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidDataObjects/EventWorkspace.h" - -// -#include "MantidMDEvents/MDEventWorkspace.h" -#include "MantidMDEvents/MDBoxBase.h" -#include "MantidMDEvents/ConvToMDBase.h" -#include "MantidMDEvents/ConvToMDSelector.h" -#include "MantidMDEvents/ConvToMDPreprocDet.h" - - -using namespace Mantid; -using namespace Mantid::API; -using namespace Mantid::Geometry; -using namespace Mantid::DataObjects; -using namespace Mantid::MDEvents; - - - -class ConvertToMDEventsWSTest : public CxxTest::TestSuite -{ - // matrix ws and event ws which contains the same data - Mantid::API::MatrixWorkspace_sptr ws2D; - Mantid::API::MatrixWorkspace_sptr ws_events; - - // MD ws obtained from histo and MD ws obtained from events, which should be again similar - boost::shared_ptr<MDEvents::MDEventWSWrapper> pHistoMDWSWrapper; - boost::shared_ptr<MDEvents::MDEventWSWrapper> pEventMDWSWrapper; - - // preprocessed detectors positions and target ws description - ConvToMDPreprocDet det_loc; - MDEvents::MDWSDescription TestWS; - - std::auto_ptr<ConvToMDBase> pConvMethods; - - // class which would select the solver as function of ws type - ConvToMDSelector WSAlgoSelector; - - // the helper claa which woudl provide log and progress --> algorithm's properties - WorkspaceCreationHelper::MockAlgorithm logProvider; - -public: -static ConvertToMDEventsWSTest *createSuite() { - return new ConvertToMDEventsWSTest(); -} -static void destroySuite(ConvertToMDEventsWSTest * suite) { delete suite; } - -void test_PreprocessDetectors() -{ - TS_ASSERT_THROWS_NOTHING(det_loc.processDetectorsPositions(ws2D,logProvider.getLogger(),logProvider.getProgress())); - -} - -void test_TwoTransfMethods() -{ - - // define the parameters of the conversion - std::vector<std::string> dimProperyNames; //--- empty property names - TS_ASSERT_THROWS_NOTHING(TestWS.buildFromMatrixWS(ws2D,"Q3D","Direct",dimProperyNames)); - TS_ASSERT_THROWS_NOTHING(TestWS.setDetectors(det_loc)); - - std::vector<double> dimMin(4,-3); - std::vector<double> dimMax(4, 3); - TS_ASSERT_THROWS_NOTHING(TestWS.setMinMax(dimMin,dimMax)); - - // define transformation - TestWS.rotMatrix.assign(9,0); - TestWS.rotMatrix[0]=1; - TestWS.rotMatrix[4]=1; - TestWS.rotMatrix[8]=1; - - // create target md workspace - pHistoMDWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); - pHistoMDWSWrapper->createEmptyMDWS(TestWS); - - Mantid::API::BoxController_sptr bc=pHistoMDWSWrapper->pWorkspace()->getBoxController(); - bc->setSplitThreshold(5); - bc->setMaxDepth(100); - bc->setSplitInto(5); - - // initialize solver converting from Matrix ws to md ws - boost::shared_ptr<ConvToMDBase> pSolver; - TS_ASSERT_THROWS_NOTHING(pSolver = WSAlgoSelector.convSelector(ws2D,pSolver)); - TS_ASSERT_THROWS_NOTHING(pSolver->initialize(TestWS,pHistoMDWSWrapper)); - - logProvider.resetProgress(4); - TS_ASSERT_THROWS_NOTHING(pSolver->runConversion(logProvider.getProgress())); - - TS_ASSERT_EQUALS(50,pHistoMDWSWrapper->pWorkspace()->getNPoints()); - -} -void test_buildFromEWS() -{ - // create empty target ws - pEventMDWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); - pEventMDWSWrapper->createEmptyMDWS(TestWS); - // convert initial matrix ws into event ws - DataObjects::Workspace2D_const_sptr inWS = boost::static_pointer_cast<const DataObjects::Workspace2D>(ws2D); - EventWorkspace_sptr outWS = convertToEvents(inWS); - - // build ws description from event ws - std::vector<std::string> dimProperyNames; //--- empty property names - TS_ASSERT_THROWS_NOTHING(TestWS.buildFromMatrixWS(outWS,"Q3D","Direct",dimProperyNames)); - - ws_events =boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>(outWS); - if (!ws_events){ - throw std::runtime_error("Error in ConvertToEventWorkspace. Cannot proceed."); - } - - // create target md workspace wrapper - pEventMDWSWrapper = boost::shared_ptr<MDEvents::MDEventWSWrapper>(new MDEvents::MDEventWSWrapper()); - pEventMDWSWrapper->createEmptyMDWS(TestWS); - - Mantid::API::BoxController_sptr bc=pEventMDWSWrapper->pWorkspace()->getBoxController(); - bc->setSplitThreshold(5); - bc->setMaxDepth(100); - bc->setSplitInto(5); - - // initialize solver converting from Event ws to md ws - boost::shared_ptr<ConvToMDBase> pTOFConv; - TS_ASSERT_THROWS_NOTHING(pTOFConv = WSAlgoSelector.convSelector(outWS)); - TS_ASSERT_THROWS_NOTHING(pTOFConv->initialize(TestWS,pEventMDWSWrapper)); - - logProvider.resetProgress(4); - TS_ASSERT_THROWS_NOTHING(pTOFConv->runConversion(logProvider.getProgress())); - TS_ASSERT_EQUALS(50,pEventMDWSWrapper->pWorkspace()->getNPoints()); - - -} - -void test_compareTwoConversions() -{ - - MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> * pMatrWs = dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> *>(this->pHistoMDWSWrapper->pWorkspace().get()); - MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> * pEvntWs = dynamic_cast<MDEvents::MDEventWorkspace<MDEvents::MDEvent<4>,4> *>(this->pEventMDWSWrapper->pWorkspace().get()); - if(!pMatrWs){ - TS_FAIL(" can not retrieve workspace obtained from matrix WS"); - return; - } - if(!pEvntWs){ - TS_FAIL(" can not retrieve workspace obtained from event WS"); - return; - } - // Get all the MDBoxes contained - //MDBoxBase<MDE,nd> * parentBox = ws->getBox(); - //std::vector<MDBoxBase<MDE,nd> *> boxes; - //parentBox->getBoxes(boxes, 1000, true); - - MDBoxBase<MDEvent<4> ,4> * parentBox = pMatrWs->getBox(); - std::vector<MDBoxBase<MDEvent<4>,4> *> boxesM; - parentBox->getBoxes(boxesM, 1000, true); - - parentBox = pEvntWs->getBox(); - std::vector<MDBoxBase<MDEvent<4>,4> *> boxesE; - parentBox->getBoxes(boxesE, 1000, true); - - - for (size_t i=0; i<boxesM.size(); i++){ - MDBox<MDEvent<4>,4> * boxM = dynamic_cast<MDBox<MDEvent<4>,4> *>(boxesM[i]); - if (boxM){ - MDBox<MDEvent<4>,4> * boxE = dynamic_cast<MDBox<MDEvent<4>,4> *>(boxesE[i]); - - std::vector<MDEvent<4> > & eventsM = boxM->getEvents(); - std::vector<MDEvent<4> > & eventsE = boxE->getEvents(); - if(eventsM.size()!=eventsE.size()) - { - TS_FAIL(" sizes of the boxes, obtained from matrix workspace="+boost::lexical_cast<std::string>(eventsM.size())+" and from event worskpace="+boost::lexical_cast<std::string>(eventsE.size())+" and are different"); - return; - } - - - std::vector<MDEvent<4> >::iterator itM = eventsM.begin(); - std::vector<MDEvent<4> >::iterator itE = eventsE.begin(); - std::vector<MDEvent<4> >::iterator it_end = eventsM.end(); - - for (; itM != it_end; itM++){ - - float Signal1 = itM->getSignal(); - float Signal2 = itE->getSignal(); - TS_ASSERT_DELTA(Signal1,Signal2,1.e-5); - float Err1 = itM->getErrorSquared(); - float Err2 = itE->getErrorSquared(); - TS_ASSERT_DELTA(Err1,Err2,1.e-5); - - for(size_t j=0;i<4;i++){ - TS_ASSERT_DELTA(itM->getCenter(j),itE->getCenter(j),1.e-4); - } - TS_ASSERT_EQUALS(itM->getDetectorID(),itE->getDetectorID()); - TS_ASSERT_EQUALS(itM->getRunIndex(),itE->getRunIndex()); - itE++; - } - boxE->releaseEvents(); - boxM->releaseEvents(); - } - } - -} - -// constructor: -ConvertToMDEventsWSTest (): -TestWS(4), -logProvider(100) -{ - API::FrameworkManager::Instance(); - - std::vector<double> L2(5,5); - std::vector<double> polar(5,(30./180.)*3.1415926); - polar[0]=0; - std::vector<double> azimutal(5,0); - azimutal[1]=(45./180.)*3.1415936; - azimutal[2]=(90./180.)*3.1415936; - azimutal[3]=(135./180.)*3.1415936; - azimutal[4]=(180./180.)*3.1415936; - - int numBins=10; - ws2D =WorkspaceCreationHelper::createProcessedInelasticWS(L2, polar, azimutal,numBins,-1,3,3); - - - -} -// function repeats convert to events algorithm which for some mysterious reasons do not work here as subalgorithm. -EventWorkspace_sptr convertToEvents(DataObjects::Workspace2D_const_sptr inWS) -{ - - // set up conversion to Time of flight - UnitsConversionHelper TOFCONV; - - TOFCONV.initialize(TestWS,"TOF"); - - //Create the event workspace - EventWorkspace_sptr outWS = boost::dynamic_pointer_cast<EventWorkspace>( - API::WorkspaceFactory::Instance().create("EventWorkspace", inWS->getNumberHistograms(), inWS->blocksize()+1, inWS->blocksize())); - - //Copy geometry, etc. over. - API::WorkspaceFactory::Instance().initializeFromParent(inWS, outWS, false); - - // Cached values for later checks - double inf = std::numeric_limits<double>::infinity(); - double ninf = -inf; - - logProvider.resetProgress(inWS->getNumberHistograms()); - Progress *prog = logProvider.getProgress(); - //PARALLEL_FOR1(inWS) - for (int iwi=0; iwi<int(inWS->getNumberHistograms()); iwi++) - { - //PARALLEL_START_INTERUPT_REGION - size_t wi = size_t(iwi); - // The input spectrum (a histogram) - const ISpectrum * inSpec = inWS->getSpectrum(wi); - const MantidVec & X = inSpec->readX(); - const MantidVec & Y = inSpec->readY(); - const MantidVec & E = inSpec->readE(); - - TOFCONV.updateConversion(iwi); - - // The output event list - EventList & el = outWS->getEventList(wi); - // Copy detector IDs and spectra - el.copyInfoFrom( *inSpec ); - // We need weights but have no way to set the time. So use weighted, no time - el.switchTo(WEIGHTED_NOTIME); - - for (size_t i=0; i<X.size()-1; i++) - { - double weight = Y[i]; - if ((weight != 0.0) && (weight == weight) /*NAN check*/ - && (weight != inf) && (weight != ninf)) - { - double error = E[i]; - // Also check that the error is not a bad number - if ((error == error) /*NAN check*/ - && (error != inf) && (error != ninf)) - { - // --------- Single event per bin ---------- - // TOF = midpoint of the bin - double tof = (X[i] + X[i+1]) / 2.0; - // Error squared is carried in the event - double errorSquared = E[i]; - errorSquared *= errorSquared; - // Create and add the event - el.addEventQuickly( WeightedEventNoTime(TOFCONV.convertUnits(tof), weight, errorSquared) ); - - } // error is nont NAN or infinite - } // weight is non-zero, not NAN, and non-infinite - } // (each bin) - - // Set the X binning parameters - el.setX( inSpec->ptrX() ); - // Manually set that this is sorted by TOF, since it is. This will make it "threadSafe" in other algos. - el.setSortOrder( TOF_SORT ); - - prog->report("Converting"); - // PARALLEL_END_INTERUPT_REGION - } - // PARALLEL_CHECK_INTERUPT_REGION - NumericAxis *pAxis0 = new NumericAxis(2); - pAxis0->setUnit("TOF"); - outWS->replaceAxis(0,pAxis0); - - return outWS; - // Set the output - //setProperty("OutputWorkspace", outWS); -} - -}; - - - -#endif \ No newline at end of file