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 <map>
15
16#include <span>
17
18namespace Mantid {
19
20namespace Kernel {
21class V3D;
22}
23
24namespace CurveFitting {
25namespace Functions {
26struct ResolutionParams;
27}
28namespace Algorithms {
29//---------------------------------------------------------------------------
30// Forward declarations
31//---------------------------------------------------------------------------
32struct DetectorParams;
33
34class MANTID_CURVEFITTING_DLL VesuvioCalculateGammaBackground final : public API::Algorithm {
35public:
38
39 const std::string name() const override;
41 const std::string summary() const override {
42 return "Calculates the background due to gamma rays produced when neutrons "
43 "are absorbed by shielding.";
44 }
45 const std::vector<std::string> seeAlso() const override { return {"VesuvioCorrections"}; }
46
47 int version() const override;
48 const std::string category() const override;
49
50private:
51 void init() override;
52 void exec() override;
53
55 struct FoilInfo {
56 double thetaMin;
57 double thetaMax;
59 double gaussWidth;
60 };
61
64 bool calculateBackground(size_t inputIndex, size_t outputIndex);
66 void applyCorrection(const size_t inputIndex, const size_t outputIndex);
68 void calculateSpectrumFromDetector(const size_t inputIndex, const size_t outputIndex);
70 void calculateBackgroundFromFoils(const size_t inputIndex, const size_t outputIndex);
72 void calculateBackgroundSingleFoil(std::vector<double> &ctfoil, const size_t wsIndex, const FoilInfo &foilInfo,
73 const Kernel::V3D &detPos, const DetectorParams &detPar,
76 std::vector<double> calculateTofSpectrum(std::span<double const> inSpectrum, std::vector<double> &tmpWork,
77 const size_t wsIndex, const DetectorParams &detpar,
79
81 void retrieveInputs();
83 void createOutputWorkspaces();
85 void cacheInstrumentGeometry();
87 std::pair<double, double> calculateThetaRange(const Geometry::IComponent_const_sptr &foilComp, const double radius,
88 const unsigned int horizDir) const;
89
93 std::map<size_t, size_t> m_indices;
95 std::string m_profileFunction;
97 size_t m_npeaks;
99 std::set<specnum_t> m_reversed;
100
104 double m_l1;
111
113 std::vector<FoilInfo> m_foils0;
115 std::vector<FoilInfo> m_foils1;
120
122 std::unique_ptr<API::Progress> m_progress = nullptr;
123};
124
125} // namespace Algorithms
126} // namespace CurveFitting
127} // namespace Mantid
std::string name
Definition Run.cpp:60
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
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.
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.
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:165
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...