Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Geometry::StructuredDetector Class Reference

StructuredDetector is a type of CompAssembly, an assembly of components. More...

#include <StructuredDetector.h>

Inheritance diagram for Mantid::Geometry::StructuredDetector:
Mantid::Geometry::CompAssembly Mantid::Geometry::IObjComponent Mantid::Geometry::ICompAssembly Mantid::Geometry::Component Mantid::Geometry::IComponent Mantid::Geometry::IComponent Mantid::Geometry::IComponent

Public Member Functions

IComponentclone () const override
 Make a clone of the present component. More...
 
void draw () const override
 Draws the objcomponent. More...
 
void drawObject () const override
 Draws the Object. More...
 
std::shared_ptr< DetectorgetAtXY (const size_t x, const size_t y) const
 Return a pointer to the component in the assembly at the (X,Y) pixel position. More...
 
std::vector< int > const & getB () const
 Returns the blue color channel for detector colors. More...
 
void getBoundingBox (BoundingBox &assemblyBox) const override
 Get the bounding box for this component and store it in the given argument. More...
 
void getBoundingBox (BoundingBox &assemblyBox) const override
 Retrieve the cached bounding box. More...
 
std::shared_ptr< const IComponentgetComponentByName (const std::string &cname, int nlevels=0) const override
 Returns a pointer to the first component of assembly encountered with the given name. More...
 
detid_t getDetectorIDAtXY (const size_t X, const size_t Y) const
 Return the detector ID corresponding to the component in the assembly at the (X,Y) pixel position. More...
 
std::vector< int > const & getG () const
 Returns the green color channel for detector colors. More...
 
int getPointInObject (Kernel::V3D &point) const override
 Try to find a point that lies within (or on) the object. More...
 
std::vector< int > const & getR () const
 Returns the red color channel for detector colors. More...
 
std::vector< double > const & getXValues () const
 
std::pair< size_t, size_t > getXYForDetectorID (const detid_t detectorID) const
 Given a detector ID, return the X,Y coords into the structured detector. More...
 
std::vector< double > const & getYValues () const
 
bool idFillByFirstY () const
 Returns the idFillByFirstY. More...
 
detid_t idStart () const
 Returns the idStart. More...
 
int idStep () const
 Returns the idStep. More...
 
int idStepByRow () const
 Returns the idStepByRow. More...
 
void initDraw () const override
 Initializes the ObjComponent for rendering, this function should be called before rendering. More...
 
void initialize (size_t xPixels, size_t yPixels, std::vector< double > &&x, std::vector< double > &&y, bool isZBeam, detid_t idStart, bool idFillByFirstY, int idStepByRow, int idStep=1)
 Create all the detector pixels of this rectangular detector. More...
 
int interceptSurface (Track &track) const override
 Checks whether the track given will pass through this Component. More...
 
bool isOnSide (const Kernel::V3D &point) const override
 Does the point given lie on the surface of this object component? More...
 
bool isValid (const Kernel::V3D &point) const override
 Does the point given lie within this object component? More...
 
const Kernel::Material material () const override
 Returns the material of the detector. More...
 
detid_t maxDetectorID ()
 maximum detector id More...
 
detid_t minDetectorID ()
 minimum detector id More...
 
virtual size_t registerContents (class ComponentVisitor &componentVisitor) const override
 Register the structured detector for Instrument 2.0 usage. More...
 
void setColors (const std::vector< int > &r, const std::vector< int > &g, const std::vector< int > &b) const
 Sets the colours for detector IDs based on color maps created by instrument actor. More...
 
const std::shared_ptr< const IObjectshape () const override
 Returns the shape of the Object. More...
 
double solidAngle (const Kernel::V3D &observer) const override
 Finds the approximate solid angle covered by the component when viewed from the point given. More...
 
 StructuredDetector ()
 Empty constructor. More...
 
 StructuredDetector (const std::string &name, IComponent *reference=nullptr)
 Constructor with a name and parent reference. More...
 
 StructuredDetector (const StructuredDetector *base, const ParameterMap *map)
 Parametrized constructor. More...
 
std::string type () const override
 String description of the type of component. More...
 
size_t xPixels () const
 Returns the number of pixels in the X direction. More...
 
size_t yPixels () const
 Returns the number of pixels in the Y direction. More...
 
- Public Member Functions inherited from Mantid::Geometry::CompAssembly
int add (IComponent *) override
 Add a component to the assembly. More...
 
void addChildren (IComponent *comp)
 Add a copy (clone) of a component. More...
 
int addCopy (IComponent *) override
 AddCopy method. More...
 
int addCopy (IComponent *, const std::string &) override
 Add a copy (clone) of a component and rename it. More...
 
IComponentclone () const override
 Make a clone of the present component. More...
 
 CompAssembly ()
 Empty constructor. More...
 
 CompAssembly (const CompAssembly &)
 Copy constructor. More...
 
 CompAssembly (const IComponent *base, const ParameterMap *map)
 Constructor for parametrized version. More...
 
 CompAssembly (const std::string &, IComponent *reference=nullptr)
 Constructor with a name and parent reference. More...
 
void getBoundingBox (BoundingBox &assemblyBox) const override
 Get the bounding box for this component and store it in the given argument. More...
 
std::shared_ptr< IComponentgetChild (const int i) const override
 Get a pointer to the ith component within the assembly. Easier to use than. More...
 
