34 return "Calculate normalization for an MDEvent workspace for single crystal "
46 "An input MDWorkspace.");
51 for (
size_t i = 0; i < dimChars.size(); i++) {
54 std::string propName =
"AlignedDim" + dim;
58 "Enter it as a comma-separated list of values with the format: "
59 "'name,minimum,maximum,number_of_bins'. Leave blank for NONE.");
62 auto fluxValidator = std::make_shared<CompositeValidator>();
66 auto solidAngleValidator = fluxValidator->
clone();
69 "An input workspace containing momentum dependent flux.");
72 "An input workspace containing momentum integrated vanadium "
73 "(a measure of the solid angle).");
76 "If set to true, the algorithm does "
77 "not check history if the workspace was modified since the"
78 "ConvertToMD algorithm was run, and assume that the elastic "
83 "An input MDHistoWorkspace used to accumulate normalization "
84 "from multiple MDEventWorkspaces. "
85 "If unspecified a blank MDHistoWorkspace will be created.");
89 "An input MDHistoWorkspace used to accumulate data from "
90 "multiple MDEventWorkspaces. If "
91 "unspecified a blank MDHistoWorkspace will be created.");
94 "A name for the output data MDHistoWorkspace.");
96 "A name for the output normalization MDHistoWorkspace.");
105 m_convention = Kernel::ConfigService::Instance().getString(
"Q.convention");
107 setProperty<Workspace_sptr>(
"OutputWorkspace", outputWS);
116 for (uint16_t expInfoIndex = 0; expInfoIndex <
m_numExptInfos; expInfoIndex++) {
119 bool skipNormalization =
false;
124 if (!skipNormalization) {
127 g_log.
warning(
"Binning limits are outside the limits of the MDWorkspace. "
128 "Not applying normalization.");
134 [](
const std::atomic<signal_t> &a,
const signal_t &b) { return a + b; });
147 throw std::invalid_argument(
"Invalid energy transfer mode. Algorithm "
148 "currently only supports elastic data.");
152 m_hmin = hdim->getMinimum();
153 m_kmin = kdim->getMinimum();
154 m_lmin = ldim->getMinimum();
155 m_hmax = hdim->getMaximum();
156 m_kmax = kdim->getMaximum();
157 m_lmax = ldim->getMaximum();
159 const auto &exptInfoZero = *(
m_inputWS->getExperimentInfo(0));
160 auto source = exptInfoZero.getInstrument()->getSource();
161 auto sample = exptInfoZero.getInstrument()->getSample();
162 if (source ==
nullptr || sample ==
nullptr) {
164 "Instrument not sufficiently defined: failed to get source and/or "
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A validator which provides a TENTATIVE check that a workspace contains common bins in each spectrum.
Kernel::IValidator_sptr clone() const override
Clone the current state.
A validator which checks that a workspace has a valid instrument.
A property class for workspaces.
A validator which checks that the unit of the workspace referred to by a WorkspaceProperty is the exp...
Exception for errors associated with the instrument definition.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void warning(const std::string &msg)
Logs at warning level.
The concrete, templated class for properties.
API::IMDEventWorkspace_sptr m_inputWS
Input workspace.
void createNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS)
Create & cached the normalization workspace.
bool m_diffraction
Flag indicating if the input workspace is from diffraction.
static std::string getDimensionChars()
void cacheDimensionXValues()
Stores the X values from each H,K,L,E dimension as member variables Energy dimension is transformed t...
void findIntegratedDimensions(const std::vector< coord_t > &otherDimValues, bool &skipNormalization)
Checks the normalization workspace against the indices of the original dimensions.
void calculateNormalization(const std::vector< coord_t > &otherValues, uint16_t expInfoIndex)
Computed the normalization for the input workspace (for MDNormSCD/MDNormDirectSC).
DataObjects::MDHistoWorkspace_sptr m_normWS
Normalization workspace.
Kernel::V3D m_samplePos
Sample position.
std::vector< coord_t > getValuesFromOtherDimensions(bool &skipNormalization, uint16_t expInfoIndex=0) const
Retrieve logged values from non-HKL dimensions.
std::vector< std::atomic< signal_t > > m_signalArray
internal array to accumulate signals to avoid copying (serial) each loop
bool m_accumulate
Flag to accumulate normalization.
DataObjects::MDHistoWorkspace_sptr binInputWS()
Runs the BinMD algorithm on the input to provide the output workspace All slicing algorithm propertie...
uint16_t m_numExptInfos
number of experiment infos
Kernel::V3D m_beamDir
Beam direction.
coord_t m_hmin
limits for h,k,l, dE dimensions
std::string inputEnergyMode() const
Currently looks for the ConvertToMD algorithm in the history.
std::string m_convention
ki-kf for Inelastic convention; kf-ki for Crystallography convention
MDNormSCD : Generate MD normalization for single crystal diffraction.
const std::string category() const override
Algorithm's category for identification.
void exec() override
Execute the algorithm.
const std::string name() const override
Algorithm's name for use in the GUI and help.
void init() override
Initialize the algorithm's properties.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
void cacheInputs()
Set up starting values for cached variables.
@ NoNormalization
Don't normalize = return raw counts.
std::string toString(const T &value)
Convert a number to a string.
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
double signal_t
Typedef for the signal recorded in a MDBox, etc.
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.
@ Output
An output workspace.