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 ComponentInfo;
25class InstrumentRayTracer;
26} // namespace Geometry
27namespace MDAlgorithms {
28
34class MANTID_MDALGORITHMS_DLL FindPeaksMD final : public API::Algorithm {
35public:
38 const std::string name() const override { return "FindPeaksMD"; };
40 const std::string summary() const override {
41 return "Find peaks in reciprocal space in a MDEventWorkspace or a "
42 "MDHistoWorkspace.";
43 }
44
46 int version() const override { return 1; };
47 const std::vector<std::string> seeAlso() const override { return {"FindPeaks"}; }
49 const std::string category() const override { return "Optimization\\PeakFinding;MDAlgorithms\\Peaks"; }
50
51 std::map<std::string, std::string> validateInputs() override;
52
53private:
55 void init() override;
57 void exec() override;
58
60 void readExperimentInfo(const Mantid::API::ExperimentInfo_sptr &ei);
61 void checkWorkspaceDims(const Mantid::API::IMDWorkspace_sptr &ws);
62 void determineOutputType(const std::string &peakType, const uint16_t numExperimentInfo);
63
65 void addPeak(const Geometry::ComponentInfo &compInfo, const Mantid::Kernel::V3D &Q, const double binCount,
66 const Geometry::InstrumentRayTracer &tracer);
67
69 void addLeanElasticPeak(const Mantid::Kernel::V3D &Q, const double binCount, const bool useGoniometer = false);
70
72 std::shared_ptr<DataObjects::Peak> createPeak(const Mantid::Kernel::V3D &Q, const double binCount,
73 const Geometry::InstrumentRayTracer &tracer);
74
76 std::shared_ptr<DataObjects::LeanElasticPeak>
77 createLeanElasticPeak(const Mantid::Kernel::V3D &Q, const double binCount, const bool useGoniometer = false);
78
80 template <typename MDE, size_t nd> void findPeaks(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws);
82 void findPeaksHisto(const Mantid::DataObjects::MDHistoWorkspace_sptr &ws);
83
86
89
92
94 int64_t m_maxPeaks;
95
97 int m_edge;
98
101
105
107 std::unique_ptr<Mantid::API::Progress> prog = nullptr;
108
110 enum eDimensionType { HKL, QLAB, QSAMPLE };
111
120
122 bool m_useNumberOfEventsNormalization = false;
124 double m_signalThresholdFactor = 1.5;
126 static const std::string volumeNormalization;
128 static const std::string numberOfEventsNormalization;
129
130 bool m_leanElasticPeak = false;
131};
132
133} // namespace MDAlgorithms
134} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
std::shared_ptr< MDEventWorkspace< MDE, nd > > sptr
Typedef for a shared pointer of this kind of event workspace.
ComponentInfo : Provides a component centric view on to the instrument.
HKL : HKL MDFrame.
Definition HKL.h:20
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:34
coord_t peakRadiusSquared
Estimated radius of peaks. Boxes closer than this are rejected.
Definition FindPeaksMD.h:88
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:47
eDimensionType dimType
Dimension type.
const std::string category() const override
Algorithm's category for identification.
Definition FindPeaksMD.h:49
eDimensionType
Enum describing which type of dimensions in the MDEventWorkspace.
double DensityThresholdFactor
Thresholding factor.
Definition FindPeaksMD.h:91
signal_t m_densityScaleFactor
Arbitrary scaling factor for density to make more manageable numbers, especially for older file forma...
int64_t m_maxPeaks
Max # of peaks.
Definition FindPeaksMD.h:94
bool m_addDetectors
Flag to include the detectors within the peak.
const std::string name() const override
Algorithm's name for identification.
Definition FindPeaksMD.h:38
Mantid::API::IPeaksWorkspace_sptr peakWS
Output PeaksWorkspace.
Definition FindPeaksMD.h:85
static const std::string numberOfEventsNormalization
NumberOfEventNormalization.
int version() const override
Algorithm's version for identification.
Definition FindPeaksMD.h:46
int m_edge
Number of edge pixels with no peaks.
Definition FindPeaksMD.h:97
Mantid::Kernel::Matrix< double > m_goniometer
Goniometer matrix.
const std::string summary() const override
Summary of algorithms purpose.
Definition FindPeaksMD.h:40
int m_runNumber
Run number of the peaks.
static const std::string volumeNormalization
VolumeNormalization.
Mantid::Geometry::Instrument_const_sptr m_inst
Instrument.
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.
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