Mantid
Loading...
Searching...
No Matches
RadiusSum.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 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 +
7#pragma once
8
10#include "MantidAlgorithms/DllConfig.h"
11#include "MantidKernel/V3D.h"
12
13namespace Mantid {
14namespace Algorithms {
15
23class MANTID_ALGORITHMS_DLL RadiusSum final : public API::Algorithm {
24public:
25 const std::string name() const override;
27 const std::string summary() const override {
28 return "Sum of all the counts inside a ring against the scattering angle "
29 "for each Radius.";
30 }
31
32 int version() const override;
33 const std::vector<std::string> seeAlso() const override { return {"RingProfile", "RadiusSum"}; }
34 const std::string category() const override;
35
36 static bool inputWorkspaceHasInstrumentAssociated(const API::MatrixWorkspace_sptr &);
37
38 static std::vector<double> getBoundariesOfNumericImage(const API::MatrixWorkspace_sptr &);
39
40 static std::vector<double> getBoundariesOfInstrument(const API::MatrixWorkspace_sptr &);
41
42 static void centerIsInsideLimits(const std::vector<double> &centre, const std::vector<double> &boundaries);
43
44private:
45 void init() override;
46 void exec() override;
47
48 std::vector<double> processInstrumentRadiusSum();
49 std::vector<double> processNumericImageRadiusSum();
50
51 void cacheInputPropertyValues();
52 void inputValidationSanityCheck();
53 void numBinsIsReasonable();
54 std::vector<double> getBoundariesOfInputWorkspace();
55
56 double getMaxDistance(const Kernel::V3D &centre, const std::vector<double> &boundary_limits);
57
58 void setUpOutputWorkspace(const std::vector<double> &values);
59
60 int getBinForPixelPos(const Kernel::V3D &pos);
61
63 int num_bins = 0;
64
66 double min_radius = 0.0, max_radius = 0.0;
67
68 double getMinBinSizeForInstrument(const API::MatrixWorkspace_sptr &);
69 double getMinBinSizeForNumericImage(const API::MatrixWorkspace_sptr &);
70
94 int fromDistanceToBin(double distance) {
95 return static_cast<int>(((distance - min_radius) * num_bins) / (max_radius - min_radius));
96 }
97
98 void normalizeOutputByRadius(std::vector<double> &values, double exp_power);
99};
100
101} // namespace Algorithms
102} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
int fromDistanceToBin(double distance)
Return the bin position for a given distance From the input, it is defined the limits of distances as...
Definition: RadiusSum.h:94
API::MatrixWorkspace_sptr inputWS
Definition: RadiusSum.h:65
const std::string summary() const override
Summary of algorithms purpose.
Definition: RadiusSum.h:27
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: RadiusSum.h:33
Class for 3D vectors.
Definition: V3D.h:34
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.