Mantid
Loading...
Searching...
No Matches
InstrumentVisitor.cpp
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 +
8#include "MantidBeamline/ComponentInfo.h"
9#include "MantidBeamline/DetectorInfo.h"
24
25#include <algorithm>
26#include <memory>
27#include <numeric>
28
29namespace Mantid::Geometry {
30
31namespace {
32std::shared_ptr<const std::unordered_map<detid_t, size_t>> makeDetIdToIndexMap(const std::vector<detid_t> &detIds) {
33
34 const size_t nDetIds = detIds.size();
35 auto detIdToIndex = std::make_shared<std::unordered_map<detid_t, size_t>>();
36 detIdToIndex->reserve(nDetIds);
37 for (size_t i = 0; i < nDetIds; ++i) {
38 (*detIdToIndex)[detIds[i]] = i;
39 }
40 return detIdToIndex;
41}
42
43void clearLegacyParameters(ParameterMap *pmap, const IComponent &comp) {
44 if (!pmap)
45 return;
46 pmap->clearParametersByName(ParameterMap::pos(), &comp);
47 pmap->clearParametersByName(ParameterMap::posx(), &comp);
48 pmap->clearParametersByName(ParameterMap::posy(), &comp);
49 pmap->clearParametersByName(ParameterMap::posz(), &comp);
50 pmap->clearParametersByName(ParameterMap::rot(), &comp);
51 pmap->clearParametersByName(ParameterMap::rotx(), &comp);
52 pmap->clearParametersByName(ParameterMap::roty(), &comp);
53 pmap->clearParametersByName(ParameterMap::rotz(), &comp);
54 pmap->clearParametersByName(ParameterMap::scale(), &comp);
55}
56
57bool hasValidShape(const ObjCompAssembly &obj) {
58 const auto *shape = obj.shape().get();
59 return shape != nullptr && shape->hasValidShape();
60}
61
66Beamline::PixelGridComponent makePixelGridComponent(const GridDetector &grid) {
67 Beamline::PixelGridComponent pixelGrid;
68 pixelGrid.nX = grid.xpixels();
69 pixelGrid.nY = grid.ypixels();
70 pixelGrid.nZ = grid.zpixels();
71 pixelGrid.xStart = grid.xstart();
72 pixelGrid.yStart = grid.ystart();
73 pixelGrid.zStart = grid.zstart();
74 pixelGrid.xStep = grid.xstep();
75 pixelGrid.yStep = grid.ystep();
76 pixelGrid.zStep = grid.zstep();
77 pixelGrid.idStart = grid.idstart();
78 pixelGrid.idStep = grid.idstep();
79 pixelGrid.idStepByRow = grid.idstepbyrow();
80 pixelGrid.idFillOrder = grid.idFillOrder();
81 pixelGrid.minDetectorID = grid.minDetectorID();
82 pixelGrid.maxDetectorID = grid.maxDetectorID();
83 return pixelGrid;
84}
85
88Beamline::StructuredGridComponent makeStructuredGridComponent(const StructuredDetector &bank) {
89 Beamline::StructuredGridComponent structuredGrid;
90 structuredGrid.nX = static_cast<int>(bank.xPixels());
91 structuredGrid.nY = static_cast<int>(bank.yPixels());
92 structuredGrid.idStart = bank.idStart();
93 structuredGrid.idStep = bank.idStep();
94 structuredGrid.idStepByRow = bank.idStepByRow();
95 structuredGrid.idFillByFirstY = bank.idFillByFirstY();
96 structuredGrid.xVertices = bank.getXValues();
97 structuredGrid.yVertices = bank.getYValues();
98 return structuredGrid;
99}
100} // namespace
101
106InstrumentVisitor::InstrumentVisitor(std::shared_ptr<const Instrument> instrument)
107 : m_orderedDetectorIds(
108 std::make_shared<std::vector<detid_t>>(instrument->getDetectorIDs(false /*Do not skip monitors*/))),
109 m_componentIds(std::make_shared<std::vector<ComponentID>>(m_orderedDetectorIds->size(), nullptr)),
110 m_assemblySortedDetectorIndices(std::make_shared<std::vector<size_t>>()),
111 m_assemblySortedComponentIndices(std::make_shared<std::vector<size_t>>()),
112 m_parentComponentIndices(std::make_shared<std::vector<size_t>>(m_orderedDetectorIds->size(), 0)),
113 m_children(std::make_shared<std::vector<std::vector<size_t>>>()),
114 m_detectorRanges(std::make_shared<std::vector<std::pair<size_t, size_t>>>()),
115 m_componentRanges(std::make_shared<std::vector<std::pair<size_t, size_t>>>()),
116 m_componentIdToIndexMap(std::make_shared<std::unordered_map<Mantid::Geometry::IComponent const *, size_t>>()),
117 m_detectorIdToIndexMap(makeDetIdToIndexMap(*m_orderedDetectorIds)),
118 m_positions(std::make_shared<std::vector<Eigen::Vector3d>>()),
119 m_detectorPositions(std::make_shared<std::vector<Eigen::Vector3d>>(m_orderedDetectorIds->size())),
120 m_rotations(std::make_shared<std::vector<Eigen::Quaterniond, Eigen::aligned_allocator<Eigen::Quaterniond>>>()),
121 m_detectorRotations(
122 std::make_shared<std::vector<Eigen::Quaterniond, Eigen::aligned_allocator<Eigen::Quaterniond>>>(
123 m_orderedDetectorIds->size())),
124 m_monitorIndices(std::make_shared<std::vector<size_t>>()), m_instrument(std::move(instrument)), m_pmap(nullptr),
125 m_nullShape(std::make_shared<const CSGObject>()),
126 m_shapes(
127 std::make_shared<std::vector<std::shared_ptr<const IObject>>>(m_orderedDetectorIds->size(), m_nullShape)),
128 m_scaleFactors(
129 std::make_shared<std::vector<Eigen::Vector3d>>(m_orderedDetectorIds->size(), Eigen::Vector3d{1, 1, 1})),
130 m_componentType(std::make_shared<std::vector<Beamline::ComponentType>>()),
131 m_names(std::make_shared<std::vector<std::string>>(m_orderedDetectorIds->size())),
132 m_sideBySideViewPositions(std::make_shared<std::map<size_t, Eigen::Vector2d>>()),
133 m_pixelGridComponents(std::make_shared<std::map<size_t, Beamline::PixelGridComponent>>()),
134 m_structuredGridComponents(std::make_shared<std::map<size_t, Beamline::StructuredGridComponent>>()) {
135 if (m_instrument->isParametrized()) {
136 m_pmap = m_instrument->getParameterMap().get();
137 }
138
139 m_sourceId = nullptr;
140 m_sampleId = nullptr;
141
142 // To prevent warning generation. Do not even try to get the source or sample
143 // id if the instrument is empty.
144 if (!m_instrument->isEmptyInstrument()) {
145
146 m_sourceId = m_instrument->getSource() ? m_instrument->getSource()->getComponentID() : nullptr;
147 m_sampleId = m_instrument->getSample() ? m_instrument->getSample()->getComponentID() : nullptr;
148 }
149
150 const auto nDetectors = m_orderedDetectorIds->size();
151 m_assemblySortedDetectorIndices->reserve(nDetectors); // Exact
152 m_componentIdToIndexMap->reserve(nDetectors); // Approximation
153}
154
156 if (m_pmap && m_pmap->empty()) {
157 // Go through the base instrument for speed.
158 m_instrument->baseInstrument()->registerContents(*this);
159 } else {
160 m_instrument->registerContents(*this);
161 }
162}
163
165 const size_t componentIndex = m_componentIds->size();
166 const ComponentID componentId = component.getComponentID();
167 markAsSourceOrSample(componentId, componentIndex);
168 // Record the ID -> index mapping
169 (*m_componentIdToIndexMap)[componentId] = componentIndex;
170 // For any non-detector we extend the m_componentIds from the back
171 m_componentIds->emplace_back(componentId);
172 m_positions->emplace_back(Kernel::toVector3d(component.getPos()));
173 m_rotations->emplace_back(Kernel::toQuaterniond(component.getRotation()));
174 m_shapes->emplace_back(m_nullShape);
175 m_scaleFactors->emplace_back(Kernel::toVector3d(component.getScaleFactor()));
176 m_names->emplace_back(component.getName());
177 if (const auto &sideBySideViewPos = component.getSideBySideViewPos()) {
178 (*m_sideBySideViewPositions)[componentIndex] = Kernel::toVector2d(*sideBySideViewPos);
179 }
180 clearLegacyParameters(m_pmap, component);
181 return componentIndex;
182}
183
185
186 std::vector<IComponent_const_sptr> assemblyChildren;
187 assembly.getChildren(assemblyChildren, false /*is recursive*/);
188
189 const size_t detectorStart = m_assemblySortedDetectorIndices->size();
190 const size_t componentStart = m_assemblySortedComponentIndices->size();
191 std::vector<size_t> children(assemblyChildren.size());
192 for (size_t i = 0; i < assemblyChildren.size(); ++i) {
193 // register everything under this assembly
194 children[i] = assemblyChildren[i]->registerContents(*this);
195 }
196 const size_t detectorStop = m_assemblySortedDetectorIndices->size();
197 const size_t componentIndex = commonRegistration(assembly);
198 m_componentType->emplace_back(Beamline::ComponentType::Unstructured);
199 m_assemblySortedComponentIndices->emplace_back(componentIndex);
200 // Unless this is the root component this parent is not correct and will be
201 // updated later in the register call of the parent.
202 m_parentComponentIndices->emplace_back(componentIndex);
203 const size_t componentStop = m_assemblySortedComponentIndices->size();
204
205 m_detectorRanges->emplace_back(detectorStart, detectorStop);
206 m_componentRanges->emplace_back(componentStart, componentStop);
207
208 // Now that we know what the index of the parent is we can apply it to the children
209 for (const auto &child : children) {
210 (*m_parentComponentIndices)[child] = componentIndex;
211 }
212 m_children->emplace_back(std::move(children));
213 return componentIndex;
214}
215
222 /*
223 * For a generic leaf component we extend the component ids list, but
224 * the detector indexes entries will of course be empty
225 */
226 m_detectorRanges->emplace_back(std::make_pair(0, 0)); // Represents an empty range
227 // Record the ID -> index mapping
228 const size_t componentIndex = commonRegistration(component);
229 m_componentType->emplace_back(Beamline::ComponentType::Generic);
230
231 const size_t componentStart = m_assemblySortedComponentIndices->size();
232 m_componentRanges->emplace_back(std::make_pair(componentStart, componentStart + 1));
233 m_assemblySortedComponentIndices->emplace_back(componentIndex);
234 // Unless this is the root component this parent is not correct and will be
235 // updated later in the register call of the parent.
236 m_parentComponentIndices->emplace_back(componentIndex);
237 // Generic components are not assemblies and do not therefore have children.
238 m_children->emplace_back();
239 return componentIndex;
240}
241
248 /*
249 * For a generic leaf component we extend the component ids list, but
250 * the detector indexes entries will of course be empty
251 */
252 m_detectorRanges->emplace_back(0, 0); // Represents an empty range
253 // Record the ID -> index mapping
254 const size_t componentIndex = commonRegistration(component);
255 m_componentType->emplace_back(Beamline::ComponentType::Infinite);
256
257 const size_t componentStart = m_assemblySortedComponentIndices->size();
258 m_componentRanges->emplace_back(componentStart, componentStart + 1);
259 m_assemblySortedComponentIndices->emplace_back(componentIndex);
260 // Unless this is the root component this parent is not correct and will be
261 // updated later in the register call of the parent.
262 m_parentComponentIndices->emplace_back(componentIndex);
263 // Generic components are not assemblies and do not therefore have children.
264 m_children->emplace_back();
265 return componentIndex;
266}
267
274 auto index = registerGenericComponent(objComponent);
275 (*m_shapes)[index] = objComponent.shape();
276 return index;
277}
278
285 auto index = registerComponentAssembly(bank);
286 size_t rangesIndex = index - m_orderedDetectorIds->size();
287 (*m_componentType)[rangesIndex] = Beamline::ComponentType::Rectangular;
288 (*m_pixelGridComponents)[index] = makePixelGridComponent(dynamic_cast<const GridDetector &>(bank));
289 return index;
290}
291
298 auto index = registerComponentAssembly(bank);
299 size_t rangesIndex = index - m_orderedDetectorIds->size();
300 (*m_componentType)[rangesIndex] = Beamline::ComponentType::Grid;
301 (*m_pixelGridComponents)[index] = makePixelGridComponent(dynamic_cast<const GridDetector &>(bank));
302 return index;
303}
304
311 auto index = registerInfiniteComponent(objComponent);
312 (*m_shapes)[index] = objComponent.shape();
313 return index;
314}
315
322 auto index = registerComponentAssembly(bank);
323 size_t rangesIndex = index - m_orderedDetectorIds->size();
324 (*m_componentType)[rangesIndex] = Beamline::ComponentType::Structured;
325 (*m_structuredGridComponents)[index] = makeStructuredGridComponent(dynamic_cast<const StructuredDetector &>(bank));
326 return index;
327}
328
331 (*m_shapes)[index] = obj.shape();
332 if (hasValidShape(obj)) {
333 size_t rangesIndex = index - m_orderedDetectorIds->size();
334 (*m_componentType)[rangesIndex] = Beamline::ComponentType::OutlineComposite;
335 }
336 return index;
337}
338
339void InstrumentVisitor::markAsSourceOrSample(ComponentID componentId, const size_t componentIndex) {
340 if (componentId == m_sampleId) {
341 m_sampleIndex = componentIndex;
342 } else if (componentId == m_sourceId) {
343 m_sourceIndex = componentIndex;
344 }
345}
346
353 auto detectorIndex = m_detectorIdToIndexMap->at(detector.getID());
354
355 /* Already allocated we just need to index into the inital front-detector
356 * part of the collection.
357 * 1. Guarantee on grouping detectors by type such that the first n
358 * components
359 * are detectors.
360 * 2. Guarantee on ordering such that the
361 * detectorIndex == componentIndex for all detectors.
362 */
363 // Record the ID -> component index mapping
364 (*m_componentIdToIndexMap)[detector.getComponentID()] = detectorIndex;
365 (*m_componentIds)[detectorIndex] = detector.getComponentID();
367 (*m_detectorPositions)[detectorIndex] = Kernel::toVector3d(detector.getPos());
368 (*m_detectorRotations)[detectorIndex] = Kernel::toQuaterniond(detector.getRotation());
369 (*m_shapes)[detectorIndex] = detector.shape();
370 (*m_scaleFactors)[detectorIndex] = Kernel::toVector3d(detector.getScaleFactor());
371 if (m_instrument->isMonitor(detector.getID())) {
372 m_monitorIndices->emplace_back(detectorIndex);
373 }
374 (*m_names)[detectorIndex] = detector.getName();
375 if (const auto &sideBySideViewPos = detector.getSideBySideViewPos()) {
376 (*m_sideBySideViewPositions)[detectorIndex] = Kernel::toVector2d(*sideBySideViewPos);
377 }
378 clearLegacyParameters(m_pmap, detector);
379
380 /* Note that positions and rotations for detectors are currently
381 NOT stored! These go into DetectorInfo at present. emplace_back works for
382 other Component types because Detectors are always come first in the resultant
383 component list
384 forming a contiguous block.
385 */
387 detectorIndex); // TODO. Optimisation. Cannot have a
388 // detector that is either source or
389 // sample. So delete this.
390 return detectorIndex;
391}
392
400std::shared_ptr<const std::vector<Mantid::Geometry::ComponentID>> InstrumentVisitor::componentIds() const {
401 return m_componentIds;
402}
403
409size_t InstrumentVisitor::size() const { return m_componentIds->size(); }
410
411bool InstrumentVisitor::isEmpty() const { return size() == 0; }
412
413std::shared_ptr<const std::unordered_map<Mantid::Geometry::IComponent const *, size_t>>
417
418std::shared_ptr<const std::unordered_map<detid_t, size_t>> InstrumentVisitor::detectorIdToIndexMap() const {
420}
421
428
429std::unique_ptr<Beamline::DetectorInfo> InstrumentVisitor::detectorInfo() const {
430 return std::make_unique<Mantid::Beamline::DetectorInfo>(*m_detectorPositions, *m_detectorRotations,
432}
433
434std::shared_ptr<std::vector<detid_t>> InstrumentVisitor::detectorIds() const { return m_orderedDetectorIds; }
435
437std::shared_ptr<ParameterInfo> InstrumentVisitor::makeParameterInfo() const {
438 // The ParameterMap does the rekeying itself
439 return m_pmap ? m_pmap->rekey(m_componentIds, m_componentIdToIndexMap) : std::make_shared<ParameterInfo>();
440}
441
442std::pair<std::unique_ptr<ComponentInfo>, std::unique_ptr<DetectorInfo>> InstrumentVisitor::makeWrappers() const {
443 auto compInfo = componentInfo();
444 auto detInfo = detectorInfo();
445 // Cross link Component and Detector info objects
446 compInfo->setDetectorInfo(detInfo.get());
447
448 // Both wrappers must share the same parameter store and reference frame
449 auto const parameterInfo = makeParameterInfo();
450 auto const referenceFrame = m_instrument->getReferenceFrame();
451 auto compInfoWrapper = std::make_unique<ComponentInfo>(std::move(compInfo), componentIds(), componentIdToIndexMap(),
452 m_shapes, parameterInfo, referenceFrame);
453 auto detInfoWrapper = std::make_unique<DetectorInfo>(std::move(detInfo), m_instrument, detectorIds(),
454 detectorIdToIndexMap(), parameterInfo, referenceFrame);
455
456 return {std::move(compInfoWrapper), std::move(detInfoWrapper)};
457}
458
459std::pair<std::unique_ptr<ComponentInfo>, std::unique_ptr<DetectorInfo>>
461 std::shared_ptr<const Instrument> visiteeInstrument;
462 if (pmap) {
463 visiteeInstrument =
464 ParComponentFactory::createInstrument(std::shared_ptr<const Instrument>(&instrument, NoDeleting()),
465 std::shared_ptr<ParameterMap>(pmap, NoDeleting()));
466 } else if (instrument.isParametrized()) {
467 // Walk a copy of the instrument's map. The visitor rekeys the map it walks and strips the legacy
468 // position parameters from it, which must not happen to a map the caller has only lent with the
469 // instrument, e.g. a workspace's map lent with its physical instrument.
470 auto const mapCopy = std::make_shared<ParameterMap>(*instrument.getParameterMap());
471 visiteeInstrument = ParComponentFactory::createInstrument(instrument.baseInstrument(), mapCopy);
472 } else {
473 visiteeInstrument = std::shared_ptr<const Instrument>(&instrument, NoDeleting());
474 }
475 InstrumentVisitor visitor(visiteeInstrument);
476 visitor.walkInstrument();
477 return visitor.makeWrappers();
478}
479} // namespace Mantid::Geometry
std::map< DeltaEMode::Type, std::string > index
IntArray detectorIndex
double obj
the value of the quadratic function
Constructive Solid Geometry object.
Definition CSGObject.h:51
bool isParametrized() const override
Return true if the Component is, in fact, parametrized (that is - it has a valid parameter map)
Definition Component.cpp:75
GridDetector is a type of CompAssembly, an assembly of components.
Class for Assembly of geometric components.
virtual void getChildren(std::vector< IComponent_const_sptr > &outVector, bool recursive) const =0
Get all children.
base class for Geometric IComponent
Definition IComponent.h:53
virtual size_t registerContents(class ComponentVisitor &component) const =0
virtual Kernel::V3D getPos() const =0
Get the position of the IComponent. Tree structure is traverse through the.
virtual std::optional< Kernel::V2D > getSideBySideViewPos() const =0
Get the position of the IComponent for display on the side by side instrument view.
virtual Kernel::Quat getRotation() const =0
Get the absolute orientation of the IComponent.
virtual Kernel::V3D getScaleFactor() const
Gets the scaling factor of the object for the Object Component.
Definition IComponent.h:124
virtual ComponentID getComponentID() const =0
Returns the ComponentID - a unique identifier of the component.
virtual std::string getName() const =0
Get the IComponent name.
Interface class for detector objects.
Definition IDetector.h:37
virtual detid_t getID() const =0
Get the detector ID.
Object Component class, this class brings together the physical attributes of the component to the po...
virtual const std::shared_ptr< const IObject > shape() const =0
Returns the shape of the Object.
IObject : Interface for geometry objects.
Definition IObject.h:43
InstrumentVisitor : Visitor for components with access to Info wrapping features.
std::shared_ptr< std::vector< std::pair< size_t, size_t > > > m_detectorRanges
Only Assemblies and other NON-detectors yield detector ranges.
std::shared_ptr< const std::unordered_map< detid_t, size_t > > m_detectorIdToIndexMap
Detector ID -> index mappings.
int64_t m_sourceIndex
Source index to set.
std::shared_ptr< std::vector< size_t > > m_assemblySortedComponentIndices
Component indexes sorted by assembly.
std::unique_ptr< Beamline::ComponentInfo > componentInfo() const
Mantid::Geometry::ParameterMap * m_pmap
Parameter map to purge.
std::shared_ptr< std::map< size_t, Beamline::StructuredGridComponent > > m_structuredGridComponents
Pixel counts, ID numbering and pixel vertices of Structured banks, keyed by component index.
InstrumentVisitor(std::shared_ptr< const Instrument > instrument)
Constructor.
virtual size_t registerComponentAssembly(const Mantid::Geometry::ICompAssembly &assembly) override
std::shared_ptr< std::vector< detid_t > > m_orderedDetectorIds
Detector indices.
size_t size() const
InstrumentVisitor::size.
std::shared_ptr< const Mantid::Geometry::IObject > m_nullShape
Null shared (empty shape)
std::shared_ptr< std::vector< Eigen::Quaterniond, Eigen::aligned_allocator< Eigen::Quaterniond > > > m_rotations
Rotations for non-detectors.
virtual size_t registerGenericObjComponent(const Mantid::Geometry::IObjComponent &objComponent) override
InstrumentVisitor::registerGenericObjComponent.
std::shared_ptr< std::vector< size_t > > m_assemblySortedDetectorIndices
Detector indexes sorted by assembly.
std::shared_ptr< std::vector< std::pair< size_t, size_t > > > m_componentRanges
Component ranges.
size_t commonRegistration(const Mantid::Geometry::IComponent &component)
Extract the common aspects relevant to all component types.
std::shared_ptr< std::vector< detid_t > > detectorIds() const
virtual size_t registerGridBank(const Mantid::Geometry::ICompAssembly &bank) override
Register a grid bank.
std::shared_ptr< std::vector< Eigen::Vector3d > > m_positions
Positions for non-detectors.
void markAsSourceOrSample(Mantid::Geometry::IComponent *componentId, const size_t componentIndex)
virtual size_t registerRectangularBank(const Mantid::Geometry::ICompAssembly &bank) override
Register a rectangular bank.
virtual size_t registerObjComponentAssembly(const ObjCompAssembly &obj) override
std::shared_ptr< std::vector< std::shared_ptr< const Mantid::Geometry::IObject > > > m_shapes
Shapes stored in fly-weight fashion.
virtual size_t registerDetector(const Mantid::Geometry::IDetector &detector) override
InstrumentVisitor::registerDetector.
std::shared_ptr< std::vector< std::vector< size_t > > > m_children
Stores instrument tree structure by storing children of all Components.
std::shared_ptr< std::map< size_t, Eigen::Vector2d > > m_sideBySideViewPositions
Side-by-side (unwrapped) instrument-view positions when declared in the IDF.
std::shared_ptr< const std::unordered_map< Mantid::Geometry::IComponent const *, size_t > > componentIdToIndexMap() const
std::shared_ptr< std::vector< Eigen::Vector3d > > m_scaleFactors
Scale factors.
std::shared_ptr< std::vector< Mantid::Geometry::IComponent * > > m_componentIds
Detectors components always specified first.
std::shared_ptr< std::vector< Eigen::Vector3d > > m_detectorPositions
Positions for detectors.
std::shared_ptr< std::vector< Beamline::ComponentType > > m_componentType
Structured bank flag.
std::shared_ptr< const std::unordered_map< detid_t, size_t > > detectorIdToIndexMap() const
std::shared_ptr< std::map< size_t, Beamline::PixelGridComponent > > m_pixelGridComponents
Rectangular/Grid bank pixel-grid metadata.
std::pair< std::unique_ptr< ComponentInfo >, std::unique_ptr< DetectorInfo > > makeWrappers() const
Make the wrappers from the data collected by walkInstrument(), which must be called first.
Mantid::Geometry::IComponent * m_sourceId
Source id to look for.
std::unique_ptr< Beamline::DetectorInfo > detectorInfo() const
virtual size_t registerStructuredBank(const Mantid::Geometry::ICompAssembly &bank) override
Register a structured bank.
std::shared_ptr< const std::vector< Mantid::Geometry::IComponent * > > componentIds() const
InstrumentVisitor::componentIds.
std::shared_ptr< std::vector< std::string > > m_names
Component names.
virtual size_t registerInfiniteComponent(const Mantid::Geometry::IComponent &component) override
InstrumentVisitor::registerInfiniteComponent.
int64_t m_sampleIndex
Sample index to set.
Mantid::Geometry::IComponent * m_sampleId
Sample id to look for.
std::shared_ptr< const Mantid::Geometry::Instrument > m_instrument
Instrument to build around.
std::shared_ptr< ParameterInfo > makeParameterInfo() const
Rekey the ParameterMap's parameters from legacy component pointers to component indices.
std::shared_ptr< std::vector< size_t > > m_parentComponentIndices
Index of the parent component.
std::shared_ptr< std::unordered_map< Mantid::Geometry::IComponent const *, size_t > > m_componentIdToIndexMap
Component ID -> Component Index map.
std::shared_ptr< std::vector< size_t > > m_monitorIndices
Monitor indexes for detectors.
virtual size_t registerInfiniteObjComponent(const IObjComponent &objComponent) override
InstrumentVisitor::registerInfiniteObjComponent.
virtual size_t registerGenericComponent(const Mantid::Geometry::IComponent &component) override
InstrumentVisitor::registerGenericComponent.
std::shared_ptr< std::vector< Eigen::Quaterniond, Eigen::aligned_allocator< Eigen::Quaterniond > > > m_detectorRotations
Rotations for detectors.
Base Instrument Class.
Definition Instrument.h:50
std::shared_ptr< const Instrument > baseInstrument() const
Pointer to the 'real' instrument, for parametrized instruments.
std::shared_ptr< ParameterMap > getParameterMap() const
Pointer to the NOT const ParameterMap holding the parameters of the modified instrument components.
Class for Assembly of geometric components.
static std::shared_ptr< Instrument > createInstrument(const std::shared_ptr< const Instrument > &base, const std::shared_ptr< ParameterMap > &map)
Create a parameterized instrument from the given base and ParameterMap.
Parameter map iterator typedef.
std::shared_ptr< ParameterInfo > rekey(std::shared_ptr< const ComponentIDs > componentIds, std::shared_ptr< const ComponentIndices > componentIndices)
Attach this map to an instrument's component index domain, rekeying its parameters onto the instrumen...
bool empty() const
Returns true if the map is empty, false otherwise.
static const std::string & scale()
static const std::string & rot()
static const std::string & posz()
static const std::string & pos()
Return string to be used in the map.
static const std::string & rotz()
static const std::string & posy()
static const std::string & posx()
static const std::string & rotx()
std::shared_ptr< Parameter > get(const IComponent *comp, const std::string &name, const std::string &type="") const
Get a parameter with a given name and type (std::string version)
static const std::string & roty()
StructuredDetector is a type of CompAssembly, an assembly of components.
This functor is used as the deleter object of a shared_ptr to effectively erase ownership Raw pointer...
Definition IComponent.h:171
Eigen::Vector3d toVector3d(const Kernel::V3D &vec)
Converts Kernel::V3D to Eigen::Vector3d.
Eigen::Vector2d toVector2d(const Kernel::V2D &vec)
Converts Kernel::V2D to Eigen::Vector2d.
Eigen::Quaterniond toQuaterniond(const Kernel::Quat &quat)
Converts Kernel::Quat to Eigen::Quaterniond.
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
Generate a tableworkspace to store the calibration results.
STL namespace.