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
19#include <tuple>
20
21namespace Mantid {
22namespace Crystal {
23
32class MANTID_CRYSTAL_DLL PredictPeaks final : public API::Algorithm {
33public:
35
37 const std::string name() const override { return "PredictPeaks"; };
39 const std::string summary() const override {
40 return "Using a known crystal lattice and UB matrix, predict where single "
41 "crystal peaks should be found in detector/TOF space. Creates a "
42 "PeaksWorkspace containing the peaks at the expected positions.";
43 }
44
46 int version() const override { return 1; };
47 const std::vector<std::string> seeAlso() const override { return {"CountReflections", "PredictFractionalPeaks"}; }
49 const std::string category() const override { return "Crystal\\Peaks"; }
50
51private:
53 void init() override;
55 void exec() override;
56
57 void checkBeamDirection() const;
58 void setInstrumentFromInputWorkspace(const API::ExperimentInfo_sptr &inWS);
59 void setRunNumberFromInputWorkspace(const API::ExperimentInfo_sptr &inWS);
60
61 void fillPossibleHKLsUsingGenerator(const Geometry::OrientedLattice &orientedLattice,
62 std::vector<Kernel::V3D> &possibleHKLs) const;
63
64 void fillPossibleHKLsUsingPeaksWorkspace(const API::IPeaksWorkspace_sptr &peaksWorkspace,
65 std::vector<Kernel::V3D> &possibleHKLs) const;
66
67 void setStructureFactorCalculatorFromSample(const API::Sample &sample);
68
69 void calculateQAndAddToOutput(const Kernel::V3D &hkl, const Kernel::DblMatrix &orientedUB,
70 const Kernel::DblMatrix &goniometerMatrix);
71
72 void calculateQAndAddToOutputLeanElastic(const Kernel::V3D &hkl, const Kernel::DblMatrix &UB);
73
74private:
76 std::tuple<Kernel::V3D, double> getPeakParametersFromQ(const Kernel::V3D &q) const;
78 void setReferenceFrameAndBeamDirection();
79 void logNumberOfPeaksFound(size_t allowedPeakCount) const;
80
82 int m_edge;
83
85 std::vector<Mantid::Geometry::ReflectionCondition_sptr> m_refConds;
87 std::unique_ptr<API::DetectorSearcher> m_detectorCacheSearch;
93 std::shared_ptr<const Geometry::ReferenceFrame> m_refFrame;
99 bool m_leanElasticPeak = false;
100
102};
103
104} // namespace Crystal
105} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
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...
int m_runNumber
Run number of input workspace.
const std::string name() const override
Algorithm's name for identification.
int m_edge
Number of edge pixels with no peaks.
const std::string category() const override
Algorithm's category for identification.
const std::string summary() const override
Summary of algorithms purpose.
std::shared_ptr< const Geometry::ReferenceFrame > m_refFrame
Reference frame for the instrument.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Geometry::Instrument_const_sptr m_inst
Instrument reference.
std::unique_ptr< API::DetectorSearcher > m_detectorCacheSearch
Detector search cache for fast look-up of detectors.
std::vector< Mantid::Geometry::ReflectionCondition_sptr > m_refConds
Reflection conditions possible.
Mantid::API::IPeaksWorkspace_sptr m_pw
Output peaks workspace.
Geometry::StructureFactorCalculator_sptr m_sfCalculator
Kernel::V3D m_refBeamDir
Direction of the beam for this instrument.
int version() const override
Algorithm's version for identification.
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.