Skip to content

Commit

Permalink
Refs #8506. Renamed algorithm.
Browse files Browse the repository at this point in the history
It was decided to move loading part out of it.
  • Loading branch information
arturbekasov committed Nov 27, 2013
1 parent b1717fb commit 425cbef
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ namespace Mantid
fn << fnBase << fnn.str() << ext;

// Load a muon nexus file with auto_group set to true
IAlgorithm_sptr loadAlg = createChildAlgorithm("MuonLoadCorrected");
IAlgorithm_sptr loadAlg = createChildAlgorithm("MuonApplyDTC");
loadAlg->initialize();
loadAlg->setPropertyValue("Filename", fn.str());
loadAlg->setPropertyValue("DtcType", getPropertyValue("DeadTimeCorrType"));
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/WorkflowAlgorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set ( SRC_FILES
src/HFIRInstrument.cpp
src/HFIRLoad.cpp
src/HFIRSANSNormalise.cpp
src/MuonLoadCorrected.cpp
src/MuonApplyDTC.cpp
src/RefReduction.cpp
src/RefRoi.cpp
src/SANSBeamFinder.cpp
Expand Down Expand Up @@ -55,7 +55,7 @@ set ( INC_FILES
inc/MantidWorkflowAlgorithms/HFIRInstrument.h
inc/MantidWorkflowAlgorithms/HFIRLoad.h
inc/MantidWorkflowAlgorithms/HFIRSANSNormalise.h
inc/MantidWorkflowAlgorithms/MuonLoadCorrected.h
inc/MantidWorkflowAlgorithms/MuonApplyDTC.h
inc/MantidWorkflowAlgorithms/RefReduction.h
inc/MantidWorkflowAlgorithms/RefRoi.h
inc/MantidWorkflowAlgorithms/SANSBeamFinder.h
Expand All @@ -69,7 +69,7 @@ set ( INC_FILES
)

set ( TEST_FILES
MuonLoadCorrectedTest.h
MuonApplyDTCTest.h
SANSSolidAngleCorrectionTest.h
StepScanTest.h
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTED_H_
#define MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTED_H_
#ifndef MANTID_WORKFLOWALGORITHMS_MUONAPPLYDTC_H_
#define MANTID_WORKFLOWALGORITHMS_MUONAPPLYDTC_H_

#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/TableWorkspace.h"
Expand All @@ -13,7 +13,7 @@ namespace WorkflowAlgorithms
using namespace API;
using namespace DataObjects;

/** MuonLoadCorrected : loads Muon data with Dead Time Correction applied.
/** MuonApplyDTC : Applies Dead Time Correction to Muon data.
Copyright &copy; 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand All @@ -35,11 +35,11 @@ namespace WorkflowAlgorithms
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
class DLLExport MuonApplyDTC : public API::Algorithm
{
public:
MuonLoadCorrected();
virtual ~MuonLoadCorrected();
MuonApplyDTC();
virtual ~MuonApplyDTC();

virtual const std::string name() const;
virtual int version() const;
Expand Down Expand Up @@ -70,4 +70,4 @@ namespace WorkflowAlgorithms
} // namespace WorkflowAlgorithms
} // namespace Mantid

#endif /* MANTID_WORKFLOWALGORITHMS_MUONLOADCORRECTED_H_ */
#endif /* MANTID_WORKFLOWALGORITHMS_MUONAPPLYDTC_H_ */
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*WIKI*
Load Muon data with Dead Time Correction applied. Part of the Muon workflow.
Applies Dead Time Correction to Muon data. Part of the Muon workflow.
*WIKI*/

#include "MantidWorkflowAlgorithms/MuonLoadCorrected.h"
#include "MantidWorkflowAlgorithms/MuonApplyDTC.h"

#include "MantidAPI/FileProperty.h"
#include "MantidAPI/TableRow.h"
Expand All @@ -19,50 +19,49 @@ namespace WorkflowAlgorithms
using namespace DataObjects;

// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(MuonLoadCorrected)
DECLARE_ALGORITHM(MuonApplyDTC)

//----------------------------------------------------------------------------------------------
/** Constructor
*/
MuonLoadCorrected::MuonLoadCorrected()
MuonApplyDTC::MuonApplyDTC()
{
}

//----------------------------------------------------------------------------------------------
/** Destructor
*/
MuonLoadCorrected::~MuonLoadCorrected()
MuonApplyDTC::~MuonApplyDTC()
{
}


//----------------------------------------------------------------------------------------------
/// Algorithm's name for identification. @see Algorithm::name
const std::string MuonLoadCorrected::name() const { return "MuonLoadCorrected";};
const std::string MuonApplyDTC::name() const { return "MuonApplyDTC";};

/// Algorithm's version for identification. @see Algorithm::version
int MuonLoadCorrected::version() const { return 1;};
int MuonApplyDTC::version() const { return 1;};

/// Algorithm's category for identification. @see Algorithm::category
const std::string MuonLoadCorrected::category() const { return "Workflow\\Muon";}
const std::string MuonApplyDTC::category() const { return "Workflow\\Muon";}

//----------------------------------------------------------------------------------------------
/// Sets documentation strings for this algorithm
void MuonLoadCorrected::initDocs()
void MuonApplyDTC::initDocs()
{
this->setWikiSummary("Loads Muon data with Dead Time Correction applied.");
this->setOptionalMessage("Loads Muon data with Dead Time Correction applied.");
this->setWikiSummary("Applies Dead Time Correction to Muon data.");
this->setOptionalMessage("Applies Dead Time Correction to Muon data.");
}

//----------------------------------------------------------------------------------------------
/**
* Initialize the algorithm's properties.
*/
void MuonLoadCorrected::init()
void MuonApplyDTC::init()
{
declareProperty(new FileProperty("Filename", "", FileProperty::Load, ".nxs"),
"The name of the Nexus file to load" );

"The name of the Nexus file to
std::vector<std::string> dtcTypes;
dtcTypes.push_back("None");
dtcTypes.push_back("FromRunData");
Expand All @@ -82,7 +81,7 @@ namespace WorkflowAlgorithms
/**
* Execute the algorithm.
*/
void MuonLoadCorrected::exec()
void MuonApplyDTC::exec()
{
const std::string filename = getPropertyValue("Filename");
Expand Down Expand Up @@ -124,7 +123,7 @@ namespace WorkflowAlgorithms
* @param numPeriods :: Number of data collection periods
* @return TableWorkspace when one period, otherwise a group of TableWorkspace-s with dead times
*/
Workspace_sptr MuonLoadCorrected::loadDeadTimesFromNexus(const std::string& filename)
Workspace_sptr MuonApplyDTC::loadDeadTimesFromNexus(const std::string& filename)
{
IAlgorithm_sptr loadNexusProc = createChildAlgorithm("LoadNexusProcessed");
loadNexusProc->setPropertyValue("Filename", filename);
Expand All @@ -139,7 +138,7 @@ namespace WorkflowAlgorithms
* @param dt :: Dead Times to use
* @return Corrected workspace
*/
Workspace_sptr MuonLoadCorrected::applyDtc(Workspace_sptr ws, Workspace_sptr dt)
Workspace_sptr MuonApplyDTC::applyDtc(Workspace_sptr ws, Workspace_sptr dt)
{
using namespace boost; // We will use it a lot
Expand Down Expand Up @@ -185,7 +184,7 @@ namespace WorkflowAlgorithms
* @param dtTable :: Dead Time Table
* @return Group of corrected workspaces
*/
WorkspaceGroup_sptr MuonLoadCorrected::applyDtcTableToGroup(WorkspaceGroup_sptr wsGroup,
WorkspaceGroup_sptr MuonApplyDTC::applyDtcTableToGroup(WorkspaceGroup_sptr wsGroup,
TableWorkspace_sptr dtTable)
{
WorkspaceGroup_sptr outputGroup = boost::make_shared<WorkspaceGroup>();
Expand All @@ -211,7 +210,7 @@ namespace WorkflowAlgorithms
* @param dtGroup :: Group of Dead Time Tables
* @return Group of corrected workspaces
*/
WorkspaceGroup_sptr MuonLoadCorrected::applyDtcGroupToGroup(WorkspaceGroup_sptr wsGroup,
WorkspaceGroup_sptr MuonApplyDTC::applyDtcGroupToGroup(WorkspaceGroup_sptr wsGroup,
WorkspaceGroup_sptr dtGroup)
{
if(dtGroup->size() != wsGroup->size())
Expand Down Expand Up @@ -246,7 +245,7 @@ namespace WorkflowAlgorithms
* @param dt :: Dead Times to use
* @return Corrected workspace
*/
MatrixWorkspace_sptr MuonLoadCorrected::runApplyDtc(MatrixWorkspace_sptr ws, TableWorkspace_sptr dt)
MatrixWorkspace_sptr MuonApplyDTC::runApplyDtc(MatrixWorkspace_sptr ws, TableWorkspace_sptr dt)
{
IAlgorithm_sptr applyDtc = createChildAlgorithm("ApplyDeadTimeCorr");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@

#include "MantidAPI/TableRow.h"
#include "MantidDataHandling/SaveNexus.h"
#include "MantidWorkflowAlgorithms/MuonLoadCorrected.h"
#include "MantidWorkflowAlgorithms/MuonApplyDTC.h"

using Mantid::WorkflowAlgorithms::MuonLoadCorrected;
using Mantid::WorkflowAlgorithms::MuonApplyDTC;

using namespace Mantid::API;
using namespace Mantid::DataHandling;
using namespace Mantid::Kernel;

class MuonLoadCorrectedTest : public CxxTest::TestSuite
class MuonApplyDTCTest : 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; }
static MuonApplyDTCTest *createSuite() { return new MuonApplyDTCTest(); }
static void destroySuite( MuonApplyDTCTest *suite ) { delete suite; }

// Name of the output workspace.
const std::string g_outWSName;

MuonLoadCorrectedTest() : g_outWSName("MuonLoadCorrectedTest_OutputWS")
MuonApplyDTCTest() : g_outWSName("MuonApplyDTCTest_OutputWS")
{}

~MuonLoadCorrectedTest()
~MuonApplyDTCTest()
{
AnalysisDataServiceImpl& ads = AnalysisDataService::Instance();

Expand All @@ -45,14 +45,14 @@ class MuonLoadCorrectedTest : public CxxTest::TestSuite

void test_init()
{
MuonLoadCorrected alg;
MuonApplyDTC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )
}

void test_properties()
{
MuonLoadCorrected alg;
MuonApplyDTC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )
TS_ASSERT( alg.existsProperty("Filename") )
Expand All @@ -63,7 +63,7 @@ class MuonLoadCorrectedTest : public CxxTest::TestSuite

void test_singlePeriod_noCorrection()
{
MuonLoadCorrected alg;
MuonApplyDTC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )

Expand Down Expand Up @@ -99,7 +99,7 @@ class MuonLoadCorrectedTest : public CxxTest::TestSuite

void test_singlePeriod_fromData()
{
MuonLoadCorrected alg;
MuonApplyDTC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )

Expand Down Expand Up @@ -139,7 +139,7 @@ class MuonLoadCorrectedTest : public CxxTest::TestSuite

createDeadTimesTableFile(filename, 0.15);

MuonLoadCorrected alg;
MuonApplyDTC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )

Expand Down Expand Up @@ -178,7 +178,7 @@ class MuonLoadCorrectedTest : public CxxTest::TestSuite

void test_multiPeriod()
{
MuonLoadCorrected alg;
MuonApplyDTC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )

Expand Down

0 comments on commit 425cbef

Please sign in to comment.