void getChildren (std::vector< IComponent_const_sptr > &outVector, bool recursive) const override
 Returns a vector of all children contained. More...
 
std::shared_ptr< const IComponentgetComponentByName (const std::string &cname, int nlevels=0) const override
 Returns a pointer to the first component of assembly encountered with the given name. More...
 
Kernel::V3D getPos () const override
 Gets the absolute position of the Parametrized CompAssembly This attempts to read the cached position value from the parameter map, and creates it if it is not available. More...
 
Kernel::Quat getRotation () const override
 Gets the absolute position of the Parametrized CompAssembly This attempts to read the cached position value from the parameter map, and creates it if it is not available. More...
 
int nelements () const override
 Return the number of elements in the assembly. More...
 
CompAssemblyoperator= (const CompAssembly &other)
 
std::shared_ptr< IComponentoperator[] (int i) const override
 Get a pointer to the ith component in the assembly. More...
 
void printChildren (std::ostream &) const override
 Print information about all children. More...
 
void printTree (std::ostream &) const override
 Print information about all the elements in the tree to a stream Loops through all components in the tree and call printSelf(os). More...
 
virtual size_t registerContents (class ComponentVisitor &componentVisitor) const override
 
int remove (IComponent *)
 Remove a component from the assembly. More...
 
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
More...
 
std::string type () const override
 String description of the type of component. More...
 
 ~CompAssembly () override
 Destructor. More...
 
- Public Member Functions inherited from Mantid::Geometry::ICompAssembly
virtual int add (IComponent *)=0
 Add a component to the assembly. More...
 
virtual int addCopy (IComponent *)=0
 Add a copy (clone) of a component. More...
 
virtual int addCopy (IComponent *, const std::string &)=0
 Add a copy (clone) of a component and rename it. More...
 
IComponentclone () const override=0
 Make a clone of the present component. More...
 
virtual std::shared_ptr< IComponentgetChild (const int i) const =0
 Get a pointer to the ith component within the assembly. More...
 
virtual void getChildren (std::vector< IComponent_const_sptr > &outVector, bool recursive) const =0
 Get all children. More...
 
virtual std::shared_ptr< const IComponentgetComponentByName (const std::string &cname, int nlevels=0) const =0
 Returns a pointer to the first component of assembly encountered with the given name. More...
 
 ICompAssembly ()
 
virtual int nelements () const =0
 Return the number of elements in the assembly. More...
 
virtual std::shared_ptr< IComponentoperator[] (int i) const =0
 Overloaded index operator. More...
 
virtual void printChildren (std::ostream &) const =0
 Print information about all children. More...
 
virtual void printTree (std::ostream &) const =0
 Print information about all the elements in the tree to a stream Loops through all components in the tree and call printSelf(os). More...
 
virtual void testIntersectionWithChildren (Track &testRay, std::deque< IComponent_const_sptr > &searchQueue) const =0
 Test the intersection of the ray with the children of the component assembly. More...
 
std::string type () const override
 String description of the type of component. More...
 
- Public Member Functions inherited from Mantid::Geometry::IComponent
virtual IComponentclone () const =0
 Return a clone to the current object. More...
 
virtual std::vector< std::shared_ptr< const IComponent > > getAncestors () const =0
 Return an array of all ancestors, the nearest first. More...
 
virtual const IComponentgetBareParent () const =0
 Returns the bare pointer to the IComponent parent. More...
 
virtual IComponent const * getBaseComponent () const =0
 Returns const pointer to base component if this component is parametrized. More...
 
virtual void getBoundingBox (BoundingBox &boundingBox) const =0
 Get the bounding box for this component and store it in the given argument. More...
 
virtual ComponentID getComponentID () const =0
 Returns the ComponentID - a unique identifier of the component. More...
 
virtual double getDistance (const IComponent &) const =0
 Get the distance to another IComponent. More...
 
virtual std::string getFullName () const =0
 Get the IComponent full path name. More...
 
virtual std::string getName () const =0
 Get the IComponent name. More...
 
virtual std::shared_ptr< const IComponentgetParent () const =0
 Return a pointer to the current parent. More...
 
virtual Kernel::V3D getPos () const =0
 Get the position of the IComponent. Tree structure is traverse through the. More...
 
virtual Kernel::V3D getRelativePos () const =0
 Get the position relative to the parent IComponent (absolute if no parent) More...
 
virtual Kernel::Quat getRelativeRot () const =0
 Get the relative Orientation. More...
 
virtual Kernel::Quat getRotation () const =0
 Get the absolute orientation of the IComponent. More...
 
virtual Kernel::V3D getScaleFactor () const
 Gets the scaling factor of the object for the Object Component. More...
 
virtual void rotate (const Kernel::Quat &)=0
 Rotate the IComponent. This is relative to parent. More...
 
virtual void rotate (double, const Kernel::V3D &)=0
 Rotate the IComponent by an angle in degrees with respect to an axis. More...
 
virtual void setName (const std::string &)=0
 Set the IComponent name. More...
 
virtual void setParent (IComponent *)=0
 Assign a parent IComponent. Previous parent link is lost. More...
 
virtual void setPos (const Kernel::V3D &)=0
 Set the position of the component The position is with respect to the parent component. More...
 
virtual void setPos (double, double, double)=0
 Set the IComponent position, x, y, z respective to parent (if present) More...
 
