Mantid
Loading...
Searching...
No Matches
VesuvioCalculateGammaBackground.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 "MantidCurveFitting/DllConfig.h"
13
14#include <unordered_map>
15
16namespace Mantid {
17
18namespace Kernel {
19class V3D;
20}
21
22namespace CurveFitting {
23namespace Functions {
24struct ResolutionParams;
25}
26namespace Algorithms {
27//---------------------------------------------------------------------------
28// Forward declarations
29//---------------------------------------------------------------------------
30struct DetectorParams;
31
32class MANTID_CURVEFITTING_DLL VesuvioCalculateGammaBackground final : public API::Algorithm {
33public:
36
37 const std::string name() const override;
39 const std::string summary() const override {
40 return "Calculates the background due to gamma rays produced when neutrons "
41 "are absorbed by shielding.";
42 }
43 const std::vector<std::string> seeAlso() const override { return {"VesuvioCorrections"}; }
44
45 int version() const override;
46 const std::string category() const override;
47
48private:
49 void init() override;
50 void exec() override;
51
53 struct FoilInfo {
54 double thetaMin;
55 double thetaMax;
57 double gaussWidth;
58 };
59
62 bool calculateBackground(size_t inputIndex, size_t outputIndex);
64 void applyCorrection(const size_t inputIndex, const size_t outputIndex);
66 void calculateSpectrumFromDetector(const size_t inputIndex, const size_t outputIndex);
68 void calculateBackgroundFromFoils(const size_t inputIndex, const size_t outputIndex);
70 void calculateBackgroundSingleFoil(std::vector<double> &ctfoil, const size_t wsIndex, const FoilInfo &foilInfo,
71 const Kernel::V3D &detPos, const DetectorParams &detPar,
74 std::vector<double> calculateTofSpectrum(const std::vector<double> &inSpectrum, std::vector<double> &tmpWork,
75 const size_t wsIndex, const DetectorParams &detpar,
77
79 void retrieveInputs();
81 void createOutputWorkspaces();
83 void cacheInstrumentGeometry();
85 std::pair<double, double> calculateThetaRange(const Geometry::IComponent_const_sptr &foilComp, const double radius,
86 const unsigned int horizDir) const;
87
91 std::unordered_map<size_t, size_t> m_indices;
93 std::string m_profileFunction;
95 size_t m_npeaks;
97 std::set<specnum_t> m_reversed;
98
102 double m_l1;
109
111 std::vector<FoilInfo> m_foils0;
113 std::vector<FoilInfo> m_foils1;
118
120 std::unique_ptr<API::Progress> m_progress = nullptr;
121};
122
123} // namespace Algorithms
124} // namespace CurveFitting
125} // namespace Mantid
double radius
Definition: Rasterize.cpp:31
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
const std::string summary() const override
Summary of algorithms purpose.
double m_foilRadius
Radius of (imaginary) circle that foils sit on.
std::set< specnum_t > m_reversed
List of spectra numbers whose background sum is to be reversed.
std::vector< FoilInfo > m_foils0
Description of foils in the position 0.
std::vector< FoilInfo > m_foils1
Description of foils in the position 0.
double m_foilUpMax
Minimum in up dir to stop integration over foil volume.
std::unordered_map< size_t, size_t > m_indices
Sorted indices to correct.
std::string m_profileFunction
Function that defines the mass profile.
API::MatrixWorkspace_sptr m_backgroundWS
Stores the value of the calculated background.
double m_foilUpMin
Minimum in up dir to start integration over foil volume.
Class for 3D vectors.
Definition: V3D.h:34
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
std::shared_ptr< const IComponent > IComponent_const_sptr
Typdef of a shared pointer to a const IComponent.
Definition: IComponent.h:161
Helper class which provides the Collimation Length for SANS instruments.
Simple data structure to store nominal detector values It avoids some functions taking a huge number ...
Simple data structure to store resolution parameter values It avoids some functions taking a huge num...