Skip to content

Commit

Permalink
Added one more output property. Refs #6526.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Oct 29, 2013
1 parent 1446b09 commit d8eabeb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/FilterEvents.cpp
Expand Up @@ -285,8 +285,9 @@ namespace Algorithms

// Generate one of the output workspaces & Copy geometry over. But we don't copy the data.
DataObjects::EventWorkspace_sptr optws = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(
API::WorkspaceFactory::Instance().create("EventWorkspace", m_eventWS->getNumberHistograms(), 2, 1));
API::WorkspaceFactory::Instance().create("EventWorkspace", m_eventWS->getNumberHistograms(), 2, 1));
API::WorkspaceFactory::Instance().initializeFromParent(m_eventWS, optws, false);
m_outputWS.insert(std::make_pair(wsgroup, optws));

// Add information, including title and comment, to output workspace
if (mWithInfo)
Expand Down Expand Up @@ -321,7 +322,6 @@ namespace Algorithms
propertyname << "OutputWorkspace_" << wsgroup;

// Inserted this pair to map
m_outputWS.insert(std::make_pair(wsgroup, optws));
m_wsNames.push_back(wsname.str());

// Set (property) to output workspace and set to ADS
Expand Down Expand Up @@ -453,7 +453,7 @@ namespace Algorithms
std::map<int, DataObjects::EventWorkspace_sptr>::iterator wsiter;

// Loop over the histograms (detector spectra) to do split from 1 event list to N event list
g_log.information() << "[FilterEvents F1206] Number of spectra = " << numberOfSpectra << ".\n";
g_log.debug() << "Number of spectra in input/source EventWorkspace = " << numberOfSpectra << ".\n";

// FIXME Make it parallel
// PARALLEL_FOR_NO_WSP_CHECK()
Expand Down
14 changes: 9 additions & 5 deletions Code/Mantid/Framework/Algorithms/test/FilterEventsTest.h
Expand Up @@ -38,7 +38,7 @@ class FilterEventsTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** Test initialization
*/
void Ptest_Initialization()
void test_Initialization()
{
FilterEvents alg;
alg.initialize();
Expand All @@ -55,7 +55,7 @@ class FilterEventsTest : public CxxTest::TestSuite
* (4) Within one pulse, two consecutive events/neutrons is apart for 10*1000*1000 seconds
* (5) "Experiment": 5 pulse times. 10 events in each pulse
*/
void Ptest_CreatedEventWorskpaceAndSplitter()
void test_CreatedEventWorskpaceAndSplitter()
{
int64_t runstart_i64 = 20000000000;
int64_t pulsedt = 100*1000*1000;
Expand Down Expand Up @@ -90,7 +90,7 @@ class FilterEventsTest : public CxxTest::TestSuite
* (1) Leave correction table workspace empty
* (2) Count events in each output including "-1", the excluded/unselected events
*/
void Ptest_FilterWOCorrection()
void test_FilterWOCorrection()
{
// 1. Create EventWorkspace and SplittersWorkspace
int64_t runstart_i64 = 20000000000;
Expand All @@ -117,6 +117,9 @@ class FilterEventsTest : public CxxTest::TestSuite
TS_ASSERT(filter.isExecuted());

// 4. Get output
int numsplittedws = filter.getProperty("NumberOutputWorkspace");
TS_ASSERT_EQUALS(numsplittedws, 4);

// 4.1 Workspace group 0
DataObjects::EventWorkspace_sptr filteredws0 = boost::dynamic_pointer_cast
<DataObjects::EventWorkspace>(AnalysisDataService::Instance().retrieve("FilteredWS01_0"));
Expand Down Expand Up @@ -150,6 +153,7 @@ class FilterEventsTest : public CxxTest::TestSuite
// 5. Clean up
AnalysisDataService::Instance().remove("Test02");
AnalysisDataService::Instance().remove("Splitter02");
AnalysisDataService::Instance().remove("FilteredWS01_unfiltered");
AnalysisDataService::Instance().remove("FilteredWS01_0");
AnalysisDataService::Instance().remove("FilteredWS01_1");
AnalysisDataService::Instance().remove("FilteredWS01_2");
Expand Down Expand Up @@ -199,7 +203,7 @@ class FilterEventsTest : public CxxTest::TestSuite

// Get output
int numsplittedws = filter.getProperty("NumberOutputWorkspace");
TS_ASSERT_EQUALS(numsplittedws, 0);
TS_ASSERT_EQUALS(numsplittedws, 3);

// 4.1 Workspace group 0
DataObjects::EventWorkspace_sptr filteredws0 = boost::dynamic_pointer_cast
Expand Down Expand Up @@ -244,7 +248,7 @@ class FilterEventsTest : public CxxTest::TestSuite
//----------------------------------------------------------------------------------------------
/** Filter test with TOF correction
*/
void Ptest_FilterWithCorrection()
void test_FilterWithCorrection()
{
// 1. Create EventWorkspace and SplittersWorkspace
int64_t runstart_i64 = 20000000000;
Expand Down

0 comments on commit d8eabeb

Please sign in to comment.