virtual void setRot (const Kernel::Quat &)=0
 Set the orientation Kernel::Quaternion relative to parent (if present) More...
 
virtual void translate (const Kernel::V3D &)=0
 Copy the Rotation from another IComponent. More...
 
virtual void translate (double, double, double)=0
 Translate the IComponent (x,y,z form). This is relative to parent if. More...
 
virtual std::string type () const
 Returns a string representation of the IComponent type. More...
 
virtual ~IComponent ()=default
 Destructor. More...
 
- Public Member Functions inherited from Mantid::Geometry::Component
IComponentclone () const override
 Clone method Make a copy of the Component. More...
 
 Component ()
 Create Empty Component at Origin, with no orientation and null parent. More...
 
 Component (const IComponent *base, const ParameterMap *map)
 Constructor for parametrized component. More...
 
 Component (std::string name, const Kernel::V3D &position, const Kernel::Quat &rotation, IComponent *parent=nullptr)
 Create a named component with positioning vector, orientation and parent. More...
 
 Component (std::string name, const Kernel::V3D &position, IComponent *parent=nullptr)
 Create a named component with positioning vector, and parent component. More...
 
 Component (std::string name, IComponent *parent=nullptr)
 Create a named component with a parent component (optional) More...
 
std::vector< std::shared_ptr< const IComponent > > getAncestors () const override
 Return an array of all ancestors. More...
 
IComponent const * getBaseComponent () const override
 Returns const pointer to base component if this component is parametrized. More...
 
void getBoundingBox (BoundingBox &boundingBox) const override
 Get the bounding box for this component and store it in the given argument. More...
 
ComponentID getComponentID () const override
 Returns the ComponentID - a unique identifier of the component. More...
 
double getDistance (const IComponent &) const override
 Get the distance to another IComponent. More...
 
std::string getFullName () const override
 Get the full pathname. More...
 
std::string getName () const override
 Get the IComponent name. More...
 
std::shared_ptr< const IComponentgetParent () const override
 Return a pointer to the current parent. as shared pointer. More...
 
Kernel::V3D getPos () const override
 Get the position of the IComponent. Tree structure is traverse through the. More...
 
Kernel::V3D getRelativePos () const override
 Get the position relative to the parent IComponent (absolute if no parent) More...
 
Kernel::Quat getRelativeRot () const override
 Get the relative Orientation. More...
 
Kernel::Quat getRotation () const override
 Get the absolute orientation of the IComponent. More...
 
bool isParentNamed (const std::string &expectedName, int maxDepth=-1) const
 Return true if one of the parents of this component is named something. More...
 
void rotate (const Kernel::Quat &) override
 Rotate the IComponent. This is relative to parent. More...
 
void rotate (double, const Kernel::V3D &) override
 Rotate the IComponent by an angle in degrees with respect to an axis. More...
 
void setName (const std::string &) override
 Set the IComponent name. More...
 
void setParent (IComponent *) override
 Assign a parent IComponent. Previous parent link is lost. More...
 
void setPos (const Kernel::V3D &) override
 Set the position of the Component The position is with respect to the parent Component. More...
 
void setPos (double, double, double) override
 Set the IComponent position, x, y, z respective to parent (if present) More...
 
void setRot (const Kernel::Quat &) override
 Set the orientation Kernel::Quaternion relative to parent (if present) More...
 
void translate (const Kernel::V3D &) override
 Translate the IComponent (vector form). This is relative to parent if. More...
 
void translate (double, double, double) override
 Translate the IComponent (x,y,z form). This is relative to parent if. More...
 
virtual std::string typeName () const
 
std::set< std::string > getParameterNames (bool recursive=true) const override
 Return the parameter names. More...
 
std::map< std::string, ComponentIDgetParameterNamesByComponent () const override
 return the parameter names and the component they are from More...
 
bool hasParameter (const std::string &name, bool recursive=true) const override
 Returns a boolean indicating if the component has the named parameter. More...
 
std::vector< double > getNumberParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a double. More...
 
std::vector< int > getIntParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as an int. More...
 
std::string getParameterType (const std::string &pname, bool recursive=true) const override
 Get a parameter's type – this is HACK until Python can export property regardless of the property type. More...
 
std::string getDescription () const
 Get this component parameter's description – no recursive search within children. More...
 
std::string getParamDescription (const std::string &pname, bool recursive=true) const
 Get description of a parameter attached to this component
More...
 
std::string getParamShortDescription (const std::string &pname, bool recursive=true) const
 Get a component's parameter short description. More...
 
std::string getShortDescription () const
 Get a components's short description. More...
 
void setDescription (const std::string &descr)
 Set components description. More...
 
std::vector< bool > getBoolParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a bool. More...
 
std::vector< Kernel::V3DgetPositionParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::V3D. More...
 
std::vector< Kernel::QuatgetRotationParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::Quaternion. More...
 
std::vector< std::string > getStringParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a string. More...
 
std::string getParameterAsString (const std::string &pname, bool recursive=true) const override
 get a string representation of a parameter More...
 
bool getParameterVisible (const std::string &p_name, bool recursive) const override
 Get a visibility attribute of a parameter from the parameter map. More...
 
void printSelf (std::ostream &) const override
 Prints a text representation of itself. More...
 
