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 const 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 (runFileName.ends_with("_event.nxs") || runFileName.ends_with(".nxs.h5") || runFileName.ends_with(".nxs")) {
143 g_log.notice() << "Loading NeXus monitors\n";
144 loadAlgName = "LoadNexusMonitors";
145 fileProp = "Filename";
146 }
147
148 if (runFileName.ends_with("_neutron_event.dat")) {
149 g_log.notice() << "Loading PreNeXus monitors\n";
150 loadAlgName = "LoadPreNexusMonitors";
151 boost::replace_first(runFileName, "_neutron_event.dat", "_runinfo.xml");
152 fileProp = "RunInfoFilename";
153 }
154
155 // Load the monitors
156 auto loadmon = createChildAlgorithm(loadAlgName);
157 loadmon->setProperty(fileProp, runFileName);
158 loadmon->setProperty("OutputWorkspace", monWsName);
159 loadmon->executeAsChildAlg();
160 Workspace_sptr monWSOutput = loadmon->getProperty("OutputWorkspace");
161 // the algorithm can return a group workspace if the file is multi
162 // period
163 monWS = std::dynamic_pointer_cast<MatrixWorkspace>(monWSOutput);
164 if ((monWSOutput) && (!monWS))
165 // this was a group workspace - DGSReduction does not support multi
166 // period data yet
167 throw Exception::NotImplementedError("The file contains multi period data, support for this is not "
168 "implemented in DGSReduction yet");
169 }
170
171 // Calculate Ei
172 auto getei = createChildAlgorithm("GetEi");
173 getei->setProperty("InputWorkspace", monWS);
174 getei->setProperty("Monitor1Spec", eiMon1Spec);
175 getei->setProperty("Monitor2Spec", eiMon2Spec);
176 getei->setProperty("EnergyEstimate", eiGuess);
177 getei->executeAsChildAlg();
178 incidentEnergy = getei->getProperty("IncidentEnergy");
179 tZero = getei->getProperty("Tzero");
180 }
181
182 g_log.notice() << "Adjusting for T0\n";
183 auto alg = createChildAlgorithm("ChangeBinOffset");
184 alg->setProperty("InputWorkspace", inputWS);
185 alg->setProperty("OutputWorkspace", outputWS);
186 alg->setProperty("Offset", -tZero);
187 alg->executeAsChildAlg();
188 outputWS = alg->getProperty("OutputWorkspace");
189
190 // Add T0 to sample logs
191 auto addLog = createChildAlgorithm("AddSampleLog");
192 addLog->setProperty("Workspace", outputWS);
193 addLog->setProperty("LogName", "CalculatedT0");
194 addLog->setProperty("LogType", "Number");
195 addLog->setProperty("LogText", boost::lexical_cast<std::string>(tZero));
196 addLog->executeAsChildAlg();
197 }
198 // Do ISIS
199 else {
200 auto getei = createChildAlgorithm("GetEi");
201 getei->setProperty("InputWorkspace", inputWS);
202 getei->setProperty("Monitor1Spec", eiMon1Spec);
203 getei->setProperty("Monitor2Spec", eiMon2Spec);
204 getei->setProperty("EnergyEstimate", eiGuess);
205 getei->executeAsChildAlg();
206
207 monPeak = getei->getProperty("FirstMonitorPeak");
208 const specnum_t monIndex = static_cast<specnum_t>(getei->getProperty("FirstMonitorIndex"));
209 // Why did the old way get it from the log?
210 incidentEnergy = getei->getProperty("IncidentEnergy");
211
212 auto cbo = createChildAlgorithm("ChangeBinOffset");
213 cbo->setProperty("InputWorkspace", inputWS);
214 cbo->setProperty("OutputWorkspace", outputWS);
215 cbo->setProperty("Offset", -monPeak);
216 cbo->executeAsChildAlg();
217 outputWS = cbo->getProperty("OutputWorkspace");
218
219 const auto &specInfo = inputWS->spectrumInfo();
220 const V3D &monPos = specInfo.position(monIndex);
221 std::string srcName = inputWS->getInstrument()->getSource()->getName();
222
223 auto moveInstComp = createChildAlgorithm("MoveInstrumentComponent");
224 moveInstComp->setProperty("Workspace", outputWS);
225 moveInstComp->setProperty("ComponentName", srcName);
226 moveInstComp->setProperty("X", monPos.X());
227 moveInstComp->setProperty("Y", monPos.Y());
228 moveInstComp->setProperty("Z", monPos.Z());
229 moveInstComp->setProperty("RelativePosition", false);
230 moveInstComp->executeAsChildAlg();
231 }
232
233 const double binOffset = -monPeak;
234
235 if ("ISIS" == facility) {
236 std::string detcalFile;
237 if (reductionManager->existsProperty("SampleDetCalFilename"))
238 detcalFile = reductionManager->getPropertyValue("SampleDetCalFilename");
239 // Try to get it from run object.
240 else
241 detcalFile = inputWS->run().getProperty("Filename")->value();
242 if (!detcalFile.empty()) {
243 const bool relocateDets = reductionManager->getProperty("RelocateDetectors");
244 auto loaddetinfo = createChildAlgorithm("LoadDetectorInfo");
245 loaddetinfo->setProperty("Workspace", outputWS);
246 loaddetinfo->setProperty("DataFilename", detcalFile);
247 loaddetinfo->setProperty("RelocateDets", relocateDets);
248 loaddetinfo->executeAsChildAlg();
249 outputWS = loaddetinfo->getProperty("Workspace");
250 } else {
251 throw std::runtime_error("Cannot find detcal filename in run object or as parameter.");
252 }
253 }
254
255 // Subtract time-independent background if necessary
256 const bool doTibSub = reductionManager->getProperty("TimeIndepBackgroundSub");
257 if (doTibSub) {
258 // Setup for later use
259 auto cnvToDist = createChildAlgorithm("ConvertToDistribution");
260
261 // Set the binning parameters for the background region
262 double tibTofStart = getDblPropOrParam("TibTofRangeStart", reductionManager, "bkgd-range-min", inputWS);
263 tibTofStart += binOffset;
264 double tibTofEnd = getDblPropOrParam("TibTofRangeEnd", reductionManager, "bkgd-range-max", inputWS);
265 tibTofEnd += binOffset;
266 const double tibTofWidth = tibTofEnd - tibTofStart;
267 std::vector<double> params{tibTofStart, tibTofWidth, tibTofEnd};
268
269 bool treatTibAsEvents = false;
270
271 // Do we want to treat the TIB as events
272 std::vector<std::string> backgroundType =
273 inputWS->getInstrument()->getStringParameter("treat-background-as-events");
274 if (backgroundType.empty()) {
275 // Set the default behaviour.
276 treatTibAsEvents = false;
277 } else {
278 if ("yes" == backgroundType[0] || "true" == backgroundType[0]) {
279 treatTibAsEvents = true;
280 }
281 }
282
283 if ("SNS" == facility) {
285
286 // Do we want to treat the constant background as events ?
287 if (treatTibAsEvents) {
288 g_log.notice("TIB removal using event mode.");
289 // Treat background as events
290 auto createBkg = createChildAlgorithm("CreateFlatEventWorkspace");
291 createBkg->setProperty("InputWorkspace", outputWS);
292 createBkg->setProperty("RangeStart", tibTofStart);
293 createBkg->setProperty("RangeEnd", tibTofEnd);
294 createBkg->executeAsChildAlg();
295 bkgWS = createBkg->getProperty("OutputWorkspace");
296 } else {
297 g_log.notice("TIB removal using legacy mode.");
298 // Create an original background workspace from a portion of the
299 // result workspace.
300 std::string origBkgWsName = "background_origin_ws";
301 auto rebin = createChildAlgorithm("Rebin");
302 rebin->setProperty("InputWorkspace", outputWS);
303 rebin->setProperty("OutputWorkspace", origBkgWsName);
304 rebin->setProperty("Params", params);
305 rebin->setProperty("PreserveEvents", false);
306 rebin->setProperty("IgnoreBinErrors", true);
307 rebin->executeAsChildAlg();
308 MatrixWorkspace_sptr origBkgWS = rebin->getProperty("OutputWorkspace");
309
310 // Convert result workspace to DeltaE since we have Et binning
311 auto cnvun = createChildAlgorithm("ConvertUnits");
312 cnvun->setProperty("InputWorkspace", outputWS);
313 cnvun->setProperty("OutputWorkspace", outputWS);
314 cnvun->setProperty("Target", "DeltaE");
315 cnvun->setProperty("EMode", "Direct");
316 cnvun->setProperty("EFixed", incidentEnergy);
317 cnvun->executeAsChildAlg();
318 outputWS = cnvun->getProperty("OutputWorkspace");
319
320 // Rebin to Et
321 rebin->setProperty("InputWorkspace", outputWS);
322 rebin->setProperty("OutputWorkspace", outputWS);
323 rebin->setProperty("Params", etBinning);
324 rebin->setProperty("PreserveEvents", false);
325 rebin->executeAsChildAlg();
326 outputWS = rebin->getProperty("OutputWorkspace");
327
328 // Convert result workspace to TOF
329 cnvun->setProperty("InputWorkspace", outputWS);
330 cnvun->setProperty("OutputWorkspace", outputWS);
331 cnvun->setProperty("Target", "TOF");
332 cnvun->setProperty("EMode", "Direct");
333 cnvun->setProperty("EFixed", incidentEnergy);
334 cnvun->executeAsChildAlg();
335 outputWS = cnvun->getProperty("OutputWorkspace");
336
337 // Make result workspace a distribution
338 cnvToDist->setProperty("Workspace", outputWS);
339 cnvToDist->executeAsChildAlg();
340 outputWS = cnvToDist->getProperty("Workspace");
341
342 // Calculate the background
343 auto flatBg = createChildAlgorithm("CalculateFlatBackground");
344 flatBg->setProperty("InputWorkspace", origBkgWS);
345 flatBg->setProperty("StartX", tibTofStart);
346 flatBg->setProperty("EndX", tibTofEnd);
347 flatBg->setProperty("Mode", "Mean");
348 flatBg->setProperty("OutputMode", "Return Background");
349 flatBg->executeAsChildAlg();
350 bkgWS = flatBg->getProperty("OutputWorkspace");
351
352 // Remove unneeded original background workspace
353 origBkgWS.reset();
354
355 // Make background workspace a distribution
356 cnvToDist->setProperty("Workspace", bkgWS);
357 cnvToDist->executeAsChildAlg();
358 bkgWS = cnvToDist->getProperty("Workspace");
359 }
360
361 // Subtract background from result workspace
362 auto minus = createChildAlgorithm("Minus");
363 minus->setProperty("LHSWorkspace", outputWS);
364 minus->setProperty("RHSWorkspace", bkgWS);
365 minus->setProperty("OutputWorkspace", outputWS);
366 minus->executeAsChildAlg();
367
368 this->setProperty("OutputTibWorkspace", bkgWS);
369 }
370 // Do ISIS
371 else {
372 // Make result workspace a distribution
373 cnvToDist->setProperty("Workspace", outputWS);
374 cnvToDist->executeAsChildAlg();
375 outputWS = cnvToDist->getProperty("Workspace");
376
377 auto flatBg = createChildAlgorithm("CalculateFlatBackground");
378 flatBg->setProperty("InputWorkspace", outputWS);
379 flatBg->setProperty("OutputWorkspace", outputWS);
380 flatBg->setProperty("StartX", tibTofStart);
381 flatBg->setProperty("EndX", tibTofEnd);
382 flatBg->setProperty("Mode", "Mean");
383 flatBg->executeAsChildAlg();
384 outputWS = flatBg->getProperty("OutputWorkspace");
385 }
386
387 if (!treatTibAsEvents) {
388 // Convert result workspace back to histogram
389 auto cnvFrDist = createChildAlgorithm("ConvertFromDistribution");
390 cnvFrDist->setProperty("Workspace", outputWS);
391 cnvFrDist->executeAsChildAlg();
392 outputWS = cnvFrDist->getProperty("Workspace");
393 }
394 }
395
396 // Normalise result workspace to incident beam parameter
397 auto norm = createChildAlgorithm("DgsPreprocessData");
398 norm->setProperty("InputWorkspace", outputWS);
399 norm->setProperty("OutputWorkspace", outputWS);
400 norm->setProperty("InputMonitorWorkspace", monWS);
401 norm->setProperty("TofRangeOffset", binOffset);
402 norm->executeAsChildAlg();
403 outputWS = norm->getProperty("OutputWorkspace");
404
405 // Convert to energy transfer
406 g_log.notice() << "Converting to energy transfer.\n";
407 auto cnvun = createChildAlgorithm("ConvertUnits");
408 cnvun->setProperty("InputWorkspace", outputWS);
409 cnvun->setProperty("OutputWorkspace", outputWS);
410 cnvun->setProperty("Target", "DeltaE");
411 cnvun->setProperty("EMode", "Direct");
412 cnvun->setProperty("EFixed", incidentEnergy);
413 cnvun->executeAsChildAlg();
414 outputWS = cnvun->getProperty("OutputWorkspace");
415
416 g_log.notice() << "Rebinning data\n";
417 auto rebin = createChildAlgorithm("Rebin");
418 rebin->setProperty("InputWorkspace", outputWS);
419 rebin->setProperty("OutputWorkspace", outputWS);
420 rebin->setProperty("Params", etBinning);
421 rebin->setProperty("IgnoreBinErrors", true);
422 rebin->setProperty("PreserveEvents", preserveEvents);
423 rebin->executeAsChildAlg();
424 outputWS = rebin->getProperty("OutputWorkspace");
425
426 // Correct for detector efficiency
427 if ("SNS" == facility) {
428 // He3TubeEfficiency requires the workspace to be in wavelength
429 cnvun->setProperty("InputWorkspace", outputWS);
430 cnvun->setProperty("OutputWorkspace", outputWS);
431 cnvun->setProperty("Target", "Wavelength");
432 cnvun->executeAsChildAlg();
433 outputWS = cnvun->getProperty("OutputWorkspace");
434
435 // Do the correction
436 auto alg2 = this->createChildAlgorithm("He3TubeEfficiency");
437 alg2->setProperty("InputWorkspace", outputWS);
438 alg2->setProperty("OutputWorkspace", outputWS);
439 alg2->executeAsChildAlg();
440 outputWS = alg2->getProperty("OutputWorkspace");
441
442 // Convert back to energy transfer
443 cnvun->setProperty("InputWorkspace", outputWS);
444 cnvun->setProperty("OutputWorkspace", outputWS);
445 cnvun->setProperty("Target", "DeltaE");
446 cnvun->executeAsChildAlg();
447 outputWS = cnvun->getProperty("OutputWorkspace");
448 }
449 // Do ISIS
450 else {
451 auto alg = createChildAlgorithm("DetectorEfficiencyCor");
452 alg->setProperty("InputWorkspace", outputWS);
453 alg->setProperty("OutputWorkspace", outputWS);
454 alg->executeAsChildAlg();
455 outputWS = alg->getProperty("OutputWorkspace");
456 }
457
458 const bool correctKiKf = reductionManager->getProperty("CorrectKiKf");
459 if (correctKiKf) {
460 // Correct for Ki/Kf
461 auto kikf = createChildAlgorithm("CorrectKiKf");
462 kikf->setProperty("InputWorkspace", outputWS);
463 kikf->setProperty("OutputWorkspace", outputWS);
464 kikf->setProperty("EMode", "Direct");
465 kikf->executeAsChildAlg();
466 outputWS = kikf->getProperty("OutputWorkspace");
467 }
468
469 // Rebin to ensure consistency
470 const bool sofphieIsDistribution = reductionManager->getProperty("SofPhiEIsDistribution");
471
472 g_log.notice() << "Rebinning data\n";
473 rebin->setProperty("InputWorkspace", outputWS);
474 rebin->setProperty("OutputWorkspace", outputWS);
475 rebin->setProperty("IgnoreBinErrors", true);
476 if (sofphieIsDistribution)
477 rebin->setProperty("PreserveEvents", false);
478 rebin->executeAsChildAlg();
479 outputWS = rebin->getProperty("OutputWorkspace");
480
481 if (sofphieIsDistribution) {
482 g_log.notice() << "Making distribution\n";
483 auto distrib = createChildAlgorithm("ConvertToDistribution");
484 distrib->setProperty("Workspace", outputWS);
485 distrib->executeAsChildAlg();
486 outputWS = distrib->getProperty("Workspace");
487 } else {
488 // Discard events outside nominal bounds
489 auto crop = createChildAlgorithm("CropWorkspace");
490 crop->setProperty("InputWorkspace", outputWS);
491 crop->setProperty("OutputWorkspace", outputWS);
492 crop->setProperty("XMin", etBinning[0]);
493 crop->setProperty("XMax", etBinning[2]);
494 crop->executeAsChildAlg();
495 outputWS = crop->getProperty("OutputWorkspace");
496 }
497
498 // Normalise by the detector vanadium if necessary
499 MatrixWorkspace_sptr detVanWS = this->getProperty("IntegratedDetectorVanadium");
500 if (detVanWS) {
501 auto divide = createChildAlgorithm("Divide");
502 divide->setProperty("LHSWorkspace", outputWS);
503 divide->setProperty("RHSWorkspace", detVanWS);
504 divide->setProperty("OutputWorkspace", outputWS);
505 divide->executeAsChildAlg();
506 outputWS = divide->getProperty("OutputWorkspace");
507 }
508
509 // Mask and group workspace if necessary.
510 MatrixWorkspace_sptr maskWS = this->getProperty("MaskWorkspace");
511 MatrixWorkspace_sptr groupWS = this->getProperty("GroupingWorkspace");
512 std::string oldGroupFile;
513 std::string filePropMod = this->getProperty("AlternateGroupingTag");
514 std::string fileProp = filePropMod + "OldGroupingFilename";
515 if (reductionManager->existsProperty(fileProp))
516 oldGroupFile = reductionManager->getPropertyValue(fileProp);
517 auto remap = createChildAlgorithm("DgsRemap");
518 remap->setProperty("InputWorkspace", outputWS);
519 remap->setProperty("OutputWorkspace", outputWS);
520 remap->setProperty("MaskWorkspace", maskWS);
521 remap->setProperty("GroupingWorkspace", groupWS);
522 remap->setProperty("OldGroupingFile", oldGroupFile);
523 remap->executeAsChildAlg();
524 outputWS = remap->getProperty("OutputWorkspace");
525
526 if ("ISIS" == facility) {
527 double scaleFactor = inputWS->getInstrument()->getNumberParameter("scale-factor")[0];
528 auto scaleAlg = createChildAlgorithm("Scale");
529 scaleAlg->setProperty("InputWorkspace", outputWS);
530 scaleAlg->setProperty("Factor", scaleFactor);
531 scaleAlg->setProperty("Operation", "Multiply");
532 scaleAlg->setProperty("OutputWorkspace", outputWS);
533 scaleAlg->executeAsChildAlg();
534 }
535 this->setProperty("OutputWorkspace", outputWS);
536}
537
538} // namespace Mantid::WorkflowAlgorithms
std::string name
Definition Run.cpp:60
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
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.
Kernel::Logger & g_log
Definition Algorithm.h:422
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:126
A specialised Property class for holding a series of time-value pairs.
TimeSeriesPropertyStatistics getStatistics(const Kernel::TimeROI *roi=nullptr) const override
Return a TimeSeriesPropertyStatistics object.
Class for 3D vectors.
Definition V3D.h:34
constexpr double X() const noexcept
Get x.
Definition V3D.h:238
constexpr double Y() const noexcept
Get y.
Definition V3D.h:239
constexpr double Z() const noexcept
Get z.
Definition V3D.h:240
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
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:14
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition EmptyValues.h:42
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