Mantid
Loading...
Searching...
No Matches
PredictPeaks.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 "MantidCrystal/DllConfig.h"
16#include "MantidKernel/Matrix.h"
18#include "MantidKernel/System.h"
19
20#include <tuple>
21
22namespace Mantid {
23namespace Crystal {
24
33class MANTID_CRYSTAL_DLL PredictPeaks final : public API::Algorithm {
34public:
36
38 const std::string name() const override { return "PredictPeaks"; };
40 const std::string summary() const override {
41 return "Using a known crystal lattice and UB matrix, predict where single "
42 "crystal peaks should be found in detector/TOF space. Creates a "
43 "PeaksWorkspace containing the peaks at the expected positions.";
44 }
45
47 int version() const override { return 1; };
48 const std::vector<std::string> seeAlso() const override { return {"CountReflections", "PredictFractionalPeaks"}; }
50 const std::string category() const override { return "Crystal\\Peaks"; }
51
52private:
54 void init() override;
56 void exec() override;
57
58 void checkBeamDirection() const;
59 void setInstrumentFromInputWorkspace(const API::ExperimentInfo_sptr &inWS);
60 void setRunNumberFromInputWorkspace(const API::ExperimentInfo_sptr &inWS);
61
62 void fillPossibleHKLsUsingGenerator(const Geometry::OrientedLattice &orientedLattice,
63 std::vector<Kernel::V3D> &possibleHKLs) const;
64
65 void fillPossibleHKLsUsingPeaksWorkspace(const API::IPeaksWorkspace_sptr &peaksWorkspace,
66 std::vector<Kernel::V3D> &possibleHKLs) const;
67
68 void setStructureFactorCalculatorFromSample(const API::Sample &sample);
69
70 void calculateQAndAddToOutput(const Kernel::V3D &hkl, const Kernel::DblMatrix &orientedUB,
71 const Kernel::DblMatrix &goniometerMatrix);
72
73 void calculateQAndAddToOutputLeanElastic(const Kernel::V3D &hkl, const Kernel::DblMatrix &UB);
74
75private:
77 std::tuple<Kernel::V3D, double> getPeakParametersFromQ(const Kernel::V3D &q) const;
79 void setReferenceFrameAndBeamDirection();
80 void logNumberOfPeaksFound(size_t allowedPeakCount) const;
81
83 int m_edge;
84
86 std::vector<Mantid::Geometry::ReflectionCondition_sptr> m_refConds;
88 std::unique_ptr<API::DetectorSearcher> m_detectorCacheSearch;
94 std::shared_ptr<const Geometry::ReferenceFrame> m_refFrame;
100 bool m_leanElasticPeak = false;
101
103};
104
105} // namespace Crystal
106} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
This class stores information about the sample used in particular run.
Definition: Sample.h:33
Using a known crystal lattice and UB matrix, predict where single crystal peaks should be found in de...
Definition: PredictPeaks.h:33
int m_runNumber
Run number of input workspace.
Definition: PredictPeaks.h:90
const std::string name() const override
Algorithm's name for identification.
Definition: PredictPeaks.h:38
int m_edge
Number of edge pixels with no peaks.
Definition: PredictPeaks.h:83
const std::string category() const override
Algorithm's category for identification.
Definition: PredictPeaks.h:50
const std::string summary() const override
Summary of algorithms purpose.
Definition: PredictPeaks.h:40
std::shared_ptr< const Geometry::ReferenceFrame > m_refFrame
Reference frame for the instrument.
Definition: PredictPeaks.h:94
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: PredictPeaks.h:48
Geometry::Instrument_const_sptr m_inst
Instrument reference.
Definition: PredictPeaks.h:92
std::unique_ptr< API::DetectorSearcher > m_detectorCacheSearch
Detector search cache for fast look-up of detectors.
Definition: PredictPeaks.h:88
std::vector< Mantid::Geometry::ReflectionCondition_sptr > m_refConds
Reflection conditions possible.
Definition: PredictPeaks.h:86
Mantid::API::IPeaksWorkspace_sptr m_pw
Output peaks workspace.
Definition: PredictPeaks.h:98
Geometry::StructureFactorCalculator_sptr m_sfCalculator
Definition: PredictPeaks.h:99
Kernel::V3D m_refBeamDir
Direction of the beam for this instrument.
Definition: PredictPeaks.h:96
int version() const override
Algorithm's version for identification.
Definition: PredictPeaks.h:47
Class to implement UB matrix.
Class for 3D vectors.
Definition: V3D.h:34
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< StructureFactorCalculator > StructureFactorCalculator_sptr
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.