Mantid
Loading...
Searching...
No Matches
DgsConvertToEnergyTransfer.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9#include "MantidAPI/Run.h"
20
21#include <boost/lexical_cast.hpp>
22
23using namespace Mantid::Kernel;
24using namespace Mantid::API;
25using namespace Mantid::Geometry;
26using namespace WorkflowAlgorithmHelpers;
27
29
30// Register the algorithm into the AlgorithmFactory
31DECLARE_ALGORITHM(DgsConvertToEnergyTransfer)
32
33
34const std::string DgsConvertToEnergyTransfer::name() const { return "DgsConvertToEnergyTransfer"; }
35
37int DgsConvertToEnergyTransfer::version() const { return 1; }
38
40const std::string DgsConvertToEnergyTransfer::category() const { return "Workflow\\Inelastic\\UsesPropertyManager"; }
41
45 this->declareProperty(std::make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::Input),
46 "A sample data workspace.");
47 this->declareProperty(
48 std::make_unique<WorkspaceProperty<>>("InputMonitorWorkspace", "", Direction::Input, PropertyMode::Optional),
49 "A monitor workspace associated with the sample workspace.");
50 this->declareProperty("IncidentEnergyGuess", EMPTY_DBL(),
51 "This is the starting point for the incident energy calculation.");
52 this->declareProperty(
53 std::make_unique<WorkspaceProperty<>>("IntegratedDetectorVanadium", "", Direction::Input, PropertyMode::Optional),
54 "A workspace containing the "
55 "integrated detector vanadium.");
56 this->declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>("MaskWorkspace", "", Direction::Input,
58 "A mask workspace");
59 this->declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>("GroupingWorkspace", "", Direction::Input,
61 "A grouping workspace");
62 this->declareProperty("AlternateGroupingTag", "", "Allows modification to the OldGroupingFile property name");
63 this->declareProperty(std::make_unique<WorkspaceProperty<>>("OutputWorkspace", "", Direction::Output),
64 "The name for the output workspace.");
65 this->declareProperty(std::make_unique<WorkspaceProperty<>>("OutputTibWorkspace", "", Direction::Output),
66 "The name for the output TIB workspace.");
67 this->declareProperty("ReductionProperties", "__dgs_reduction_properties", Direction::Input);
68}
69
73 g_log.notice() << "Starting DgsConvertToEnergyTransfer\n";
74 // Get the reduction property manager
75 const std::string reductionManagerName = this->getProperty("ReductionProperties");
76 std::shared_ptr<PropertyManager> reductionManager;
77 if (PropertyManagerDataService::Instance().doesExist(reductionManagerName))
78 reductionManager = PropertyManagerDataService::Instance().retrieve(reductionManagerName);
79 else
80 throw std::runtime_error("DgsConvertToEnergyTransfer cannot run without a "
81 "reduction PropertyManager.");
82
83 MatrixWorkspace_sptr inputWS = this->getProperty("InputWorkspace");
84 MatrixWorkspace_sptr outputWS = this->getProperty("OutputWorkspace");
85 MatrixWorkspace_sptr monWS = this->getProperty("InputMonitorWorkspace");
86
87 // Make a monitor workspace name for SNS data
88 std::string monWsName = inputWS->getName() + "_monitors";
89 bool preserveEvents = false;
90
91 // Calculate the initial energy and time zero
92 const std::string facility = ConfigService::Instance().getFacility().name();
93 g_log.notice() << "Processing for " << facility << '\n';
94 double eiGuess = this->getProperty("IncidentEnergyGuess");
95 if (EMPTY_DBL() == eiGuess) {
96 // SNS has a log called EnergyRequest that can be used to get the
97 // incident energy guess.
98 if ("SNS" == facility) {
99 TimeSeriesProperty<double> *eiLog = inputWS->run().getTimeSeriesProperty<double>("EnergyRequest");
100 eiGuess = eiLog->getStatistics().mean;
101 } else {
102 throw std::runtime_error("Incident energy guess MUST be given!");
103 }
104 }
105 const bool useEiGuess = reductionManager->getProperty("UseIncidentEnergyGuess");
106 const double tZeroGuess = reductionManager->getProperty("TimeZeroGuess");
107 std::vector<double> etBinning = reductionManager->getProperty("EnergyTransferRange");
108
109 // Create a default set of binning parameters: (-0.5Ei, 0.01Ei, 0.99Ei)
110 if (etBinning.empty()) {
111 double emin = -0.5 * eiGuess;
112 double deltaE = 0.01 * eiGuess;
113 double emax = 0.99 * eiGuess;
114 etBinning.emplace_back(emin);
115 etBinning.emplace_back(deltaE);
116 etBinning.emplace_back(emax);
117 }
118
119 double incidentEnergy = 0.0;
120 double monPeak = 0.0;
121 specnum_t eiMon1Spec = static_cast<specnum_t>(reductionManager->getProperty("Monitor1SpecId"));
122 specnum_t eiMon2Spec = static_cast<specnum_t>(reductionManager->getProperty("Monitor2SpecId"));
123
124 if ("SNS" == facility) {
125 // SNS wants to preserve events until the last
126 preserveEvents = true;
127 double tZero = 0.0;
128 if (useEiGuess) {
129 incidentEnergy = eiGuess;
130 if (EMPTY_DBL() != tZeroGuess)
131 tZero = tZeroGuess;
132 } else {
133 if (!monWS) {
134 g_log.notice() << "Trying to determine file name\n";
135 std::string runFileName = inputWS->run().getProperty("Filename")->value();
136 if (runFileName.empty())
137 throw std::runtime_error("Cannot find run filename, therefore cannot "
138 "find the initial energy");
139
140 std::string loadAlgName;
141 std::string fileProp;
142 if (boost::ends_with(runFileName, "_event.nxs") || boost::ends_with(runFileName, ".nxs.h5") ||
143 boost::ends_with(runFileName, ".nxs")) {
144 g_log.notice() << "Loading NeXus monitors\n";
145 loadAlgName = "LoadNexusMonitors";
146 fileProp = "Filename";
147 }
148
149 if (boost::ends_with(runFileName, "_neutron_event.dat")) {
150 g_log.notice() << "Loading PreNeXus monitors\n";
151 loadAlgName = "LoadPreNexusMonitors";
152 boost::replace_first(runFileName, "_neutron_event.dat", "_runinfo.xml");
153 fileProp = "RunInfoFilename";
154 }
155
156 // Load the monitors
157 auto loadmon = createChildAlgorithm(loadAlgName);
158 loadmon->setProperty(fileProp, runFileName);
159 loadmon->setProperty("OutputWorkspace", monWsName);
160 loadmon->executeAsChildAlg();
161 Workspace_sptr monWSOutput = loadmon->getProperty("OutputWorkspace");
162 // the algorithm can return a group workspace if the file is multi
163 // period
164 monWS = std::dynamic_pointer_cast<MatrixWorkspace>(monWSOutput);
165 if ((monWSOutput) && (!monWS))
166 // this was a group workspace - DGSReduction does not support multi
167 // period data yet
168 throw Exception::NotImplementedError("The file contains multi period data, support for this is not "
169 "implemented in DGSReduction yet");
170 }
171
172 // Calculate Ei
173 auto getei = createChildAlgorithm("GetEi");
174 getei->setProperty("InputWorkspace", monWS);
175 getei->setProperty("Monitor1Spec", eiMon1Spec);
176 getei->setProperty("Monitor2Spec", eiMon2Spec);
177 getei->setProperty("EnergyEstimate", eiGuess);
178 getei->executeAsChildAlg();
179 incidentEnergy = getei->getProperty("IncidentEnergy");
180 tZero = getei->getProperty("Tzero");
181 }
182
183 g_log.notice() << "Adjusting for T0\n";
184 auto alg = createChildAlgorithm("ChangeBinOffset");
185 alg->setProperty("InputWorkspace", inputWS);
186 alg->setProperty("OutputWorkspace", outputWS);
187 alg->setProperty("Offset", -tZero);
188 alg->executeAsChildAlg();
189 outputWS = alg->getProperty("OutputWorkspace");
190
191 // Add T0 to sample logs
192 auto addLog = createChildAlgorithm("AddSampleLog");
193 addLog->setProperty("Workspace", outputWS);
194 addLog->setProperty("LogName", "CalculatedT0");
195 addLog->setProperty("LogType", "Number");
196 addLog->setProperty("LogText", boost::lexical_cast<std::string>(tZero));
197 addLog->executeAsChildAlg();
198 }
199 // Do ISIS
200 else {
201 auto getei = createChildAlgorithm("GetEi");
202 getei->setProperty("InputWorkspace", inputWS);
203 getei->setProperty("Monitor1Spec", eiMon1Spec);
204 getei->setProperty("Monitor2Spec", eiMon2Spec);
205 getei->setProperty("EnergyEstimate", eiGuess);
206 getei->executeAsChildAlg();
207
208 monPeak = getei->getProperty("FirstMonitorPeak");
209 const specnum_t monIndex = static_cast<specnum_t>(getei->getProperty("FirstMonitorIndex"));
210 // Why did the old way get it from the log?
211 incidentEnergy = getei->getProperty("IncidentEnergy");
212
213 auto cbo = createChildAlgorithm("ChangeBinOffset");
214 cbo->setProperty("InputWorkspace", inputWS);
215 cbo->setProperty("OutputWorkspace", outputWS);
216 cbo->setProperty("Offset", -monPeak);
217 cbo->executeAsChildAlg();
218 outputWS = cbo->getProperty("OutputWorkspace");
219
220 const auto &specInfo = inputWS->spectrumInfo();
221 const V3D &monPos = specInfo.position(monIndex);
222 std::string srcName = inputWS->getInstrument()->getSource()->getName();
223
224 auto moveInstComp = createChildAlgorithm("MoveInstrumentComponent");
225 moveInstComp->setProperty("Workspace", outputWS);
226 moveInstComp->setProperty("ComponentName", srcName);
227 moveInstComp->setProperty("X", monPos.X());
228 moveInstComp->setProperty("Y", monPos.Y());
229 moveInstComp->setProperty("Z", monPos.Z());
230 moveInstComp->setProperty("RelativePosition", false);
231 moveInstComp->executeAsChildAlg();
232 }
233
234 const double binOffset = -monPeak;
235
236 if ("ISIS" == facility) {
237 std::string detcalFile;
238 if (reductionManager->existsProperty("SampleDetCalFilename"))
239 detcalFile = reductionManager->getPropertyValue("SampleDetCalFilename");
240 // Try to get it from run object.
241 else
242 detcalFile = inputWS->run().getProperty("Filename")->value();
243 if (!detcalFile.empty()) {
244 const bool relocateDets = reductionManager->getProperty("RelocateDetectors");
245 auto loaddetinfo = createChildAlgorithm("LoadDetectorInfo");
246 loaddetinfo->setProperty("Workspace", outputWS);
247 loaddetinfo->setProperty("DataFilename", detcalFile);
248 loaddetinfo->setProperty("RelocateDets", relocateDets);
249 loaddetinfo->executeAsChildAlg();
250 outputWS = loaddetinfo->getProperty("Workspace");
251 } else {
252 throw std::runtime_error("Cannot find detcal filename in run object or as parameter.");
253 }
254 }
255
256 // Subtract time-independent background if necessary
257 const bool doTibSub = reductionManager->getProperty("TimeIndepBackgroundSub");
258 if (doTibSub) {
259 // Setup for later use
260 auto cnvToDist = createChildAlgorithm("ConvertToDistribution");
261
262 // Set the binning parameters for the background region
263 double tibTofStart = getDblPropOrParam("TibTofRangeStart", reductionManager, "bkgd-range-min", inputWS);
264 tibTofStart += binOffset;
265 double tibTofEnd = getDblPropOrParam("TibTofRangeEnd", reductionManager, "bkgd-range-max", inputWS);
266 tibTofEnd += binOffset;
267 const double tibTofWidth = tibTofEnd - tibTofStart;
268 std::vector<double> params{tibTofStart, tibTofWidth, tibTofEnd};
269
270 bool treatTibAsEvents = false;
271
272 // Do we want to treat the TIB as events
273 std::vector<std::string> backgroundType =
274 inputWS->getInstrument()->getStringParameter("treat-background-as-events");
275 if (backgroundType.empty()) {
276 // Set the default behaviour.
277 treatTibAsEvents = false;
278 } else {
279 if ("yes" == backgroundType[0] || "true" == backgroundType[0]) {
280 treatTibAsEvents = true;
281 }
282 }
283
284 if ("SNS" == facility) {
286
287 // Do we want to treat the constant background as events ?
288 if (treatTibAsEvents) {
289 g_log.notice("TIB removal using event mode.");
290 // Treat background as events
291 auto createBkg = createChildAlgorithm("CreateFlatEventWorkspace");
292 createBkg->setProperty("InputWorkspace", outputWS);
293 createBkg->setProperty("RangeStart", tibTofStart);
294 createBkg->setProperty("RangeEnd", tibTofEnd);
295 createBkg->executeAsChildAlg();
296 bkgWS = createBkg->getProperty("OutputWorkspace");
297 } else {
298 g_log.notice("TIB removal using legacy mode.");
299 // Create an original background workspace from a portion of the
300 // result workspace.
301 std::string origBkgWsName = "background_origin_ws";
302 auto rebin = createChildAlgorithm("Rebin");
303 rebin->setProperty("InputWorkspace", outputWS);
304 rebin->setProperty("OutputWorkspace", origBkgWsName);
305 rebin->setProperty("Params", params);
306 rebin->setProperty("PreserveEvents", false);
307 rebin->setProperty("IgnoreBinErrors", true);
308 rebin->executeAsChildAlg();
309 MatrixWorkspace_sptr origBkgWS = rebin->getProperty("OutputWorkspace");
310
311 // Convert result workspace to DeltaE since we have Et binning
312 auto cnvun = createChildAlgorithm("ConvertUnits");
313 cnvun->setProperty("InputWorkspace", outputWS);
314 cnvun->setProperty("OutputWorkspace", outputWS);
315 cnvun->setProperty("Target", "DeltaE");
316 cnvun->setProperty("EMode", "Direct");
317 cnvun->setProperty("EFixed", incidentEnergy);
318 cnvun->executeAsChildAlg();
319 outputWS = cnvun->getProperty("OutputWorkspace");
320
321 // Rebin to Et
322 rebin->setProperty("InputWorkspace", outputWS);
323 rebin->setProperty("OutputWorkspace", outputWS);
324 rebin->setProperty("Params", etBinning);
325 rebin->setProperty("PreserveEvents", false);
326 rebin->executeAsChildAlg();
327 outputWS = rebin->getProperty("OutputWorkspace");
328
329 // Convert result workspace to TOF
330 cnvun->setProperty("InputWorkspace", outputWS);
331 cnvun->setProperty("OutputWorkspace", outputWS);
332 cnvun->setProperty("Target", "TOF");
333 cnvun->setProperty("EMode", "Direct");
334 cnvun->setProperty("EFixed", incidentEnergy);
335 cnvun->executeAsChildAlg();
336 outputWS = cnvun->getProperty("OutputWorkspace");
337
338 // Make result workspace a distribution
339 cnvToDist->setProperty("Workspace", outputWS);
340 cnvToDist->executeAsChildAlg();
341 outputWS = cnvToDist->getProperty("Workspace");
342
343 // Calculate the background
344 auto flatBg = createChildAlgorithm("CalculateFlatBackground");
345 flatBg->setProperty("InputWorkspace", origBkgWS);
346 flatBg->setProperty("StartX", tibTofStart);
347 flatBg->setProperty("EndX", tibTofEnd);
348 flatBg->setProperty("Mode", "Mean");
349 flatBg->setProperty("OutputMode", "Return Background");
350 flatBg->executeAsChildAlg();
351 bkgWS = flatBg->getProperty("OutputWorkspace");
352
353 // Remove unneeded original background workspace
354 origBkgWS.reset();
355
356 // Make background workspace a distribution
357 cnvToDist->setProperty("Workspace", bkgWS);
358 cnvToDist->executeAsChildAlg();
359 bkgWS = cnvToDist->getProperty("Workspace");
360 }
361
362 // Subtract background from result workspace
363 auto minus = createChildAlgorithm("Minus");
364 minus->setProperty("LHSWorkspace", outputWS);
365 minus->setProperty("RHSWorkspace", bkgWS);
366 minus->setProperty("OutputWorkspace", outputWS);
367 minus->executeAsChildAlg();
368
369 this->setProperty("OutputTibWorkspace", bkgWS);
370 }
371 // Do ISIS
372 else {
373 // Make result workspace a distribution
374 cnvToDist->setProperty("Workspace", outputWS);
375 cnvToDist->executeAsChildAlg();
376 outputWS = cnvToDist->getProperty("Workspace");
377
378 auto flatBg = createChildAlgorithm("CalculateFlatBackground");
379 flatBg->setProperty("InputWorkspace", outputWS);
380 flatBg->setProperty("OutputWorkspace", outputWS);
381 flatBg->setProperty("StartX", tibTofStart);
382 flatBg->setProperty("EndX", tibTofEnd);
383 flatBg->setProperty("Mode", "Mean");
384 flatBg->executeAsChildAlg();
385 outputWS = flatBg->getProperty("OutputWorkspace");
386 }
387
388 if (!treatTibAsEvents) {
389 // Convert result workspace back to histogram
390 auto cnvFrDist = createChildAlgorithm("ConvertFromDistribution");
391 cnvFrDist->setProperty("Workspace", outputWS);
392 cnvFrDist->executeAsChildAlg();
393 outputWS = cnvFrDist->getProperty("Workspace");
394 }
395 }
396
397 // Normalise result workspace to incident beam parameter
398 auto norm = createChildAlgorithm("DgsPreprocessData");
399 norm->setProperty("InputWorkspace", outputWS);
400 norm->setProperty("OutputWorkspace", outputWS);
401 norm->setProperty("InputMonitorWorkspace", monWS);
402 norm->setProperty("TofRangeOffset", binOffset);
403 norm->executeAsChildAlg();
404 outputWS = norm->getProperty("OutputWorkspace");
405
406 // Convert to energy transfer
407 g_log.notice() << "Converting to energy transfer.\n";
408 auto cnvun = createChildAlgorithm("ConvertUnits");
409 cnvun->setProperty("InputWorkspace", outputWS);
410 cnvun->setProperty("OutputWorkspace", outputWS);
411 cnvun->setProperty("Target", "DeltaE");
412 cnvun->setProperty("EMode", "Direct");
413 cnvun->setProperty("EFixed", incidentEnergy);
414 cnvun->executeAsChildAlg();
415 outputWS = cnvun->getProperty("OutputWorkspace");
416
417 g_log.notice() << "Rebinning data\n";
418 auto rebin = createChildAlgorithm("Rebin");
419 rebin->setProperty("InputWorkspace", outputWS);
420 rebin->setProperty("OutputWorkspace", outputWS);
421 rebin->setProperty("Params", etBinning);
422 rebin->setProperty("IgnoreBinErrors", true);
423 rebin->setProperty("PreserveEvents", preserveEvents);
424 rebin->executeAsChildAlg();
425 outputWS = rebin->getProperty("OutputWorkspace");
426
427 // Correct for detector efficiency
428 if ("SNS" == facility) {
429 // He3TubeEfficiency requires the workspace to be in wavelength
430 cnvun->setProperty("InputWorkspace", outputWS);
431 cnvun->setProperty("OutputWorkspace", outputWS);
432 cnvun->setProperty("Target", "Wavelength");
433 cnvun->executeAsChildAlg();
434 outputWS = cnvun->getProperty("OutputWorkspace");
435
436 // Do the correction
437 auto alg2 = this->createChildAlgorithm("He3TubeEfficiency");
438 alg2->setProperty("InputWorkspace", outputWS);
439 alg2->setProperty("OutputWorkspace", outputWS);
440 alg2->executeAsChildAlg();
441 outputWS = alg2->getProperty("OutputWorkspace");
442
443 // Convert back to energy transfer
444 cnvun->setProperty("InputWorkspace", outputWS);
445 cnvun->setProperty("OutputWorkspace", outputWS);
446 cnvun->setProperty("Target", "DeltaE");
447 cnvun->executeAsChildAlg();
448 outputWS = cnvun->getProperty("OutputWorkspace");
449 }
450 // Do ISIS
451 else {
452 auto alg = createChildAlgorithm("DetectorEfficiencyCor");
453 alg->setProperty("InputWorkspace", outputWS);
454 alg->setProperty("OutputWorkspace", outputWS);
455 alg->executeAsChildAlg();
456 outputWS = alg->getProperty("OutputWorkspace");
457 }
458
459 const bool correctKiKf = reductionManager->getProperty("CorrectKiKf");
460 if (correctKiKf) {
461 // Correct for Ki/Kf
462 auto kikf = createChildAlgorithm("CorrectKiKf");
463 kikf->setProperty("InputWorkspace", outputWS);
464 kikf->setProperty("OutputWorkspace", outputWS);
465 kikf->setProperty("EMode", "Direct");
466 kikf->executeAsChildAlg();
467 outputWS = kikf->getProperty("OutputWorkspace");
468 }
469
470 // Rebin to ensure consistency
471 const bool sofphieIsDistribution = reductionManager->getProperty("SofPhiEIsDistribution");
472
473 g_log.notice() << "Rebinning data\n";
474 rebin->setProperty("InputWorkspace", outputWS);
475 rebin->setProperty("OutputWorkspace", outputWS);
476 rebin->setProperty("IgnoreBinErrors", true);
477 if (sofphieIsDistribution)
478 rebin->setProperty("PreserveEvents", false);
479 rebin->executeAsChildAlg();
480 outputWS = rebin->getProperty("OutputWorkspace");
481
482 if (sofphieIsDistribution) {
483 g_log.notice() << "Making distribution\n";
484 auto distrib = createChildAlgorithm("ConvertToDistribution");
485 distrib->setProperty("Workspace", outputWS);
486 distrib->executeAsChildAlg();
487 outputWS = distrib->getProperty("Workspace");
488 } else {
489 // Discard events outside nominal bounds
490 auto crop = createChildAlgorithm("CropWorkspace");
491 crop->setProperty("InputWorkspace", outputWS);
492 crop->setProperty("OutputWorkspace", outputWS);
493 crop->setProperty("XMin", etBinning[0]);
494 crop->setProperty("XMax", etBinning[2]);
495 crop->executeAsChildAlg();
496 outputWS = crop->getProperty("OutputWorkspace");
497 }
498
499 // Normalise by the detector vanadium if necessary
500 MatrixWorkspace_sptr detVanWS = this->getProperty("IntegratedDetectorVanadium");
501 if (detVanWS) {
502 auto divide = createChildAlgorithm("Divide");
503 divide->setProperty("LHSWorkspace", outputWS);
504 divide->setProperty("RHSWorkspace", detVanWS);
505 divide->setProperty("OutputWorkspace", outputWS);
506 divide->executeAsChildAlg();
507 outputWS = divide->getProperty("OutputWorkspace");
508 }
509
510 // Mask and group workspace if necessary.
511 MatrixWorkspace_sptr maskWS = this->getProperty("MaskWorkspace");
512 MatrixWorkspace_sptr groupWS = this->getProperty("GroupingWorkspace");
513 std::string oldGroupFile;
514 std::string filePropMod = this->getProperty("AlternateGroupingTag");
515 std::string fileProp = filePropMod + "OldGroupingFilename";
516 if (reductionManager->existsProperty(fileProp))
517 oldGroupFile = reductionManager->getPropertyValue(fileProp);
518 auto remap = createChildAlgorithm("DgsRemap");
519 remap->setProperty("InputWorkspace", outputWS);
520 remap->setProperty("OutputWorkspace", outputWS);
521 remap->setProperty("MaskWorkspace", maskWS);
522 remap->setProperty("GroupingWorkspace", groupWS);
523 remap->setProperty("OldGroupingFile", oldGroupFile);
524 remap->executeAsChildAlg();
525 outputWS = remap->getProperty("OutputWorkspace");
526
527 if ("ISIS" == facility) {
528 double scaleFactor = inputWS->getInstrument()->getNumberParameter("scale-factor")[0];
529 auto scaleAlg = createChildAlgorithm("Scale");
530 scaleAlg->setProperty("InputWorkspace", outputWS);
531 scaleAlg->setProperty("Factor", scaleFactor);
532 scaleAlg->setProperty("Operation", "Multiply");
533 scaleAlg->setProperty("OutputWorkspace", outputWS);
534 scaleAlg->executeAsChildAlg();
535 }
536 this->setProperty("OutputWorkspace", outputWS);
537}
538
539} // namespace Mantid::WorkflowAlgorithms
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
Definition: Algorithm.cpp:1913
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Definition: Algorithm.cpp:2076
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.
Definition: Algorithm.cpp:842
Kernel::Logger & g_log
Definition: Algorithm.h:451
A property class for workspaces.
Marks code as not implemented yet.
Definition: Exception.h:138
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void notice(const std::string &msg)
Logs at notice level.
Definition: Logger.cpp:95
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
A specialised Property class for holding a series of time-value pairs.
TimeSeriesPropertyStatistics getStatistics() const
Return a TimeSeriesPropertyStatistics object.
Class for 3D vectors.
Definition: V3D.h:34
constexpr double X() const noexcept
Get x.
Definition: V3D.h:232
constexpr double Y() const noexcept
Get y.
Definition: V3D.h:233
constexpr double Z() const noexcept
Get z.
Definition: V3D.h:234
DgsConvertToEnergyTransfer : This is the algorithm responsible for the conversion from TOF to energy ...
const std::string category() const override
Algorithm's category for identification.
int version() const override
Algorithm's version for identification.
void init() override
Initialize the algorithm's properties.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
int32_t specnum_t
Typedef for a spectrum Number.
Definition: IDTypes.h:16
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition: EmptyValues.h:43
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.
STL namespace.
@ Input
An input workspace.
Definition: Property.h:53
@ Output
An output workspace.
Definition: Property.h:54