const IComponentbase () const
 Returns the address of the base component. More...
 
Kernel::V3D getScaleFactor () const override
 Returns the ScaleFactor. More...
 
const IComponentgetBareParent () const override
 Returns the bare pointer to the IComponent parent. More...
 
virtual void readXMLAttributes (const Poco::XML::Attributes &attr)
 Reads the XML attributes from Poco XML parser. More...
 
virtual void writeXML (Poco::XML::XMLWriter &writer) const
 
virtual void appendXML (std::ostream &xmlStream) const
 Append to an open XML string. More...
 
bool isParametrized () const override
 Return true if the Component is, in fact, parametrized (that is - it has a valid parameter map) More...
 
bool hasComponentInfo () const
 
size_t index () const
 Helper for legacy access mode. Returns the index of the component. More...
 
- Public Member Functions inherited from Mantid::Geometry::IObjComponent
IComponentclone () const override=0
 Virtual Copy Constructor. More...
 
virtual void draw () const =0
 Draws the objcomponent. More...
 
virtual void drawObject () const =0
 Draws the Object. More...
 
virtual int getPointInObject (Kernel::V3D &point) const =0
 Try to find a point that lies within (or on) the object. More...
 
GeometryHandlerHandle () const
 Gets the GeometryHandler. More...
 
virtual void initDraw () const =0
 Initializes the ObjComponent for rendering, this function should be called before rendering. More...
 
virtual int interceptSurface (Track &track) const =0
 Checks whether the track given will pass through this Component. More...
 
 IObjComponent ()
 
 IObjComponent (const IObjComponent &)
 Copy constructor. More...
 
 IObjComponent (GeometryHandler *the_handler)
 Constructor, specifying the GeometryHandler (renderer engine) for this IObjComponent. More...
 
virtual bool isOnSide (const Kernel::V3D &point) const =0
 Does the point given lie on the surface of this object component? More...
 
virtual bool isValid (const Kernel::V3D &point) const =0
 Does the point given lie within this object component? More...
 
virtual const Kernel::Material material () const =0
 Returns the material of the Object. More...
 
IObjComponentoperator= (const IObjComponent &rhs)
 Assignment operator. More...
 
virtual const std::shared_ptr< const IObjectshape () const =0
 Returns the shape of the Object. More...
 
virtual double solidAngle (const Kernel::V3D &observer) const =0
 Finds the approximate solid angle covered by the component when viewed from the point given. More...
 
std::string type () const override
 type string More...
 
 ~IObjComponent () override
 

Static Public Member Functions

static bool compareName (const std::string &proposedMatch)
 Matches name to Structured Detector. More...
 

Private Member Functions

DetectoraddDetector (CompAssembly *parent, const std::string &name, size_t x, size_t y, detid_t id)
 Creates new hexahedral detector pixel at row x column y using the detector vertex values. More...
 
void createDetectors ()
 Creates all detector pixels within the StructuredDetector. More...
 
void init ()
 initialize members to bare defaults More...
 
StructuredDetectoroperator= (const ICompAssembly &)
 Private copy assignment operator. More...
 

Private Attributes

std::vector< int > b
 
std::vector< int > g
 
const StructuredDetectorm_base
 Pointer to the base RectangularDetector, for parametrized instruments. More...
 
bool m_idFillByFirstY
 IDs are filled in Y fastest. More...
 
detid_t m_idStart
 IDs start here. More...
 
int m_idStep
 Step size in ID in each col. More...
 
int m_idStepByRow
 Step size in ID in each row. More...
 
detid_t m_maxDetId
 maximum detector id More...
 
detid_t m_minDetId
 minimum detector id More...
 
size_t m_xPixels
 The number of pixels in the X (horizontal) direction;. More...
 
std::vector< double > m_xvalues
 
size_t m_yPixels
 The number of pixels in the Y (vertical) direction;. More...
 
std::vector< double > m_yvalues
 
std::vector< int > r
 

Additional Inherited Members

- Protected Types inherited from Mantid::Geometry::CompAssembly
using comp_it = std::vector< IComponent * >::iterator
 Iterator type. More...
 
using const_comp_it = std::vector< IComponent * >::const_iterator
 Const iterator type. More...
 
- Protected Member Functions inherited from Mantid::Geometry::ICompAssembly
 ICompAssembly (const ICompAssembly &)=default
 Protected copy constructor. More...
 
- Protected Member Functions inherited from Mantid::Geometry::Component
template<class TYPE >
std::vector< TYPEgetParameter (const std::string &p_name, bool recursive) const
 Get a parameter from the parameter map. More...
 
void swap (const Component *base, const ParameterMap *pmap)
 Swap the current references to the un-parameterized component and parameter map for new ones. More...
 
- Protected Member Functions inherited from Mantid::Geometry::IObjComponent
void setGeometryHandler (GeometryHandler *h)
 Reset the current geometry handler. More...
 
- Protected Attributes inherited from Mantid::Geometry::CompAssembly
BoundingBoxm_cachedBoundingBox
 A cached bounding box. More...
 
std::vector< IComponent * > m_children
 the group of child components More...
 
- Protected Attributes inherited from Mantid::Geometry::Component
const IComponentm_parent
 Parent component in the tree. More...
 
const Componentm_base
 The base component - this is the unmodified component (without the parameters). More...
 
const ParameterMapm_map
 A pointer to const ParameterMap containing the parameters. More...
 
