Skip to content

Commit

Permalink
Refs #5678. Fixes to get things working (not yet).
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Aug 2, 2012
1 parent f4c4a6e commit baffaee
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions Code/Mantid/Framework/WorkflowAlgorithms/src/DgsDiagnose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace WorkflowAlgorithms
this->declareProperty(new WorkspaceProperty<>("DetVanWorkspace", "",
Direction::Input), "The detector vanadium workspace.");
this->declareProperty(new WorkspaceProperty<>("DetVanCompWorkspace", "",
Direction::Input),
Direction::Input, PropertyMode::Optional),
"A detector vanadium workspace to compare against the primary one.");
this->declareProperty(new WorkspaceProperty<>("SampleWorkspace", "",
Direction::Input, PropertyMode::Optional),
Expand Down Expand Up @@ -116,8 +116,7 @@ namespace WorkflowAlgorithms
const double samHi = reductionManager->getProperty("AcceptanceFactor");
const double samLo = 0.0;
const double bleedRate = reductionManager->getProperty("MaxFramerate");
// Get the one string property
const std::string bleedPixels = reductionManager->getProperty("IgnoredPixels");
const int bleedPixels = reductionManager->getProperty("IgnoredPixels");
//reductionManager->getProperty();
//reductionManager->getProperty();

Expand All @@ -144,6 +143,19 @@ namespace WorkflowAlgorithms
detVan->executeAsSubAlg();
}

AnalysisDataServiceImpl & dataStore = AnalysisDataService::Instance();
// Get the processed workspaces for possible later use.
MatrixWorkspace_sptr dvWS = dataStore.retrieveWS<MatrixWorkspace>(dvInternal);
MatrixWorkspace_sptr dvCompWS;
if (dataStore.doesExist(dvCompInternal))
{
dvCompWS = dataStore.retrieveWS<MatrixWorkspace>(dvCompInternal);
}
else
{
dvCompWS = boost::shared_ptr<MatrixWorkspace>();
}

// Process the sample data if any of the sample checks are requested.
if (checkBkg || rejectZeroBkg || createPsdBleed)
{
Expand All @@ -157,8 +169,6 @@ namespace WorkflowAlgorithms
norm->executeAsSubAlg();
}

AnalysisDataServiceImpl & dataStore = AnalysisDataService::Instance();

// Handle case where one of the other tests (checkBkg or rejectZeroBkg)
// are requested, but not createPsdBleed.
if (createPsdBleed)
Expand Down Expand Up @@ -231,28 +241,27 @@ namespace WorkflowAlgorithms
mult->executeAsSubAlg();
*/
// Normalise the background integral workspace
MatrixWorkspace_sptr wi = dataStore.retrieveWS<MatrixWorkspace>(dvInternal);
if (detVanCompWS)
if (dvCompWS)
{
MatrixWorkspace_sptr swi = dataStore.retrieveWS<MatrixWorkspace>(dvCompInternal);
MatrixWorkspace_sptr hmean = 2.0 * wi * swi;
hmean /= (wi + swi);

MatrixWorkspace_sptr hmean = 2.0 * dvWS * dvCompWS;
hmean /= (dvWS + dvCompWS);
backgroundIntWS /= hmean;
}
else
{
backgroundIntWS /= wi;
backgroundIntWS /= dvWS;
}
}
else
{
backgroundIntWS = boost::shared_ptr<MatrixWorkspace>();
}

IAlgorithm_sptr diag = this->createSubAlgorithm("DetectorDiagnose");
IAlgorithm_sptr diag = this->createSubAlgorithm("DetectorDiagnostic");
diag->setAlwaysStoreInADS(true);
diag->setProperty("InputWorkspace", dvInternal);
diag->setProperty("WhiteBeamCompare", dvCompInternal);
diag->setProperty("WhiteBeamCompare", dvCompWS);
diag->setProperty("SampleWorkspace", sampleWS);
diag->setProperty("SampleTotalCountsWorkspace", totalCountsWS);
diag->setProperty("SampleBackgroundWorkspace", backgroundIntWS);
Expand Down

0 comments on commit baffaee

Please sign in to comment.