21#include <boost/regex.hpp>
34int getOneTextureSize(
int desired) {
36 while (desired > size) {
74 static const boost::regex exp(
"RectangularDetector|rectangularDetector|"
75 "rectangulardetector|rectangular_detector");
77 return boost::regex_match(proposedMatch, exp);
123 return std::pair<int, int>(std::get<0>(xyz), std::get<1>(xyz));
168 int ypixels,
double ystart,
double ystep,
int idstart,
bool idfillbyfirst_y,
169 int idstepbyrow,
int idstep) {
171 GridDetector::initialize(std::move(
shape),
xpixels,
xstart,
xstep,
ypixels,
ystart,
ystep, 0, 0, 0,
idstart,
186 std::deque<IComponent_const_sptr> & )
const {
196 basePoint =
getAtXY(0, 0)->getPos();
224 double u = (double(
xpixels() - 1) * tuv[1] + 0.5);
225 double v = (double(
ypixels() - 1) * tuv[2] + 0.5);
230 auto xIndex = int(u);
231 auto yIndex = int(v);
244 auto comp =
getAtXY(xIndex, yIndex);
245 testRay.
addLink(intersec, intersec, 0.0, *(comp->shape()), comp->getComponentID());
256 ysize = getOneTextureSize(this->
ypixels());
290 os <<
"************************\n";
291 os <<
"Number of children :" << ass.
nelements() <<
'\n';
void printChildren(std::ostream &) const override
Print information about all children.
int nelements() const override
Return the number of elements in the assembly.
ComponentVisitor : Visitor for IComponents.
virtual size_t registerRectangularBank(const ICompAssembly &bank)=0
Handles rendering of all object Geometry.
GridDetector is a type of CompAssembly, an assembly of components.
double ystart() const
Returns the start position in the Y direction.
std::tuple< int, int, int > getXYZForDetectorID(const detid_t detectorID) const
Given a detector ID, return the X,Y,Z coords into the grid detector.
const std::shared_ptr< const IObject > shape() const override
Returns the shape of the Object.
std::shared_ptr< Detector > getAtXYZ(const int x, const int y, const int z) const
Return a pointer to the component in the assembly at the (X,Y) pixel position.
double xsize() const
Size in X of the detector.
void initialize(std::shared_ptr< IObject > shape, int xpixels, double xstart, double xstep, int ypixels, double ystart, double ystep, int zpixels, double zstart, double zstep, int idstart, const std::string &idFillOrder, int idstepbyrow, int idstep=1)
Create all the detector pixels of this grid detector.
bool idfillbyfirst_y() const
Returns the idfillbyfirst_y.
int xpixels() const
Returns the number of pixels in the X direction.
int idstep() const
Returns the idstep.
int idstart() const
Returns the idstart.
double ystep() const
Returns the step size in the Y direction.
double xstep() const
Returns the step size in the X direction.
void init()
initialize members to bare defaults
Kernel::V3D getRelativePosAtXYZ(int x, int y, int z) const
Returns the position of the center of the pixel at x,y, relative to the center of the GridDetector,...
int ypixels() const
Returns the number of pixels in the Y direction.
double xstart() const
Returns the start position in the X direction.
detid_t getDetectorIDAtXYZ(const int x, const int y, const int z) const
Return the detector ID corresponding to the component in the assembly at the (X,Y) pixel position.
int idstepbyrow() const
Returns the idstepbyrow.
base class for Geometric IComponent
virtual void printSelf(std::ostream &) const =0
Prints a text representation of itself.
virtual void setName(const std::string &)=0
Set the IComponent name.
void setGeometryHandler(GeometryHandler *h)
Reset the current geometry handler.
RectangularDetector is a type of CompAssembly, an assembly of components.
void setTextureID(unsigned int textureID)
Set the texture ID to use when rendering the RectangularDetector.
const Kernel::Material material() const override
Returns the material of the detector.
unsigned int getTextureID() const
Return the texture ID to be used in plotting .
void getTextureSize(int &xsize, int &ysize) const
Return the number of pixels to make a texture in, given the desired pixel size.
RectangularDetector()
Empty constructor.
RectangularDetector * clone() const override
Make a clone of the present component.
std::pair< int, int > getXYForDetectorID(const int detectorID) const
Given a detector ID, return the X,Y coords into the rectangular detector.
unsigned int m_textureID
Texture ID to use in rendering.
detid_t getDetectorIDAtXY(const int X, const int Y) const
Return the detector ID corresponding to the component in the assembly at the (X,Y) pixel position.
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.
Kernel::V3D getRelativePosAtXY(int x, int y) const
Returns the position of the center of the pixel at x,y, relative to the center of the RectangularDete...
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.
static bool compareName(const std::string &proposedMatch)
Matches name to Structured Detector.
virtual size_t registerContents(class ComponentVisitor &componentVisitor) const override
void testIntersectionWithChildren(Track &testRay, std::deque< IComponent_const_sptr > &searchQueue) const override
Test the intersection of the ray with the children of the component assembly, for InstrumentRayTracer...
Defines a track as a start point and a direction.
const Kernel::V3D & startPoint() const
Returns the starting point.
int addLink(const Kernel::V3D &firstPoint, const Kernel::V3D &secondPoint, const double distanceAlongTrack, const IObject &obj, const ComponentID compID=nullptr)
Adds a link to the track.
const Kernel::V3D & direction() const
Returns the direction as a unit vector.
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
T Invert()
LU inversion routine.
void setColumn(const size_t nCol, const std::vector< T > &newCol)
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.
int32_t detid_t
Typedef for a detector ID.