std::string m_name
 Name of the component. More...
 
Kernel::V3D m_pos
 Position w. More...
 
Kernel::Quat m_rot
 Orientation. More...
 

Detailed Description

StructuredDetector is a type of CompAssembly, an assembly of components.

It is designed to be a more efficient way of defining instruments which are topologically regular but geometrically irregular.

Assembly of Detector objects with topological regularity and geometrical irregularity

Author
Lamar Moore, ISIS
Date
07-March-2016

Definition at line 32 of file StructuredDetector.h.

Constructor & Destructor Documentation

◆ StructuredDetector() [1/3]

Mantid::Geometry::StructuredDetector::StructuredDetector ( )

Empty constructor.

Definition at line 30 of file StructuredDetector.cpp.

References init().

Referenced by clone().

◆ StructuredDetector() [2/3]

Mantid::Geometry::StructuredDetector::StructuredDetector ( const std::string &  name,
IComponent reference = nullptr 
)

Constructor with a name and parent reference.

Valued constructor.

Parameters
name:: name of the assembly
reference:: the parent Component
If the reference is an object of class Component,
normal parenting apply. If the reference object is an assembly itself, then in addition to parenting this is registered as a children of reference.

Definition at line 41 of file StructuredDetector.cpp.

References init(), and Mantid::Geometry::IComponent::setName().

◆ StructuredDetector() [3/3]

Mantid::Geometry::StructuredDetector::StructuredDetector ( const StructuredDetector base,
const ParameterMap map 
)

Parametrized constructor.

Constructor for a parametrized StructuredrDetector.

Parameters
basethe base (un-parametrized) StructuredDetector
mappointer to the ParameterMap

Definition at line 51 of file StructuredDetector.cpp.

References init().

Member Function Documentation

◆ addDetector()

Detector * Mantid::Geometry::StructuredDetector::addDetector ( CompAssembly parent,
const std::string &  name,
size_t  x,
size_t  y,
detid_t  id 
)
private

Creates new hexahedral detector pixel at row x column y using the detector vertex values.

Parameters
parent:: The parent component assembly
name:: The pixel name identifier
x:: The pixel row
y:: The pixel column
id:: The pixel ID
Returns
newly created detector.

Definition at line 366 of file StructuredDetector.cpp.

References Mantid::Geometry::ShapeFactory::createHexahedralShape(), m_xPixels, m_xvalues, m_yvalues, shape(), Mantid::Geometry::x, and Mantid::Geometry::y.

Referenced by createDetectors().

◆ clone()

IComponent * Mantid::Geometry::StructuredDetector::clone ( ) const
overridevirtual

Make a clone of the present component.

Clone method Make a copy of the component assembly.

Returns
new(*this)

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 80 of file StructuredDetector.cpp.

References StructuredDetector().

◆ compareName()

bool Mantid::Geometry::StructuredDetector::compareName ( const std::string &  proposedMatch)
static

◆ createDetectors()

void Mantid::Geometry::StructuredDetector::createDetectors ( )
private

◆ draw()

void Mantid::Geometry::StructuredDetector::draw ( ) const
overridevirtual

Draws the objcomponent.

Draws the objcomponent, If the handler is not set then this function does nothing.

Implements Mantid::Geometry::IObjComponent.

Definition at line 515 of file StructuredDetector.cpp.

References Mantid::Geometry::IObjComponent::Handle(), and Mantid::Geometry::GeometryHandler::render().

◆ drawObject()

void Mantid::Geometry::StructuredDetector::drawObject ( ) const
overridevirtual

Draws the Object.

Implements Mantid::Geometry::IObjComponent.

Definition at line 525 of file StructuredDetector.cpp.

◆ getAtXY()

std::shared_ptr< Detector > Mantid::Geometry::StructuredDetector::getAtXY ( const size_t  x,
const size_t  y 
) const

Return a pointer to the component in the assembly at the (X,Y) pixel position.

Parameters
x:: index from 0..m_xPixels-1
y:: index from 0..m_yPixels-1
Returns
a pointer to the component in the assembly at the (X,Y) pixel position
Exceptions
runtime_errorif the x/y pixel width is not set, or X/Y are out of range

Definition at line 93 of file StructuredDetector.cpp.

References Mantid::Geometry::CompAssembly::getChild(), Mantid::Geometry::x, xPixels(), Mantid::Geometry::y, and yPixels().

Referenced by getBoundingBox().

◆ getB()

std::vector< int > const & Mantid::Geometry::StructuredDetector::getB ( ) const

Returns the blue color channel for detector colors.

Returns
blue color channel

Definition at line 194 of file StructuredDetector.cpp.

References b, getB(), m_base, and Mantid::Geometry::Component::m_map.

Referenced by getB().

◆ getBoundingBox() [1/2]

void Mantid::Geometry::CompAssembly::getBoundingBox ( BoundingBox assemblyBox) const
overridevirtual

Get the bounding box for this component and store it in the given argument.

Get the bounding box for this assembly.

It is simply the sum of the bounding boxes of its children

Parameters
assemblyBox:: [Out] The resulting bounding box is stored here.

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 80 of file CompAssembly.cpp.

◆ getBoundingBox() [2/2]

void Mantid::Geometry::StructuredDetector::getBoundingBox ( BoundingBox assemblyBox) const
overridevirtual

