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 "ConvertHFIRSCDtoMDE"};
31 }
32
33private:
34 void init() override;
35 void exec() override;
36 void validateBinningForTemporaryDataWorkspace(const std::map<std::string, std::string> &,
38 std::map<std::string, std::string> validateInputs() override final;
39 std::string QDimensionName(std::vector<double> projection);
40 std::string QDimensionNameQSample(int i);
41 std::map<std::string, std::string> getBinParameters();
42 void createNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS);
43 void createBackgroundNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS);
44
46 DataObjects::MDHistoWorkspace_sptr binInputWS(const std::vector<Geometry::SymmetryOperation> &symmetryOps);
47
51 DataObjects::MDHistoWorkspace_sptr binMDEventWorkspace(const API::IMDEventWorkspace_sptr &ws,
52 const std::string &temporaryWSPropertyName,
53 const std::string &outputWSPropertyName,
54 const std::vector<Geometry::SymmetryOperation> &symmetryOps,
55 const std::map<std::string, std::string> &parameters);
56
58 DataObjects::MDHistoWorkspace_sptr binBackgroundWS(const std::vector<Geometry::SymmetryOperation> &symmetryOps);
59
61 DataObjects::MDHistoWorkspace_sptr
62 binMonoSCDNormalizationWS(const std::vector<Geometry::SymmetryOperation> &symmetryOps);
63
65 Mantid::Kernel::DblMatrix buildSymmetryMatrix(const Geometry::SymmetryOperation &so);
66 void determineBasisVector(const size_t &qindex, const std::string &value, const Kernel::DblMatrix &Qtransform,
67 std::vector<double> &projection, std::stringstream &basisVector,
68 std::vector<size_t> &qDimensionIndices);
69 inline void setQUnit(const std::vector<size_t> &qDimensionIndices,
70 const Mantid::DataObjects::MDHistoWorkspace_sptr &outputMDHWS);
71
72 std::vector<coord_t> getValuesFromOtherDimensions(bool &skipNormalization, uint16_t expInfoIndex = 0) const;
73
74 void cacheDimensionXValues();
75 void calculateNormalization(const std::vector<coord_t> &otherValues, const Geometry::SymmetryOperation &so,
76 uint16_t expInfoIndex, size_t soIndex);
77
78 void calculateIntersections(std::vector<std::array<double, 4>> &intersections, const double theta, const double phi,
79 const Kernel::DblMatrix &transform, double lowvalue, double highvalue);
80
81 void calcIntegralsForIntersections(const std::vector<double> &xValues, const API::MatrixWorkspace &integrFlux,
82
83 size_t sp, std::vector<double> &yValues);
84
85 void calcDiffractionIntersectionIntegral(std::vector<std::array<double, 4>> &intersections,
86 std::vector<double> &xValues, std::vector<double> &yValues,
87 const API::MatrixWorkspace &integrFlux, const size_t &wsIdx);
88
89 Mantid::Kernel::DblMatrix calQTransform(const Mantid::API::ExperimentInfo &currentExpInfo,
90 const Geometry::SymmetryOperation &so);
91
92 void calcSingleDetectorNorm(const std::vector<std::array<double, 4>> &intersections, const double &solid,
93 std::vector<double> &yValues, const size_t &vmdDims, std::vector<coord_t> &pos,
94 std::vector<coord_t> &posNew, std::vector<std::atomic<signal_t>> &signalArray,
95 const double &solidBkgd, std::vector<std::atomic<signal_t>> &bkgdSignalArray);
96
98 const std::string &outputwsname, const double &startProgress,
99 const double &endProgress);
100
102 DataObjects::MDHistoWorkspace_sptr m_normWS;
103 DataObjects::MDHistoWorkspace_sptr m_bkgdNormWS;
108
110 bool m_isRLU;
112 std::vector<double> m_Q0Basis{1., 0., 0.}, m_Q1Basis{0., 1., 0.}, m_Q2Basis{0., 0., 1.};
121 std::vector<double> m_hX, m_kX, m_lX, m_eX;
123 size_t m_hIdx, m_kIdx, m_lIdx, m_eIdx;
129 double m_Ei;
144 std::string convention;
145};
146
147} // namespace MDAlgorithms
148} // namespace Mantid
std::string name
Definition Run.cpp:60
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:76
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:127
bool m_monochromatic
Flag indicating a pre-computed MonoSCDNormalizationWorkspace was provided (monochromatic single cryst...
Definition MDNorm.h:134
Mantid::Kernel::DblMatrix m_W
W matrix.
Definition MDNorm.h:116
Mantid::Kernel::Matrix< coord_t > m_transformation
matrix for transforming from intersections to positions in the normalization workspace
Definition MDNorm.h:119
bool m_dEIntegrated
Flag to indicate that the energy dimension is integrated.
Definition MDNorm.h:138
bool m_diffraction
Flag indicating if the input workspace is from diffraction.
Definition MDNorm.h:131
bool m_accumulate
Flag to accumulate normalization.
Definition MDNorm.h:136
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:129
Mantid::Kernel::DblMatrix m_UB
UB matrix.
Definition MDNorm.h:114
Kernel::V3D m_beamDir
Beam direction.
Definition MDNorm.h:142
size_t m_numExptInfos
number of experimentInfo objects
Definition MDNorm.h:125
std::string convention
ki-kf for Inelastic convention; kf-ki for Crystallography convention
Definition MDNorm.h:144
std::vector< double > m_eX
Definition MDNorm.h:121
Kernel::V3D m_samplePos
Sample position.
Definition MDNorm.h:140
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.
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.