Mantid
|
This class represents a detector - i.e. More...
#include <Detector.h>
Public Member Functions | |
Component * | clone () const override |
Clone method Make a copy of the Component. More... | |
Detector * | cloneParameterized (const ParameterMap *map) const override |
Create a cloned instance with a parameter map applied. More... | |
Detector (const std::string &name, int id, const std::shared_ptr< IObject > &shape, IComponent *parent) | |
Constructor. More... | |
Detector (const std::string &name, int id, IComponent *parent) | |
Constructor. More... | |
double | getDistance (const IComponent &comp) const override |
Get the distance between the detector and another component. More... | |
detid_t | getID () const override |
Gets the detector id. More... | |
double | getPhi () const override |
Get the phi angle between the detector with reference to the origin This function will not be supported in Instrument-2.0 due to its ambiguity. More... | |
double | getPhiOffset (const double &offset) const override |
Calculate the phi angle between detector and beam, and then offset. More... | |
double | getSignedTwoTheta (const Kernel::V3D &observer, const Kernel::V3D &axis, const Kernel::V3D &instrumentUp) const override |
Get the two theata angle signed according the quadrant. More... | |
det_topology | getTopology (Kernel::V3D ¢er) const override |
returns the detector's topology, namely, the meaning of the detector's angular measurements. More... | |
double | getTwoTheta (const Kernel::V3D &observer, const Kernel::V3D &axis) const override |
Get the twotheta angle between the detector and an observer. More... | |
size_t | index () const override |
Helper for legacy access mode. Returns the index of the detector. More... | |
std::size_t | nDets () const override |
A Detector object represents a single physical detector. More... | |
const ParameterMap & | parameterMap () const override |
Helper for legacy access mode. Returns a reference to the ParameterMap. More... | |
virtual size_t | registerContents (class ComponentVisitor &componentVisitor) const override |
Register the contents of this ObjComponent. More... | |
std::string | type () const override |
A string representation of the component type. More... | |
Public Member Functions inherited from Mantid::Geometry::IDetector | |
virtual IDetector * | cloneParameterized (const ParameterMap *map) const =0 |
Create a cloned instance with a parameter map applied. More... | |
double | getDistance (const IComponent &comp) const override=0 |
Get the distance of this detector object from another Component. More... | |
virtual detid_t | getID () const =0 |
Get the detector ID. More... | |
virtual double | getPhi () const =0 |
Gives the phi of this detector object in radians. More... | |
virtual double | getPhiOffset (const double &offset) const =0 |
Gives the phi of this detector offset from y=0 by offset. More... | |
virtual double | getSignedTwoTheta (const Kernel::V3D &observer, const Kernel::V3D &axis, const Kernel::V3D &instrumentUp) const =0 |
Gives the signed angle of this detector object with respect to an axis. More... | |
virtual det_topology | getTopology (Kernel::V3D ¢er) const =0 |
returns the geometry of detectors, meaningful for groups, rectangular for single; returns the centre of a detector More... | |
virtual double | getTwoTheta (const Kernel::V3D &observer, const Kernel::V3D &axis) const =0 |
Gives the angle of this detector object with respect to an axis. More... | |
IDetector () | |
(Empty) Constructor. More... | |
virtual size_t | index () const =0 |
Helper for legacy access mode. Returns the index of the detector. More... | |
virtual std::size_t | nDets () const =0 |
Get the number of physical detectors this object represents. More... | |
virtual const ParameterMap & | parameterMap () const =0 |
Helper for legacy access mode. Returns a reference to the ParameterMap. More... | |
Public Member Functions inherited from Mantid::Geometry::IObjComponent | |
IComponent * | clone () 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... | |
GeometryHandler * | Handle () 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... | |
IObjComponent & | operator= (const IObjComponent &rhs) |
Assignment operator. More... | |
virtual const std::shared_ptr< const IObject > | shape () 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 | |
Public Member Functions inherited from Mantid::Geometry::IComponent | |
virtual IComponent * | clone () 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 IComponent * | getBareParent () 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 IComponent > | getParent () 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::ObjComponent | |
void | boundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const |
IComponent * | clone () const override |
Virtual Copy Constructor. More... | |
void | draw () const override |
Draws the objcomponent, If the handler is not set then this function does nothing. More... | |
void | drawObject () const override |
Draws the Object. More... | |
void | getBoundingBox (BoundingBox &absoluteBB) const override |
get bounding box, which may or may not be axis aligned; More... | |
virtual double | getDepth () const |
get Depth (Z-dimension) value for component More... | |
virtual double | getHeight () const |
get Height (Y-dimension) value for component More... | |
int | getPointInObject (Kernel::V3D &point) const override |
Try to find a point that lies within (or on) the object. More... | |
virtual double | getWidth () const |
get Width (X-dimension) value for component More... | |
void | initDraw () const override |
Initializes the ObjComponent for rendering, this function should be called before rendering. 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 |
Return the material this component is made from. More... | |
ObjComponent (const IComponent *base, const ParameterMap *map) | |
Constructor for parametrized component. More... | |
ObjComponent (const std::string &name, IComponent *parent=nullptr) | |
Constructor. More... | |
ObjComponent (const std::string &name, std::shared_ptr< const IObject > shape, IComponent *parent=nullptr) | |
Constructor. More... | |
virtual size_t | registerContents (class ComponentVisitor &componentVisitor) const override |
Register the contents of this ObjComponent. More... | |
void | setShape (std::shared_ptr< const IObject > newShape) |
Set a new shape on the component void setShape(std::shared_ptr<const IObject> newShape);. More... | |
const std::shared_ptr< const IObject > | shape () const override |
Return the shape of the component. 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... | |
std::string | type () const override |
type string More... | |
Public Member Functions inherited from Mantid::Geometry::Component | |
IComponent * | clone () 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 IComponent > | getParent () 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, ComponentID > | getParameterNamesByComponent () 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::V3D > | getPositionParameter (const std::string &pname, bool recursive=true) const override |
Get a parameter defined as a Kernel::V3D. More... | |
std::vector< Kernel::Quat > | getRotationParameter (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 IComponent * | base () const |
Returns the address of the base component. More... | |
Kernel::V3D | getScaleFactor () const override |
Returns the ScaleFactor. More... | |
const IComponent * | getBareParent () 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... | |
Protected Member Functions | |
Detector (const Detector *base, const ParameterMap *map) | |
Constructor for parametrized version. More... | |
bool | hasDetectorInfo () const |
Protected Member Functions inherited from Mantid::Geometry::IObjComponent | |
void | setGeometryHandler (GeometryHandler *h) |
Reset the current geometry handler. More... | |
Protected Member Functions inherited from Mantid::Geometry::ObjComponent | |
const Kernel::V3D | factorOutComponentPosition (const Kernel::V3D &point) const |
Find the point that's in the same place relative to the constituent geometrical Object if the position and rotation introduced by the Component is ignored. More... | |
const Kernel::V3D | takeOutRotation (Kernel::V3D point) const |
Rotates a point by the reverse of the component's rotation. More... | |
Protected Member Functions inherited from Mantid::Geometry::Component | |
template<class TYPE > | |
std::vector< TYPE > | getParameter (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... | |
Private Attributes | |
const detid_t | m_id |
The detector id. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::Geometry::ObjComponent | |
std::shared_ptr< const IObject > | m_shape |
The physical geometry representation. More... | |
Protected Attributes inherited from Mantid::Geometry::Component | |
const IComponent * | m_parent |
Parent component in the tree. More... | |
const Component * | m_base |
The base component - this is the unmodified component (without the parameters). More... | |
const ParameterMap * | m_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... | |
This class represents a detector - i.e.
a single pixel in an instrument. It is An extension of the ObjectComponent class to add a detector id.
Definition at line 30 of file Detector.h.
Mantid::Geometry::Detector::Detector | ( | const std::string & | name, |
int | id, | ||
IComponent * | parent | ||
) |
Constructor.
name | :: The name of the component |
id | :: Index for the component |
parent | :: The parent component |
Definition at line 35 of file Detector.cpp.
Mantid::Geometry::Detector::Detector | ( | const std::string & | name, |
int | id, | ||
const std::shared_ptr< IObject > & | shape, | ||
IComponent * | parent | ||
) |
Constructor.
name | :: The name of the component |
id | :: Index for the component |
shape | :: A pointer to the object describing the shape of this component |
parent | :: The parent component |
Definition at line 45 of file Detector.cpp.
|
protected |
Constructor for parametrized version.
Constructor for a parametrized Detector.
base | the base (un-parametrized) IComponent |
map | pointer to the ParameterMap |
Definition at line 28 of file Detector.cpp.
|
inlineoverridevirtual |
Clone method Make a copy of the Component.
if pmap not present throw
Reimplemented from Mantid::Geometry::Component.
Definition at line 38 of file Detector.h.
|
inlineoverridevirtual |
Create a cloned instance with a parameter map applied.
Implements Mantid::Geometry::IDetector.
Reimplemented in Mantid::Geometry::GridDetectorPixel.
Definition at line 41 of file Detector.h.
|
overridevirtual |
Get the distance between the detector and another component.
comp | :: The other component |
Implements Mantid::Geometry::IDetector.
Definition at line 65 of file Detector.cpp.
References Mantid::Geometry::IComponent::getDistance().
|
overridevirtual |
Gets the detector id.
Implements Mantid::Geometry::IDetector.
Definition at line 51 of file Detector.cpp.
References Mantid::Geometry::d, Mantid::Geometry::Component::m_base, m_id, and Mantid::Geometry::Component::m_map.
Referenced by InstrumentCreationHelper::addFullInstrumentToWorkspace(), and Mantid::Geometry::InstrumentDefinitionParser::createDetectorOrMonitor().
|
overridevirtual |
Get the phi angle between the detector with reference to the origin This function will not be supported in Instrument-2.0 due to its ambiguity.
DO NOT USE IN NEW CODE
Implements Mantid::Geometry::IDetector.
Definition at line 100 of file Detector.cpp.
References Mantid::Geometry::Component::getPos().
Referenced by getPhiOffset().
|
overridevirtual |
Calculate the phi angle between detector and beam, and then offset.
offset | in radians |
Implements Mantid::Geometry::IDetector.
Definition at line 110 of file Detector.cpp.
References getPhi().
|
overridevirtual |
Get the two theata angle signed according the quadrant.
observer | :: The observer position |
axis | :: The axis |
instrumentUp | :: instrument up direction. |
Implements Mantid::Geometry::IDetector.
Definition at line 83 of file Detector.cpp.
References Mantid::Kernel::V3D::angle(), Mantid::Kernel::V3D::cross_prod(), Mantid::Geometry::Component::getPos(), and Mantid::Kernel::V3D::scalar_prod().
|
overridevirtual |
returns the detector's topology, namely, the meaning of the detector's angular measurements.
It is different in cartesian and cylindrical (surrounding the beam) coordinate system
Implements Mantid::Geometry::IDetector.
Definition at line 120 of file Detector.cpp.
References Mantid::Geometry::Component::getPos(), and Mantid::Geometry::rect.
|
overridevirtual |
Get the twotheta angle between the detector and an observer.
observer | :: The observer position |
axis | :: The axis |
Implements Mantid::Geometry::IDetector.
Definition at line 71 of file Detector.cpp.
References Mantid::Kernel::V3D::angle(), and Mantid::Geometry::Component::getPos().
|
protected |
Definition at line 135 of file Detector.cpp.
References Mantid::Geometry::IComponent::getBareParent(), Mantid::Geometry::ParameterMap::hasDetectorInfo(), Mantid::Geometry::Component::m_base, and Mantid::Geometry::Component::m_map.
Referenced by Mantid::Geometry::GridDetectorPixel::getRelativePos().
|
overridevirtual |
Helper for legacy access mode. Returns the index of the detector.
Implements Mantid::Geometry::IDetector.
Definition at line 129 of file Detector.cpp.
References Mantid::Geometry::ParameterMap::detectorIndex(), m_id, and Mantid::Geometry::Component::m_map.
|
inlineoverridevirtual |
A Detector object represents a single physical detector.
Implements Mantid::Geometry::IDetector.
Definition at line 43 of file Detector.h.
|
overridevirtual |
Helper for legacy access mode. Returns a reference to the ParameterMap.
Implements Mantid::Geometry::IDetector.
Definition at line 126 of file Detector.cpp.
References Mantid::Geometry::Component::m_map.
|
overridevirtual |
Register the contents of this ObjComponent.
Reimplemented from Mantid::Geometry::ObjComponent.
Definition at line 131 of file Detector.cpp.
References Mantid::Geometry::ComponentVisitor::registerDetector().
|
inlineoverridevirtual |
A string representation of the component type.
Reimplemented from Mantid::Geometry::IComponent.
Reimplemented in Mantid::Geometry::GridDetectorPixel.
Definition at line 33 of file Detector.h.
|
private |