Retrieve the cached bounding box.

Get the bounding box and store it in the given object.

This is cached after the first call.

Parameters
assemblyBox:: A BoundingBox object that will be overwritten

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 484 of file StructuredDetector.cpp.

References Mantid::Geometry::ComponentInfo::boundingBox(), Mantid::Geometry::ParameterMap::componentInfo(), getAtXY(), Mantid::Geometry::BoundingBox::grow(), Mantid::Geometry::Component::hasComponentInfo(), Mantid::Geometry::Component::index(), Mantid::Geometry::CompAssembly::m_cachedBoundingBox, Mantid::Geometry::Component::m_map, xPixels(), and yPixels().

◆ getComponentByName()

std::shared_ptr< const IComponent > Mantid::Geometry::StructuredDetector::getComponentByName ( const std::string &  cname,
int  nlevels = 0 
) const
overridevirtual

Returns a pointer to the first component of assembly encountered with the given name.

Find a component by name.

Parameters
cname:: The name of the component. If there are multiple matches, the first one found is returned. If the name contains '/', it will search for the component whose name occurs before the '/' then within that component's assembly, search the component whose name occurs after the '/' and so on with any subsequent '/'. For example to find 'tube020' in 'panel07', one could use the cname 'panel07/tube020', given that tube020 is unique within panel07.
nlevels:: Optional argument to limit number of levels searched. If cname has a '/', then nlevels will apply to each step delimited by the '/'s, rather than the whole search. In particular, nlevels=1, would force cname to be a full path name.
Returns
A shared pointer to the component

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 427 of file StructuredDetector.cpp.

References Mantid::Geometry::CompAssembly::getComponentByName(), and Mantid::Geometry::IComponent::getName().

◆ getDetectorIDAtXY()

detid_t Mantid::Geometry::StructuredDetector::getDetectorIDAtXY ( const size_t  x,
const size_t  y 
) const

Return the detector ID corresponding to the component in the assembly at the (X,Y) pixel position.

No bounds check is made!

Parameters
x:: index from 0..m_xPixels-1
y:: index from 0..m_yPixels-1
Returns
detector ID int
Exceptions
runtime_errorif the x/y pixel width is not set, or X/Y are out of range

Definition at line 115 of file StructuredDetector.cpp.

References m_base, m_idFillByFirstY, m_idStart, m_idStep, m_idStepByRow, Mantid::Geometry::Component::m_map, Mantid::Geometry::x, and Mantid::Geometry::y.

Referenced by createDetectors().

◆ getG()

std::vector< int > const & Mantid::Geometry::StructuredDetector::getG ( ) const

Returns the green color channel for detector colors.

Returns
green color channel

Definition at line 185 of file StructuredDetector.cpp.

References g, getG(), m_base, and Mantid::Geometry::Component::m_map.

Referenced by getG().

◆ getPointInObject()

int Mantid::Geometry::StructuredDetector::getPointInObject ( Kernel::V3D point) const
overridevirtual

Try to find a point that lies within (or on) the object.

Implements Mantid::Geometry::IObjComponent.

Definition at line 475 of file StructuredDetector.cpp.

◆ getR()

std::vector< int > const & Mantid::Geometry::StructuredDetector::getR ( ) const

Returns the red color channel for detector colors.

Returns
red color channel

Definition at line 176 of file StructuredDetector.cpp.

References getR(), m_base, Mantid::Geometry::Component::m_map, and r.

Referenced by getR().

◆ getXValues()

std::vector< double > const & Mantid::Geometry::StructuredDetector::getXValues ( ) const

Definition at line 242 of file StructuredDetector.cpp.

References getXValues(), m_base, Mantid::Geometry::Component::m_map, and m_xvalues.

Referenced by getXValues().

◆ getXYForDetectorID()

std::pair< size_t, size_t > Mantid::Geometry::StructuredDetector::getXYForDetectorID ( const detid_t  detectorID) const

Given a detector ID, return the X,Y coords into the structured detector.

Parameters
detectorID:: detectorID
Returns
pair of (x,y)

Definition at line 129 of file StructuredDetector.cpp.

References m_base, m_idFillByFirstY, m_idStart, m_idStep, m_idStepByRow, and Mantid::Geometry::Component::m_map.

◆ getYValues()

std::vector< double > const & Mantid::Geometry::StructuredDetector::getYValues ( ) const

Definition at line 249 of file StructuredDetector.cpp.

References getYValues(), m_base, Mantid::Geometry::Component::m_map, and m_yvalues.

Referenced by getYValues().

◆ idFillByFirstY()

bool Mantid::Geometry::StructuredDetector::idFillByFirstY ( ) const

Returns the idFillByFirstY.

Definition at line 219 of file StructuredDetector.cpp.

References m_base, m_idFillByFirstY, and Mantid::Geometry::Component::m_map.

Referenced by initialize().

◆ idStart()

detid_t Mantid::Geometry::StructuredDetector::idStart ( ) const

Returns the idStart.

Definition at line 211 of file StructuredDetector.cpp.

References m_base, m_idStart, and Mantid::Geometry::Component::m_map.

Referenced by initialize().

◆ idStep()

int Mantid::Geometry::StructuredDetector::idStep ( ) const

Returns the idStep.

Definition at line 235 of file StructuredDetector.cpp.

