Mantid
Loading...
Searching...
No Matches
SpatialGrouping.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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
11#include "MantidAlgorithms/DllConfig.h"
14
15namespace Mantid {
16namespace Geometry {
17class IDetector;
18class BoundingBox;
19} // namespace Geometry
20
21namespace Algorithms {
32class MANTID_ALGORITHMS_DLL SpatialGrouping final : public API::Algorithm {
33public:
35 const std::string name() const override { return "SpatialGrouping"; }
37 const std::string summary() const override {
38 return "This algorithm creates an XML grouping file, which can be used in "
39 "GroupDetectors or ReadGroupsFromFile, which groups the detectors "
40 "of an instrument based on the distance between the detectors. It "
41 "does this by querying the getNeighbours method on the Detector "
42 "object.";
43 }
44
46 int version() const override { return (1); }
47 const std::vector<std::string> seeAlso() const override { return {"GroupDetectors"}; }
49 const std::string category() const override { return "Transforms\\Grouping"; }
50
51private:
53 void init() override;
55 void exec() override;
56
58 bool expandNet(std::map<specnum_t, Mantid::Kernel::V3D> &nearest, specnum_t spec, const size_t noNeighbours,
61 void sortByDistance(std::map<specnum_t, Mantid::Kernel::V3D> &nearest, const size_t noNeighbours);
63 void createBox(const Geometry::IDetector &det, Geometry::BoundingBox &bndbox, double searchDist);
65 void growBox(double &min, double &max, const double factor);
66
68 std::map<specnum_t, Kernel::V3D> m_positions;
70 std::set<specnum_t> m_included;
72 std::vector<std::vector<int>> m_groups;
73
75 std::unique_ptr<API::WorkspaceNearestNeighbourInfo> m_neighbourInfo;
76};
77
78} // namespace Algorithms
79} // namespace Mantid
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
This algorithm creates an XML Grouping File for use in the GroupDetectors (v2) or ReadGroupsFromFile ...
std::map< specnum_t, Kernel::V3D > m_positions
map of detectors in the instrument
const std::string summary() const override
Summary of algorithms purpose.
std::vector< std::vector< int > > m_groups
first and last values for each group
std::unique_ptr< API::WorkspaceNearestNeighbourInfo > m_neighbourInfo
NearestNeighbourInfo used by expandNet()
std::set< specnum_t > m_included
flag which detectors are included in a group already
int version() const override
Algorithm's version.
const std::string category() const override
Algorithm's category for identification.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
const std::string name() const override
Algorithm's name.
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition BoundingBox.h:33
Interface class for detector objects.
Definition IDetector.h:37
Helper class which provides the Collimation Length for SANS instruments.
int32_t specnum_t
Typedef for a spectrum Number.
Definition IDTypes.h:14