Mantid
Loading...
Searching...
No Matches
FindPeaksMD.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
13#include "MantidAPI/Progress.h"
18#include "MantidKernel/Matrix.h"
19#include "MantidKernel/V3D.h"
20#include "MantidMDAlgorithms/DllConfig.h"
21
22namespace Mantid {
23namespace Geometry {
24class InstrumentRayTracer;
25}
26namespace MDAlgorithms {
27
33class MANTID_MDALGORITHMS_DLL FindPeaksMD final : public API::Algorithm {
34public:
37 const std::string name() const override { return "FindPeaksMD"; };
39 const std::string summary() const override {
40 return "Find peaks in reciprocal space in a MDEventWorkspace or a "
41 "MDHistoWorkspace.";
42 }
43
45 int version() const override { return 1; };
46 const std::vector<std::string> seeAlso() const override { return {"FindPeaks"}; }
48 const std::string category() const override { return "Optimization\\PeakFinding;MDAlgorithms\\Peaks"; }
49
50 std::map<std::string, std::string> validateInputs() override;
51
52private:
54 void init() override;
56 void exec() override;
57
59 void readExperimentInfo(const Mantid::API::ExperimentInfo_sptr &ei);
60 void checkWorkspaceDims(const Mantid::API::IMDWorkspace_sptr &ws);
61 void determineOutputType(const std::string &peakType, const uint16_t numExperimentInfo);
62
64 void addPeak(const Mantid::Kernel::V3D &Q, const double binCount, const Geometry::InstrumentRayTracer &tracer);
65
67 void addLeanElasticPeak(const Mantid::Kernel::V3D &Q, const double binCount, const bool useGoniometer = false);
68
70 std::shared_ptr<DataObjects::Peak> createPeak(const Mantid::Kernel::V3D &Q, const double binCount,
71 const Geometry::InstrumentRayTracer &tracer);
72
74 std::shared_ptr<DataObjects::LeanElasticPeak>
75 createLeanElasticPeak(const Mantid::Kernel::V3D &Q, const double binCount, const bool useGoniometer = false);
76
78 template <typename MDE, size_t nd> void findPeaks(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws);
80 void findPeaksHisto(const Mantid::DataObjects::MDHistoWorkspace_sptr &ws);
81
84
87
90
92 int64_t m_maxPeaks;
93
95 int m_edge;
96
99
103
105 std::unique_ptr<Mantid::API::Progress> prog = nullptr;
106
108 enum eDimensionType { HKL, QLAB, QSAMPLE };
109
118
120 bool m_useNumberOfEventsNormalization = false;
122 double m_signalThresholdFactor = 1.5;
124 static const std::string volumeNormalization;
126 static const std::string numberOfEventsNormalization;
127
128 bool m_leanElasticPeak = false;
129};
130
131} // namespace MDAlgorithms
132} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
std::shared_ptr< MDEventWorkspace< MDE, nd > > sptr
Typedef for a shared pointer of this kind of event workspace.
HKL : HKL MDFrame.
Definition: HKL.h:21
This class is responsible for tracking rays and accumulating a list of objects that are intersected a...
Numerical Matrix class.
Definition: Matrix.h:42
Class for 3D vectors.
Definition: V3D.h:34
FindPeaksMD : TODO: DESCRIPTION.
Definition: FindPeaksMD.h:33
Mantid::Geometry::Instrument_const_sptr inst
Instrument.
Definition: FindPeaksMD.h:111
coord_t peakRadiusSquared
Estimated radius of peaks. Boxes closer than this are rejected.
Definition: FindPeaksMD.h:86
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: FindPeaksMD.h:46
eDimensionType dimType
Dimension type.
Definition: FindPeaksMD.h:115
const std::string category() const override
Algorithm's category for identification.
Definition: FindPeaksMD.h:48
eDimensionType
Enum describing which type of dimensions in the MDEventWorkspace.
Definition: FindPeaksMD.h:108
double DensityThresholdFactor
Thresholding factor.
Definition: FindPeaksMD.h:89
signal_t m_densityScaleFactor
Arbitrary scaling factor for density to make more manageable numbers, especially for older file forma...
Definition: FindPeaksMD.h:102
int64_t m_maxPeaks
Max # of peaks.
Definition: FindPeaksMD.h:92
bool m_addDetectors
Flag to include the detectors within the peak.
Definition: FindPeaksMD.h:98
const std::string name() const override
Algorithm's name for identification.
Definition: FindPeaksMD.h:37
Mantid::API::IPeaksWorkspace_sptr peakWS
Output PeaksWorkspace.
Definition: FindPeaksMD.h:83
static const std::string numberOfEventsNormalization
NumberOfEventNormalization.
Definition: FindPeaksMD.h:126
int version() const override
Algorithm's version for identification.
Definition: FindPeaksMD.h:45
int m_edge
Number of edge pixels with no peaks.
Definition: FindPeaksMD.h:95
Mantid::Kernel::Matrix< double > m_goniometer
Goniometer matrix.
Definition: FindPeaksMD.h:117
const std::string summary() const override
Summary of algorithms purpose.
Definition: FindPeaksMD.h:39
int m_runNumber
Run number of the peaks.
Definition: FindPeaksMD.h:113
static const std::string volumeNormalization
VolumeNormalization.
Definition: FindPeaksMD.h:124
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
std::shared_ptr< ExperimentInfo > ExperimentInfo_sptr
Shared pointer to ExperimentInfo.
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.
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
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