References m_base, m_idStep, and Mantid::Geometry::Component::m_map.

Referenced by initialize().

◆ idStepByRow()

int Mantid::Geometry::StructuredDetector::idStepByRow ( ) const

Returns the idStepByRow.

Definition at line 227 of file StructuredDetector.cpp.

References m_base, m_idStepByRow, and Mantid::Geometry::Component::m_map.

Referenced by initialize().

◆ init()

void Mantid::Geometry::StructuredDetector::init ( )
private

◆ initDraw()

void Mantid::Geometry::StructuredDetector::initDraw ( ) const
overridevirtual

Initializes the ObjComponent for rendering, this function should be called before rendering.

Implements Mantid::Geometry::IObjComponent.

Definition at line 531 of file StructuredDetector.cpp.

References Mantid::Geometry::IObjComponent::Handle(), and Mantid::Geometry::GeometryHandler::initialize().

◆ initialize()

void Mantid::Geometry::StructuredDetector::initialize ( size_t  xPixels,
size_t  yPixels,
std::vector< double > &&  x,
std::vector< double > &&  y,
bool  isZBeam,
detid_t  idStart,
bool  idFillByFirstY,
int  idStepByRow,
int  idStep = 1 
)

Create all the detector pixels of this rectangular detector.

Initialize a StructuredDetector by creating all of the pixels contained within it.

You should have set the name, position and rotation and facing of this object BEFORE calling this. NB xPixels and yPixels requires (xPixels+1)*(yPixels+1) vertices

Parameters
xPixels:: number of pixels in X
yPixels:: number of pixels in Y
x:: X vertices
y:: Y vertices
isZBeam:: Whether or not the alongBeam axis is z
idStart:: detector ID of the first pixel
idFillByFirstY:: set to true if ID numbers increase with Y indices first. That is: (0,0)=0; (0,1)=1, (0,2)=2 and so on.
idStepByRow:: amount to increase the ID number on each row. e.g, if you fill by Y first, and set idStepByRow = 100, and have 50 Y pixels, you would get: (0,0)=0; (0,1)=1; ... (0,49)=49; (1,0)=100; (1,1)=101; etc.
idStep:: amount to increase each individual ID number with a row. e.g, if you fill by Y first, and idStep=100 and idStart=1 then (0,0)=1; (0,1)=101; and so on

IDs start here

IDs are filled in Y fastest

Step size in ID in each row

Step size in ID in each col

Definition at line 278 of file StructuredDetector.cpp.

References createDetectors(), idFillByFirstY(), idStart(), idStep(), idStepByRow(), m_idFillByFirstY, m_idStart, m_idStep, m_idStepByRow, Mantid::Geometry::Component::m_map, m_xPixels, m_xvalues, m_yPixels, m_yvalues, Mantid::Geometry::x, xPixels(), Mantid::Geometry::y, and yPixels().

◆ interceptSurface()

int Mantid::Geometry::StructuredDetector::interceptSurface ( Track track) const
overridevirtual

Checks whether the track given will pass through this Component.

Implements Mantid::Geometry::IObjComponent.

Definition at line 464 of file StructuredDetector.cpp.

◆ isOnSide()

bool Mantid::Geometry::StructuredDetector::isOnSide ( const Kernel::V3D point) const
overridevirtual

Does the point given lie on the surface of this object component?

Implements Mantid::Geometry::IObjComponent.

Definition at line 459 of file StructuredDetector.cpp.

◆ isValid()

bool Mantid::Geometry::StructuredDetector::isValid ( const Kernel::V3D point) const
overridevirtual

Does the point given lie within this object component?

Implements Mantid::Geometry::IObjComponent.

Definition at line 454 of file StructuredDetector.cpp.

◆ material()

const Kernel::Material Mantid::Geometry::StructuredDetector::material ( ) const
overridevirtual

Returns the material of the detector.

Implements Mantid::Geometry::IObjComponent.

Definition at line 586 of file StructuredDetector.cpp.

◆ maxDetectorID()

int Mantid::Geometry::StructuredDetector::maxDetectorID ( )

maximum detector id

Returns the maximum detector id.

Returns
maximum detector id

Definition at line 421 of file StructuredDetector.cpp.

References m_base, Mantid::Geometry::Component::m_map, and m_maxDetId.

◆ minDetectorID()

int Mantid::Geometry::StructuredDetector::minDetectorID ( )

minimum detector id

Returns the minimum detector id.

Returns
minimum detector id

Definition at line 411 of file StructuredDetector.cpp.

References m_base, Mantid::Geometry::Component::m_map, and m_minDetId.

◆ operator=()

StructuredDetector & Mantid::Geometry::StructuredDetector::operator= ( const ICompAssembly )
private

Private copy assignment operator.

◆ registerContents()

size_t Mantid::Geometry::StructuredDetector::registerContents ( class ComponentVisitor componentVisitor) const
overridevirtual

Register the structured detector for Instrument 2.0 usage.

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 612 of file StructuredDetector.cpp.

References Mantid::Geometry::ComponentVisitor::registerStructuredBank().

◆ setColors()

void Mantid::Geometry::StructuredDetector::setColors ( const std::vector< int > &  r,
const std::vector< int > &  g,
const std::vector< int > &  b 
) const

Sets the colours for detector IDs based on color maps created by instrument actor.

Parameters
rred color channel
ggreen color channel
bblue color channel

Definition at line 163 of file StructuredDetector.cpp.

References b, g, m_base, Mantid::Geometry::Component::m_map, r, and setColors().

Referenced by setColors().

◆ shape()

const std::shared_ptr< const IObject > Mantid::Geometry::StructuredDetector::shape ( ) const
overridevirtual

Returns the shape of the Object.

Implements Mantid::Geometry::IObjComponent.

Definition at line 539 of file StructuredDetector.cpp.

References Mantid::Geometry::ShapeFactory::createShape(), m_xPixels, m_xvalues, m_yPixels, m_yvalues, and xPixels().

Referenced by addDetector().

◆ solidAngle()

double Mantid::Geometry::StructuredDetector::solidAngle ( const Kernel::V3D observer) const
overridevirtual

Finds the approximate solid angle covered by the component when viewed from the point given.

Implements Mantid::Geometry::IObjComponent.

Definition at line 470 of file StructuredDetector.cpp.

◆ type()

std::string Mantid::Geometry::StructuredDetector::type ( ) const
inlineoverridevirtual

String description of the type of component.

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 35 of file StructuredDetector.h.

◆ xPixels()

size_t Mantid::Geometry::StructuredDetector::xPixels ( ) const

Returns the number of pixels in the X direction.

Returns
number of X pixels

Definition at line 150 of file StructuredDetector.cpp.

References m_base, Mantid::Geometry::Component::m_map, and m_xPixels.

Referenced by getAtXY(), getBoundingBox(), initialize(), and shape().

◆ yPixels()

size_t Mantid::Geometry::StructuredDetector::yPixels ( ) const

Returns the number of pixels in the Y direction.

Returns
number of Y pixels

Definition at line 203 of file StructuredDetector.cpp.

References m_base, Mantid::Geometry::Component::m_map, and m_yPixels.

Referenced by getAtXY(), getBoundingBox(), and initialize().

Member Data Documentation

◆ b

std::vector<int> Mantid::Geometry::StructuredDetector::b
mutableprivate

Definition at line 167 of file StructuredDetector.h.

Referenced by getB(), and setColors().

◆ g

std::vector<int> Mantid::Geometry::StructuredDetector::g
mutableprivate

Definition at line 166 of file StructuredDetector.h.

Referenced by getG(), and setColors().

◆ m_base

const StructuredDetector* Mantid::Geometry::StructuredDetector::m_base
private

◆ m_idFillByFirstY

bool Mantid::Geometry::StructuredDetector::m_idFillByFirstY
private

IDs are filled in Y fastest.

Definition at line 156 of file StructuredDetector.h.

Referenced by getDetectorIDAtXY(), getXYForDetectorID(), idFillByFirstY(), init(), and initialize().

◆ m_idStart

detid_t Mantid::Geometry::StructuredDetector::m_idStart
private

IDs start here.

Definition at line 154 of file StructuredDetector.h.

Referenced by createDetectors(), getDetectorIDAtXY(), getXYForDetectorID(), idStart(), init(), and initialize().

◆ m_idStep

int Mantid::Geometry::StructuredDetector::m_idStep
private

Step size in ID in each col.

Definition at line 160 of file StructuredDetector.h.

Referenced by getDetectorIDAtXY(), getXYForDetectorID(), idStep(), init(), and initialize().

◆ m_idStepByRow

int Mantid::Geometry::StructuredDetector::m_idStepByRow
private

Step size in ID in each row.

Definition at line 158 of file StructuredDetector.h.

Referenced by getDetectorIDAtXY(), getXYForDetectorID(), idStepByRow(), init(), and initialize().

◆ m_maxDetId

detid_t Mantid::Geometry::StructuredDetector::m_maxDetId
private

maximum detector id

Definition at line 151 of file StructuredDetector.h.

Referenced by createDetectors(), init(), and maxDetectorID().

◆ m_minDetId

detid_t Mantid::Geometry::StructuredDetector::m_minDetId
private

minimum detector id

Definition at line 149 of file StructuredDetector.h.

Referenced by createDetectors(), init(), and minDetectorID().

◆ m_xPixels

size_t Mantid::Geometry::StructuredDetector::m_xPixels
private

The number of pixels in the X (horizontal) direction;.

Definition at line 144 of file StructuredDetector.h.

Referenced by addDetector(), createDetectors(), init(), initialize(), shape(), and xPixels().

◆ m_xvalues

std::vector<double> Mantid::Geometry::StructuredDetector::m_xvalues
private

Definition at line 162 of file StructuredDetector.h.

Referenced by addDetector(), getXValues(), initialize(), and shape().

◆ m_yPixels

size_t Mantid::Geometry::StructuredDetector::m_yPixels
private

The number of pixels in the Y (vertical) direction;.

Definition at line 146 of file StructuredDetector.h.

Referenced by createDetectors(), init(), initialize(), shape(), and yPixels().

◆ m_yvalues

std::vector<double> Mantid::Geometry::StructuredDetector::m_yvalues
private

Definition at line 163 of file StructuredDetector.h.

Referenced by addDetector(), getYValues(), initialize(), and shape().

◆ r

std::vector<int> Mantid::Geometry::StructuredDetector::r
mutableprivate

Definition at line 165 of file StructuredDetector.h.

Referenced by getR(), and setColors().


The documentation for this class was generated from the following files: