Skip to content
Snippets Groups Projects
Commit 0746b7f7 authored by Michael Reuter's avatar Michael Reuter
Browse files

Refs #5453. Preserving events for SNS.

parent 2c60dc28
No related merge requests found
...@@ -106,6 +106,8 @@ namespace WorkflowAlgorithms ...@@ -106,6 +106,8 @@ namespace WorkflowAlgorithms
const std::string inWsName = inputWS->getName(); const std::string inWsName = inputWS->getName();
std::string outWsName = inWsName + "_et"; std::string outWsName = inWsName + "_et";
bool preserveEvents = false;
// Calculate the initial energy and time zero // Calculate the initial energy and time zero
const std::string facility = ConfigService::Instance().getFacility().name(); const std::string facility = ConfigService::Instance().getFacility().name();
g_log.notice() << "Processing for " << facility << std::endl; g_log.notice() << "Processing for " << facility << std::endl;
...@@ -113,6 +115,8 @@ namespace WorkflowAlgorithms ...@@ -113,6 +115,8 @@ namespace WorkflowAlgorithms
double initial_energy = 0.0; double initial_energy = 0.0;
if ("SNS" == facility) if ("SNS" == facility)
{ {
// SNS wants to preserve events until the last
preserveEvents = true;
const std::string instName = inputWS->getInstrument()->getName(); const std::string instName = inputWS->getInstrument()->getName();
double t0 = 0.0; double t0 = 0.0;
if ("CNCS" == instName || "HYSPEC" == instName) if ("CNCS" == instName || "HYSPEC" == instName)
...@@ -171,7 +175,7 @@ namespace WorkflowAlgorithms ...@@ -171,7 +175,7 @@ namespace WorkflowAlgorithms
rebin->setProperty("InputWorkspace", outWsName); rebin->setProperty("InputWorkspace", outWsName);
rebin->setProperty("OutputWorkspace", outWsName); rebin->setProperty("OutputWorkspace", outWsName);
rebin->setProperty("Params", et_binning); rebin->setProperty("Params", et_binning);
rebin->setProperty("PreserveEvents", false); rebin->setProperty("PreserveEvents", preserveEvents);
rebin->execute(); rebin->execute();
} }
...@@ -217,6 +221,18 @@ namespace WorkflowAlgorithms ...@@ -217,6 +221,18 @@ namespace WorkflowAlgorithms
kikf->setProperty("EMode", "Direct"); kikf->setProperty("EMode", "Direct");
kikf->execute(); kikf->execute();
// Rebin to ensure consistency
if (!et_binning.empty())
{
g_log.notice() << "Rebinning data" << std::endl;
IAlgorithm_sptr rebin = this->createSubAlgorithm("Rebin");
rebin->setAlwaysStoreInADS(true);
rebin->setProperty("InputWorkspace", outWsName);
rebin->setProperty("OutputWorkspace", outWsName);
rebin->setProperty("Params", et_binning);
rebin->execute();
}
MatrixWorkspace_sptr outputWS = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(outWsName); MatrixWorkspace_sptr outputWS = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(outWsName);
this->setProperty("OutputWorkspace", outputWS); this->setProperty("OutputWorkspace", outputWS);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment