55 std::ostringstream xml;
56 xml <<
"<cylinder id=\"" <<
id <<
"\">"
57 <<
"<centre-of-bottom-base x=\"" << baseCentre.
X() <<
"\" y=\"" << baseCentre.
Y() <<
"\" z=\"" << baseCentre.
Z()
59 <<
"<axis x=\"" << axis.
X() <<
"\" y=\"" << axis.
Y() <<
"\" z=\"" << axis.
Z() <<
"\"/>"
60 <<
"<radius val=\"" <<
radius <<
"\" />"
61 <<
"<height val=\"" <<
height <<
"\" />"
70 const std::string &
id) {
77 instrument->add(source);
78 instrument->markAsSource(source);
87 const std::string &
id) {
88 std::ostringstream xml;
89 xml <<
"<hollow-cylinder id=\"" <<
id <<
"\">"
90 <<
"<centre-of-bottom-base x=\"" << baseCentre.
X() <<
"\" y=\"" << baseCentre.
Y() <<
"\" z=\"" << baseCentre.
Z()
92 <<
"<axis x=\"" << axis.
X() <<
"\" y=\"" << axis.
Y() <<
"\" z=\"" << axis.
Z() <<
"\"/>"
94 <<
"<outer-radius val=\"" << outerRadius <<
"\" />"
95 <<
"<height val=\"" <<
height <<
"\" />"
96 <<
"</hollow-cylinder>";
104 const V3D &baseCentre,
const V3D &axis,
const std::string &
id) {
110 instrument->setPos(samplePos);
111 instrument->add(sample);
112 instrument->markAsSamplePos(sample);
121 std::ostringstream xml;
122 xml <<
"<sphere id=\"" <<
id <<
"\">"
123 <<
"<centre x=\"" << centre.
X() <<
"\" y=\"" << centre.
Y() <<
"\" z=\"" << centre.
Z() <<
"\" />"
124 <<
"<radius val=\"" <<
radius <<
"\" />"
137std::string
cuboidXML(
double xHalfLength,
double yHalfLength,
double zHalfLength,
const V3D ¢rePos,
138 const std::string &
id) {
139 const double szX = xHalfLength;
140 const double szY = (yHalfLength == -1.0 ? szX : yHalfLength);
141 const double szZ = (zHalfLength == -1.0 ? szX : zHalfLength);
144 V3D leftFrontBottom{szX, -szY, -szZ};
145 V3D leftFrontTop{szX, -szY, szZ};
146 V3D leftBackBottom{-szX, -szY, -szZ};
147 V3D rightFrontBottom{szX, szY, -szZ};
149 leftFrontBottom += centrePos;
150 leftFrontTop += centrePos;
151 leftBackBottom += centrePos;
152 rightFrontBottom += centrePos;
154 std::ostringstream xmlShapeStream;
155 xmlShapeStream <<
" <cuboid id=\"" <<
id <<
"\"> "
156 <<
"<left-front-bottom-point x=\"" << leftFrontBottom.
X() <<
"\" y=\"" << leftFrontBottom.Y()
157 <<
"\" z=\"" << leftFrontBottom.Z() <<
"\" /> "
158 <<
"<left-front-top-point x=\"" << leftFrontTop.X() <<
"\" y=\"" << leftFrontTop.Y() <<
"\" z=\""
159 << leftFrontTop.Z() <<
"\" /> "
160 <<
"<left-back-bottom-point x=\"" << leftBackBottom.X() <<
"\" y=\"" << leftBackBottom.Y()
161 <<
"\" z=\"" << leftBackBottom.Z() <<
"\" /> "
162 <<
"<right-front-bottom-point x=\"" << rightFrontBottom.X() <<
"\" y=\"" << rightFrontBottom.Y()
163 <<
"\" z=\"" << rightFrontBottom.Z() <<
"\" /> "
166 return xmlShapeStream.str();
171std::shared_ptr<CSGObject>
createCuboid(
double xHalfLength,
double yHalfLength,
double zHalfLength,
172 const V3D ¢rePos,
const std::string &
id) {
174 return shapeCreator.
createShape(
cuboidXML(xHalfLength, yHalfLength, zHalfLength, centrePos,
id));
187std::shared_ptr<CSGObject>
createCuboid(
double xHalfLength,
double yHalfLength,
double zHalfLength,
double angle,
190 V3D leftFrontBottom{xHalfLength, -yHalfLength, -zHalfLength};
191 V3D leftFrontTop{xHalfLength, -yHalfLength, zHalfLength};
192 V3D leftBackBottom{-xHalfLength, -yHalfLength, -zHalfLength};
193 V3D rightFrontBottom{xHalfLength, yHalfLength, -zHalfLength};
196 leftFrontBottom.rotate(rotMatrix);
197 leftFrontTop.rotate(rotMatrix);
198 leftBackBottom.rotate(rotMatrix);
199 rightFrontBottom.rotate(rotMatrix);
200 std::ostringstream xmlShapeStream;
201 xmlShapeStream <<
" <cuboid id=\"detector-shape\"> "
202 <<
"<left-front-bottom-point x=\"" << leftFrontBottom.X() <<
"\" y=\"" << leftFrontBottom.Y()
203 <<
"\" z=\"" << leftFrontBottom.Z() <<
"\" /> "
204 <<
"<left-front-top-point x=\"" << leftFrontTop.X() <<
"\" y=\"" << leftFrontTop.Y() <<
"\" z=\""
205 << leftFrontTop.Z() <<
"\" /> "
206 <<
"<left-back-bottom-point x=\"" << leftBackBottom.X() <<
"\" y=\"" << leftBackBottom.Y()
207 <<
"\" z=\"" << leftBackBottom.Z() <<
"\" /> "
208 <<
"<right-front-bottom-point x=\"" << rightFrontBottom.X() <<
"\" y=\"" << rightFrontBottom.Y()
209 <<
"\" z=\"" << rightFrontBottom.Z() <<
"\" /> "
212 std::string xmlCuboidShape(xmlShapeStream.str());
214 auto cuboidShape = shapeCreator.
createShape(xmlCuboidShape);
223 std::shared_ptr<CompAssembly> bank = std::make_shared<CompAssembly>(
"BankName");
228 for (
size_t i = 1; i < 5; ++i) {
230 physicalPixel->
setPos(
static_cast<double>(i), 0.0, 0.0);
231 bank->add(physicalPixel);
243 "\n" +
"<algebra val=\"(outer (# inner))\" />";
255 std::vector<std::shared_ptr<const IDetector>> groupMembers(ndets);
258 for (
int i = 0; i < ndets; ++i) {
259 std::ostringstream os;
261 auto det = std::make_shared<Detector>(os.str(), i + 1, detShape,
nullptr);
262 det->setPos(
static_cast<double>(i + 1), 2.0, 2.0);
263 groupMembers[i] = det;
266 return std::make_shared<DetectorGroup>(groupMembers);
275 std::vector<std::shared_ptr<const IDetector>> groupMembers(nDet);
278 for (
unsigned int i = 0; i < nDet; ++i) {
279 std::ostringstream os;
281 auto det = std::make_shared<Detector>(os.str(), i + 1, detShape,
nullptr);
282 det->setPos(
double(-0.5 * nDet + i) + gap, 2.0, 2.0);
283 groupMembers[i] = det;
286 return std::make_shared<DetectorGroup>(groupMembers);
291 std::vector<std::unique_ptr<IDetector>> allDetectors;
297 auto NY = int(ceil(2 * R_max / h) + 1);
298 auto NX = int(ceil(2 * R_max / R0) + 1);
299 double y_bl = NY * h;
300 double x_bl = NX * R0;
302 double Rmin2(R_min * R_min), Rmax2(R_max * R_max);
305 for (
int j = 0; j < NY; j++) {
306 double y = -0.5 * y_bl + j * h;
307 for (
int i = 0; i < NX; i++) {
308 double x = -0.5 * x_bl + i * R0;
309 double Rsq =
x *
x +
y *
y;
310 if (Rsq >= Rmin2 && Rsq < Rmax2) {
311 std::ostringstream os;
313 auto det = std::make_unique<Detector>(os.str(), ic + 1, detShape,
nullptr);
314 det->setPos(
x,
y, z0);
315 allDetectors.emplace_back(std::move(det));
332 std::vector<std::shared_ptr<const IDetector>> groupMembers;
333 groupMembers.reserve(vecOfDetectors.size());
334 std::transform(vecOfDetectors.begin(), vecOfDetectors.end(), std::back_inserter(groupMembers),
335 [](
auto &det) { return std::move(det); });
336 return std::make_shared<DetectorGroup>(std::move(groupMembers));
341 const double cylHeight) {
342 auto testInst = std::make_shared<Instrument>(
"basic");
346 V3D(0., 1.0, 0.),
"pixel-shape");
351 for (
int banknum = 1; banknum <= num_banks; banknum++) {
353 std::ostringstream bankname;
354 bankname <<
"bank" << banknum;
358 for (
int i = -1; i < 2; ++i) {
359 for (
int j = -1; j < 2; ++j) {
360 std::ostringstream lexer;
361 lexer <<
"pixel-(" << j <<
";" << i <<
")";
362 Detector *physicalPixel =
new Detector(lexer.str(), pixelID, pixelShape, bank);
363 const double xpos = j * (cylRadius * 2.0);
364 const double ypos = i * cylHeight;
365 physicalPixel->
setPos(xpos, ypos, 0.0);
367 bank->
add(physicalPixel);
368 testInst->markAsDetector(physicalPixel);
373 bank->
setPos(
V3D(0.0, 0.0, 5.0 * banknum));
384 double xMin,
double xMax,
double yMin,
double yMax) {
386 const double ySpan = (yMax - yMin);
387 const double xSpan = (xMax - xMin);
388 const double tubeDiameter = xSpan /
static_cast<double>(nTubes);
389 const double cylRadius = tubeDiameter / 2;
390 const double cylHeight = ySpan /
static_cast<double>(nDetsPerTube);
391 const double bankZPos = 2;
392 const double sourceZPos = -10;
393 const double sampleZPos = 0;
396 V3D(0., 1.0, 0.),
"pixel-shape");
397 auto instrument = std::make_shared<Instrument>(
"instrument_with_tubes");
399 for (
size_t i = 0; i < nTubes; ++i) {
401 for (
size_t j = 0; j < nDetsPerTube; ++j) {
403 auto id =
static_cast<int>(i * nDetsPerTube + j);
405 tube->
add(physicalPixel);
406 physicalPixel->
setPos(
V3D(0,
static_cast<double>(j) * cylHeight, 0));
407 instrument->markAsDetector(physicalPixel);
409 tube->
setPos(
V3D(xMin +
static_cast<double>(i) * tubeDiameter, -ySpan / 2 + verticalOffsets[i], 0));
415 instrument->add(bank);
416 instrument->setReferenceFrame(
428 const double TOL(1.e-4);
429 if (std::fabs(x1 + x2) <
TOL) {
430 return (std::fabs(x1 - x2) <
TOL);
432 return (std::fabs((x1 - x2) / (x1 + x2)) <
TOL / 2);
436 const std::vector<double> &polar,
437 const std::vector<double> &azim) {
439 auto testInst = std::make_shared<Instrument>(
"processed");
441 double dAzi_min(FLT_MAX);
442 double dPol_min(FLT_MAX);
443 double L2_min(FLT_MAX);
445 std::vector<double> az(azim);
446 std::vector<double> po(polar);
447 std::sort(az.begin(), az.end());
448 std::sort(po.begin(), po.end());
451 for (
size_t i = 0; i < L2.size(); i++) {
454 for (
size_t j = i + 1; j < L2.size(); j++) {
456 dAzi = std::fabs(az[i] - az[j]);
461 dPol = std::fabs(po[i] - po[j]);
467 double cylRadius = L2_min * sin(dAzi_min * 0.5);
468 double cylHeight = 2 * L2_min * sin(dPol_min * 0.5);
472 V3D(0., 1.0, 0.),
"pixel-shape");
478 for (
size_t i = 0; i < azim.size(); i++) {
480 double zpos = L2[i] * cos(polar[i]);
481 double xpos = L2[i] * sin(polar[i]) * cos(azim[i]);
482 double ypos = L2[i] * sin(polar[i]) * sin(azim[i]);
483 physicalPixel->
setPos(xpos, ypos, zpos);
485 bank->
add(physicalPixel);
486 testInst->markAsDetector(physicalPixel);
500 const std::string &bankName,
const V3D &bankPos,
const Quat &bankRot) {
502 const double cylRadius(pixelSpacing / 2);
503 const double cylHeight(0.0002);
506 V3D(0., 1.0, 0.),
"pixel-shape");
509 bank->initialize(pixelShape, pixels, 0.0, pixelSpacing, pixels, 0.0, pixelSpacing, idStart,
true, pixels);
512 for (
int x = 0;
x < pixels;
x++)
513 for (
int y = 0;
y < pixels;
y++) {
514 std::shared_ptr<Detector> detector = bank->getAtXY(
x,
y);
520 testInstrument.
add(bank);
521 bank->setPos(bankPos);
522 bank->setRot(bankRot);
541 double bankDistanceFromSample,
bool addMonitor) {
542 auto testInst = std::make_shared<Instrument>(
"basic_rect");
544 for (
int banknum = 1; banknum <= num_banks; banknum++) {
546 std::ostringstream bankName;
547 bankName <<
"bank" << banknum;
548 V3D bankPos(0.0, 0.0, bankDistanceFromSample * banknum);
550 addRectangularBank(*testInst, banknum * pixels * pixels, pixels, pixelSpacing, bankName.str(), bankPos, bankRot);
555 auto *mon =
new Detector(
"test-monitor", 2 ,
nullptr);
557 testInst->markAsMonitor(mon);
580 const auto instrName =
"basic_rect";
581 auto testInst = std::make_shared<Instrument>(instrName);
583 const double cylRadius(pixelSpacing / 2);
584 const double cylHeight(0.0002);
587 V3D(0., 1.0, 0.),
"pixel-shape");
589 for (
int banknum = 1; banknum <= num_banks; banknum++) {
591 std::ostringstream bankname;
592 bankname <<
"bank" << banknum;
594 bank->initialize(pixelShape, pixels, -pixels * pixelSpacing / 2.0, pixelSpacing, pixels,
595 -pixels * pixelSpacing / 2.0, pixelSpacing, (banknum - 1) * pixels * pixels,
true, pixels);
598 for (
int x = 0;
x < pixels;
x++)
599 for (
int y = 0;
y < pixels;
y++) {
600 std::shared_ptr<Detector> detector = bank->getAtXY(
x,
y);
603 testInst->markAsDetector(detector.get());
608 bank->setPos(
V3D(1.0 * banknum, 0.0, 0.0));
610 bank->setRot(
Quat(90.0,
V3D(0, 1, 0)));
631 auto testInst = std::make_shared<Instrument>(
"");
633 const double cylRadius(pixelSpacing / 2);
634 const double cylHeight(0.0002);
637 V3D(0., 1.0, 0.),
"pixel-shape");
639 for (
int banknum = 1; banknum <= num_banks; banknum++) {
641 std::ostringstream bankname;
645 bank->
initialize(pixelShape, pixels, -pixels * pixelSpacing / 2.0, pixelSpacing, pixels,
646 -pixels * pixelSpacing / 2.0, pixelSpacing, (banknum - 1) * pixels * pixels,
true, pixels);
649 for (
int x = 0;
x < pixels;
x++)
650 for (
int y = 0;
y < pixels;
y++) {
651 std::shared_ptr<Detector> detector = bank->
getAtXY(
x,
y);
654 testInst->markAsDetector(detector.get());
659 bank->
setPos(
V3D(1.0 * banknum, 0.0, 0.0));
678 V3D place_holder_pos(0, 0, 0);
682 place_holder_0->
setPos(place_holder_pos);
684 instrument->add(place_holder_0);
685 instrument->markAsSource(place_holder_0);
689 place_holder_1->
setPos(place_holder_pos);
690 instrument->add(place_holder_1);
691 instrument->markAsSamplePos(place_holder_1);
711 instrument->setReferenceFrame(
716 source->
setPos(sourcePos);
718 instrument->add(source);
719 instrument->markAsSource(source);
723 sample->
setPos(samplePos);
724 instrument->add(sample);
725 instrument->markAsSamplePos(sample);
731 instrument->add(det);
732 instrument->markAsDetector(det);
751 instrument->setReferenceFrame(
754 instrument->setName(
"test-instrument-with-monitor");
758 source->setPos(
V3D(-10, 0, 0));
760 instrument->add(source);
761 instrument->markAsSource(source);
764 auto *sample =
new Component(
"some-surface-holder");
765 sample->setPos(
V3D(0, 0, 0));
766 instrument->add(sample);
767 instrument->markAsSamplePos(sample);
770 auto *det =
new Detector(
"point-detector", 1 ,
nullptr);
771 det->setPos(
V3D(0, 0, 10));
773 instrument->add(det);
774 instrument->markAsDetector(det);
777 auto *mon =
new Detector(
"test-monitor", 2 ,
nullptr);
778 mon->setPos(monitorPos);
779 mon->setRot(monitorRot);
781 instrument->add(mon);
782 instrument->markAsMonitor(mon);
803 instrument->add(source);
804 instrument->markAsSource(source);
811 instrument->add(sample);
812 instrument->markAsSamplePos(sample);
819 instrument->add(det);
820 instrument->markAsDetector(det);
849 instrument->setReferenceFrame(
852 instrument->setName(
"test-instrument-with-detector-rotations");
856 source->
setPos(sourcePos);
858 instrument->add(source);
859 instrument->markAsSource(source);
863 sample->
setPos(samplePos);
864 instrument->add(sample);
865 instrument->markAsSamplePos(sample);
871 det->
setRot(relativeDetRotation);
872 instrument->markAsDetector(det);
876 compAss->setPos(detectorPos);
877 compAss->setRot(relativeBankRotation);
879 instrument->add(compAss);
902 instrument->setReferenceFrame(
905 instrument->setName(
"test-instrument");
909 source->
setPos(sourcePos);
911 source->
setRot(relativeSourceRotation);
912 instrument->add(source);
913 instrument->markAsSource(source);
917 sample->
setPos(samplePos);
918 instrument->add(sample);
919 instrument->markAsSamplePos(sample);
925 instrument->markAsDetector(det);
929 compAss->setPos(detectorPos);
931 instrument->add(compAss);
938 auto width_d = double(width);
939 auto height_d = double(
height);
940 static int bankNo = 1;
942 static size_t id = 1;
943 for (
size_t i = 0; i < width; ++i) {
944 for (
size_t j = 0; j <
height; ++j) {
946 det->
setPos(
V3D{double(i), double(j), double(0)});
952 bank->setPos(
V3D{width_d / 2, height_d / 2, 0});
965 auto instrument = std::make_shared<Instrument>();
967 instrument->setReferenceFrame(
977 trolley1->
setPos(trolley1Pos);
979 trolley2->
setPos(trolley2Pos);
991 trolley2->
add(l_curtain);
993 trolley2->
add(r_curtain);
995 instrument->add(trolley1);
996 instrument->add(trolley2);
1014 testInst->setReferenceFrame(
1018 const double pixelRadius(0.01);
1019 const double pixelHeight(0.003);
1020 const double radius(1.0);
1022 pixelRadius, pixelHeight,
V3D(0.0, -0.5 * pixelHeight, 0.0),
V3D(0.0, 1.0, 0.0),
"pixelShape");
1025 pixelRadius, pixelHeight,
V3D(0.0, -0.5 * pixelHeight * (
double)nPixelsPerTube, 0.0),
V3D(0.0, 1.0, 0.0),
1028 for (
size_t i = 0; i < nTubes; ++i) {
1029 std::ostringstream lexer;
1030 lexer <<
"tube-" << i;
1031 const auto theta = (M_PI / 2.0) *
double(i) / (double(nTubes) - 1);
1032 auto x = xDirection *
radius * sin(theta);
1035 if (i == 0 && xDirection < 0)
1037 const auto z =
radius * cos(theta);
1041 for (
size_t j = 0; j < nPixelsPerTube; ++j) {
1043 lexer <<
"pixel-" << i * nPixelsPerTube + j;
1044 Detector *pixel =
new Detector(lexer.str(),
int(i * nPixelsPerTube + j + 1), pixelShape, tube);
1045 const double xpos = 0.0;
1046 const double ypos = double(j) * pixelHeight;
1047 pixel->
setPos(xpos, ypos, 0.0);
1049 testInst->markAsDetector(pixel);
1051 testInst->add(tube);
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.
Constructive Solid Geometry object.
Class for Assembly of geometric components.
int add(IComponent *) override
Add a component to the assembly.
Component is a wrapper for a Component which can modify some of its parameters, e....
void setRot(const Kernel::Quat &) override
Set the orientation Kernel::Quaternion relative to parent (if present)
void setPos(double, double, double) override
Set the IComponent position, x, y, z respective to parent (if present)
This class represents a detector - i.e.
virtual void setPos(double, double, double)=0
Set the IComponent position, x, y, z respective to parent (if present)
virtual void setRot(const Kernel::Quat &)=0
Set the orientation Kernel::Quaternion relative to parent (if present)
void markAsDetector(const IDetector *)
mark a Component which has already been added to the Instrument (as a child comp.) to be a Detector c...
virtual int add(IComponent *component) override
Add a component to the instrument.
Class for Assembly of geometric components.
void setOutline(std::shared_ptr< const IObject > obj)
Sets the outline shape for this assembly.
int add(IComponent *) override
Add a component to the assembly.
std::shared_ptr< IObject > createOutline()
Set the outline of the assembly.
Object Component class, this class brings together the physical attributes of the component to the po...
const std::shared_ptr< const IObject > shape() const override
Return the shape of the component.
void setShape(std::shared_ptr< const IObject > newShape)
Set a new shape on the component void setShape(std::shared_ptr<const IObject> newShape);.
RectangularDetector is a type of CompAssembly, an assembly of components.
std::shared_ptr< Detector > getAtXY(const int X, const int Y) const
Return a pointer to the component in the assembly at the (X,Y) pixel position.
void initialize(std::shared_ptr< IObject > shape, int xpixels, double xstart, double xstep, int ypixels, double ystart, double ystep, int idstart, bool idfillbyfirst_y, int idstepbyrow, int idstep=1)
Create all the detector pixels of this rectangular detector.
Class originally intended to be used with the DataHandling 'LoadInstrument' algorithm.
std::shared_ptr< CSGObject > createShape(Poco::XML::Element *pElem)
Creates a geometric object from a DOM-element-node pointing to an element whose child nodes contain t...
std::vector< double > getRotation(bool check_normalisation=false, bool throw_on_errors=false) const
returns the rotation matrix defined by this quaternion as an 9-point
Implements a 2-dimensional vector embedded in a 3D space, i.e.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.
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 ¢re, 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)
bool double_cmprsn(double x1, double x2)
create instrument with cylindrical detectors located in specific positions
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 ¢re=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 ¢re={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 ¢re=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)
CompAssembly * makeBank(size_t width, size_t height, Instrument *instrument)
std::string cuboidXML(double xHalfLength, double yHalfLength=-1.0, double zHalfLength=-1.0, const Mantid::Kernel::V3D ¢re={0.0, 0.0, 0.0}, const std::string &id="detector-shape")
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
std::shared_ptr< IObject > IObject_sptr
Typdef for a shared pointer.
Mantid::Kernel::Matrix< double > DblMatrix
std::string to_string(const wide_integer< Bits, Signed > &n)