Mantid
Loading...
Searching...
No Matches
DiffractionFocussing2.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 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
10#include "MantidAlgorithms/DllConfig.h"
13#include "MantidIndexing/SpectrumNumber.h"
14
15namespace Mantid {
16namespace Algorithms {
65class MANTID_ALGORITHMS_DLL DiffractionFocussing2 final : public API::Algorithm {
66public:
68 const std::string name() const override { return "DiffractionFocussing"; }
70 const std::string summary() const override {
71 return "Algorithm to focus powder diffraction data into a number of "
72 "histograms according to a grouping scheme defined in a CalFile.";
73 }
74
76 int version() const override { return 2; }
77 const std::vector<std::string> seeAlso() const override { return {"AlignAndFocusPowder", "LoadCalFile"}; }
79 const std::string category() const override { return "Diffraction\\Focussing"; }
80
81private:
82 // Overridden Algorithm methods
83 void init() override;
84 std::map<std::string, std::string> validateInputs() override;
85 void exec() override;
86 void cleanup();
87
88 void getGroupingWorkspace();
89 std::size_t setupGroupToWSIndices();
90
91 // For events
92 void execEvent();
93
97 void determineRebinParameters(const std::vector<int> &udet2group);
98 void determineRebinParametersFromParameters(const std::vector<int> &udet2group);
99 int validateSpectrumInGroup(const std::vector<int> &udet2group, size_t wi);
100 void validateInputWorkspaceUnit(API::MatrixWorkspace_const_sptr inputWS, std::map<std::string, std::string> &issues);
101
104
107
108 // This map needs to be ordered to process the groups in order.
110 using group2vectormap = std::map<int, std::shared_ptr<MantidVec>>;
112 std::vector<int> groupAtWorkspaceIndex;
114 std::map<int, HistogramData::BinEdges> group2xvector;
115 std::map<int, double> group2xstep;
119 int64_t nGroups = 0;
121 int nHist = 0;
123 int nPoints = 0;
125 std::vector<std::vector<std::size_t>> m_wsIndices;
127 std::vector<Indexing::SpectrumNumber> m_validGroups;
128};
129
130} // namespace Algorithms
131} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
Algorithm to focus powder diffraction data into a number of histograms according to a grouping scheme...
Mantid::DataObjects::GroupingWorkspace_sptr m_groupWS
Grouping workspace with groups to build.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
std::map< int, HistogramData::BinEdges > group2xvector
Map from the group number to the group's X vector.
std::map< int, std::shared_ptr< MantidVec > > group2vectormap
typedef for the storage of each group's X vector
std::vector< int > groupAtWorkspaceIndex
The list of group numbers.
std::vector< std::vector< std::size_t > > m_wsIndices
Mapping of group number to vector of inputworkspace indices.
std::vector< Indexing::SpectrumNumber > m_validGroups
List of valid group numbers.
const std::string summary() const override
Summary of algorithms purpose.
group2vectormap group2wgtvector
Map from the group number to the group's summed weight vector.
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
int version() const override
Algorithm's version for identification overriding a virtual method.
API::MatrixWorkspace_const_sptr m_matrixInputW
Shared pointer to the input workspace.
const std::string category() const override
Algorithm's category for identification overriding a virtual method.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< GroupingWorkspace > GroupingWorkspace_sptr
shared pointer to the GroupingWorkspace class
Helper class which provides the Collimation Length for SANS instruments.