Mantid
Loading...
Searching...
No Matches
PaalmanPingsAbsorptionCorrection.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 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 +
10#include "MantidAPI/Run.h"
11#include "MantidAPI/Sample.h"
22#include "MantidHistogramData/Interpolate.h"
25#include "MantidKernel/Unit.h"
27
28namespace Mantid::Algorithms {
29
30// Register the algorithm into the AlgorithmFactory
31DECLARE_ALGORITHM(PaalmanPingsAbsorptionCorrection)
32
33using namespace API;
34using namespace Geometry;
35using HistogramData::interpolateLinearInplace;
36using namespace Kernel;
37using namespace Mantid::DataObjects;
38
39namespace {
40// the maximum number of elements to combine at once in the pairwise summation
41constexpr size_t MAX_INTEGRATION_LENGTH{1000};
42
43inline size_t findMiddle(const size_t start, const size_t stop) {
44 auto half = static_cast<size_t>(floor(.5 * (static_cast<double>(stop - start))));
45 return start + half;
46}
47
48} // namespace
49
51 : API::Algorithm(), m_inputWS(), m_sampleObject(nullptr), m_containerObject(nullptr), m_sampleL1s(),
52 m_sample_containerL1s(), m_sampleElementVolumes(), m_sampleElementPositions(), m_numSampleVolumeElements(0),
53 m_sampleVolume(0.0), m_containerL1s(), m_container_sampleL1s(), m_containerElementVolumes(),
54 m_containerElementPositions(), m_numContainerVolumeElements(0), m_containerVolume(0.0),
55 m_ampleLinearCoefTotScatt(0), m_containerLinearCoefTotScatt(0), m_num_lambda(0), m_xStep(0),
56 m_cubeSideSample(0.0), m_cubeSideContainer(0.0) {}
57
59
60 // The input workspace must have an instrument and units of wavelength
61 auto wsValidator = std::make_shared<CompositeValidator>();
62 wsValidator->add<WorkspaceUnitValidator>("Wavelength");
63 wsValidator->add<InstrumentValidator>();
64
65 declareProperty(std::make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::Input, wsValidator),
66 "The X values for the input workspace must be in units of wavelength");
67 declareProperty(std::make_unique<WorkspaceProperty<WorkspaceGroup>>("OutputWorkspace", "", Direction::Output),
68 "Output workspace name");
69
70 auto positiveInt = std::make_shared<BoundedValidator<int64_t>>();
71 positiveInt->setLower(1);
72 declareProperty("NumberOfWavelengthPoints", static_cast<int64_t>(EMPTY_INT()), positiveInt,
73 "The number of wavelength points for which the numerical integral is\n"
74 "calculated (default: all points)");
75
76 auto moreThanZero = std::make_shared<BoundedValidator<double>>();
77 moreThanZero->setLower(0.001);
78 declareProperty("ElementSize", 1.0, moreThanZero, "The size of one side of an integration element cube in mm");
79
80 declareProperty("ContainerElementSize", EMPTY_DBL(),
81 "The size of one side of an integration element cube in mm for container."
82 "Default to be the same as ElementSize.");
83}
84
85std::map<std::string, std::string> PaalmanPingsAbsorptionCorrection::validateInputs() {
86 std::map<std::string, std::string> result;
87
88 // verify that the container information is there if requested
89 API::MatrixWorkspace_const_sptr wksp = getProperty("InputWorkspace");
90 const auto &sample = wksp->sample();
91 if (sample.hasEnvironment()) {
92 const auto numComponents = sample.getEnvironment().nelements();
93 // first element is assumed to be the container
94 if (numComponents == 0) {
95 result["InputWorkspace"] = "Sample does not have a container defined";
96 }
97 } else {
98 result["InputWorkspace"] = "Sample does not have a container defined";
99 }
100 return result;
101}
102
104 // Retrieve the input workspace
105 m_inputWS = getProperty("InputWorkspace");
106 // Cache the beam direction
107 m_beamDirection = m_inputWS->getInstrument()->getBeamDirection();
108
109 // Get the input parameters
111
112 // Create the output workspaces
113
114 // A_s,s - absorption factor for scattering and self-absorption in sample
115 MatrixWorkspace_sptr ass = create<HistoWorkspace>(*m_inputWS);
116 ass->setDistribution(true); // The output of this is a distribution
117 ass->setYUnit(""); // Need to explicitly set YUnit to nothing
118 ass->setYUnitLabel("Attenuation factor");
119 // A_s,sc - absorption factor for scattering in sample and absorption in both
120 // sample and container
121 MatrixWorkspace_sptr assc = create<HistoWorkspace>(*m_inputWS);
122 assc->setDistribution(true); // The output of this is a distribution
123 assc->setYUnit(""); // Need to explicitly set YUnit to nothing
124 assc->setYUnitLabel("Attenuation factor");
125 // A_c,c - absorption factor for scattering and self-absorption in container
126 MatrixWorkspace_sptr acc = create<HistoWorkspace>(*m_inputWS);
127 acc->setDistribution(true); // The output of this is a distribution
128 acc->setYUnit(""); // Need to explicitly set YUnit to nothing
129 acc->setYUnitLabel("Attenuation factor");
130 // A_c,sc - absorption factor for scattering in container and absorption in
131 // both sample and container
132 MatrixWorkspace_sptr acsc = create<HistoWorkspace>(*m_inputWS);
133 acsc->setDistribution(true); // The output of this is a distribution
134 acsc->setYUnit(""); // Need to explicitly set YUnit to nothing
135 acsc->setYUnitLabel("Attenuation factor");
136
137 constructSample(m_inputWS->mutableSample());
138
139 const auto numHists = static_cast<int64_t>(m_inputWS->getNumberHistograms());
140 const auto specSize = static_cast<int64_t>(m_inputWS->blocksize());
141
142 // If the number of wavelength points has not been given, use them all
144 m_num_lambda = specSize;
145 m_xStep = specSize / m_num_lambda; // Bin step between points to calculate
146
147 if (m_xStep == 0) // Number of wavelength points >number of histogram points
148 m_xStep = 1;
149
150 std::ostringstream message;
151 message << "Numerical integration performed every " << m_xStep << " wavelength points";
152 g_log.information(message.str());
153 message.str("");
154
155 // Calculate the cached values of L1, element volumes, and geometry size
157 if (m_sampleL1s.empty() || m_containerL1s.empty()) {
158 throw std::runtime_error("Failed to define any initial scattering gauge volume for geometry");
159 }
160
161 const auto &spectrumInfo = m_inputWS->spectrumInfo();
162 Progress prog(this, 0.0, 1.0, numHists);
163 // Loop over the spectra
164 PARALLEL_FOR_IF(Kernel::threadSafe(*m_inputWS, *ass, *assc, *acc, *acsc))
165 for (int64_t i = 0; i < int64_t(numHists); ++i) {
167 // Copy over bins
168 ass->setSharedX(i, m_inputWS->sharedX(i));
169 assc->setSharedX(i, m_inputWS->sharedX(i));
170 acc->setSharedX(i, m_inputWS->sharedX(i));
171 acsc->setSharedX(i, m_inputWS->sharedX(i));
172
173 if (!spectrumInfo.hasDetectors(i)) {
174 g_log.information() << "Spectrum " << i << " does not have a detector defined for it\n";
175 continue;
176 }
177 const auto &det = spectrumInfo.detector(i);
178
179 // scattering and self-absorption in sample L2 distances, used for A_s,s and
180 // A_s,sc
181 std::vector<double> sample_L2s(m_numSampleVolumeElements);
182 // scattering in sample and absorption in both sample and container L2
183 // distance, used for A_s,sc
184 std::vector<double> sample_container_L2s(m_numSampleVolumeElements);
185 // absorption factor for scattering and self-absorption in container L2
186 // distances, used for A_c,c and A_c,sc
187 std::vector<double> container_L2s(m_numContainerVolumeElements);
188 // scattering in container and absorption in both sample and container L2
189 // distances, used for A_c,sc
190 std::vector<double> container_sample_L2s(m_numContainerVolumeElements);
191
192 calculateDistances(det, sample_L2s, sample_container_L2s, container_L2s, container_sample_L2s);
193
194 const auto wavelengths = m_inputWS->points(i);
195 // these need to have the minus sign applied still
196 const auto sampleLinearCoefAbs = m_material.linearAbsorpCoef(wavelengths.cbegin(), wavelengths.cend());
197 const auto containerLinearCoefAbs = m_containerMaterial.linearAbsorpCoef(wavelengths.cbegin(), wavelengths.cend());
198
199 // Get a reference to the Y's in the output WS for storing the factors
200 auto &assY = ass->mutableY(i);
201 auto &asscY = assc->mutableY(i);
202 auto &accY = acc->mutableY(i);
203 auto &acscY = acsc->mutableY(i);
204
205 // Loop through the bins in the current spectrum every m_xStep
206 for (int64_t j = 0; j < specSize; j = j + m_xStep) {
207 double integral = 0.0;
208 double crossIntegral = 0.0;
209
210 doIntegration(integral, crossIntegral, -sampleLinearCoefAbs[j], m_ampleLinearCoefTotScatt, m_sampleElementVolumes,
211 m_sampleL1s, sample_L2s, -containerLinearCoefAbs[j], m_containerLinearCoefTotScatt,
212 m_sample_containerL1s, sample_container_L2s, 0, m_numSampleVolumeElements);
213 assY[j] = integral / m_sampleVolume; // Divide by total volume of the shape
214 asscY[j] = crossIntegral / m_sampleVolume; // Divide by total volume of the shape
215
216 integral = 0.0;
217 crossIntegral = 0.0;
218 doIntegration(integral, crossIntegral, -containerLinearCoefAbs[j], m_containerLinearCoefTotScatt,
219 m_containerElementVolumes, m_containerL1s, container_L2s, -sampleLinearCoefAbs[j],
220 m_ampleLinearCoefTotScatt, m_container_sampleL1s, container_sample_L2s, 0,
222 accY[j] = integral / m_containerVolume; // Divide by total volume of the shape
223 acscY[j] = crossIntegral / m_containerVolume; // Divide by total volume of the shape
224
225 // Make certain that last point is calculated
226 if (m_xStep > 1 && j + m_xStep >= specSize && j + 1 != specSize) {
227 j = specSize - m_xStep - 1;
228 }
229 }
230
231 // Interpolate linearly between points separated by m_xStep,
232 // last point required
233 if (m_xStep > 1) {
234 auto histnew = ass->histogram(i);
235 interpolateLinearInplace(histnew, m_xStep);
236 ass->setHistogram(i, histnew);
237 auto histnew2 = assc->histogram(i);
238 interpolateLinearInplace(histnew2, m_xStep);
239 assc->setHistogram(i, histnew2);
240 auto histnew3 = acc->histogram(i);
241 interpolateLinearInplace(histnew3, m_xStep);
242 acc->setHistogram(i, histnew3);
243 auto histnew4 = acsc->histogram(i);
244 interpolateLinearInplace(histnew4, m_xStep);
245 acsc->setHistogram(i, histnew4);
246 }
247
248 prog.report();
249
251 }
253
254 g_log.information() << "Total number of elements in the integration was " << m_sampleL1s.size() << '\n';
255
256 const std::string outWSName = getProperty("OutputWorkspace");
257
258 std::vector<std::string> names;
259 names.emplace_back(outWSName + "_ass");
260 API::AnalysisDataService::Instance().addOrReplace(names.back(), ass);
261 names.emplace_back(outWSName + "_assc");
262 API::AnalysisDataService::Instance().addOrReplace(names.back(), assc);
263 names.emplace_back(outWSName + "_acc");
264 API::AnalysisDataService::Instance().addOrReplace(names.back(), acc);
265 names.emplace_back(outWSName + "_acsc");
266 API::AnalysisDataService::Instance().addOrReplace(names.back(), acsc);
267
268 auto group = createChildAlgorithm("GroupWorkspaces");
269 group->initialize();
270 group->setProperty("InputWorkspaces", names);
271 group->setProperty("OutputWorkspace", outWSName);
272 group->execute();
273 API::WorkspaceGroup_sptr outWS = group->getProperty("OutputWorkspace");
274
275 setProperty("OutputWorkspace", outWS);
276}
277
282 // First, check if a 'gauge volume' has been defined. If not, it's the same as
283 // the sample.
284 auto integrationVolume = std::shared_ptr<const IObject>(m_sampleObject->clone());
285 if (m_inputWS->run().hasProperty("GaugeVolume")) {
286 integrationVolume = constructGaugeVolume();
287 }
288
289 auto raster = Geometry::Rasterize::calculate(m_beamDirection, *integrationVolume, m_cubeSideSample);
290 m_sampleVolume = raster.totalvolume;
291 if (raster.l1.size() == 0)
292 throw std::runtime_error("Failed to rasterize shape");
293 // move over the information
294 m_numSampleVolumeElements = raster.l1.size();
295 m_sampleL1s = std::move(raster.l1);
296 m_sampleElementPositions = std::move(raster.position);
297 m_sampleElementVolumes = std::move(raster.volume);
298
299 // now for the container
300 integrationVolume = std::shared_ptr<const IObject>(m_containerObject->clone());
301 if (m_inputWS->run().hasProperty("GaugeVolume")) {
302 integrationVolume = constructGaugeVolume();
303 }
304
306 m_containerVolume = raster.totalvolume;
307 if (raster.l1.size() == 0)
308 throw std::runtime_error("Failed to rasterize shape");
309 // move over the information
310 m_numContainerVolumeElements = raster.l1.size();
311 m_containerL1s = std::move(raster.l1);
312 m_containerElementPositions = std::move(raster.position);
313 m_containerElementVolumes = std::move(raster.volume);
314
315 // Get the L1s for the cross terms
316
317 // L1s for absorbed by the container to be scattered by the sample
319 for (size_t i = 0; i < m_numSampleVolumeElements; ++i) {
323 }
324
325 // L1s for absorbed by the sample to be scattered by the container
327 for (size_t i = 0; i < m_numContainerVolumeElements; ++i) {
331 }
332}
333
334std::shared_ptr<const Geometry::IObject> PaalmanPingsAbsorptionCorrection::constructGaugeVolume() {
335 g_log.information("Calculating scattering within the gauge volume defined on "
336 "the input workspace");
337
338 // Retrieve and create the gauge volume shape
339 std::shared_ptr<const Geometry::IObject> volume =
340 ShapeFactory().createShape(m_inputWS->run().getProperty("GaugeVolume")->value());
341
342 return volume;
343}
344
347
348 // get the material from the correct component
349 const auto &sampleObj = m_inputWS->sample();
350 m_material = sampleObj.getShape().material();
351 m_containerMaterial = sampleObj.getEnvironment().getContainer().material();
352
353 // NOTE: the angstrom^-2 to barns and the angstrom^-1 to cm^-1
354 // will cancel for mu to give units: cm^-1
358
359 m_num_lambda = getProperty("NumberOfWavelengthPoints");
360
361 // Call the virtual function for any further properties
362 m_cubeSideSample = getProperty("ElementSize"); // in mm
363 m_cubeSideSample *= 0.001; // now in m
364 // use the same elementsize for container if not specified, otherwise use the specified value
365 m_cubeSideContainer = getProperty("ContainerElementSize"); // in mm
366 m_cubeSideContainer = isDefault("ContainerElementSize") ? m_cubeSideSample : m_cubeSideContainer * 1e-3;
367}
368
371 m_sampleObject = &sample.getShape();
373
374 // Check there is one, and fail if not
376 const std::string mess("No shape has been defined for the sample in the input workspace");
377 g_log.error(mess);
378 throw std::invalid_argument(mess);
379 }
380 // Check there is one, and fail if not
382 const std::string mess("No shape has been defined for the container in the input workspace");
383 g_log.error(mess);
384 throw std::invalid_argument(mess);
385 }
386}
387
389void PaalmanPingsAbsorptionCorrection::calculateDistances(const IDetector &detector, std::vector<double> &sample_L2s,
390 std::vector<double> &sample_container_L2s,
391 std::vector<double> &container_L2s,
392 std::vector<double> &container_sample_L2s) const {
393 V3D detectorPos(detector.getPos());
394 if (detector.nDets() > 1) {
395 // We need to make sure this is right for grouped detectors - should use
396 // average theta & phi
397 detectorPos.spherical(detectorPos.norm(), detector.getTwoTheta(V3D(), V3D(0, 0, 1)) * 180.0 / M_PI,
398 detector.getPhi() * 180.0 / M_PI);
399 }
400
401 for (size_t i = 0; i < m_numSampleVolumeElements; ++i) {
402 // Create track for distance between scattering point in sample and detector
403 const V3D direction = normalize(detectorPos - m_sampleElementPositions[i]);
404 Track outgoing(m_sampleElementPositions[i], direction);
405
406 // find distance in sample
408 sample_L2s[i] = outgoing.totalDistInsideObject();
409
410 outgoing.clearIntersectionResults();
411
412 // find distance in container
414 sample_container_L2s[i] = outgoing.totalDistInsideObject();
415 }
416
417 for (size_t i = 0; i < m_numContainerVolumeElements; ++i) {
418 // Create track for distance between scattering point in container and
419 // detector
420 const V3D direction = normalize(detectorPos - m_containerElementPositions[i]);
421 Track outgoing(m_containerElementPositions[i], direction);
422
423 // find distance in container
425 container_L2s[i] = outgoing.totalDistInsideObject();
426
427 outgoing.clearIntersectionResults();
428
429 // find distance in sample
431 container_sample_L2s[i] = outgoing.totalDistInsideObject();
432 }
433}
434
435// the integrations are done using pairwise summation to reduce
436// issues from adding lots of little numbers together
437// https://en.wikipedia.org/wiki/Pairwise_summation
438
441
442void PaalmanPingsAbsorptionCorrection::doIntegration(double &integral, double &crossIntegral,
443 const double linearCoefAbs, const double linearCoefTotScatt,
444 const std::vector<double> &elementVolumes,
445 const std::vector<double> &L1s, const std::vector<double> &L2s,
446 const double linearCoefAbs2, const double linearCoefTotScatt2,
447 const std::vector<double> &L1s2, const std::vector<double> &L2s2,
448 const size_t startIndex, const size_t endIndex) const {
449 if (endIndex - startIndex > MAX_INTEGRATION_LENGTH) {
450 size_t middle = findMiddle(startIndex, endIndex);
451
452 doIntegration(integral, crossIntegral, linearCoefAbs, linearCoefTotScatt, elementVolumes, L1s, L2s, linearCoefAbs2,
453 linearCoefTotScatt2, L1s2, L2s2, startIndex, middle);
454 doIntegration(integral, crossIntegral, linearCoefAbs, linearCoefTotScatt, elementVolumes, L1s, L2s, linearCoefAbs2,
455 linearCoefTotScatt2, L1s2, L2s2, middle, endIndex);
456 } else {
457
458 // Iterate over all the elements, summing up the integral
459 for (size_t i = startIndex; i < endIndex; ++i) {
460 double exponent = (linearCoefAbs + linearCoefTotScatt) * (L1s[i] + L2s[i]);
461 integral += (exp(exponent) * (elementVolumes[i]));
462 exponent += (linearCoefAbs2 + linearCoefTotScatt2) * (L1s2[i] + L2s2[i]);
463 crossIntegral += (exp(exponent) * (elementVolumes[i]));
464 }
465 }
466}
467
468} // namespace Mantid::Algorithms
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
Definition: MultiThreaded.h:94
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
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
bool isDefault(const std::string &name) const
Definition: Algorithm.cpp:2084
static bool isEmpty(const NumT toCheck)
checks that the value was not set by users, uses the value in empty double/int.
A validator which checks that a workspace has a valid instrument.
Helper class for reporting progress from algorithms.
Definition: Progress.h:25
This class stores information about the sample used in particular run.
Definition: Sample.h:33
const Geometry::IObject & getShape() const
Return the sample shape.
Definition: Sample.cpp:102
const Geometry::SampleEnvironment & getEnvironment() const
Get a reference to the sample's environment.
Definition: Sample.cpp:136
A property class for workspaces.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
API::MatrixWorkspace_sptr m_inputWS
A pointer to the input workspace.
void constructSample(API::Sample &sample)
Create the sample object using the Geometry classes, or use the existing one.
std::vector< double > m_sampleL1s
Cached sample L1 distances.
double m_containerLinearCoefTotScatt
The total scattering cross-section in 1/m for the container.
void initialiseCachedDistances()
Calculate the distances for L1 (for both self-absorption and absorption by other object) and element ...
std::vector< double > m_containerL1s
Cached container L1 distances.
size_t m_numContainerVolumeElements
The number of container volume elements.
std::vector< double > m_sample_containerL1s
Cached L1 distances through container hitting sample.
void retrieveBaseProperties()
Fetch the properties and set the appropriate member variables.
void calculateDistances(const Geometry::IDetector &detector, std::vector< double > &sample_L2s, std::vector< double > &sample_container_L2s, std::vector< double > &container_L2s, std::vector< double > &container_sample_L2s) const
Calculate the distances traversed by the neutrons within the sample.
std::vector< Kernel::V3D > m_sampleElementPositions
Cached sample element positions.
const Geometry::IObject * m_sampleObject
Local cache of sample object.
std::shared_ptr< const Geometry::IObject > constructGaugeVolume()
Create the gague volume for the correction.
int64_t m_num_lambda
The number of points in wavelength, the rest is.
size_t m_numSampleVolumeElements
The number of sample volume elements.
std::map< std::string, std::string > validateInputs() override
Method checking errors on ALL the inputs, before execution.
const Geometry::IObject * m_containerObject
Local cache of container object.
std::vector< Kernel::V3D > m_containerElementPositions
Cached container element positions.
double m_cubeSideContainer
The length of the side of an element cube in m.
double m_cubeSideSample
The length of the side of an element cube in m.
void doIntegration(double &integral, double &crossIntegral, const double linearCoefAbs, const double linearCoefTotScatt, const std::vector< double > &elementVolumes, const std::vector< double > &L1s, const std::vector< double > &L2s, const double linearCoefAbs2, const double linearCoefTotScatt2, const std::vector< double > &L1s2, const std::vector< double > &L2s2, const size_t startIndex, const size_t endIndex) const
Carries out the numerical integration over the sample for elastic instruments.
std::vector< double > m_containerElementVolumes
Cached container element volumes.
std::vector< double > m_container_sampleL1s
Cached L1 distances through sample hitting container.
double m_ampleLinearCoefTotScatt
The total scattering cross-section in 1/m for the sample.
std::vector< double > m_sampleElementVolumes
Cached sample element volumes.
virtual Kernel::V3D getPos() const =0
Get the position of the IComponent. Tree structure is traverse through the.
Interface class for detector objects.
Definition: IDetector.h:43
virtual double getPhi() const =0
Gives the phi of this detector object in radians.
virtual std::size_t nDets() const =0
Get the number of physical detectors this object represents.
virtual double getTwoTheta(const Kernel::V3D &observer, const Kernel::V3D &axis) const =0
Gives the angle of this detector object with respect to an axis.
virtual int interceptSurface(Geometry::Track &) const =0
virtual IObject * clone() const =0
virtual bool hasValidShape() const =0
const Container & getContainer() const
Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.
Definition: ShapeFactory.h:89
std::shared_ptr< CSGObject > createShape(Poco::XML::Element *pElem)
Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain t...
Defines a track as a start point and a direction.
Definition: Track.h:165
void clearIntersectionResults()
Clear the current set of intersection results.
Definition: Track.cpp:55
double totalDistInsideObject() const
Returns the sum of all the links distInsideObject in the track.
Definition: Track.cpp:254
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void error(const std::string &msg)
Logs at error level.
Definition: Logger.cpp:77
void information(const std::string &msg)
Logs at information level.
Definition: Logger.cpp:105
double numberDensityEffective() const
Get the effective number density.
Definition: Material.cpp:195
double linearAbsorpCoef(const double lambda=PhysicalConstants::NeutronAtom::ReferenceLambda) const
Returns the linear coefficient of absorption for the material in units of cm^-1 this should match the...
Definition: Material.cpp:309
double totalScatterXSection() const
Return the total scattering cross section for a given wavelength in barns.
Definition: Material.cpp:252
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
Definition: ProgressBase.h:51
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
Class for 3D vectors.
Definition: V3D.h:34
void spherical(const double R, const double theta, const double phi) noexcept
Sets the vector position based on spherical coordinates.
Definition: V3D.cpp:57
double norm() const noexcept
Definition: V3D.h:263
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
MANTID_GEOMETRY_DLL Raster calculate(const Kernel::V3D &beamDirection, const IObject &shape, const double cubeSizeInMetre)
Definition: Rasterize.cpp:181
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
Definition: MultiThreaded.h:22
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
Definition: V3D.h:341
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
Definition: EmptyValues.h:25
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition: EmptyValues.h:43
@ Input
An input workspace.
Definition: Property.h:53
@ Output
An output workspace.
Definition: Property.h:54