Mantid
Loading...
Searching...
No Matches
NexusGeometryTestHelpers.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 +
9#include "MantidNexusGeometry/NexusShapeFactory.h"
10#include <numeric>
11
12using namespace Mantid::NexusGeometry;
13
15std::shared_ptr<const Mantid::Geometry::IObject> createShape() {
16 Eigen::Matrix<double, 3, 3> pointsDef;
17 // Vector to base positioned at center of cylinder
18 pointsDef.col(0) = Eigen::Vector3d(-0.00101, 0.0, 0.0);
19 // vector to base which is radial
20 pointsDef.col(1) = Eigen::Vector3d(-0.00101, 0.00405, 0.0);
21 // vector to top positioned at center of cylinder
22 pointsDef.col(2) = Eigen::Vector3d(0.00101, 0.0, 0.0);
23 return NexusShapeFactory::createCylinder(pointsDef);
24}
25
27 // Assuming tubes with axis vectors (1, 0, 0) create two tubes lying along x
28 // axis.
29 Eigen::Matrix<double, 3, 4> pix;
30 double tube1_y = 0;
31 double tube2_y = 0.05;
32
33 // Add 2 cylinder positions to tube 1
34 for (int i = 0; i < 2; ++i)
35 pix.col(i) = Eigen::Vector3d(0.00202 * i, tube1_y, 0);
36
37 // Add 2 cylinder positions to tube 2
38 for (int i = 2; i < 4; ++i)
39 pix.col(i) = Eigen::Vector3d(0.00202 * i, tube2_y, 0);
40
41 return pix;
42}
43
45 // Add two 4 cylinders which are not CoLinear
46 Eigen::Matrix<double, 3, 4> pix;
47 pix.col(0) = Eigen::Vector3d(0, 0.1, 0);
48 pix.col(1) = Eigen::Vector3d(0.3, 0.6, 0.3);
49 pix.col(2) = Eigen::Vector3d(-0.7, -0.7, 0);
50 pix.col(3) = Eigen::Vector3d(1, 1.9, 0);
51
52 return pix;
53}
54
55std::vector<int> getFakeDetIDs() {
56 std::vector<int> detIDs(4);
57 std::iota(detIDs.begin(), detIDs.end(), 4);
58 return detIDs;
59}
60} // namespace NexusGeometryTestHelpers
std::shared_ptr< const Mantid::Geometry::IObject > createShape()