Mantid
Loading...
Searching...
No Matches
StructuredDetector.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 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
9#include "MantidGeometry/DllConfig.h"
14#include <string>
15#include <vector>
16
17namespace Mantid {
18namespace Geometry {
19class ComponentVisitor;
31class MANTID_GEOMETRY_DLL StructuredDetector : public CompAssembly, public IObjComponent {
32public:
34 std::string type() const override { return "StructuredDetector"; }
35
37 static bool compareName(const std::string &proposedMatch);
38
41
43 StructuredDetector(const std::string &name, IComponent *reference = nullptr);
44
46 StructuredDetector(const StructuredDetector *base, const ParameterMap *map);
47
49 void initialize(size_t xPixels, size_t yPixels, std::vector<double> &&x, std::vector<double> &&y, bool isZBeam,
50 detid_t idStart, bool idFillByFirstY, int idStepByRow, int idStep = 1);
51
53 IComponent *clone() const override;
54
55 std::shared_ptr<Detector> getAtXY(const size_t x, const size_t y) const;
56
57 detid_t getDetectorIDAtXY(const size_t X, const size_t Y) const;
58 std::pair<size_t, size_t> getXYForDetectorID(const detid_t detectorID) const;
59
60 std::vector<double> const &getXValues() const;
61 std::vector<double> const &getYValues() const;
62
63 void setColors(const std::vector<int> &r, const std::vector<int> &g, const std::vector<int> &b) const;
64
65 std::vector<int> const &getR() const;
66 std::vector<int> const &getG() const;
67 std::vector<int> const &getB() const;
68
69 size_t xPixels() const;
70 size_t yPixels() const;
71 detid_t idStart() const;
72 bool idFillByFirstY() const;
73 int idStepByRow() const;
74 int idStep() const;
75
77 detid_t minDetectorID();
79 detid_t maxDetectorID();
80
81 std::shared_ptr<const IComponent> getComponentByName(const std::string &cname, int nlevels = 0) const override;
82
83 // This should inherit the getBoundingBox implementation from CompAssembly
84 // but
85 // the multiple inheritance seems to confuse it so we'll explicityly tell it
86 // that here
87 using CompAssembly::getBoundingBox;
88
89 // ------------ IObjComponent methods ----------------
90
92 bool isValid(const Kernel::V3D &point) const override;
93
95 bool isOnSide(const Kernel::V3D &point) const override;
96
98 int interceptSurface(Track &track) const override;
99
102 double solidAngle(const Geometry::SolidAngleParams &params) const override;
104 void getBoundingBox(BoundingBox &assemblyBox) const override;
105
107 int getPointInObject(Kernel::V3D &point) const override;
108
109 // Rendering member functions
111 void draw() const override;
112
114 void drawObject() const override;
115
118 void initDraw() const override;
119
121 const std::shared_ptr<const IObject> shape() const override;
123 const Kernel::Material material() const override;
124
126 virtual size_t registerContents(class ComponentVisitor &componentVisitor) const override;
127
128 // ------------ End of IObjComponent methods ----------------
129private:
131 void init();
132
133 void createDetectors();
134
135 Detector *addDetector(CompAssembly *parent, const std::string &name, size_t x, size_t y, detid_t id);
141
143 size_t m_xPixels;
145 size_t m_yPixels;
146
151
160
161 std::vector<double> m_xvalues;
162 std::vector<double> m_yvalues;
163
164 mutable std::vector<int> r;
165 mutable std::vector<int> g;
166 mutable std::vector<int> b;
167};
168
169MANTID_GEOMETRY_DLL std::ostream &operator<<(std::ostream &, const StructuredDetector &);
170
171using StructuredDetector_sptr = std::shared_ptr<StructuredDetector>;
172using StructuredDetector_const_sptr = std::shared_ptr<const StructuredDetector>;
173} // namespace Geometry
174} // namespace Mantid
std::string name
Definition Run.cpp:60
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition BoundingBox.h:33
Class for Assembly of geometric components.
ComponentVisitor : Visitor for IComponents.
This class represents a detector - i.e.
Definition Detector.h:30
Class for Assembly of geometric components.
base class for Geometric IComponent
Definition IComponent.h:53
Object Component class, this class brings together the physical attributes of the component to the po...
StructuredDetector is a type of CompAssembly, an assembly of components.
size_t m_xPixels
The number of pixels in the X (horizontal) direction;.
detid_t m_maxDetId
maximum detector id
size_t m_yPixels
The number of pixels in the Y (vertical) direction;.
const StructuredDetector * m_base
Pointer to the base RectangularDetector, for parametrized instruments.
int m_idStepByRow
Step size in ID in each row.
int m_idStep
Step size in ID in each col.
detid_t m_minDetId
minimum detector id
bool m_idFillByFirstY
IDs are filled in Y fastest.
std::string type() const override
String description of the type of component.
StructuredDetector & operator=(const ICompAssembly &)
Private copy assignment operator.
Defines a track as a start point and a direction.
Definition Track.h:165
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
Definition Material.h:50
Class for 3D vectors.
Definition V3D.h:34
std::shared_ptr< StructuredDetector > StructuredDetector_sptr
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.
std::shared_ptr< const StructuredDetector > StructuredDetector_const_sptr
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.