59 g_log.
notice() <<
"Starting DgsProcessDetectorVanadium\n";
61 const std::string reductionManagerName = this->
getProperty(
"ReductionProperties");
62 std::shared_ptr<PropertyManager> reductionManager;
63 if (PropertyManagerDataService::Instance().doesExist(reductionManagerName)) {
64 reductionManager = PropertyManagerDataService::Instance().retrieve(reductionManagerName);
66 throw std::runtime_error(
"DgsProcessDetectorVanadium cannot run without a "
67 "reduction PropertyManager.");
76 norm->setProperty(
"InputWorkspace", inputWS);
77 norm->setProperty(
"OutputWorkspace", inputWS);
78 norm->setProperty(
"InputMonitorWorkspace", monWS);
79 norm->executeAsChildAlg();
81 inputWS = norm->getProperty(
"OutputWorkspace");
83 double detVanIntRangeLow =
getDblPropOrParam(
"DetVanIntRangeLow", reductionManager,
"wb-integr-min", inputWS);
85 double detVanIntRangeHigh =
getDblPropOrParam(
"DetVanIntRangeHigh", reductionManager,
"wb-integr-max", inputWS);
87 const std::string detVanIntRangeUnits = reductionManager->getProperty(
"DetVanIntRangeUnits");
89 if (
"TOF" != detVanIntRangeUnits) {
92 cnvun->setProperty(
"InputWorkspace", inputWS);
93 cnvun->setProperty(
"OutputWorkspace", inputWS);
94 cnvun->setProperty(
"Target", detVanIntRangeUnits);
95 cnvun->setProperty(
"EMode",
"Elastic");
96 cnvun->executeAsChildAlg();
97 inputWS = cnvun->getProperty(
"OutputWorkspace");
101 std::vector<double> binning{detVanIntRangeLow, detVanIntRangeHigh - detVanIntRangeLow, detVanIntRangeHigh};
104 rebin->setProperty(
"InputWorkspace", inputWS);
105 rebin->setProperty(
"OutputWorkspace", outputWS);
106 rebin->setProperty(
"PreserveEvents",
false);
107 rebin->setProperty(
"Params", binning);
108 rebin->executeAsChildAlg();
109 outputWS = rebin->getProperty(
"OutputWorkspace");
116 remap->setProperty(
"InputWorkspace", outputWS);
117 remap->setProperty(
"OutputWorkspace", outputWS);
118 remap->setProperty(
"MaskWorkspace", maskWS);
119 remap->executeAsChildAlg();
120 outputWS = remap->getProperty(
"OutputWorkspace");
122 const std::string facility = ConfigService::Instance().getFacility().name();
123 if (
"ISIS" == facility) {
125 double wbScaleFactor = inputWS->getInstrument()->getNumberParameter(
"wb-scale-factor")[0];
126 outputWS *= wbScaleFactor;
129 if (reductionManager->existsProperty(
"SaveProcessedDetVan")) {
130 bool saveProc = reductionManager->getProperty(
"SaveProcessedDetVan");
132 std::string outputFile;
133 if (reductionManager->existsProperty(
"SaveProcDetVanFilename")) {
134 outputFile = reductionManager->getPropertyValue(
"SaveProcDetVanFilename");
136 if (outputFile.empty()) {
138 outputFile +=
".nxs";
142 if (!outputFile.empty() && !outputFile.starts_with(
"ChildAlgOutput") && !outputFile.starts_with(
"__")) {
144 save->setProperty(
"InputWorkspace", outputWS);
145 save->setProperty(
"FileName", outputFile);
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
double getDblPropOrParam(const std::string &pmProp, Mantid::Kernel::PropertyManager_sptr &pm, const std::string &instParam, Mantid::API::MatrixWorkspace_sptr &ws, const double overrideValue=Mantid::EMPTY_DBL())
Function to get double property or instrument parameter value.