Mantid
Loading...
Searching...
No Matches
MDNorm.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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
12#include "MantidMDAlgorithms/DllConfig.h"
14
15namespace Mantid {
16namespace MDAlgorithms {
17
21class MANTID_MDALGORITHMS_DLL MDNorm final : public API::Algorithm {
22public:
23 MDNorm();
24 const std::string name() const override;
25 int version() const override;
26 const std::string category() const override;
27 const std::string summary() const override;
28 const std::vector<std::string> seeAlso() const override {
29 return {"CropWorkspaceForMDNorm", "MDNormSCD", "MDNormDirectSC", "RecalculateTrajectoriesExtents"};
30 }
31
32private:
33 void init() override;
34 void exec() override;
35 void validateBinningForTemporaryDataWorkspace(const std::map<std::string, std::string> &,
37 std::map<std::string, std::string> validateInputs() override final;
38 std::string QDimensionName(std::vector<double> projection);
39 std::string QDimensionNameQSample(int i);
40 std::map<std::string, std::string> getBinParameters();
41 void createNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS);
42 void createBackgroundNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS);
43
45 DataObjects::MDHistoWorkspace_sptr binInputWS(const std::vector<Geometry::SymmetryOperation> &symmetryOps);
46
48 DataObjects::MDHistoWorkspace_sptr binBackgroundWS(const std::vector<Geometry::SymmetryOperation> &symmetryOps);
49
51 Mantid::Kernel::DblMatrix buildSymmetryMatrix(const Geometry::SymmetryOperation &so);
52 void determineBasisVector(const size_t &qindex, const std::string &value, const Kernel::DblMatrix &Qtransform,
53 std::vector<double> &projection, std::stringstream &basisVector,
54 std::vector<size_t> &qDimensionIndices);
55 inline void setQUnit(const std::vector<size_t> &qDimensionIndices,
56 const Mantid::DataObjects::MDHistoWorkspace_sptr &outputMDHWS);
57
58 std::vector<coord_t> getValuesFromOtherDimensions(bool &skipNormalization, uint16_t expInfoIndex = 0) const;
59
60 void cacheDimensionXValues();
61 void calculateNormalization(const std::vector<coord_t> &otherValues, const Geometry::SymmetryOperation &so,
62 uint16_t expInfoIndex, size_t soIndex);
63
64 void calculateIntersections(std::vector<std::array<double, 4>> &intersections, const double theta, const double phi,
65 const Kernel::DblMatrix &transform, double lowvalue, double highvalue);
66
67 void calcIntegralsForIntersections(const std::vector<double> &xValues, const API::MatrixWorkspace &integrFlux,
68
69 size_t sp, std::vector<double> &yValues);
70
71 void calcDiffractionIntersectionIntegral(std::vector<std::array<double, 4>> &intersections,
72 std::vector<double> &xValues, std::vector<double> &yValues,
73 const API::MatrixWorkspace &integrFlux, const size_t &wsIdx);
74
75 Mantid::Kernel::DblMatrix calQTransform(const Mantid::API::ExperimentInfo &currentExpInfo,
76 const Geometry::SymmetryOperation &so);
77
78 void calcSingleDetectorNorm(const std::vector<std::array<double, 4>> &intersections, const double &solid,
79 std::vector<double> &yValues, const size_t &vmdDims, std::vector<coord_t> &pos,
80 std::vector<coord_t> &posNew, std::vector<std::atomic<signal_t>> &signalArray,
81 const double &solidBkgd, std::vector<std::atomic<signal_t>> &bkgdSignalArray);
82
84 const std::string &outputwsname, const double &startProgress,
85 const double &endProgress);
86
88 DataObjects::MDHistoWorkspace_sptr m_normWS;
89 DataObjects::MDHistoWorkspace_sptr m_bkgdNormWS;
93 API::IMDEventWorkspace_sptr m_backgroundWS;
94
96 bool m_isRLU;
98 std::vector<double> m_Q0Basis{1., 0., 0.}, m_Q1Basis{0., 1., 0.}, m_Q2Basis{0., 0., 1.};
107 std::vector<double> m_hX, m_kX, m_lX, m_eX;
109 size_t m_hIdx, m_kIdx, m_lIdx, m_eIdx;
115 double m_Ei;
127 std::string convention;
128};
129
130} // namespace MDAlgorithms
131} // namespace Mantid
const std::vector< double > & rhs
double value
The value of the point.
Definition: FitMW.cpp:51
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
This class is shared by a few Workspace types and holds information related to a particular experimen...
Base MatrixWorkspace Abstract Class.
Crystallographic symmetry operations are composed of a rotational component, which is represented by ...
Class for 3D vectors.
Definition: V3D.h:34
MDNormalization : Bin single crystal diffraction or direct geometry inelastic data and calculate the ...
Definition: MDNorm.h:21
size_t m_numSymmOps
number of symmetry operations
Definition: MDNorm.h:113
Mantid::Kernel::DblMatrix m_W
W matrix.
Definition: MDNorm.h:102
Mantid::Kernel::Matrix< coord_t > m_transformation
matrix for transforming from intersections to positions in the normalization workspace
Definition: MDNorm.h:105
bool m_dEIntegrated
Flag to indicate that the energy dimension is integrated.
Definition: MDNorm.h:121
bool m_diffraction
Flag indicating if the input workspace is from diffraction.
Definition: MDNorm.h:117
bool m_accumulate
Flag to accumulate normalization.
Definition: MDNorm.h:119
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition: MDNorm.h:28
double m_Ei
Cached value of incident energy dor direct geometry.
Definition: MDNorm.h:115
Mantid::Kernel::DblMatrix m_UB
UB matrix.
Definition: MDNorm.h:100
Kernel::V3D m_beamDir
Beam direction.
Definition: MDNorm.h:125
size_t m_numExptInfos
number of experimentInfo objects
Definition: MDNorm.h:111
std::string convention
ki-kf for Inelastic convention; kf-ki for Crystallography convention
Definition: MDNorm.h:127
std::vector< double > m_eX
Definition: MDNorm.h:107
Kernel::V3D m_samplePos
Sample position.
Definition: MDNorm.h:123
std::shared_ptr< IMDEventWorkspace > IMDEventWorkspace_sptr
Shared pointer to Mantid::API::IMDEventWorkspace.
std::shared_ptr< IMDHistoWorkspace > IMDHistoWorkspace_sptr
shared pointer to Mantid::API::IMDHistoWorkspace
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
Definition: IMDWorkspace.h:146
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27
double signal_t
Typedef for the signal recorded in a MDBox, etc.
Definition: MDTypes.h:36
STL namespace.