56 std::ostringstream xml;
57 xml <<
"<cylinder id=\"" <<
id <<
"\">"
58 <<
"<centre-of-bottom-base x=\"" << baseCentre.
X() <<
"\" y=\"" << baseCentre.
Y() <<
"\" z=\"" << baseCentre.
Z()
60 <<
"<axis x=\"" << axis.
X() <<
"\" y=\"" << axis.
Y() <<
"\" z=\"" << axis.
Z() <<
"\"/>"
61 <<
"<radius val=\"" << radius <<
"\" />"
62 <<
"<height val=\"" <<
height <<
"\" />"
71 const std::string &
id) {
78 instrument->add(source);
79 instrument->markAsSource(source);
88 const std::string &
id) {
89 std::ostringstream xml;
90 xml <<
"<hollow-cylinder id=\"" <<
id <<
"\">"
91 <<
"<centre-of-bottom-base x=\"" << baseCentre.
X() <<
"\" y=\"" << baseCentre.
Y() <<
"\" z=\"" << baseCentre.
Z()
93 <<
"<axis x=\"" << axis.
X() <<
"\" y=\"" << axis.
Y() <<
"\" z=\"" << axis.
Z() <<
"\"/>"
94 <<
"<inner-radius val=\"" << innerRadius <<
"\" />"
95 <<
"<outer-radius val=\"" << outerRadius <<
"\" />"
96 <<
"<height val=\"" <<
height <<
"\" />"
97 <<
"</hollow-cylinder>";
105 const V3D &baseCentre,
const V3D &axis,
const std::string &
id) {
111 instrument->setPos(samplePos);
112 instrument->add(sample);
113 instrument->markAsSamplePos(sample);
121std::string
sphereXML(
double radius,
const V3D ¢re,
const std::string &
id) {
122 std::ostringstream xml;
123 xml <<
"<sphere id=\"" <<
id <<
"\">"
124 <<
"<centre x=\"" << centre.
X() <<
"\" y=\"" << centre.
Y() <<
"\" z=\"" << centre.
Z() <<
"\" />"
125 <<
"<radius val=\"" << radius <<
"\" />"
133std::shared_ptr<CSGObject>
createSphere(
double radius,
const V3D ¢re,
const std::string &
id) {
138std::string
cuboidXML(
double xHalfLength,
double yHalfLength,
double zHalfLength,
const V3D ¢rePos,
139 const std::string &
id) {
140 const double szX = xHalfLength;
141 const double szY = (yHalfLength == -1.0 ? szX : yHalfLength);
142 const double szZ = (zHalfLength == -1.0 ? szX : zHalfLength);
145 V3D leftFrontBottom{szX, -szY, -szZ};
146 V3D leftFrontTop{szX, -szY, szZ};
147 V3D leftBackBottom{-szX, -szY, -szZ};
148 V3D rightFrontBottom{szX, szY, -szZ};
150 leftFrontBottom += centrePos;
151 leftFrontTop += centrePos;
152 leftBackBottom += centrePos;
153 rightFrontBottom += centrePos;
155 std::ostringstream xmlShapeStream;
156 xmlShapeStream <<
" <cuboid id=\"" <<
id <<
"\"> "
157 <<
"<left-front-bottom-point x=\"" << leftFrontBottom.
X() <<
"\" y=\"" << leftFrontBottom.Y()
158 <<
"\" z=\"" << leftFrontBottom.Z() <<
"\" /> "
159 <<
"<left-front-top-point x=\"" << leftFrontTop.X() <<
"\" y=\"" << leftFrontTop.Y() <<
"\" z=\""
160 << leftFrontTop.Z() <<
"\" /> "
161 <<
"<left-back-bottom-point x=\"" << leftBackBottom.X() <<
"\" y=\"" << leftBackBottom.Y()
162 <<
"\" z=\"" << leftBackBottom.Z() <<
"\" /> "
163 <<
"<right-front-bottom-point x=\"" << rightFrontBottom.X() <<
"\" y=\"" << rightFrontBottom.Y()
164 <<
"\" z=\"" << rightFrontBottom.Z() <<
"\" /> "
167 return xmlShapeStream.str();
172std::shared_ptr<CSGObject>
createCuboid(
double xHalfLength,
double yHalfLength,
double zHalfLength,
173 const V3D ¢rePos,
const std::string &
id) {
175 return shapeCreator.
createShape(
cuboidXML(xHalfLength, yHalfLength, zHalfLength, centrePos,
id));
188std::shared_ptr<CSGObject>
createCuboid(
double xHalfLength,
double yHalfLength,
double zHalfLength,
double angle,
191 V3D leftFrontBottom{xHalfLength, -yHalfLength, -zHalfLength};
192 V3D leftFrontTop{xHalfLength, -yHalfLength, zHalfLength};
193 V3D leftBackBottom{-xHalfLength, -yHalfLength, -zHalfLength};
194 V3D rightFrontBottom{xHalfLength, yHalfLength, -zHalfLength};
197 leftFrontBottom.rotate(rotMatrix);
198 leftFrontTop.rotate(rotMatrix);
199 leftBackBottom.rotate(rotMatrix);
200 rightFrontBottom.rotate(rotMatrix);
201 std::ostringstream xmlShapeStream;
202 xmlShapeStream <<
" <cuboid id=\"detector-shape\"> "
203 <<
"<left-front-bottom-point x=\"" << leftFrontBottom.X() <<
"\" y=\"" << leftFrontBottom.Y()
204 <<
"\" z=\"" << leftFrontBottom.Z() <<
"\" /> "
205 <<
"<left-front-top-point x=\"" << leftFrontTop.X() <<
"\" y=\"" << leftFrontTop.Y() <<
"\" z=\""
206 << leftFrontTop.Z() <<
"\" /> "
207 <<
"<left-back-bottom-point x=\"" << leftBackBottom.X() <<
"\" y=\"" << leftBackBottom.Y()
208 <<
"\" z=\"" << leftBackBottom.Z() <<
"\" /> "
209 <<
"<right-front-bottom-point x=\"" << rightFrontBottom.X() <<
"\" y=\"" << rightFrontBottom.Y()
210 <<
"\" z=\"" << rightFrontBottom.Z() <<
"\" /> "
213 std::string xmlCuboidShape(xmlShapeStream.str());
215 auto cuboidShape = shapeCreator.
createShape(xmlCuboidShape);
224 std::shared_ptr<CompAssembly> bank = std::make_shared<CompAssembly>(
"BankName");
229 for (
size_t i = 1; i < 5; ++i) {
231 physicalPixel->
setPos(
static_cast<double>(i), 0.0, 0.0);
232 bank->add(physicalPixel);
243 std::string wholeXML =
sphereXML(innerRadius, centre,
"inner") +
"\n" +
sphereXML(outerRadius, centre,
"outer") +
244 "\n" +
"<algebra val=\"(outer (# inner))\" />";
256 std::vector<std::shared_ptr<const IDetector>> groupMembers(ndets);
259 for (
int i = 0; i < ndets; ++i) {
260 std::ostringstream os;
262 auto det = std::make_shared<Detector>(os.str(), i + 1, detShape,
nullptr);
263 det->setPos(
static_cast<double>(i + 1), 2.0, 2.0);
264 groupMembers[i] = det;
267 return std::make_shared<DetectorGroup>(groupMembers);
276 std::vector<std::shared_ptr<const IDetector>> groupMembers(nDet);
279 for (
unsigned int i = 0; i < nDet; ++i) {
280 std::ostringstream os;
282 auto det = std::make_shared<Detector>(os.str(), i + 1, detShape,
nullptr);
283 det->setPos(
double(-0.5 * nDet + i) + gap, 2.0, 2.0);
284 groupMembers[i] = det;
287 return std::make_shared<DetectorGroup>(groupMembers);
292 std::vector<std::unique_ptr<IDetector>> allDetectors;
298 auto NY = int(ceil(2 * R_max / h) + 1);
299 auto NX = int(ceil(2 * R_max / R0) + 1);
300 double y_bl = NY * h;
301 double x_bl = NX * R0;
303 double Rmin2(R_min * R_min), Rmax2(R_max * R_max);
306 for (
int j = 0; j < NY; j++) {
307 double y = -0.5 * y_bl + j * h;
308 for (
int i = 0; i < NX; i++) {
309 double x = -0.5 * x_bl + i * R0;
310 double Rsq =
x *
x +
y *
y;
311 if (Rsq >= Rmin2 && Rsq < Rmax2) {
312 std::ostringstream os;
314 auto det = std::make_unique<Detector>(os.str(), ic + 1, detShape,
nullptr);
315 det->setPos(
x,
y, z0);
316 allDetectors.emplace_back(std::move(det));
333 std::vector<std::shared_ptr<const IDetector>> groupMembers;
334 groupMembers.reserve(vecOfDetectors.size());
335 std::transform(vecOfDetectors.begin(), vecOfDetectors.end(), std::back_inserter(groupMembers),
336 [](
auto &det) { return std::move(det); });
337 return std::make_shared<DetectorGroup>(std::move(groupMembers));
342 const double cylHeight) {
343 auto testInst = std::make_shared<Instrument>(
"basic");
347 V3D(0., 1.0, 0.),
"pixel-shape");
352 for (
int banknum = 1; banknum <= num_banks; banknum++) {
354 std::ostringstream bankname;
355 bankname <<
"bank" << banknum;
359 for (
int i = -1; i < 2; ++i) {
360 for (
int j = -1; j < 2; ++j) {
361 std::ostringstream lexer;
362 lexer <<
"pixel-(" << j <<
";" << i <<
")";
363 Detector *physicalPixel =
new Detector(lexer.str(), pixelID, pixelShape, bank);
364 const double xpos = j * (cylRadius * 2.0);
365 const double ypos = i * cylHeight;
366 physicalPixel->
setPos(xpos, ypos, 0.0);
368 bank->
add(physicalPixel);
369 testInst->markAsDetector(physicalPixel);
374 bank->
setPos(
V3D(0.0, 0.0, 5.0 * banknum));
385 size_t nDetsPerTube,
double xMin,
double xMax,
double yMin,
388 const double ySpan = (yMax - yMin);
389 const double xSpan = (xMax - xMin);
390 const double tubeDiameter = xSpan /
static_cast<double>(nTubes);
391 const double cylRadius = tubeDiameter / 2;
392 const double cylHeight = ySpan /
static_cast<double>(nDetsPerTube);
393 const double bankZPos = 2;
394 const double sourceZPos = -10;
395 const double sampleZPos = 0;
398 V3D(0., 1.0, 0.),
"pixel-shape");
399 auto instrument = std::make_shared<Instrument>(
"instrument_with_tubes");
401 for (
size_t i = 0; i < nTubes; ++i) {
403 for (
size_t j = 0; j < nDetsPerTube; ++j) {
405 auto id =
static_cast<int>(i * nDetsPerTube + j);
407 tube->
add(physicalPixel);
408 physicalPixel->
setPos(
V3D(0,
static_cast<double>(j) * cylHeight, 0));
409 instrument->markAsDetector(physicalPixel);
411 tube->
setPos(
V3D(xMin +
static_cast<double>(i) * tubeDiameter, -ySpan / 2 + verticalOffsets[i], 0));
416 instrument->add(bank);
417 instrument->setReferenceFrame(
429 const double TOL(1.e-4);
433 const std::vector<double> &polar,
434 const std::vector<double> &azim) {
436 auto testInst = std::make_shared<Instrument>(
"processed");
438 double dAzi_min(FLT_MAX);
439 double dPol_min(FLT_MAX);
440 double L2_min(FLT_MAX);
442 std::vector<double> az(azim);
443 std::vector<double> po(polar);
444 std::sort(az.begin(), az.end());
445 std::sort(po.begin(), po.end());
448 for (
size_t i = 0; i < L2.size(); i++) {
451 for (
size_t j = i + 1; j < L2.size(); j++) {
453 dAzi = std::fabs(az[i] - az[j]);
458 dPol = std::fabs(po[i] - po[j]);
464 double cylRadius = L2_min * sin(dAzi_min * 0.5);
465 double cylHeight = 2 * L2_min * sin(dPol_min * 0.5);
469 V3D(0., 1.0, 0.),
"pixel-shape");
475 for (
size_t i = 0; i < azim.size(); i++) {
477 double zpos = L2[i] * cos(polar[i]);
478 double xpos = L2[i] * sin(polar[i]) * cos(azim[i]);
479 double ypos = L2[i] * sin(polar[i]) * sin(azim[i]);
480 physicalPixel->
setPos(xpos, ypos, zpos);
482 bank->
add(physicalPixel);
483 testInst->markAsDetector(physicalPixel);
497 const std::string &bankName,
const V3D &bankPos,
const Quat &bankRot) {
499 const double cylRadius(pixelSpacing / 2);
500 const double cylHeight(0.0002);
503 V3D(0., 1.0, 0.),
"pixel-shape");
506 bank->initialize(pixelShape, pixels, 0.0, pixelSpacing, pixels, 0.0, pixelSpacing, idStart,
true, pixels);
509 for (
int x = 0;
x < pixels;
x++)
510 for (
int y = 0;
y < pixels;
y++) {
511 std::shared_ptr<Detector> detector = bank->getAtXY(
x,
y);
517 testInstrument.
add(bank);
518 bank->setPos(bankPos);
519 bank->setRot(bankRot);
539 double bankDistanceFromSample,
bool addMonitor,
540 const std::string &instrumentName) {
541 auto testInst = std::make_shared<Instrument>(instrumentName);
543 for (
int banknum = 1; banknum <= num_banks; banknum++) {
545 std::ostringstream bankName;
546 bankName <<
"bank" << banknum;
547 V3D bankPos(0.0, 0.0, bankDistanceFromSample * banknum);
549 addRectangularBank(*testInst, banknum * pixels * pixels, pixels, pixelSpacing, bankName.str(), bankPos, bankRot);
554 auto *mon =
new Detector(
"test-monitor", 2 ,
nullptr);
556 testInst->markAsMonitor(mon);
579 const auto instrName =
"basic_rect";
580 auto testInst = std::make_shared<Instrument>(instrName);
582 const double cylRadius(pixelSpacing / 2);
583 const double cylHeight(0.0002);
586 V3D(0., 1.0, 0.),
"pixel-shape");
588 for (
int banknum = 1; banknum <= num_banks; banknum++) {
590 std::ostringstream bankname;
591 bankname <<
"bank" << banknum;
593 bank->initialize(pixelShape, pixels, -pixels * pixelSpacing / 2.0, pixelSpacing, pixels,
594 -pixels * pixelSpacing / 2.0, pixelSpacing, (banknum - 1) * pixels * pixels,
true, pixels);
597 for (
int x = 0;
x < pixels;
x++)
598 for (
int y = 0;
y < pixels;
y++) {
599 std::shared_ptr<Detector> detector = bank->getAtXY(
x,
y);
602 testInst->markAsDetector(detector.get());
607 bank->setPos(
V3D(1.0 * banknum, 0.0, 0.0));
609 bank->setRot(
Quat(90.0,
V3D(0, 1, 0)));
630 auto testInst = std::make_shared<Instrument>(
"");
632 const double cylRadius(pixelSpacing / 2);
633 const double cylHeight(0.0002);
636 V3D(0., 1.0, 0.),
"pixel-shape");
638 for (
int banknum = 1; banknum <= num_banks; banknum++) {
640 std::ostringstream bankname;
644 bank->
initialize(pixelShape, pixels, -pixels * pixelSpacing / 2.0, pixelSpacing, pixels,
645 -pixels * pixelSpacing / 2.0, pixelSpacing, (banknum - 1) * pixels * pixels,
true, pixels);
648 for (
int x = 0;
x < pixels;
x++)
649 for (
int y = 0;
y < pixels;
y++) {
650 std::shared_ptr<Detector> detector = bank->
getAtXY(
x,
y);
653 testInst->markAsDetector(detector.get());
658 bank->
setPos(
V3D(1.0 * banknum, 0.0, 0.0));
677 V3D place_holder_pos(0, 0, 0);
681 place_holder_0->
setPos(place_holder_pos);
683 instrument->add(place_holder_0);
684 instrument->markAsSource(place_holder_0);
688 place_holder_1->
setPos(place_holder_pos);
689 instrument->add(place_holder_1);
690 instrument->markAsSamplePos(place_holder_1);
710 instrument->setReferenceFrame(
715 source->
setPos(sourcePos);
717 instrument->add(source);
718 instrument->markAsSource(source);
722 sample->
setPos(samplePos);
723 instrument->add(sample);
724 instrument->markAsSamplePos(sample);
730 instrument->add(det);
731 instrument->markAsDetector(det);
750 instrument->setReferenceFrame(
753 instrument->setName(
"test-instrument-with-monitor");
757 source->setPos(
V3D(-10, 0, 0));
759 instrument->add(source);
760 instrument->markAsSource(source);
763 auto *sample =
new Component(
"some-surface-holder");
764 sample->setPos(
V3D(0, 0, 0));
765 instrument->add(sample);
766 instrument->markAsSamplePos(sample);
769 auto *det =
new Detector(
"point-detector", 1 ,
nullptr);
770 det->setPos(
V3D(0, 0, 10));
772 instrument->add(det);
773 instrument->markAsDetector(det);
776 auto *mon =
new Detector(
"test-monitor", 2 ,
nullptr);
777 mon->setPos(monitorPos);
778 mon->setRot(monitorRot);
780 instrument->add(mon);
781 instrument->markAsMonitor(mon);
802 instrument->add(source);
803 instrument->markAsSource(source);
810 instrument->add(sample);
811 instrument->markAsSamplePos(sample);
818 instrument->add(det);
819 instrument->markAsDetector(det);
848 instrument->setReferenceFrame(
851 instrument->setName(
"test-instrument-with-detector-rotations");
855 source->
setPos(sourcePos);
857 instrument->add(source);
858 instrument->markAsSource(source);
862 sample->
setPos(samplePos);
863 instrument->add(sample);
864 instrument->markAsSamplePos(sample);
870 det->
setRot(relativeDetRotation);
871 instrument->markAsDetector(det);
875 compAss->setPos(detectorPos);
876 compAss->setRot(relativeBankRotation);
878 instrument->add(compAss);
901 instrument->setReferenceFrame(
904 instrument->setName(
"test-instrument");
908 source->
setPos(sourcePos);
910 source->
setRot(relativeSourceRotation);
911 instrument->add(source);
912 instrument->markAsSource(source);
916 sample->
setPos(samplePos);
917 instrument->add(sample);
918 instrument->markAsSamplePos(sample);
924 instrument->markAsDetector(det);
928 compAss->setPos(detectorPos);
930 instrument->add(compAss);
937 auto width_d = double(width);
938 auto height_d = double(
height);
939 static int bankNo = 1;
941 static size_t id = 1;
942 for (
size_t i = 0; i < width; ++i) {
943 for (
size_t j = 0; j <
height; ++j) {
945 det->
setPos(
V3D{double(i), double(j), double(0)});
951 bank->setPos(
V3D{width_d / 2, height_d / 2, 0});
964 auto instrument = std::make_shared<Instrument>();
966 instrument->setReferenceFrame(
976 trolley1->
setPos(trolley1Pos);
978 trolley2->
setPos(trolley2Pos);
990 trolley2->
add(l_curtain);
992 trolley2->
add(r_curtain);
994 instrument->add(trolley1);
995 instrument->add(trolley2);
1013 testInst->setReferenceFrame(
1017 const double pixelRadius(0.01);
1018 const double pixelHeight(0.003);
1019 const double radius(1.0);
1021 pixelRadius, pixelHeight,
V3D(0.0, -0.5 * pixelHeight, 0.0),
V3D(0.0, 1.0, 0.0),
"pixelShape");
1024 pixelRadius, pixelHeight,
V3D(0.0, -0.5 * pixelHeight * (
double)nPixelsPerTube, 0.0),
V3D(0.0, 1.0, 0.0),
1027 for (
size_t i = 0; i < nTubes; ++i) {
1028 std::ostringstream lexer;
1029 lexer <<
"tube-" << i;
1030 const auto theta = (M_PI / 2.0) *
double(i) / (double(nTubes) - 1);
1031 auto x = xDirection * radius * sin(theta);
1034 if (i == 0 && xDirection < 0)
1036 const auto z = radius * cos(theta);
1040 for (
size_t j = 0; j < nPixelsPerTube; ++j) {
1042 lexer <<
"pixel-" << i * nPixelsPerTube + j;
1043 Detector *pixel =
new Detector(lexer.str(),
int(i * nPixelsPerTube + j + 1), pixelShape, tube);
1044 const double xpos = 0.0;
1045 const double ypos = double(j) * pixelHeight;
1046 pixel->
setPos(xpos, ypos, 0.0);
1048 testInst->markAsDetector(pixel);
1050 testInst->add(tube);
Mantid::Kernel::Quat(ComponentInfo::* rotation)(const size_t) const
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...
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...
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 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.
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 ...
Mantid::Geometry::Instrument_sptr createCylInstrumentWithVerticalOffsetsSpecified(size_t nTubes, const 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::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)
Mantid::Geometry::Instrument_sptr createTestInstrumentRectangular(int num_banks, int pixels, double pixelSpacing=0.008, double bankDistanceFromSample=5.0, bool addMonitor=false, const std::string &instrumentName="basic_rect")
Create a test instrument with n panels of rectangular detectors, pixels*pixels in size,...
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_DLL bool withinRelativeDifference(T const x, T const y, S const tolerance)
Test whether x, y are within relative tolerance tol.
Mantid::Kernel::Matrix< double > DblMatrix
std::string to_string(const wide_integer< Bits, Signed > &n)