Mantid
Loading...
Searching...
No Matches
ComponentInfo.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/ComponentType.h"
21
22#include <Eigen/Geometry>
23#include <algorithm>
24#include <exception>
25#include <iterator>
26#include <string>
27
28namespace Mantid::Geometry {
29
30namespace {
34const Eigen::Vector3d undoRotation(const Eigen::Vector3d &point, const Beamline::ComponentInfo &compInfo,
35 const size_t componentIndex) {
36 auto unRotateTransform = Eigen::Affine3d(compInfo.rotation(componentIndex).inverse());
37 return unRotateTransform * point;
38}
46const Kernel::V3D toShapeFrame(const Kernel::V3D &point, const Beamline::ComponentInfo &compInfo,
47 const size_t componentIndex) {
48 return Kernel::toV3D(
49 undoRotation(Kernel::toVector3d(point) - compInfo.position(componentIndex), compInfo, componentIndex));
50}
51
52} // namespace
53
64 std::unique_ptr<Beamline::ComponentInfo> componentInfo,
65 std::shared_ptr<const std::vector<Mantid::Geometry::IComponent *>> componentIds,
66 std::shared_ptr<const std::unordered_map<Geometry::IComponent const *, size_t>> componentIdToIndexMap,
67 std::shared_ptr<std::vector<std::shared_ptr<const Geometry::IObject>>> shapes,
68 std::shared_ptr<ParameterInfo> parameterInfo, std::shared_ptr<const ReferenceFrame> referenceFrame)
69 : m_componentInfo(std::move(componentInfo)), m_componentIds(std::move(componentIds)),
70 m_compIDToIndex(std::move(componentIdToIndexMap)), m_shapes(std::move(shapes)),
71 m_parameterInfo(std::move(parameterInfo)), m_referenceFrame(std::move(referenceFrame)) {
72
73 if (m_componentIds->size() != m_compIDToIndex->size()) {
74 throw std::invalid_argument("Inconsistent ID and Mapping input containers "
75 "for Geometry::ComponentInfo");
76 }
77 if (m_componentIds->size() != m_componentInfo->size()) {
78 throw std::invalid_argument("Inconsistent ID and base "
79 "Beamline::ComponentInfo sizes for "
80 "Geometry::ComponentInfo");
81 }
82}
83
88std::unique_ptr<Geometry::ComponentInfo> ComponentInfo::cloneWithoutDetectorInfo() const {
89
90 return std::unique_ptr<Geometry::ComponentInfo>(new Geometry::ComponentInfo(*this));
91}
92
98 : m_componentInfo(other.m_componentInfo->cloneWithoutDetectorInfo()), m_componentIds(other.m_componentIds),
99 m_compIDToIndex(other.m_compIDToIndex), m_shapes(other.m_shapes), m_parameterInfo(other.m_parameterInfo),
100 m_referenceFrame(other.m_referenceFrame) {}
101
102// Defined as default in source for forward declaration with std::unique_ptr.
104
105std::vector<size_t> ComponentInfo::detectorsInSubtree(size_t componentIndex) const {
106 return m_componentInfo->detectorsInSubtree(componentIndex);
107}
108
109std::vector<size_t> ComponentInfo::componentsInSubtree(size_t componentIndex) const {
110 return m_componentInfo->componentsInSubtree(componentIndex);
111}
112
113const std::vector<size_t> &ComponentInfo::children(size_t componentIndex) const {
114 return m_componentInfo->children(componentIndex);
115}
116
117size_t ComponentInfo::size() const { return m_componentInfo->size(); }
118
120 auto type = componentType(componentIndex);
121 auto parentType = componentType(parent(componentIndex));
122 if (!(type == Beamline::ComponentType::Structured || type == Beamline::ComponentType::Rectangular ||
123 parentType == Beamline::ComponentType::Grid))
124 throw std::runtime_error("ComponentType is not Structured or Rectangular "
125 "in ComponentInfo::quadrilateralComponent.");
126
128 const auto &innerRangeComp = m_componentInfo->children(componentIndex);
129 corners.nX = innerRangeComp.size();
130 const auto &firstCol = m_componentInfo->children(innerRangeComp[0]);
131 const auto &lastCol = m_componentInfo->children(innerRangeComp[corners.nX - 1]);
132 corners.nY = firstCol.size();
133 corners.bottomLeft = firstCol.front();
134 corners.topRight = lastCol.back();
135 corners.topLeft = firstCol.back();
136 corners.bottomRight = lastCol.front();
137
138 return corners;
139}
140
141size_t ComponentInfo::indexOf(Geometry::IComponent const *id) const { return m_compIDToIndex->at(id); }
142
144 auto const found = m_compIDToIndex->find(id);
145 return found == m_compIDToIndex->end() ? invalidIndex : found->second;
146}
147
148size_t ComponentInfo::indexOfAny(const std::string &name) const { return m_componentInfo->indexOfAny(name); }
149
150bool ComponentInfo::uniqueName(const std::string &name) const { return m_componentInfo->uniqueName(name); }
151
152bool ComponentInfo::isDetector(const size_t componentIndex) const {
153 return m_componentInfo->isDetector(componentIndex);
154}
155
156bool ComponentInfo::hasValidShape(const size_t componentIndex) const {
157 const auto *shapeAtIndex = (*m_shapes)[componentIndex].get();
158 return shapeAtIndex != nullptr && shapeAtIndex->hasValidShape();
159}
160
161Kernel::V3D ComponentInfo::position(const size_t componentIndex) const {
162 return Kernel::toV3D(m_componentInfo->position(componentIndex));
163}
164
165Kernel::V3D ComponentInfo::position(const std::pair<size_t, size_t> &index) const {
166 return Kernel::toV3D(m_componentInfo->position(index));
167}
168
169Kernel::Quat ComponentInfo::rotation(const size_t componentIndex) const {
170 return Kernel::toQuat(m_componentInfo->rotation(componentIndex));
171}
172
173Kernel::Quat ComponentInfo::rotation(const std::pair<size_t, size_t> &index) const {
174 return Kernel::toQuat(m_componentInfo->rotation(index));
175}
176
177Kernel::V3D ComponentInfo::relativePosition(const size_t componentIndex) const {
178 return Kernel::toV3D(m_componentInfo->relativePosition(componentIndex));
179}
180
181Kernel::Quat ComponentInfo::relativeRotation(const size_t componentIndex) const {
182 return Kernel::toQuat(m_componentInfo->relativeRotation(componentIndex));
183}
184
185void ComponentInfo::setPosition(const std::pair<size_t, size_t> &index, const Kernel::V3D &newPosition) {
186 m_componentInfo->setPosition(index, Kernel::toVector3d(newPosition));
187}
188
189void ComponentInfo::setRotation(const std::pair<size_t, size_t> &index, const Kernel::Quat &newRotation) {
190 m_componentInfo->setRotation(index, Kernel::toQuaterniond(newRotation));
191}
192
193void ComponentInfo::scaleComponent(const size_t componentIndex, const Kernel::V3D &newScaling) {
194 m_componentInfo->scaleComponent(componentIndex, Kernel::toVector3d(newScaling));
195}
196
197void ComponentInfo::scaleComponent(const std::pair<size_t, size_t> &index, const Kernel::V3D &newScaling) {
198 m_componentInfo->scaleComponent(index, Kernel::toVector3d(newScaling));
199}
200
201size_t ComponentInfo::parent(const size_t componentIndex) const { return m_componentInfo->parent(componentIndex); }
202
203bool ComponentInfo::hasParent(const size_t componentIndex) const { return m_componentInfo->hasParent(componentIndex); }
204
205bool ComponentInfo::hasDetectorInfo() const { return m_componentInfo->hasDetectorInfo(); }
206
208
210
211bool ComponentInfo::hasSource() const { return m_componentInfo->hasSource(); }
212
213/*
214 * @brief Check the sources of two componentInfo objects coincide
215 *
216 * @details check both objects either lack or have a source. If the latter,
217 * check their positions differ by less than 1 nm = 1e-9 m.
218 *
219 * @returns true if sources are equivalent
220 */
222 return m_componentInfo->hasEquivalentSource(*(other.m_componentInfo));
223}
224
225bool ComponentInfo::hasSample() const { return m_componentInfo->hasSample(); }
226
227/*
228 * @brief Check the samples of two componentInfo objects coincide
229 *
230 * @details check both objects either lack or have a sample. If the latter,
231 * check their positions differ by less than 1 nm = 1e-9 m.
232 *
233 * @returns true if sources are equivalent
234 */
236 return m_componentInfo->hasEquivalentSample(*(other.m_componentInfo));
237}
238
239bool ComponentInfo::hasDetectors(const size_t componentIndex) const {
240 if (isDetector(componentIndex))
241 return false;
242 const auto range = m_componentInfo->detectorRangeInSubtree(componentIndex);
243 return range.begin() < range.end();
244}
245
246size_t ComponentInfo::source() const { return m_componentInfo->source(); }
247
248size_t ComponentInfo::sample() const { return m_componentInfo->sample(); }
249
250double ComponentInfo::l1() const { return m_componentInfo->l1(); }
251
252size_t ComponentInfo::root() const { return m_componentInfo->root(); }
253
254void ComponentInfo::setPosition(const size_t componentIndex, const Kernel::V3D &newPosition) {
255 m_componentInfo->setPosition(componentIndex, Kernel::toVector3d(newPosition));
256}
257
258std::shared_ptr<const ReferenceFrame> ComponentInfo::referenceFrame() const {
260 return m_referenceFrame;
261 static const auto defaultFrame = std::make_shared<const ReferenceFrame>();
262 return defaultFrame;
263}
264
265void ComponentInfo::setRotation(const size_t componentIndex, const Kernel::Quat &newRotation) {
266 m_componentInfo->setRotation(componentIndex, Kernel::toQuaterniond(newRotation));
267}
268
269const IObject &ComponentInfo::shape(const size_t componentIndex) const { return *(*m_shapes)[componentIndex]; }
270
277std::unordered_map<std::shared_ptr<const IObject>, std::vector<size_t>> ComponentInfo::shapeToComponentIndices() const {
278 std::unordered_map<std::shared_ptr<const IObject>, std::vector<size_t>> result;
279 const auto &shapes = *m_shapes;
280 for (size_t i = 0; i < shapes.size(); ++i) {
281 const auto &currentShape = shapes[i];
282 if (currentShape != nullptr && currentShape->hasValidShape())
283 result[currentShape].emplace_back(i);
284 }
285 return result;
286}
287
288Kernel::V3D ComponentInfo::scaleFactor(const size_t componentIndex) const {
289 return Kernel::toV3D(m_componentInfo->scaleFactor(componentIndex));
290}
291
292const std::string &ComponentInfo::name(const size_t componentIndex) const {
293 return m_componentInfo->name(componentIndex);
294}
295
296void ComponentInfo::setScaleFactor(const size_t componentIndex, const Kernel::V3D &scaleFactor) {
297 m_componentInfo->setScaleFactor(componentIndex, Kernel::toVector3d(scaleFactor));
298}
299
300Kernel::V2D ComponentInfo::sideBySideViewPosition(const size_t componentIndex) const {
301 return Kernel::toV2D(m_componentInfo->sideBySideViewPosition(componentIndex));
302}
303
304bool ComponentInfo::isGridDetector(size_t const componentIndex) const {
305 return m_componentInfo->isGridDetector(componentIndex);
306}
307
308Beamline::PixelGridComponent ComponentInfo::pixelGridComponent(const size_t componentIndex) const {
309 if (!isGridDetector(componentIndex)) {
310 throw std::runtime_error("ComponentType is not Rectangular or Grid in ComponentInfo::pixelGridComponent.");
311 }
312 return m_componentInfo->pixelGridComponent(componentIndex);
313}
314
315bool ComponentInfo::isStructuredDetector(size_t const componentIndex) const {
316 return m_componentInfo->isStructuredDetector(componentIndex);
317}
318
319const Beamline::StructuredGridComponent &ComponentInfo::structuredGridComponent(const size_t componentIndex) const {
320 if (!isStructuredDetector(componentIndex)) {
321 throw std::runtime_error("ComponentType is not Structured in ComponentInfo::structuredGridComponent.");
322 }
323 return m_componentInfo->structuredGridComponent(componentIndex);
324}
325
326size_t ComponentInfo::detectorIndexAtXYZ(const size_t componentIndex, const int x, const int y, const int z) const {
327 return m_componentInfo->detectorIndexAtXYZ(componentIndex, x, y, z);
328}
329
330namespace {
331std::tuple<int, int, int> xyzFillFirstZ(const Beamline::PixelGridComponent &grid, int col, int id) {
332 if (grid.idFillOrder[1] == 'y') {
333 int row = (id / grid.idStepByRow) % grid.nY;
334 int layer = (id / grid.idStepByRow) / grid.nY;
335 return {layer, row, col};
336 }
337 int row = (id / grid.idStepByRow) % grid.nX;
338 int layer = (id / grid.idStepByRow) / grid.nX;
339 return {row, layer, col};
340}
341
342std::tuple<int, int, int> xyzFillFirstY(const Beamline::PixelGridComponent &grid, int col, int id) {
343 if (grid.idFillOrder[1] == 'z') {
344 int row = (id / grid.idStepByRow) % grid.nZ;
345 int layer = (id / grid.idStepByRow) / grid.nZ;
346 return {layer, col, row};
347 }
348 int row = (id / grid.idStepByRow) % grid.nX;
349 int layer = (id / grid.idStepByRow) / grid.nX;
350 return {row, col, layer};
351}
352
353std::tuple<int, int, int> xyzFillFirstX(const Beamline::PixelGridComponent &grid, int col, int id) {
354 if (grid.idFillOrder[1] == 'y') {
355 int row = (id / grid.idStepByRow) % grid.nY;
356 int layer = (id / grid.idStepByRow) / grid.nY;
357 return {col, row, layer};
358 }
359 int row = (id / grid.idStepByRow) % grid.nZ;
360 int layer = (id / grid.idStepByRow) / grid.nZ;
361 return {col, layer, row};
362}
363} // namespace
364
373std::tuple<int, int, int> ComponentInfo::xyzForDetectorID(const size_t componentIndex, const detid_t detectorID) const {
374 const auto grid = pixelGridComponent(componentIndex);
375
376 const int id = detectorID - grid.idStart;
377 if (grid.idStepByRow == 0 || grid.idStep == 0)
378 return {-1, -1, -1};
379 const int col = (id % grid.idStepByRow) / grid.idStep;
380
381 if (grid.idFillOrder[0] == 'z')
382 return xyzFillFirstZ(grid, col, id);
383 if (grid.idFillOrder[0] == 'y')
384 return xyzFillFirstY(grid, col, id);
385 return xyzFillFirstX(grid, col, id);
386}
387
388double ComponentInfo::solidAngle(const size_t componentIndex, const Geometry::SolidAngleParams &params) const {
389 if (!hasValidShape(componentIndex))
390 throw Kernel::Exception::NullPointerException("ComponentInfo::solidAngle", "shape");
391 // This is the observer position in the shape's coordinate system.
392 const Kernel::V3D relativeObserver = toShapeFrame(params.observer(), *m_componentInfo, componentIndex);
393 const Kernel::V3D scaleFactorAtIndex = this->scaleFactor(componentIndex);
394 const auto paramsWithRelativeObserver = params.copyWithNewObserver(relativeObserver);
395 if ((scaleFactorAtIndex - Kernel::V3D(1.0, 1.0, 1.0)).norm() < 1e-12)
396 return shape(componentIndex).solidAngle(paramsWithRelativeObserver);
397 else {
398 // This function will scale the object shape when calculating the solid
399 // angle.
400 return shape(componentIndex).solidAngle(paramsWithRelativeObserver, scaleFactorAtIndex);
401 }
402}
403
422 Geometry::BoundingBox &mutableBB,
423 const bool excludeMonitors) const {
424
425 auto panel = quadrilateralComponent(index);
426 mutableBB.grow(componentBoundingBox(panel.bottomLeft, reference, excludeMonitors));
427 mutableBB.grow(componentBoundingBox(panel.topRight, reference, excludeMonitors));
428 mutableBB.grow(componentBoundingBox(panel.topLeft, reference, excludeMonitors));
429 mutableBB.grow(componentBoundingBox(panel.bottomRight, reference, excludeMonitors));
430}
431
443 const bool excludeMonitors) const {
444 mutableBB.grow(componentBoundingBox(index, reference, excludeMonitors));
445}
446
457 const bool excludeMonitors) const {
458 // Check that we have a valid shape here
459 if (componentType(index) == Beamline::ComponentType::Infinite) {
460 return BoundingBox(); // Return null bounding box
461 }
462 if (excludeMonitors) {
463 // skip monitors
464 if (isDetector(index) && m_componentInfo->isMonitor(index)) {
465 return BoundingBox();
466 }
467 // skip other components such as choppers, etc
468 if (componentType(index) == Beamline::ComponentType::Generic) {
469 return BoundingBox();
470 }
471 }
472 if (!hasValidShape(index)) {
473 return BoundingBox(this->position(index).X(), this->position(index).Y(), this->position(index).Z(),
474 this->position(index).X(), this->position(index).Y(), this->position(index).Z());
475 } else {
476 const auto &s = this->shape(index);
477 BoundingBox absoluteBB = s.getBoundingBox();
478
479 // modify in place for speed
480 const Eigen::Vector3d scaleFactorAtIndex = m_componentInfo->scaleFactor(index);
481 // Scale
482 absoluteBB.xMin() *= scaleFactorAtIndex[0];
483 absoluteBB.xMax() *= scaleFactorAtIndex[0];
484 absoluteBB.yMin() *= scaleFactorAtIndex[1];
485 absoluteBB.yMax() *= scaleFactorAtIndex[1];
486 absoluteBB.zMin() *= scaleFactorAtIndex[2];
487 absoluteBB.zMax() *= scaleFactorAtIndex[2];
488 // Rotate
489 (this->rotation(index))
490 .rotateBB(absoluteBB.xMin(), absoluteBB.yMin(), absoluteBB.zMin(), absoluteBB.xMax(), absoluteBB.yMax(),
491 absoluteBB.zMax());
492
493 // Shift
494 const Eigen::Vector3d localPos = m_componentInfo->position(index);
495 absoluteBB.xMin() += localPos[0];
496 absoluteBB.xMax() += localPos[0];
497 absoluteBB.yMin() += localPos[1];
498 absoluteBB.yMax() += localPos[1];
499 absoluteBB.zMin() += localPos[2];
500 absoluteBB.zMax() += localPos[2];
501
502 if (reference && !reference->isAxisAligned()) { // copy coordinate system
503
504 std::vector<Kernel::V3D> coordSystem;
505 coordSystem.assign(reference->getCoordSystem().begin(), reference->getCoordSystem().end());
506
507 // realign to reference coordinate system
508 absoluteBB.realign(&coordSystem);
509 }
510 return absoluteBB;
511 }
512}
513
525BoundingBox ComponentInfo::boundingBox(const size_t componentIndex, const BoundingBox *reference,
526 const bool excludeMonitors) const {
527 if (isDetector(componentIndex) || componentType(componentIndex) == Beamline::ComponentType::Infinite) {
528 return componentBoundingBox(componentIndex, reference, excludeMonitors);
529 }
530
531 BoundingBox absoluteBB;
532 const auto compFlag = componentType(componentIndex);
533
534 auto parentFlag = Beamline::ComponentType::Generic;
535 if (size() > 1)
536 parentFlag = componentType(parent(componentIndex));
537
538 if (hasSource() && componentIndex == source()) {
539 // Do nothing. Source is not considered part of the beamline for bounding
540 // box calculations.
541 } else if (compFlag == Beamline::ComponentType::Unstructured) {
542 for (const auto &childIndex : this->children(componentIndex)) {
543 absoluteBB.grow(boundingBox(childIndex, reference, excludeMonitors));
544 }
545 } else if (compFlag == Beamline::ComponentType::Grid) {
546 for (const auto &childIndex : this->children(componentIndex)) {
547 growBoundingBoxAsRectuangularBank(childIndex, reference, absoluteBB, excludeMonitors);
548 }
549 } else if (compFlag == Beamline::ComponentType::Rectangular || compFlag == Beamline::ComponentType::Structured ||
550 parentFlag == Beamline::ComponentType::Grid) {
551 growBoundingBoxAsRectuangularBank(componentIndex, reference, absoluteBB, excludeMonitors);
552 } else if (compFlag == Beamline::ComponentType::OutlineComposite) {
553 growBoundingBoxAsOutline(componentIndex, reference, absoluteBB, excludeMonitors);
554 } else {
555 // General case
556 absoluteBB.grow(componentBoundingBox(componentIndex, reference, excludeMonitors));
557 }
558 return absoluteBB;
559}
560
561Beamline::ComponentType ComponentInfo::componentType(const size_t componentIndex) const {
562 return m_componentInfo->componentType(componentIndex);
563}
564
565void ComponentInfo::setScanInterval(const std::pair<Types::Core::DateAndTime, Types::Core::DateAndTime> &interval) {
566 m_componentInfo->setScanInterval({interval.first.totalNanoseconds(), interval.second.totalNanoseconds()});
567}
568
569size_t ComponentInfo::scanCount() const { return m_componentInfo->scanCount(); }
570
571void ComponentInfo::merge(const ComponentInfo &other) { m_componentInfo->merge(*other.m_componentInfo); }
572
574
576
578
580
581size_t ComponentInfo::findBankParent(size_t index, const std::string &bankPart) const {
582 constexpr size_t noBankParent{0}; // index 0 will always be a dectector and never a bank
583 // if this component is a bank, return the parent
584 if (name(index).starts_with(bankPart)) {
585 return parent(index);
586 }
587 // check if the children components begin with bankPart
588 auto indexChildren = children(index);
589 if (indexChildren.empty()) {
590 return noBankParent;
591 }
592 // if they do, we found the bank parent
593 if (name(indexChildren[0]).starts_with(bankPart)) {
594 return index;
595 }
596 // if not, check the grandchildren
597 for (size_t const child : indexChildren) {
598 size_t j = findBankParent(child, bankPart);
599 if (j != noBankParent) {
600 return j;
601 }
602 }
603 return noBankParent;
604}
605
608std::string ComponentInfo::fullName(const size_t componentIndex) const {
609 std::vector<size_t> ancestry{componentIndex};
610 for (size_t index = componentIndex; hasParent(index);) {
611 index = parent(index);
612 ancestry.emplace_back(index);
613 }
614 std::string result;
615 for (auto it = ancestry.crbegin(); it != ancestry.crend(); ++it) {
616 if (it != ancestry.crbegin()) {
617 result += "/";
618 }
619 result += name(*it);
620 }
621 return result;
622}
623
633size_t ComponentInfo::indexOfFullName(const std::string &fullName) const {
634 if (fullName.empty() || size() == 0) {
635 return invalidIndex;
636 }
637
638 size_t current = root();
639 size_t segmentStart = 0;
640 bool first = true;
641 while (segmentStart <= fullName.size()) {
642 const auto separator = fullName.find('/', segmentStart);
643 const auto segment =
644 fullName.substr(segmentStart, separator == std::string::npos ? std::string::npos : separator - segmentStart);
645 if (first) {
646 // The leading segment names the root itself, as fullName() writes it.
647 if (name(current) != segment) {
648 return invalidIndex;
649 }
650 first = false;
651 } else {
652 auto const &candidates = children(current);
653 auto const found =
654 std::find_if(candidates.cbegin(), candidates.cend(), [&](size_t child) { return name(child) == segment; });
655 if (found == candidates.cend()) {
656 return invalidIndex;
657 }
658 current = *found;
659 }
660 if (separator == std::string::npos) {
661 break;
662 }
663 segmentStart = separator + 1;
664 }
665 return current;
666}
667
668Parameter_sptr ComponentInfo::findParameter(size_t componentIndex, std::string const &name, bool recursive) const {
669 if (!m_parameterInfo) {
670 return nullptr;
671 }
672 return recursive ? m_parameterInfo->getRecursive(*this, componentIndex, name)
673 : m_parameterInfo->get(componentIndex, name);
674}
675
676template <class T>
677std::vector<T> ComponentInfo::getParameter(size_t componentIndex, const std::string &name, bool recursive) const {
678 std::vector<T> result;
679 if (auto const param = findParameter(componentIndex, name, recursive)) {
680 result.emplace_back(param->value<T>());
681 }
682 return result;
683}
684
685bool ComponentInfo::hasParameter(const size_t componentIndex, const std::string &name, bool recursive) const {
686 bool result = false;
687 if (m_parameterInfo) {
688 // Recursively walk the ParameterInfo to search for name
689 result = recursive ? static_cast<bool>(m_parameterInfo->getRecursive(*this, componentIndex, name))
690 : m_parameterInfo->contains(componentIndex, name);
691 }
692 return result;
693}
694
695std::set<std::string> ComponentInfo::getParameterNames(const size_t componentIndex, bool recursive) const {
696 std::set<std::string> result;
697 if (m_parameterInfo) {
698 // Unlike the single-parameter lookups, this searches for all instances in component tree
699 result = m_parameterInfo->names(componentIndex);
700 if (recursive && hasParent(componentIndex)) {
701 auto const parentNames = getParameterNames(parent(componentIndex), true);
702 result.insert(parentNames.cbegin(), parentNames.cend());
703 }
704 }
705 return result;
706}
707
709 if (!m_parameterInfo) {
710 m_parameterInfo = std::make_shared<ParameterInfo>();
711 }
712 return *m_parameterInfo;
713}
714
715template <class T>
716void ComponentInfo::addTypedParameter(const size_t componentIndex, const std::string &type, const std::string &name,
717 const T &value, const std::string *const pDescription,
718 const std::string &pVisible) {
719 auto param = ParameterFactory::create(type, name, pVisible);
720 auto typedParameter = std::dynamic_pointer_cast<ParameterType<T>>(param);
721 if (!typedParameter) {
722 throw std::invalid_argument("ComponentInfo: parameter type '" + type + "' does not match the value supplied for '" +
723 name + "'");
724 }
725 typedParameter->setValue(value);
726 if (pDescription) {
727 param->setDescription(*pDescription);
728 }
729 mutableParameterInfo().add(componentIndex, param);
730}
731
732void ComponentInfo::addParameter(const size_t componentIndex, const std::string &type, const std::string &name,
733 const std::string &value, const std::string *const pDescription,
734 const std::string &pVisible) {
735 auto param = ParameterFactory::create(type, name, pVisible);
736 // fromString rather than setValue: the value arrives already serialised, and the concrete
737 // parameter type knows how to parse its own form.
738 param->fromString(value);
739 if (pDescription) {
740 param->setDescription(*pDescription);
741 }
742 mutableParameterInfo().add(componentIndex, param);
743}
744
745void ComponentInfo::addDouble(const size_t componentIndex, const std::string &name, double value,
746 const std::string *const pDescription, const std::string &pVisible) {
747 addTypedParameter(componentIndex, ParameterMap::pDouble(), name, value, pDescription, pVisible);
748}
749
750void ComponentInfo::addInt(const size_t componentIndex, const std::string &name, int value,
751 const std::string *const pDescription, const std::string &pVisible) {
752 addTypedParameter(componentIndex, ParameterMap::pInt(), name, value, pDescription, pVisible);
753}
754
755void ComponentInfo::addBool(const size_t componentIndex, const std::string &name, bool value,
756 const std::string *const pDescription, const std::string &pVisible) {
757 addTypedParameter(componentIndex, ParameterMap::pBool(), name, value, pDescription, pVisible);
758}
759
760void ComponentInfo::addString(const size_t componentIndex, const std::string &name, const std::string &value,
761 const std::string *const pDescription, const std::string &pVisible) {
762 addTypedParameter(componentIndex, ParameterMap::pString(), name, value, pDescription, pVisible);
763}
764
765void ComponentInfo::addV3D(const size_t componentIndex, const std::string &name, const Kernel::V3D &value,
766 const std::string *const pDescription) {
767 addTypedParameter(componentIndex, ParameterMap::pV3D(), name, value, pDescription, "true");
768}
769
770void ComponentInfo::addQuat(const size_t componentIndex, const std::string &name, const Kernel::Quat &value,
771 const std::string *const pDescription) {
772 addTypedParameter(componentIndex, ParameterMap::pQuat(), name, value, pDescription, "true");
773}
774
775void ComponentInfo::addFittingParameter(const size_t componentIndex, const std::string &name,
776 const std::string &fittingFunction, const std::string &value,
777 const std::string *const pDescription, const std::string &pVisible) {
778 auto param = ParameterFactory::create("fitting", name, pVisible);
779 param->fromString(value);
780 if (pDescription) {
781 param->setDescription(*pDescription);
782 }
783 mutableParameterInfo().addFittingParameter(componentIndex, param, fittingFunction);
784}
785
787 static ParameterInfo::LogfileParameters const empty;
788 return m_parameterInfo ? m_parameterInfo->logfileParameters() : empty;
789}
790
791void ComponentInfo::addLogfileParameter(size_t const componentIndex, std::string const &cacheKey,
792 std::shared_ptr<const XMLInstrumentParameter> const &param) {
793 mutableParameterInfo().addLogfileParameter(componentIndex, cacheKey, param);
794}
795
796void ComponentInfo::clearParameter(const size_t componentIndex, const std::string &name) {
797 if (m_parameterInfo) {
798 m_parameterInfo->clearParametersByName(componentIndex, name);
799 }
800}
801
803 // Cleared in place, not replaced: the store is shared with the owning ParameterMap.
804 if (m_parameterInfo) {
805 m_parameterInfo->clear();
806 }
807}
808
809const ParameterInfo::ComponentParameters &ComponentInfo::parameters(const size_t componentIndex) const {
810 static ParameterInfo::ComponentParameters const empty;
811 return m_parameterInfo ? m_parameterInfo->parameters(componentIndex) : empty;
812}
813
814std::shared_ptr<const Parameter> ComponentInfo::parameter(const size_t componentIndex, const std::string &name,
815 const std::string &type, bool recursive) const {
816 if (!m_parameterInfo) {
817 return nullptr;
818 }
819 return recursive ? m_parameterInfo->getRecursive(*this, componentIndex, name, type)
820 : m_parameterInfo->get(componentIndex, name, type);
821}
822
823std::shared_ptr<const Parameter> ComponentInfo::parameterByType(const size_t componentIndex, const std::string &type,
824 bool recursive) const {
825 if (!m_parameterInfo) {
826 return nullptr;
827 }
828 return recursive ? m_parameterInfo->getRecursiveByType(*this, componentIndex, type)
829 : m_parameterInfo->getByType(componentIndex, type);
830}
831
832std::vector<double> ComponentInfo::getNumberParameter(const size_t componentIndex, const std::string &name,
833 bool recursive) const {
834 return getParameter<double>(componentIndex, name, recursive);
835}
836
837std::vector<int> ComponentInfo::getIntParameter(const size_t componentIndex, const std::string &name,
838 bool recursive) const {
839 return getParameter<int>(componentIndex, name, recursive);
840}
841
842std::vector<bool> ComponentInfo::getBoolParameter(const size_t componentIndex, const std::string &name,
843 bool recursive) const {
844 return getParameter<bool>(componentIndex, name, recursive);
845}
846
847std::vector<std::string> ComponentInfo::getStringParameter(const size_t componentIndex, const std::string &name,
848 bool recursive) const {
849 return getParameter<std::string>(componentIndex, name, recursive);
850}
851
852std::vector<Kernel::V3D> ComponentInfo::getPositionParameter(const size_t componentIndex, const std::string &name,
853 bool recursive) const {
854 return getParameter<Kernel::V3D>(componentIndex, name, recursive);
855}
856
857std::vector<Kernel::Quat> ComponentInfo::getRotationParameter(const size_t componentIndex, const std::string &name,
858 bool recursive) const {
859 return getParameter<Kernel::Quat>(componentIndex, name, recursive);
860}
861
862std::string ComponentInfo::getParameterAsString(const size_t componentIndex, const std::string &name,
863 bool recursive) const {
864 auto const param = findParameter(componentIndex, name, recursive);
865 return param ? param->asString() : std::string();
866}
867
868bool ComponentInfo::getParameterVisible(const size_t componentIndex, const std::string &name, bool recursive) const {
869 auto const param = findParameter(componentIndex, name, recursive);
870 return param && param->visible();
871}
872
873std::string ComponentInfo::getParameterType(const size_t componentIndex, const std::string &name,
874 bool recursive) const {
875 auto const param = findParameter(componentIndex, name, recursive);
876 return param ? std::string(param->type()) : std::string();
877}
878
879std::string ComponentInfo::getParamDescription(const size_t componentIndex, const std::string &name,
880 bool recursive) const {
881 auto const param = findParameter(componentIndex, name, recursive);
882 return param ? param->getDescription() : std::string();
883}
884
885std::string ComponentInfo::getParamShortDescription(const size_t componentIndex, const std::string &name,
886 bool recursive) const {
887 auto const param = findParameter(componentIndex, name, recursive);
888 return param ? param->getShortDescription() : std::string();
889}
890
891std::string ComponentInfo::getDescription(const size_t componentIndex) const {
892 return getParamDescription(componentIndex, name(componentIndex), false);
893}
894
895std::string ComponentInfo::getShortDescription(const size_t componentIndex) const {
896 return getParamShortDescription(componentIndex, name(componentIndex), false);
897}
898
899void ComponentInfo::setDescription(const size_t componentIndex, const std::string &description) {
900 auto const &componentName = name(componentIndex);
901 if (auto const param = findParameter(componentIndex, componentName, true)) {
902 param->setDescription(description);
903 } else {
904 addString(componentIndex, componentName, "", &description);
905 }
906}
907
908double ComponentInfo::getFittingParameter(const size_t componentIndex, const std::string &name, double xvalue) const {
909 if (!m_parameterInfo)
910 throw std::runtime_error("Parameters are not available in component=" + this->name(componentIndex));
911 Parameter_sptr param = m_parameterInfo->getRecursive(*this, componentIndex, name, "fitting");
912 if (!param)
913 throw std::runtime_error("Fitting parameter=" + name +
914 " could not be extracted from component=" + this->name(componentIndex));
915 try {
916 const auto &fitParam = param->value<FitParameter>();
917 return fitParam.getValue(xvalue);
918 } catch (...) {
919 throw std::runtime_error("Unable to get lookup table for parameter=" + name +
920 " from component=" + this->name(componentIndex));
921 }
922}
923
928 const size_t n = size();
929 // Beamline::ComponentInfo holds all the per-component arrays
930 const size_t beamlineMem = m_componentInfo->getMemorySize();
931 // m_componentIds: shared_ptr<const vector<IComponent*>> — count the heap-allocated vector object + its buffer
932 const size_t componentIdsMem = sizeof(std::vector<Geometry::IComponent *>) + n * sizeof(Geometry::IComponent *);
933 // m_compIDToIndex: shared_ptr<const unordered_map<IComponent const*, size_t>>
934 // Count the heap-allocated map object + each node (key + value + ~2 pointers for bucket/chain overhead)
935 const size_t compIDToIndexMem = sizeof(std::unordered_map<Geometry::IComponent const *, size_t>) +
936 n * (sizeof(Geometry::IComponent const *) + sizeof(size_t) + 2 * sizeof(void *));
937 // m_shapes: shared_ptr<vector<shared_ptr<const IObject>>>
938 // IObject shapes are shared; count the vector object + buffer of shared_ptrs, not the shapes themselves
939 const size_t shapesMem =
940 m_shapes ? sizeof(*m_shapes) + m_shapes->capacity() * sizeof(std::shared_ptr<const Geometry::IObject>) : 0;
941 return sizeof(*this) + beamlineMem + componentIdsMem + compIDToIndexMem + shapesMem;
942}
943
944} // namespace Mantid::Geometry
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
double position
Definition GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
Mantid::Kernel::Quat(ComponentInfo::* rotation)(const size_t) const
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition BoundingBox.h:33
double xMax() const
Return the maximum value of X.
Definition BoundingBox.h:79
double zMin() const
Return the minimum value of Z.
Definition BoundingBox.h:85
std::vector< Kernel::V3D > const & getCoordSystem() const
returns the coordinate system to which BB is alighned to;
double zMax() const
Return the maximum value of Z.
Definition BoundingBox.h:87
double yMax() const
Return the maximum value of Y.
Definition BoundingBox.h:83
bool isAxisAligned() const
Check if it is normal axis aligned bounding box or not.
double xMin() const
Return the minimum value of X.
Definition BoundingBox.h:77
double yMin() const
Return the minimum value of Y.
Definition BoundingBox.h:81
void grow(const BoundingBox &other)
Grow the bounding box so that it also encompasses the given box.
void realign(std::vector< Kernel::V3D > const *const pCS=nullptr)
reallign the BB according to new coordinate system, provided earlier or specified as parameter;
ComponentInfo : Provides a component centric view on to the instrument.
std::vector< int > getIntParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
bool hasParent(const size_t componentIndex) const
ParameterInfo & mutableParameterInfo()
The store, created on first write if this ComponentInfo was built without one (a bare,...
const ComponentInfoIterator< const ComponentInfo > cend()
BoundingBox componentBoundingBox(const size_t index, const BoundingBox *reference, const bool excludeMonitors=false) const
Calculates the absolute bounding box for the leaf item at index.
size_t findBankParent(size_t index, const std::string &bankPart) const
std::shared_ptr< const Parameter > parameter(const size_t componentIndex, const std::string &name, const std::string &type="", bool recursive=true) const
The named parameter, of the given type if one is given, or null if the component has none.
std::string getShortDescription(const size_t componentIndex) const
The component's own short description: that of the parameter named after the component,...
bool isStructuredDetector(size_t const componentIndex) const
void clearParameter(const size_t componentIndex, const std::string &name)
Remove every parameter of this name from this component.
std::shared_ptr< const ReferenceFrame > m_referenceFrame
The instrument's reference frame (up, along-beam and handedness), or null if none was given.
std::string fullName(const size_t componentIndex) const
The fully-qualified name of a component ("instrument/bank1/pixel3")
std::unordered_map< std::shared_ptr< const Geometry::IObject >, std::vector< size_t > > shapeToComponentIndices() const
Build a map from each unique shape to the list of component indices that share it.
size_t indexOfAny(const std::string &name) const
The first component with this name in a breadth-first search, as Instrument::getComponentByName() fin...
void setRotation(size_t componentIndex, const Kernel::Quat &newRotation)
bool hasDetectors(const size_t componentIndex) const
std::shared_ptr< Parameter > findParameter(size_t componentIndex, std::string const &name, bool recursive) const
The named parameter on this component (or, if recursive, its nearest ancestor), or null.
bool hasEquivalentSource(const ComponentInfo &other) const
void setDescription(const size_t componentIndex, const std::string &description)
Set the component's description, as Component::setDescription() does: on the parameter named after th...
void clearParameters()
Remove every parameter from every component.
std::shared_ptr< const ReferenceFrame > referenceFrame() const
The instrument's reference frame: which axes point up and along the beam, and its handedness.
void addQuat(const size_t componentIndex, const std::string &name, const Kernel::Quat &value, const std::string *const pDescription=nullptr)
Add or replace a named quaternion parameter at a specific component index.
void addFittingParameter(const size_t componentIndex, const std::string &name, const std::string &fittingFunction, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add a fitting parameter.
double solidAngle(const size_t componentIndex, const Geometry::SolidAngleParams &params) const
size_t parent(const size_t componentIndex) const
std::string getParamDescription(const size_t componentIndex, const std::string &name, bool recursive=true) const
The description of the named parameter, or an empty string if it is unset.
Kernel::Quat rotation(const size_t componentIndex) const
bool isGridDetector(size_t const componentIndex) const
void growBoundingBoxAsOutline(size_t index, const Geometry::BoundingBox *reference, Geometry::BoundingBox &mutableBB, const bool excludeMonitors=false) const
Grow the bounding box on the basis that the component described by index has an outline,...
BoundingBox boundingBox(const size_t componentIndex, const BoundingBox *reference=nullptr, const bool excludeMonitors=false) const
Compute the bounding box for the component with componentIndex taking into account all sub components...
std::shared_ptr< std::vector< std::shared_ptr< const Geometry::IObject > > > m_shapes
Shapes for each component.
void scaleComponent(const size_t componentIndex, const Kernel::V3D &newScaling)
std::vector< Kernel::Quat > getRotationParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
std::vector< std::string > getStringParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
std::shared_ptr< const std::unordered_map< Geometry::IComponent const *, size_t > > m_compIDToIndex
Map of component ids to indexes.
Kernel::V3D position(const size_t componentIndex) const
const std::vector< size_t > & children(size_t componentIndex) const
Kernel::V2D sideBySideViewPosition(const size_t componentIndex) const
std::vector< size_t > componentsInSubtree(size_t componentIndex) const
bool hasParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
Returns empty (or false) if the ComponentInfo was built without parameters or the parameter is unset.
void addTypedParameter(const size_t componentIndex, const std::string &type, const std::string &name, const T &value, const std::string *const pDescription, const std::string &pVisible)
Shared implementation of the typed add*() methods.
void merge(const ComponentInfo &other)
bool hasValidShape(const size_t componentIndex) const
std::vector< double > getNumberParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
const Beamline::StructuredGridComponent & structuredGridComponent(const size_t componentIndex) const
The pixel counts, ID numbering and pixel vertices of a Structured bank. Throws if it is not one.
std::vector< Kernel::V3D > getPositionParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
std::shared_ptr< const Parameter > parameterByType(const size_t componentIndex, const std::string &type, bool recursive=true) const
The first parameter of the given type, or null if the component has none.
double getFittingParameter(const size_t componentIndex, const std::string &name, double xvalue) const
void addString(const size_t componentIndex, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add or replace a named string parameter at a specific component index.
std::vector< bool > getBoolParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
Beamline::PixelGridComponent pixelGridComponent(const size_t componentIndex) const
const ParameterInfo::LogfileParameters & logfileParameters() const
Parameters whose values are taken from the sample logs by ExperimentInfo::populateInstrumentParameter...
size_t indexOfOrInvalid(Geometry::IComponent const *id) const
The index for a component ID, or invalidIndex if it is not part of this instrument.
std::shared_ptr< ParameterInfo > m_parameterInfo
The instrument's named parameters, keyed by component index.
std::vector< T > getParameter(size_t componentIndex, const std::string &name, bool recursive) const
ComponentInfoIterator< ComponentInfo > begin()
bool hasEquivalentSample(const ComponentInfo &other) const
void setScaleFactor(const size_t componentIndex, const Kernel::V3D &scaleFactor)
ComponentInfoIterator< ComponentInfo > end()
std::unique_ptr< Beamline::ComponentInfo > m_componentInfo
Pointer to the actual ComponentInfo object (non-wrapping part).
std::vector< size_t > detectorsInSubtree(size_t componentIndex) const
std::string getParamShortDescription(const size_t componentIndex, const std::string &name, bool recursive=true) const
The short description (tooltip) of the named parameter, or an empty string if it is unset.
bool isDetector(const size_t componentIndex) const
bool uniqueName(const std::string &name) const
std::string getParameterAsString(size_t const componentIndex, std::string const &name, bool const recursive=true) const
The value of the named parameter as a string, whatever its type, or an empty string if it is unset.
void growBoundingBoxAsRectuangularBank(size_t index, const Geometry::BoundingBox *reference, Geometry::BoundingBox &mutableBB, const bool excludeMonitors=false) const
Grow the bounding box on the basis that the component described by index is a regular grid in a trape...
std::set< std::string > getParameterNames(const size_t componentIndex, bool recursive=true) const
std::unique_ptr< ComponentInfo > cloneWithoutDetectorInfo() const
Clone current instance but not the DetectorInfo non-owned parts.
const ComponentInfoIterator< const ComponentInfo > cbegin()
std::shared_ptr< const std::vector< Geometry::IComponent * > > m_componentIds
Collection of component ids.
bool getParameterVisible(const size_t componentIndex, const std::string &name, bool recursive=true) const
The named parameter's visibility attribute, or false if it is unset.
void addInt(const size_t componentIndex, const std::string &name, int value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add or replace a named integer parameter at a specific component index.
size_t detectorIndexAtXYZ(const size_t componentIndex, const int x, const int y, const int z) const
std::string getDescription(const size_t componentIndex) const
The component's own description: that of the parameter named after the component, not inherited.
Kernel::V3D relativePosition(const size_t componentIndex) const
std::tuple< int, int, int > xyzForDetectorID(const size_t componentIndex, const detid_t detectorID) const
Given the component index of a Rectangular/Grid bank, and a detector ID within it,...
size_t indexOf(Geometry::IComponent const *id) const
const std::string & name(const size_t componentIndex) const
size_t getMemorySize() const
Return memory used by the component info, in bytes.
Kernel::Quat relativeRotation(const size_t componentIndex) const
std::string getParameterType(const size_t componentIndex, const std::string &name, bool recursive=true) const
The type of the named parameter, or an empty string if the component has no such parameter.
void setPosition(size_t componentIndex, const Kernel::V3D &newPosition)
void addDouble(const size_t componentIndex, const std::string &name, double value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add or replace a named double parameter at a specific component index.
static constexpr size_t invalidIndex
Returned by indexOfOrInvalid() for a component ID that is not part of this instrument.
const Geometry::IObject & shape(const size_t componentIndex) const
void setScanInterval(const std::pair< Types::Core::DateAndTime, Types::Core::DateAndTime > &interval)
const ParameterInfo::ComponentParameters & parameters(const size_t componentIndex) const
All parameters on one component, non-recursive, ordered by name.
void addBool(const size_t componentIndex, const std::string &name, bool value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add or replace a named boolean parameter at a specific component index.
size_t indexOfFullName(const std::string &fullName) const
The component with this fully-qualified name, or invalidIndex if there is none.
QuadrilateralComponent quadrilateralComponent(const size_t componentIndex) const
Beamline::ComponentType componentType(const size_t componentIndex) const
void addV3D(const size_t componentIndex, const std::string &name, const Kernel::V3D &value, const std::string *const pDescription=nullptr)
Add or replace a named vector parameter at a specific component index.
Kernel::V3D scaleFactor(const size_t componentIndex) const
ComponentInfo(const ComponentInfo &other)
Private copy constructor. Do not make public.
void addLogfileParameter(size_t const componentIndex, std::string const &cacheKey, std::shared_ptr< const XMLInstrumentParameter > const &parameter)
Add or replace a logfile parameter on a component.
void addParameter(const size_t componentIndex, const std::string &type, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add or replace a named parameter at a specific component index.
Store information about a fitting parameter such as its value if it is constrained or tied.
double getValue(const double &at) const
get paramter value
base class for Geometric IComponent
Definition IComponent.h:53
IObject : Interface for geometry objects.
Definition IObject.h:43
virtual double solidAngle(const SolidAngleParams &params) const =0
static std::shared_ptr< Parameter > create(const std::string &className, const std::string &name, const std::string &visible="true")
Creates an instance of a parameter.
Definition Parameter.cpp:86
ParameterInfo : the named parameters of an instrument, addressed by component index.
bool addFittingParameter(size_t const componentIndex, std::shared_ptr< Parameter > const &parameter, std::string const &fittingFunction)
Add a fitting parameter, deduplicating by (name, function) rather than by name alone so that two func...
void addLogfileParameter(size_t const componentIndex, std::string const &cacheKey, std::shared_ptr< const XMLInstrumentParameter > const &parameter)
Add a logfile parameter, replacing any existing one with the same cache key on the same component.
void add(size_t const componentIndex, std::shared_ptr< Parameter > const &parameter)
Add a parameter, replacing any existing parameter of the same name on the same component.
std::multimap< std::string, std::shared_ptr< Parameter >, Kernel::CaseInsensitiveStringComparator > ComponentParameters
Parameters of a single component, ordered by name.
std::map< std::pair< size_t, std::string >, std::shared_ptr< const XMLInstrumentParameter > > LogfileParameters
Parameters whose values are taken from the sample logs when ExperimentInfo::populateInstrumentParamet...
static const std::string & pQuat()
static const std::string & pBool()
static const std::string & pV3D()
static const std::string & pDouble()
static const std::string & pString()
static const std::string & pInt()
const SolidAngleParams copyWithNewObserver(Kernel::V3D newObserver) const
const Kernel::V3D & observer() const
Exception thrown when an attempt is made to dereference a null pointer.
Definition Exception.h:305
Class for quaternions.
Definition Quat.h:38
Implements a 2-dimensional vector embedded in a 3D space, i.e.
Definition V2D.h:29
Class for 3D vectors.
Definition V3D.h:35
std::shared_ptr< Parameter > Parameter_sptr
Typedef for the shared pointer.
Definition Parameter.h:203
ComponentInfoIterator< const ComponentInfo > ComponentInfoConstIt
ComponentInfoIterator< ComponentInfo > ComponentInfoIt
Kernel::Quat toQuat(const Eigen::Quaterniond &quat)
Converts Eigen::Quaterniond to Kernel::Quat.
Kernel::V2D toV2D(const Eigen::Vector2d &vec)
Converts Eigen::Vector2d to Kernel::V2D.
Eigen::Vector3d toVector3d(const Kernel::V3D &vec)
Converts Kernel::V3D to Eigen::Vector3d.
Kernel::V3D toV3D(const Eigen::Vector3d &vec)
This header provides conversion helpers between vector and rotation types in MantidKernel and equival...
Eigen::Quaterniond toQuaterniond(const Kernel::Quat &quat)
Converts Kernel::Quat to Eigen::Quaterniond.
int32_t detid_t
Typedef for a detector ID.
STL namespace.