-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d41fe4
commit 0de0b86
Showing
4 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Code/Mantid/Framework/WorkflowAlgorithms/inc/MantidWorkflowAlgorithms/MuonLoadCorrected.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTED_H_ | ||
#define MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTED_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace WorkflowAlgorithms | ||
{ | ||
|
||
/** MuonLoadCorrected : loads Muon data with Dead Time Correction applied. | ||
Copyright © 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport MuonLoadCorrected : public API::Algorithm | ||
{ | ||
public: | ||
MuonLoadCorrected(); | ||
virtual ~MuonLoadCorrected(); | ||
|
||
virtual const std::string name() const; | ||
virtual int version() const; | ||
virtual const std::string category() const; | ||
|
||
private: | ||
virtual void initDocs(); | ||
void init(); | ||
void exec(); | ||
}; | ||
|
||
|
||
} // namespace WorkflowAlgorithms | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTED_H_ */ |
63 changes: 63 additions & 0 deletions
63
Code/Mantid/Framework/WorkflowAlgorithms/src/MuonLoadCorrected.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/*WIKI* | ||
TODO: Enter a full wiki-markup description of your algorithm here. You can then use the Build/wiki_maker.py script to generate your full wiki page. | ||
*WIKI*/ | ||
|
||
#include "MantidWorkflowAlgorithms/MuonLoadCorrected.h" | ||
|
||
namespace Mantid | ||
{ | ||
namespace WorkflowAlgorithms | ||
{ | ||
|
||
// Register the algorithm into the AlgorithmFactory | ||
DECLARE_ALGORITHM(MuonLoadCorrected) | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Constructor | ||
*/ | ||
MuonLoadCorrected::MuonLoadCorrected() | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Destructor | ||
*/ | ||
MuonLoadCorrected::~MuonLoadCorrected() | ||
{ | ||
} | ||
|
||
|
||
//---------------------------------------------------------------------------------------------- | ||
/// Algorithm's name for identification. @see Algorithm::name | ||
const std::string MuonLoadCorrected::name() const { return "MuonLoadCorrected";}; | ||
|
||
/// Algorithm's version for identification. @see Algorithm::version | ||
int MuonLoadCorrected::version() const { return 1;}; | ||
|
||
/// Algorithm's category for identification. @see Algorithm::category | ||
const std::string MuonLoadCorrected::category() const { return "Workflow\\Muon";} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/// Sets documentation strings for this algorithm | ||
void MuonLoadCorrected::initDocs() | ||
{ | ||
this->setWikiSummary("Loads Muon data with Dead Time Correction applied."); | ||
this->setOptionalMessage("Loads Muon data with Dead Time Correction applied."); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Initialize the algorithm's properties. | ||
*/ | ||
void MuonLoadCorrected::init() | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------- | ||
/** Execute the algorithm. | ||
*/ | ||
void MuonLoadCorrected::exec() | ||
{ | ||
} | ||
|
||
} // namespace WorkflowAlgorithms | ||
} // namespace Mantid |
76 changes: 76 additions & 0 deletions
76
Code/Mantid/Framework/WorkflowAlgorithms/test/MuonLoadCorrectedTest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTEDTEST_H_ | ||
#define MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTEDTEST_H_ | ||
|
||
#include <cxxtest/TestSuite.h> | ||
|
||
#include "MantidWorkflowAlgorithms/MuonLoadCorrected.h" | ||
|
||
using Mantid::WorkflowAlgorithms::MuonLoadCorrected; | ||
|
||
using namespace Mantid::Kernel; | ||
using namespace Mantid::API; | ||
|
||
class MuonLoadCorrectedTest : public CxxTest::TestSuite | ||
{ | ||
public: | ||
// This pair of boilerplate methods prevent the suite being created statically | ||
// This means the constructor isn't called when running other tests | ||
static MuonLoadCorrectedTest *createSuite() { return new MuonLoadCorrectedTest(); } | ||
static void destroySuite( MuonLoadCorrectedTest *suite ) { delete suite; } | ||
|
||
// Name of the output workspace. | ||
const std::string g_outWSName; | ||
|
||
MuonLoadCorrectedTest() : g_outWSName("MuonLoadCorrectedTest_OutputWS") | ||
{} | ||
|
||
~MuonLoadCorrectedTest() | ||
{ | ||
// Remove workspace from the data service if exists | ||
if ( AnalysisDataService::Instance().doesExist(g_outWSName) ) | ||
AnalysisDataService::Instance().remove(g_outWSName); | ||
} | ||
|
||
void test_init() | ||
{ | ||
MuonLoadCorrected alg; | ||
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) | ||
TS_ASSERT( alg.isInitialized() ) | ||
} | ||
|
||
void test_properties() | ||
{ | ||
MuonLoadCorrected alg; | ||
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) | ||
TS_ASSERT( alg.isInitialized() ) | ||
TS_ASSERT( alg.existsProperty("Filename") ) | ||
TS_ASSERT( alg.existsProperty("DTCType") ) | ||
TS_ASSERT( alg.existsProperty("DTCFile") ) | ||
TS_ASSERT( alg.existsProperty("OutputWorkspace") ) | ||
} | ||
|
||
void test_noCorrection() | ||
{ | ||
MuonLoadCorrected alg; | ||
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) | ||
TS_ASSERT( alg.isInitialized() ) | ||
|
||
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Filename", "MUSR00015189") ); | ||
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("DTCType", "None") ); | ||
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", g_outWSName) ); | ||
|
||
TS_ASSERT_THROWS_NOTHING( alg.execute(); ); | ||
TS_ASSERT( alg.isExecuted() ); | ||
|
||
// Retrieve the workspace from data service. TODO: Change to your desired type | ||
MatrixWorkspace_sptr ws; | ||
TS_ASSERT_THROWS_NOTHING( ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(g_outWSName) ); | ||
TS_ASSERT(ws); | ||
if (!ws) return; | ||
|
||
TSM_ASSERT( "You have forgot to check the results", 0); | ||
} | ||
}; | ||
|
||
|
||
#endif /* MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTEDTEST_H_ */ |