Mantid
Loading...
Searching...
No Matches
WeightingStrategy.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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
9#include "MantidAlgorithms/DllConfig.h"
10#include "MantidKernel/V3D.h"
11
12namespace Mantid {
13namespace Algorithms {
14
23class MANTID_ALGORITHMS_DLL WeightingStrategy {
24public:
26 WeightingStrategy(const double cutOff);
30 virtual ~WeightingStrategy() = default;
37 virtual double weightAt(const Mantid::Kernel::V3D &distance) = 0;
38
46 virtual double weightAt(const double &adjX, const double &ix, const double &adjY, const double &iy) = 0;
47
48protected:
50 double m_cutOff;
51};
52
53/*
54Flat (no weighting) strategy. Concrete WeightingStrategy
55*/
56class MANTID_ALGORITHMS_DLL FlatWeighting : public WeightingStrategy {
57public:
58 double weightAt(const double &, const double &, const double &, const double &) override;
59 double weightAt(const Mantid::Kernel::V3D &) override;
60};
61
62/*
63Linear weighting strategy.
64*/
65class MANTID_ALGORITHMS_DLL LinearWeighting : public WeightingStrategy {
66public:
67 LinearWeighting(const double cutOff);
68 double weightAt(const Mantid::Kernel::V3D &) override;
69 double weightAt(const double &adjX, const double &ix, const double &adjY, const double &iy) override;
70};
71
72/*
73Parabolic weighting strategy.
74*/
75class MANTID_ALGORITHMS_DLL ParabolicWeighting : public WeightingStrategy {
76public:
77 ParabolicWeighting(const double cutOff);
78 double weightAt(const Mantid::Kernel::V3D &) override;
79 double weightAt(const double &adjX, const double &ix, const double &adjY, const double &iy) override;
80};
81
82/*
83Null weighting strategy.
84*/
85class MANTID_ALGORITHMS_DLL NullWeighting : public WeightingStrategy {
86public:
87 double weightAt(const Mantid::Kernel::V3D &) override;
88 double weightAt(const double &, const double &, const double &, const double &) override;
89};
90
91/*
92Gaussian nD Strategy.
93
94y = exp(-0.5*((r./p(1)).^2) where p = sqtr(2)*sigma
95*/
96class MANTID_ALGORITHMS_DLL GaussianWeightingnD : public WeightingStrategy {
97public:
98 GaussianWeightingnD(double cutOff, double sigma);
99 double weightAt(const Mantid::Kernel::V3D &) override;
100 double weightAt(const double &, const double &, const double &, const double &) override;
101
102private:
103 double calculateGaussian(const double normalisedDistanceSq);
105};
106
107} // namespace Algorithms
108} // namespace Mantid
double sigma
Definition: GetAllEi.cpp:156
virtual double weightAt(const double &adjX, const double &ix, const double &adjY, const double &iy)=0
Calculate the weight at distance from epicenter.
virtual double weightAt(const Mantid::Kernel::V3D &distance)=0
Calculate the weight at distance from epicenter.
virtual ~WeightingStrategy()=default
Destructor.
Class for 3D vectors.
Definition: V3D.h:34
Helper class which provides the Collimation Length for SANS instruments.