Mantid
Loading...
Searching...
No Matches
ComponentCreationHelper.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/*********************************************************************************
8 * PLEASE READ THIS!!!!!!!
9 *
10 * This header MAY NOT be included in any test from a package below Geometry
11 * (e.g. Kernel).
12 * Conversely, this file (and its cpp) MAY NOT be modified to use anything from
13 *a
14 * package higher than Geometry (e.g. API, DataObjects, ...)
15 *********************************************************************************/
16#pragma once
17
21#include "MantidKernel/V3D.h"
22#include <memory>
23
24// Forward declarations
25namespace Mantid {
26namespace Kernel {
27class Quat;
28}
29namespace Geometry {
30class CompAssembly;
31class ObjComponent;
32class DetectorGroup;
33class DetectorsRing;
34class IDetector;
35class Instrument;
36} // namespace Geometry
37} // namespace Mantid
38
40
46//----------------------------------------------------------------------------------------------
47
50
53 const std::string &name = "moderator");
54
58std::string cappedCylinderXML(double radius, double height, const Mantid::Kernel::V3D &baseCentre,
59 const Mantid::Kernel::V3D &axis, const std::string &id);
60
64std::shared_ptr<Mantid::Geometry::CSGObject> createCappedCylinder(double radius, double height,
65 const Mantid::Kernel::V3D &baseCentre,
66 const Mantid::Kernel::V3D &axis,
67 const std::string &id);
71std::string hollowCylinderXML(double innerRadius, double outerRadius, double height,
72 const Mantid::Kernel::V3D &baseCentre, const Mantid::Kernel::V3D &axis,
73 const std::string &id);
77std::shared_ptr<Mantid::Geometry::CSGObject> createHollowCylinder(double innerRadius, double outerRadius, double height,
78 const Mantid::Kernel::V3D &baseCentre,
79 const Mantid::Kernel::V3D &axis,
80 const std::string &id);
84std::string sphereXML(double radius, const Mantid::Kernel::V3D &centre, const std::string &id);
88std::shared_ptr<Mantid::Geometry::CSGObject>
89createSphere(double radius, const Mantid::Kernel::V3D &centre = Mantid::Kernel::V3D(), const std::string &id = "sp-1");
90std::string cuboidXML(double xHalfLength, double yHalfLength = -1.0, double zHalfLength = -1.0,
91 const Mantid::Kernel::V3D &centre = {0.0, 0.0, 0.0}, const std::string &id = "detector-shape");
93std::shared_ptr<Mantid::Geometry::CSGObject> createCuboid(double xHalfLength, double yHalfLength = -1.0,
94 double zHalfLength = -1.0,
95 const Mantid::Kernel::V3D &centre = {0.0, 0.0, 0.0},
96 const std::string &id = "detector-shape");
100std::shared_ptr<Mantid::Geometry::CSGObject> createCuboid(double xHalfLength, double yHalfLength, double zHalfLength,
101 double angle, const Mantid::Kernel::V3D &axis);
105std::shared_ptr<Mantid::Geometry::CompAssembly> createTestAssemblyOfFourCylinders();
110std::shared_ptr<Mantid::Geometry::CSGObject>
111createHollowShell(double innerRadius, double outerRadius, const Mantid::Kernel::V3D &centre = Mantid::Kernel::V3D());
115std::shared_ptr<Mantid::Geometry::DetectorGroup> createDetectorGroupWith5CylindricalDetectors();
119std::shared_ptr<Mantid::Geometry::DetectorGroup>
120createDetectorGroupWithNCylindricalDetectorsWithGaps(unsigned int nDet = 4, double gap = 0.01);
128std::shared_ptr<Mantid::Geometry::DetectorGroup>
129createRingOfCylindricalDetectors(const double R_min = 4.5, const double R_max = 5, const double z000000000000000 = 4);
130
138std::vector<std::unique_ptr<Mantid::Geometry::IDetector>>
139createVectorOfCylindricalDetectors(const double R_min = 4.5, const double R_max = 5, const double z000000000000000 = 4);
140
155createCylInstrumentWithVerticalOffsetsSpecified(size_t nTubes, std::vector<double> verticalOffsets, size_t nDetsPerTube,
156 double xMin, double xMax, double yMin, double yMax);
157
161 const std::vector<double> &polar,
162 const std::vector<double> &azim);
179 const Mantid::Kernel::V3D &sourcePos = Mantid::Kernel::V3D(0.0, 0.0, -10.),
180 const Mantid::Kernel::V3D &samplePos = Mantid::Kernel::V3D(),
181 const double cylRadius = 0.004, const double cylHeight = 0.0002);
182
183void addRectangularBank(Mantid::Geometry::Instrument &testInstrument, int idStart, int pixels, double pixelSpacing,
184 const std::string &bankName, const Mantid::Kernel::V3D &bankPos,
185 const Mantid::Kernel::Quat &bankRot);
186
190 double pixelSpacing = 0.008,
191 double bankDistanceFromSample = 5.0,
192 bool addMonitor = false);
193
195 double pixelSpacing = 0.008);
196
197Mantid::Geometry::Instrument_sptr createTestUnnamedRectangular2(int num_banks, int pixels, double pixelSpacing = 0.008);
198
201
204 const Mantid::Kernel::V3D &samplePos,
205 const Mantid::Kernel::V3D &detectorPos);
206
208 const Mantid::Kernel::Quat &monitorRot);
209
210// creates a minimal instrument with optional source, sample, and detector.
212 bool haveDetector);
213
215 const Mantid::Kernel::V3D &sourcePos, const Mantid::Kernel::V3D &samplePos, const Mantid::Kernel::V3D &detectorPos,
216 const Mantid::Kernel::Quat &relativeBankRotation, const Mantid::Kernel::Quat &relativeDetRotation,
217 const Mantid::Kernel::V3D &detOffset = Mantid::Kernel::V3D(0, 0, 0));
218
221 const Mantid::Kernel::V3D &detectorPos,
222 const Mantid::Kernel::Quat &relativeSourceRotation);
223
225 const Mantid::Kernel::V3D &samplePos,
226 const Mantid::Kernel::V3D &trolley1Pos,
227 const Mantid::Kernel::V3D &trolley2Pos);
228
230createInstrumentWithPSDTubes(const size_t nTubes = 3, const size_t nPixelsPerTube = 50, const bool mirrorTubes = false);
231} // namespace ComponentCreationHelper
double height
Definition: GetAllEi.cpp:155
double radius
Definition: Rasterize.cpp:31
double innerRadius
Definition: Rasterize.cpp:39
Base Instrument Class.
Definition: Instrument.h:47
Class for quaternions.
Definition: Quat.h:39
Class for 3D vectors.
Definition: V3D.h:34
std::string cappedCylinderXML(double radius, double height, const Mantid::Kernel::V3D &baseCentre, const Mantid::Kernel::V3D &axis, const std::string &id)
Return the appropriate XML for the requested cylinder.
std::shared_ptr< Mantid::Geometry::DetectorGroup > createDetectorGroupWith5CylindricalDetectors()
Create a detector group containing 5 detectors.
Mantid::Geometry::Instrument_sptr createCylInstrumentWithDetInGivenPositions(const std::vector< double > &L2, const std::vector< double > &polar, const std::vector< double > &azim)
create instrument with cylindrical detectors located in specific angular positions
Mantid::Geometry::Instrument_sptr createTestInstrumentCylindrical(int num_banks, const Mantid::Kernel::V3D &sourcePos=Mantid::Kernel::V3D(0.0, 0.0, -10.), const Mantid::Kernel::V3D &samplePos=Mantid::Kernel::V3D(), const double cylRadius=0.004, const double cylHeight=0.0002)
Create an test instrument with n panels of 9 cylindrical detectors, a source and a sample position.
std::shared_ptr< Mantid::Geometry::CSGObject > createHollowCylinder(double innerRadius, double outerRadius, double height, const Mantid::Kernel::V3D &baseCentre, const Mantid::Kernel::V3D &axis, const std::string &id)
Create a hollow cylinder object.
Mantid::Geometry::Instrument_sptr createMinimalInstrument(const Mantid::Kernel::V3D &sourcePos, const Mantid::Kernel::V3D &samplePos, const Mantid::Kernel::V3D &detectorPos)
Creates a mimimal valid virtual instrument.
std::string sphereXML(double radius, const Mantid::Kernel::V3D &centre, const std::string &id)
Return the XML for a sphere.
std::shared_ptr< Mantid::Geometry::DetectorGroup > createDetectorGroupWithNCylindricalDetectorsWithGaps(unsigned int nDet=4, double gap=0.01)
Create a detector group containing n detectors with gaps.
std::shared_ptr< Mantid::Geometry::DetectorGroup > createRingOfCylindricalDetectors(const double R_min=4.5, const double R_max=5, const double z000000000000000=4)
Create a detector group containing detectors ring R_min – min radius of the ring R_max – max radius o...
Mantid::Geometry::Instrument_sptr createTestInstrumentRectangular(int num_banks, int pixels, double pixelSpacing=0.008, double bankDistanceFromSample=5.0, bool addMonitor=false)
Create a test instrument with n panels of rectangular detectors, pixels*pixels in size,...
Mantid::Geometry::Instrument_sptr createEmptyInstrument()
Creates a geometrically nonsensical virtual instrument to be populated with detectors later.
Mantid::Geometry::Instrument_sptr createSimpleInstrumentWithRotation(const Mantid::Kernel::V3D &sourcePos, const Mantid::Kernel::V3D &samplePos, const Mantid::Kernel::V3D &detectorPos, const Mantid::Kernel::Quat &relativeBankRotation, const Mantid::Kernel::Quat &relativeDetRotation, const Mantid::Kernel::V3D &detOffset=Mantid::Kernel::V3D(0, 0, 0))
createSimpleInstrumentWithRotation, creates the most simple possible definition of an instrument in w...
Mantid::Geometry::Instrument_sptr sansInstrument(const Mantid::Kernel::V3D &sourcePos, const Mantid::Kernel::V3D &samplePos, const Mantid::Kernel::V3D &trolley1Pos, const Mantid::Kernel::V3D &trolley2Pos)
void addSourceToInstrument(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &sourcePos, const std::string &name="moderator")
Add a source with given name and sourcePos to given instrument.
Mantid::Geometry::Instrument_sptr createCylInstrumentWithVerticalOffsetsSpecified(size_t nTubes, std::vector< double > verticalOffsets, size_t nDetsPerTube, double xMin, double xMax, double yMin, double yMax)
Creates a single flat bank with cylindrical (tubes) of detectors.
std::shared_ptr< Mantid::Geometry::CSGObject > createSphere(double radius, const Mantid::Kernel::V3D &centre=Mantid::Kernel::V3D(), const std::string &id="sp-1")
Create a sphere object.
Mantid::Geometry::Instrument_sptr createInstrumentWithOptionalComponents(bool haveSource, bool haveSample, bool haveDetector)
Mantid::Geometry::Instrument_sptr createInstrumentWithSourceRotation(const Mantid::Kernel::V3D &sourcePos, const Mantid::Kernel::V3D &samplePos, const Mantid::Kernel::V3D &detectorPos, const Mantid::Kernel::Quat &relativeSourceRotation)
createInstrumentWithSourceRotation, from createSimpleInstrumentWithRotation.
Mantid::Geometry::Instrument_sptr createTestInstrumentRectangular2(int num_banks, int pixels, double pixelSpacing=0.008)
Create an test instrument with n panels of rectangular detectors, pixels*pixels in size,...
std::string hollowCylinderXML(double innerRadius, double outerRadius, double height, const Mantid::Kernel::V3D &baseCentre, const Mantid::Kernel::V3D &axis, const std::string &id)
Return the XML for a hollow cylinder.
std::shared_ptr< Mantid::Geometry::CSGObject > createCuboid(double xHalfLength, double yHalfLength=-1.0, double zHalfLength=-1.0, const Mantid::Kernel::V3D &centre={0.0, 0.0, 0.0}, const std::string &id="detector-shape")
Create a cuboid shape.
std::vector< std::unique_ptr< Mantid::Geometry::IDetector > > createVectorOfCylindricalDetectors(const double R_min=4.5, const double R_max=5, const double z000000000000000=4)
Create a detector vector containing detectors ring R_min – min radius of the ring R_max – max radius ...
std::shared_ptr< Mantid::Geometry::CompAssembly > createTestAssemblyOfFourCylinders()
Create a component assembly at the origin made up of 4 cylindrical detectors.
void addSampleToInstrument(Mantid::Geometry::Instrument_sptr &instrument, const Mantid::Kernel::V3D &samplePos)
A set of helper functions for creating various component structures for the unit tests.
std::shared_ptr< Mantid::Geometry::CSGObject > createHollowShell(double innerRadius, double outerRadius, const Mantid::Kernel::V3D &centre=Mantid::Kernel::V3D())
Create a hollow shell, i.e.
Mantid::Geometry::Instrument_sptr createMinimalInstrumentWithMonitor(const Mantid::Kernel::V3D &monitorPos, const Mantid::Kernel::Quat &monitorRot)
createMinimalInstrumentWithMonitor, creates the most simple possible definition of an instrument with...
void addRectangularBank(Mantid::Geometry::Instrument &testInstrument, int idStart, int pixels, double pixelSpacing, const std::string &bankName, const Mantid::Kernel::V3D &bankPos, const Mantid::Kernel::Quat &bankRot)
std::shared_ptr< Mantid::Geometry::CSGObject > createCappedCylinder(double radius, double height, const Mantid::Kernel::V3D &baseCentre, const Mantid::Kernel::V3D &axis, const std::string &id)
Create a capped cylinder object.
Mantid::Geometry::Instrument_sptr createTestUnnamedRectangular2(int num_banks, int pixels, double pixelSpacing=0.008)
Create an test instrument with multiple nameless banks.
Mantid::Geometry::Instrument_sptr createInstrumentWithPSDTubes(const size_t nTubes=3, const size_t nPixelsPerTube=50, const bool mirrorTubes=false)
std::string cuboidXML(double xHalfLength, double yHalfLength=-1.0, double zHalfLength=-1.0, const Mantid::Kernel::V3D &centre={0.0, 0.0, 0.0}, const std::string &id="detector-shape")
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
Helper class which provides the Collimation Length for SANS instruments.