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

Base Instrument Class. More...

#include <Instrument.h>

Inheritance diagram for Mantid::Geometry::Instrument:
Mantid::Geometry::CompAssembly Mantid::Geometry::ICompAssembly Mantid::Geometry::Component Mantid::Geometry::IComponent Mantid::Geometry::IComponent

Public Types

enum  ContainsState { Full , Partial , None }
 To determine whether the instrument contains elements of some type. More...
 

Public Member Functions

virtual int add (IComponent *component) override
 Add a component to the instrument. More...
 
std::shared_ptr< const InstrumentbaseInstrument () const
 Pointer to the 'real' instrument, for parametrized instruments. More...
 
Instrumentclone () const override
 Virtual copy constructor. More...
 
ContainsState containsRectDetectors () const
 Check whether instrument contains rectangular detectors. More...
 
size_t detectorIndex (const detid_t detID) const
 Returns the index for a detector ID. Used for accessing DetectorInfo. More...
 
std::vector< RectangularDetector_const_sptrfindRectDetectors () const
 
std::vector< std::shared_ptr< const IComponent > > getAllComponentsWithName (const std::string &cname) const
 Returns pointers to all components encountered with the given name. More...
 
const IDetectorgetBaseDetector (const detid_t &detector_id) const
 Gets a pointer to the base (non-parametrized) detector from its ID returns null if the detector has not been found. More...
 
Kernel::V3D getBeamDirection () const
 Gets the beam direction (i.e. 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...
 
std::shared_ptr< const IComponentgetComponentByID (const IComponent *id) const
 Returns a shared pointer to a component. More...
 
std::string getDefaultAxis () const
 Retrieves from which side the instrument to be viewed from when the instrument viewer first starts, possibilities are "Z+, Z-, X+, ...". More...
 
std::string getDefaultView () const
 Get the default type of the instrument view. More...
 
IDetector_const_sptr getDetector (const detid_t &detector_id) const
 Gets a pointer to the detector from its ID Note that for getting the detector associated with a spectrum, the MatrixWorkspace::getDetector method should be used rather than this one because it takes account of the possibility of more than one detector contributing to a single spectrum. More...
 
IDetector_const_sptr getDetectorG (const std::set< detid_t > &det_ids) const
 Returns a pointer to the geometrical object for the given set of IDs. More...
 
std::vector< detid_tgetDetectorIDs (bool skipMonitors=false) const
 Return a vector of detector IDs in this instrument. More...
 
std::vector< IDetector_const_sptrgetDetectors (const std::set< detid_t > &det_ids) const
 Returns a list of Detectors for the given detectors ids. More...
 
std::vector< IDetector_const_sptrgetDetectors (const std::vector< detid_t > &det_ids) const
 Returns a list of Detectors for the given detectors ids. More...
 
void getDetectors (detid2det_map &out_map) const
 return reference to detector cache More...
 
void getDetectorsInBank (std::vector< IDetector_const_sptr > &dets, const IComponent &comp) const
 Fill a vector with all the detectors contained (at any depth) in a named component. More...
 
void getDetectorsInBank (std::vector< IDetector_const_sptr > &dets, const std::string &bankName) const
 Fill a vector with all the detectors contained (at any depth) in a named component. More...
 
const std::string & getFilename () const
 
void getInstrumentParameters (double &l1, Kernel::V3D &beamline, double &beamline_norm, Kernel::V3D &samplePos) const
 Get several instrument parameters used in tof to D-space conversion. More...
 
InstrumentParameterCachegetLogfileCache ()
 Get information about the parameters described in the instrument definition file and associated parameter files. More...
 
const InstrumentParameterCachegetLogfileCache () const
 
std::map< std::string, std::string > & getLogfileUnit ()
 Get information about the units used for parameters described in the IDF and associated parameter files. More...
 
void getMinMaxDetectorIDs (detid_t &min, detid_t &max) const
 Get the minimum and maximum (inclusive) detector IDs. More...
 
std::vector< detid_tgetMonitors () const
 Returns a list containing the detector ids of monitors. More...
 
std::size_t getNumberDetectors (bool skipMonitors=false) const
 
std::shared_ptr< ParameterMapgetParameterMap () const
 Pointer to the NOT const ParameterMap holding the parameters of the modified instrument components. More...
 
std::shared_ptr< const InstrumentgetPhysicalInstrument () const
 INDIRECT GEOMETRY INSTRUMENTS ONLY: Returns the physical instrument, if one has been specified as distinct from the 'neutronic' one. More...
 
std::shared_ptr< const std::vector< IObjComponent_const_sptr > > getPlottable () const
 Get pointers to plottable components. More...
 
std::shared_ptr< const ReferenceFramegetReferenceFrame () const
 Get refernce Frame. More...
 
IComponent_const_sptr getSample () const
 Gets a pointer to the Sample Position. More...
 
IComponent_const_sptr getSource () const
 Gets a pointer to the source. More...
 
Types::Core::DateAndTime getValidFromDate () const
 
Types::Core::DateAndTime getValidToDate () const
 
const std::string & getXmlText () const
 
bool hasSample () const
 Checks to see if the Instrument has a sample. More...
 
bool hasSource () const
 Checks to see if the Instrument has a source. More...
 
 Instrument ()
 Default constructor. More...
 
 Instrument (const Instrument &)
 Copy constructor This method was added to deal with having distinct neutronic and physical positions in indirect instruments. More...
 
 Instrument (const std::shared_ptr< const Instrument > &instr, const std::shared_ptr< ParameterMap > &map)
 Constructor to create a parametrized instrument. More...
 
 Instrument (const std::string &name)
 Constructor with name. More...
 
bool isEmptyInstrument () const
 
bool isMonitor (const detid_t &detector_id) const
 
bool isMonitor (const std::set< detid_t > &detector_ids) const
 
bool isMonitorViaIndex (const size_t index) const
 Temporary helper for refactoring. Argument is index, not ID! More...
 
void loadNexus (::NeXus::File *file, const std::string &group)
 Load the object from an open NeXus file. More...
 
std::pair< std::unique_ptr< ComponentInfo >, std::unique_ptr< DetectorInfo > > makeBeamline (ParameterMap &pmap, const ParameterMap *source=nullptr) const
 Return ComponentInfo and DetectorInfo for instrument given by pmap. More...
 
std::shared_ptr< ParameterMapmakeLegacyParameterMap () const
 Returns a legacy ParameterMap, containing information that is now stored in DetectorInfo (masking, positions, rotations, scale factors). More...
 
void markAsDetector (const IDetector *)
 mark a Component which has already been added to the Instrument (as a child comp.) to be a Detector component by adding it to _detectorCache More...
 
void markAsDetectorFinalize ()
 Sorts the detector cache. More...
 
void markAsDetectorIncomplete (const IDetector *)
 As markAsDetector but without the required sorting. More...
 
void markAsMonitor (const IDetector *)
 mark a Component which has already been added to the Instrument (as a child comp.) to be a monitor and also add it to _detectorCache for possible later retrieval More...
 
void markAsSamplePos (const IComponent *)
 mark a Component which has already been added to the Instrument (as a child comp.) to be 'the' samplePos Component. More...
 
void markAsSource (const IComponent *)
 mark a Component which has already been added to the Instrument (as a child comp.) to be 'the' source Component. More...
 
void parseTreeAndCacheBeamline ()
 Parse the instrument tree and create ComponentInfo and DetectorInfo. More...
 
void removeDetector (IDetector *)
 Remove a detector from the instrument. More...
 
void saveNexus (::NeXus::File *file, const std::string &group) const
 Save the instrument to an open NeXus file. More...
 
void setDefaultView (const std::string &type)
 Set the default type of the instrument view. More...
 
void setDefaultViewAxis (const std::string &axis)
 Retrieves from which side the instrument to be viewed from when the instrument viewer first starts, possibilities are "Z+, Z-, X+, ...". More...
 
void setFilename (const std::string &filename)
 Set the path to the original IDF .xml file that was loaded for this instrument. More...
 
void setPhysicalInstrument (std::unique_ptr< Instrument >)
 INDIRECT GEOMETRY INSTRUMENTS ONLY: Sets the physical instrument. More...
 
void setReferenceFrame (std::shared_ptr< ReferenceFrame > frame)
 Set reference Frame. More...
 
void setValidFromDate (const Types::Core::DateAndTime &val)
 Set the date from which the instrument definition begins to be valid. More...
 
void setValidToDate (const Types::Core::DateAndTime &val)
 Set the date at which the instrument definition is no longer valid. More...
 
void setXmlText (const std::string &XmlText)
 Set the Contents of the IDF .xml file that was loaded for this instrument. More...
 
std::string type () const override
 String description of the type of component. 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...
 

Private Member Functions

bool addAssemblyChildrenToQueue (std::queue< IComponent_const_sptr > &queue, IComponent_const_sptr component) const
 If component is a ComponentAssembly, we add its children to the queue to check if they're Rectangular Detectors and returns true. More...
 
void addInstrumentChildrenToQueue (std::queue< IComponent_const_sptr > &queue) const
 
void appendPlottable (const CompAssembly &ca, std::vector< IObjComponent_const_sptr > &lst) const
 Add a plottable component. More...
 
std::pair< std::unique_ptr< ComponentInfo >, std::unique_ptr< DetectorInfo > > makeWrappers (ParameterMap &pmap, const ComponentInfo &componentInfo, const DetectorInfo &detectorInfo) const
 Sets up links between m_detectorInfo, m_componentInfo, and m_instrument. More...
 
Instrumentoperator= (const Instrument &)
 Private copy assignment operator. More...
 
void saveDetectorSetInfoToNexus (::NeXus::File *file, const std::vector< detid_t > &detIDs) const
 Save information about a set of detectors to Nexus. More...
 
bool validateComponentProperties (IComponent_const_sptr component) const
 

Private Attributes

std::shared_ptr< const ComponentInfom_componentInfo {nullptr}
 Pointer to the ComponentInfo object. May be NULL. More...
 
std::string m_defaultView
 Stores the default type of the instrument view: 3D or one of the "unwrapped". More...
 
std::string m_defaultViewAxis
 Stores from which side the instrument will be viewed from, initially in the instrument viewer, possibilities are "Z+, Z-, X+, ...". More...
 
std::vector< std::tuple< detid_t, IDetector_const_sptr, bool > > m_detectorCache
 Map which holds detector-IDs and pointers to detector components, and monitor flags. More...
 
std::shared_ptr< const DetectorInfom_detectorInfo {nullptr}
 Pointer to the DetectorInfo object. May be NULL. More...
 
std::string m_filename
 Path to the original IDF .xml file that was loaded for this instrument. More...
 
std::shared_ptr< const Instrumentm_instr
 Pointer to the "real" instrument, for parametrized Instrument. More...
 
bool m_isPhysicalInstrument {false}
 Flag - is this the physical rather than neutronic instrument. More...
 
InstrumentParameterCache m_logfileCache
 To store info about the parameters defined in IDF. More...
 
std::map< std::string, std::string > m_logfileUnit
 Store units used by users to specify angles in IDFs and associated parameter files. More...
 
std::shared_ptr< ParameterMapm_map_nonconst
 Non-const pointer to the parameter map. More...
 
std::shared_ptr< const Instrumentm_physicalInstrument
 Pointer to the physical instrument, where this differs from the 'neutronic' one (indirect geometry) More...
 
std::shared_ptr< ReferenceFramem_referenceFrame
 Pointer to the reference frame object. More...
 
const IComponentm_sampleCache
 Purpose to hold copy of samplePos component. More...
 
const IComponentm_sourceCache
 Purpose to hold copy of source component. More...
 
Types::Core::DateAndTime m_ValidFrom
 the date from which the instrument definition begins to be valid. More...
 
Types::Core::DateAndTime m_ValidTo
 the date at which the instrument definition is no longer valid. More...
 
std::string m_xmlText
 Contents of the IDF .xml file that was loaded for this instrument. More...
 

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 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

Base Instrument Class.

Author
Nick Draper, ISIS, RAL
Date
26/09/2007
Author
Anders Markvardsen, ISIS, RAL
Date
1/4/2008

Definition at line 47 of file Instrument.h.

Member Enumeration Documentation

◆ ContainsState

To determine whether the instrument contains elements of some type.

Enumerator
Full 
Partial 
None 

Definition at line 203 of file Instrument.h.

Constructor & Destructor Documentation

◆ Instrument() [1/4]

Mantid::Geometry::Instrument::Instrument ( const std::shared_ptr< const Instrument > &  instr,
const std::shared_ptr< ParameterMap > &  map 
)

Constructor to create a parametrized instrument.

Parameters
instr:: instrument for parameter inclusion
map:: parameter map to include

Definition at line 61 of file Instrument.cpp.

◆ Instrument() [2/4]

Mantid::Geometry::Instrument::Instrument ( )

Default constructor.

Definition at line 48 of file Instrument.cpp.

Referenced by clone().

◆ Instrument() [3/4]

Mantid::Geometry::Instrument::Instrument ( const std::string &  name)

Constructor with name.

Definition at line 53 of file Instrument.cpp.

◆ Instrument() [4/4]

Mantid::Geometry::Instrument::Instrument ( const Instrument instr)

Copy constructor This method was added to deal with having distinct neutronic and physical positions in indirect instruments.

Definition at line 76 of file Instrument.cpp.

References Mantid::Geometry::CompAssembly::getChildren(), Mantid::Geometry::IComponent::getName(), isMonitor(), m_sampleCache, m_sourceCache, markAsDetector(), markAsMonitor(), markAsSamplePos(), markAsSource(), and obj.

Member Function Documentation

◆ add()

int Mantid::Geometry::Instrument::add ( IComponent component)
overridevirtual

Add a component to the instrument.

Implements Mantid::Geometry::ICompAssembly.

Definition at line 1164 of file Instrument.cpp.

References Mantid::Geometry::CompAssembly::add().

Referenced by ComponentCreationHelper::addRectangularBank().

◆ addAssemblyChildrenToQueue()

bool Mantid::Geometry::Instrument::addAssemblyChildrenToQueue ( std::queue< IComponent_const_sptr > &  queue,
IComponent_const_sptr  component 
) const
private

If component is a ComponentAssembly, we add its children to the queue to check if they're Rectangular Detectors and returns true.

Otherwise, it returns false.

Definition at line 1144 of file Instrument.cpp.

Referenced by containsRectDetectors(), and findRectDetectors().

◆ addInstrumentChildrenToQueue()

void Mantid::Geometry::Instrument::addInstrumentChildrenToQueue ( std::queue< IComponent_const_sptr > &  queue) const
private

◆ appendPlottable()

void Mantid::Geometry::Instrument::appendPlottable ( const CompAssembly ca,
std::vector< IObjComponent_const_sptr > &  lst 
) const
private

◆ baseInstrument()

Instrument_const_sptr Mantid::Geometry::Instrument::baseInstrument ( ) const

Pointer to the 'real' instrument, for parametrized instruments.

Definition at line 124 of file Instrument.cpp.

References m_instr, and Mantid::Geometry::Component::m_map.

Referenced by export_Instrument(), and Mantid::API::ExperimentInfo::readParameterMap().

◆ clone()

Instrument * Mantid::Geometry::Instrument::clone ( ) const
overridevirtual

Virtual copy constructor.

Implements Mantid::Geometry::ICompAssembly.

Definition at line 121 of file Instrument.cpp.

References Instrument().

◆ containsRectDetectors()

Instrument::ContainsState Mantid::Geometry::Instrument::containsRectDetectors ( ) const

Check whether instrument contains rectangular detectors.

Returns
Full if all detectors are rect., Partial if some, None if none

Definition at line 1053 of file Instrument.cpp.

References addAssemblyChildrenToQueue(), addInstrumentChildrenToQueue(), Full, None, Partial, and validateComponentProperties().

◆ detectorIndex()

size_t Mantid::Geometry::Instrument::detectorIndex ( const detid_t  detID) const

Returns the index for a detector ID. Used for accessing DetectorInfo.

Definition at line 1170 of file Instrument.cpp.

References m_instr, and Mantid::Geometry::Component::m_map.

Referenced by Mantid::Geometry::ParameterMap::detectorIndex().

◆ findRectDetectors()

std::vector< RectangularDetector_const_sptr > Mantid::Geometry::Instrument::findRectDetectors ( ) const

◆ getAllComponentsWithName()

std::vector< std::shared_ptr< const IComponent > > Mantid::Geometry::Instrument::getAllComponentsWithName ( const std::string &  cname) const

Returns pointers to all components encountered with the given name.

Find all components in an Instrument Definition File (IDF) with a given name.

If you know a component has a unique name use instead getComponentByName(), which is as fast or faster for retrieving a uniquely named component.

Parameters
cname:: The name of the component. If there are multiple matches, the first one found is returned.
Returns
Pointers to components

Definition at line 399 of file Instrument.cpp.

References Mantid::Geometry::Component::getName().

◆ getBaseDetector()

const IDetector * Mantid::Geometry::Instrument::getBaseDetector ( const detid_t detector_id) const

Gets a pointer to the base (non-parametrized) detector from its ID returns null if the detector has not been found.

Parameters
detector_idThe requested detector ID
Returns
A const pointer to the detector object

Definition at line 483 of file Instrument.cpp.

References m_instr.

◆ getBeamDirection()

Kernel::V3D Mantid::Geometry::Instrument::getBeamDirection ( ) const

Gets the beam direction (i.e.

source->sample direction). Not virtual because it relies the getSample() & getPos() virtual functions

Returns
A unit vector denoting the direction of the beam

Definition at line 375 of file Instrument.cpp.

References Mantid::Geometry::CompAssembly::getPos(), getSample(), getSource(), and Mantid::Kernel::normalize().

◆ getBoundingBox()

void Mantid::Geometry::Instrument::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 instrument.

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

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

Implements Mantid::Geometry::IComponent.

Definition at line 733 of file Instrument.cpp.

References Mantid::Geometry::ComponentInfo::boundingBox(), Mantid::Geometry::ParameterMap::componentInfo(), getChild(), getSource(), Mantid::Geometry::BoundingBox::grow(), Mantid::Geometry::ParameterMap::hasComponentInfo(), Mantid::Geometry::Component::index(), Mantid::Geometry::CompAssembly::m_cachedBoundingBox, Mantid::Geometry::CompAssembly::m_children, Mantid::Geometry::Component::m_map, and Mantid::Geometry::CompAssembly::nelements().

◆ getChild()

std::shared_ptr< IComponent > Mantid::Geometry::CompAssembly::getChild ( const int  i) const
overridevirtual

Get a pointer to the ith component within the assembly. Easier to use than.

Get a pointer to the ith component in the assembly.

Note standard C/C++ array notation used, that is, i most be an integer i = 0,1,..., N-1, where N is the number of component in the assembly. Easier to use than the [] operator when you have a pointer

Parameters
i:: The index of the component you want
Returns
m_children[i]
Exceptions
std::runtime_errorif i is not in range

Reimplemented from Mantid::Geometry::CompAssembly.

Definition at line 66 of file CompAssembly.cpp.

Referenced by addInstrumentChildrenToQueue(), and getBoundingBox().

◆ getComponentByID()

std::shared_ptr< const IComponent > Mantid::Geometry::Instrument::getComponentByID ( const IComponent id) const

Returns a shared pointer to a component.

Get a shared pointer to a component by its ID, const version.

Parameters
id:: ID
Returns
A pointer to the component.

Definition at line 382 of file Instrument.cpp.

References Mantid::Geometry::Component::base(), Mantid::Geometry::ParComponentFactory::create(), and Mantid::Geometry::Component::m_map.

◆ getDefaultAxis()

std::string Mantid::Geometry::Instrument::getDefaultAxis ( ) const
inline

Retrieves from which side the instrument to be viewed from when the instrument viewer first starts, possibilities are "Z+, Z-, X+, ...".

Definition at line 154 of file Instrument.h.

◆ getDefaultView()

std::string Mantid::Geometry::Instrument::getDefaultView ( ) const
inline

Get the default type of the instrument view.

The possible values are: 3D, CYLINDRICAL_X, CYLINDRICAL_Y, CYLINDRICAL_Z, SPHERICAL_X, SPHERICAL_Y, SPHERICAL_Z

Definition at line 147 of file Instrument.h.

◆ getDetector()

IDetector_const_sptr Mantid::Geometry::Instrument::getDetector ( const detid_t detector_id) const

Gets a pointer to the detector from its ID Note that for getting the detector associated with a spectrum, the MatrixWorkspace::getDetector method should be used rather than this one because it takes account of the possibility of more than one detector contributing to a single spectrum.

Parameters
detector_idThe requested detector ID
Returns
A pointer to the detector object
Exceptions
NotFoundErrorIf no detector is found for the detector ID given

Definition at line 461 of file Instrument.cpp.

References Mantid::Geometry::ParComponentFactory::createDetector(), m_instr, and Mantid::Geometry::Component::m_map.

Referenced by export_Instrument(), getDetectorG(), getDetectors(), and Mantid::API::ExperimentInfo::readParameterMap().

◆ getDetectorG()

IDetector_const_sptr Mantid::Geometry::Instrument::getDetectorG ( const std::set< detid_t > &  det_ids) const

Returns a pointer to the geometrical object for the given set of IDs.

Parameters
det_ids:: A list of detector ids
Returns
A pointer to the detector object
Exceptions
NotFoundErrorIf no detector is found for the detector ID given

Definition at line 513 of file Instrument.cpp.

References getDetector().

◆ getDetectorIDs()

std::vector< detid_t > Mantid::Geometry::Instrument::getDetectorIDs ( bool  skipMonitors = false) const

Return a vector of detector IDs in this instrument.

Definition at line 205 of file Instrument.cpp.

References m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

Referenced by saveNexus().

◆ getDetectors() [1/3]

std::vector< IDetector_const_sptr > Mantid::Geometry::Instrument::getDetectors ( const std::set< detid_t > &  det_ids) const

Returns a list of Detectors for the given detectors ids.

Definition at line 544 of file Instrument.cpp.

References getDetector().

◆ getDetectors() [2/3]

std::vector< IDetector_const_sptr > Mantid::Geometry::Instrument::getDetectors ( const std::vector< detid_t > &  det_ids) const

Returns a list of Detectors for the given detectors ids.

Definition at line 530 of file Instrument.cpp.

References getDetector().

Referenced by saveDetectorSetInfoToNexus().

◆ getDetectors() [3/3]

void Mantid::Geometry::Instrument::getDetectors ( detid2det_map out_map) const

return reference to detector cache

Fills a copy of the detector cache.

Returns
a map of the detectors hold by the instrument

Definition at line 186 of file Instrument.cpp.

References getDetector(), m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

◆ getDetectorsInBank() [1/2]

void Mantid::Geometry::Instrument::getDetectorsInBank ( std::vector< IDetector_const_sptr > &  dets,
const IComponent comp 
) const

Fill a vector with all the detectors contained (at any depth) in a named component.

For example, you might have a bank10 with 4 tubes with 100 pixels each; this will return the 400 contained Detector objects.

Parameters
[out]dets:: vector filled with detector pointers
comp:: the parent component assembly that contains detectors.

Definition at line 275 of file Instrument.cpp.

References Mantid::Geometry::ICompAssembly::getChildren().

Referenced by getDetectorsInBank().

◆ getDetectorsInBank() [2/2]

void Mantid::Geometry::Instrument::getDetectorsInBank ( std::vector< IDetector_const_sptr > &  dets,
const std::string &  bankName 
) const

Fill a vector with all the detectors contained (at any depth) in a named component.

For example, you might have a bank10 with 4 tubes with 100 pixels each; this will return the 400 contained Detector objects.

Parameters
[out]dets:: vector filled with detector pointers
bankName:: name of the parent component assembly that contains detectors. The name must be unique, otherwise the first matching component (getComponentByName) is used.
Exceptions
NotFoundErrorif the given bank does not exist.

Definition at line 301 of file Instrument.cpp.

References Mantid::Geometry::CompAssembly::getComponentByName(), and getDetectorsInBank().

◆ getFilename()

const std::string & Mantid::Geometry::Instrument::getFilename ( ) const
Returns
the path to the original IDF .xml file that was loaded for this instrument

Definition at line 857 of file Instrument.cpp.

References m_filename, m_instr, and Mantid::Geometry::Component::m_map.

◆ getInstrumentParameters()

void Mantid::Geometry::Instrument::getInstrumentParameters ( double &  l1,
Kernel::V3D beamline,
double &  beamline_norm,
Kernel::V3D samplePos 
) const

Get several instrument parameters used in tof to D-space conversion.

Parameters
l1:: primary flight path (source-sample distance)
beamline:: vector of the direction and length of the beam (source to samepl)
beamline_norm:: 2 * the length of beamline
samplePos:: vector of the position of the sample

Definition at line 824 of file Instrument.cpp.

References Mantid::Geometry::Component::getName(), getSample(), getSource(), and Mantid::Kernel::V3D::norm().

◆ getLogfileCache() [1/2]

InstrumentParameterCache & Mantid::Geometry::Instrument::getLogfileCache ( )
inline

Get information about the parameters described in the instrument definition file and associated parameter files.

Definition at line 137 of file Instrument.h.

◆ getLogfileCache() [2/2]

const InstrumentParameterCache & Mantid::Geometry::Instrument::getLogfileCache ( ) const
inline

Definition at line 138 of file Instrument.h.

◆ getLogfileUnit()

std::map< std::string, std::string > & Mantid::Geometry::Instrument::getLogfileUnit ( )
inline

Get information about the units used for parameters described in the IDF and associated parameter files.

Definition at line 142 of file Instrument.h.

◆ getMinMaxDetectorIDs()

void Mantid::Geometry::Instrument::getMinMaxDetectorIDs ( detid_t min,
detid_t max 
) const

Get the minimum and maximum (inclusive) detector IDs.

Parameters
min:: set to the min detector ID
max:: set to the max detector ID

Definition at line 256 of file Instrument.cpp.

References m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

◆ getMonitors()

std::vector< detid_t > Mantid::Geometry::Instrument::getMonitors ( ) const

Returns a list containing the detector ids of monitors.

This method returns monitor detector ids.

Returns
a vector holding detector ids of monitors

Definition at line 716 of file Instrument.cpp.

References m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

◆ getNumberDetectors()

std::size_t Mantid::Geometry::Instrument::getNumberDetectors ( bool  skipMonitors = false) const
Returns
The total number of detector IDs in the instrument *‍/

Definition at line 222 of file Instrument.cpp.

References m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

Referenced by export_Instrument().

◆ getParameterMap()

ParameterMap_sptr Mantid::Geometry::Instrument::getParameterMap ( ) const

Pointer to the NOT const ParameterMap holding the parameters of the modified instrument components.

Pointer to the ParameterMap holding the parameters of the modified instrument components.

Returns
parameter map from modified instrument components

Definition at line 137 of file Instrument.cpp.

References Mantid::Geometry::Component::m_map, and m_map_nonconst.

Referenced by Mantid::Crystal::CalibrationHelpers::adjustBankPositionsAndSizes(), makeLegacyParameterMap(), and Mantid::Crystal::SCDCalibratePanels::saveXmlFile().

◆ getPhysicalInstrument()

Instrument_const_sptr Mantid::Geometry::Instrument::getPhysicalInstrument ( ) const

INDIRECT GEOMETRY INSTRUMENTS ONLY: Returns the physical instrument, if one has been specified as distinct from the 'neutronic' one.

Otherwise (and most commonly) returns a null pointer, meaning that the holding instrument is already the physical instrument.

Definition at line 151 of file Instrument.cpp.

References m_instr, Mantid::Geometry::Component::m_map, m_map_nonconst, and m_physicalInstrument.

◆ getPlottable()

std::shared_ptr< const std::vector< IObjComponent_const_sptr > > Mantid::Geometry::Instrument::getPlottable ( ) const

Get pointers to plottable components.

Definition at line 772 of file Instrument.cpp.

References appendPlottable(), Mantid::Geometry::ParComponentFactory::create(), m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

◆ getReferenceFrame()

std::shared_ptr< const ReferenceFrame > Mantid::Geometry::Instrument::getReferenceFrame ( ) const

Get refernce Frame.

Getter for the reference frame.

Returns
: reference frame.

Definition at line 1010 of file Instrument.cpp.

References m_instr, Mantid::Geometry::Component::m_map, and m_referenceFrame.

Referenced by Mantid::Algorithms::BeamProfileFactory::createBeamProfile(), and export_Instrument().

◆ getSample()

IComponent_const_sptr Mantid::Geometry::Instrument::getSample ( ) const

◆ getSource()

IComponent_const_sptr Mantid::Geometry::Instrument::getSource ( ) const

◆ getValidFromDate()

Types::Core::DateAndTime Mantid::Geometry::Instrument::getValidFromDate ( ) const
inline
Returns
the date from which the instrument definition begins to be valid.

Definition at line 169 of file Instrument.h.

Referenced by export_Instrument(), and Mantid::Crystal::SCDCalibratePanels::saveXmlFile().

◆ getValidToDate()

Types::Core::DateAndTime Mantid::Geometry::Instrument::getValidToDate ( ) const
inline
Returns
the date at which the instrument definition is no longer valid.

Definition at line 172 of file Instrument.h.

Referenced by export_Instrument().

◆ getXmlText()

const std::string & Mantid::Geometry::Instrument::getXmlText ( ) const
Returns
Contents of the IDF .xml file that was loaded for this instrument

Definition at line 873 of file Instrument.cpp.

References m_instr, Mantid::Geometry::Component::m_map, and m_xmlText.

Referenced by saveNexus().

◆ hasSample()

bool Mantid::Geometry::Instrument::hasSample ( ) const

Checks to see if the Instrument has a sample.

Returns
True if the instrument has a sample cache.

Definition at line 317 of file Instrument.cpp.

References m_sampleCache.

◆ hasSource()

bool Mantid::Geometry::Instrument::hasSource ( ) const

Checks to see if the Instrument has a source.

Returns
True if the instrument has a source cache.

Definition at line 312 of file Instrument.cpp.

References m_sourceCache.

◆ isEmptyInstrument()

bool Mantid::Geometry::Instrument::isEmptyInstrument ( ) const

Definition at line 1162 of file Instrument.cpp.

References Mantid::Geometry::CompAssembly::nelements().

◆ isMonitor() [1/2]

bool Mantid::Geometry::Instrument::isMonitor ( const detid_t detector_id) const

◆ isMonitor() [2/2]

bool Mantid::Geometry::Instrument::isMonitor ( const std::set< detid_t > &  detector_ids) const

Definition at line 499 of file Instrument.cpp.

◆ isMonitorViaIndex()

bool Mantid::Geometry::Instrument::isMonitorViaIndex ( const size_t  index) const

Temporary helper for refactoring. Argument is index, not ID!

Definition at line 1155 of file Instrument.cpp.

References Mantid::Geometry::Component::index(), m_detectorCache, m_instr, and Mantid::Geometry::Component::m_map.

Referenced by saveNexus().

◆ loadNexus()

void Mantid::Geometry::Instrument::loadNexus ( ::NeXus::File *  file,
const std::string &  group 
)

Load the object from an open NeXus file.

Parameters
file:: open NeXus file
group:: name of the group to open

Definition at line 995 of file Instrument.cpp.

◆ makeBeamline()

std::pair< std::unique_ptr< ComponentInfo >, std::unique_ptr< DetectorInfo > > Mantid::Geometry::Instrument::makeBeamline ( ParameterMap pmap,
const ParameterMap source = nullptr 
) const

◆ makeLegacyParameterMap()

std::shared_ptr< ParameterMap > Mantid::Geometry::Instrument::makeLegacyParameterMap ( ) const

◆ makeWrappers()

std::pair< std::unique_ptr< ComponentInfo >, std::unique_ptr< DetectorInfo > > Mantid::Geometry::Instrument::makeWrappers ( ParameterMap pmap,
const ComponentInfo componentInfo,
const DetectorInfo detectorInfo 
) const
private

Sets up links between m_detectorInfo, m_componentInfo, and m_instrument.

Definition at line 1305 of file Instrument.cpp.

References Mantid::Geometry::ComponentInfo::cloneWithoutDetectorInfo(), and Mantid::Geometry::ParComponentFactory::createInstrument().

Referenced by makeBeamline().

◆ markAsDetector()

void Mantid::Geometry::Instrument::markAsDetector ( const IDetector det)

mark a Component which has already been added to the Instrument (as a child comp.) to be a Detector component by adding it to _detectorCache

Mark a Component which has already been added to the Instrument (as a child component) to be a Detector by adding it to a detector cache.

Parameters
det:: Component to be marked (stored for later retrieval) as a detector Component

Definition at line 620 of file Instrument.cpp.

References Mantid::Geometry::IDetector::getID(), isMonitor(), m_detectorCache, and Mantid::Geometry::Component::m_map.

Referenced by ComponentCreationHelper::addRectangularBank(), Instrument(), ComponentCreationHelper::makeBank(), and markAsMonitor().

◆ markAsDetectorFinalize()

void Mantid::Geometry::Instrument::markAsDetectorFinalize ( )

Sorts the detector cache.

Called after all detectors have been marked via markAsDetectorIncomplete.

Definition at line 651 of file Instrument.cpp.

References m_detectorCache.

◆ markAsDetectorIncomplete()

void Mantid::Geometry::Instrument::markAsDetectorIncomplete ( const IDetector det)

As markAsDetector but without the required sorting.

Must call markAsDetectorFinalize before accessing detectors.

Definition at line 638 of file Instrument.cpp.

References Mantid::Geometry::IDetector::getID(), isMonitor(), m_detectorCache, and Mantid::Geometry::Component::m_map.

◆ markAsMonitor()

void Mantid::Geometry::Instrument::markAsMonitor ( const IDetector det)

mark a Component which has already been added to the Instrument (as a child comp.) to be a monitor and also add it to _detectorCache for possible later retrieval

Mark a Component which has already been added to the Instrument class as a monitor and add it to the detector cache.

Parameters
det:: Component to be marked (stored for later retrieval) as a detector Component
Exceptions
Exception::ExistsErrorif cannot add detector to cache

Definition at line 677 of file Instrument.cpp.

References Mantid::Geometry::IDetector::getID(), m_detectorCache, Mantid::Geometry::Component::m_map, and markAsDetector().

Referenced by Instrument().

◆ markAsSamplePos()

void Mantid::Geometry::Instrument::markAsSamplePos ( const IComponent comp)

mark a Component which has already been added to the Instrument (as a child comp.) to be 'the' samplePos Component.

Mark a component which has already been added to the Instrument (as a child component) to be 'the' samplePos component.

For now it is assumed that we have at most one of these.

NOTE THOUGH THAT THIS METHOD DOES NOT VERIFY THAT THIS IS THE CASE. It is assumed that we have at only one of these. The component is required to have a name.

Parameters
comp:: Component to be marked (stored for later retrieval) as a "SamplePos" Component

Definition at line 564 of file Instrument.cpp.

References Mantid::Geometry::g_log, Mantid::Geometry::IComponent::getName(), Mantid::Geometry::Component::m_map, m_sampleCache, and Mantid::Kernel::Logger::warning().

Referenced by Instrument().

◆ markAsSource()

void Mantid::Geometry::Instrument::markAsSource ( const IComponent comp)

mark a Component which has already been added to the Instrument (as a child comp.) to be 'the' source Component.

Mark a component which has already been added to the Instrument (as a child component) to be 'the' source component.NOTE THOUGH THAT THIS METHOD DOES NOT VERIFY THAT THIS IS THE CASE.

For now it is assumed that we have at most one of these.

It is assumed that we have at only one of these. The component is required to have a name.

Parameters
comp:: Component to be marked (stored for later retrieval) as a "source" Component

Definition at line 597 of file Instrument.cpp.

References Mantid::Geometry::g_log, Mantid::Geometry::IComponent::getName(), Mantid::Geometry::Component::m_map, m_sourceCache, and Mantid::Kernel::Logger::warning().

Referenced by Instrument().

◆ operator=()

Instrument & Mantid::Geometry::Instrument::operator= ( const Instrument )
private

Private copy assignment operator.

◆ parseTreeAndCacheBeamline()

void Mantid::Geometry::Instrument::parseTreeAndCacheBeamline ( )

Parse the instrument tree and create ComponentInfo and DetectorInfo.

This can be called for the base instrument once it is completely created, in particular when it is stored in the InstrumentDataService for reusing it later and avoiding repeated tree walks if several workspaces with the same instrument are loaded.

Definition at line 1278 of file Instrument.cpp.

References Mantid::Geometry::Component::isParametrized(), m_componentInfo, m_detectorInfo, and Mantid::Geometry::InstrumentVisitor::makeWrappers().

◆ removeDetector()

void Mantid::Geometry::Instrument::removeDetector ( IDetector det)

Remove a detector from the instrument.

Removes a detector from the instrument and from the detector cache.

The object is deleted.

Parameters
detThe detector to remove

Definition at line 694 of file Instrument.cpp.

References Mantid::Geometry::IComponent::getBareParent(), Mantid::Geometry::IDetector::getID(), m_detectorCache, Mantid::Geometry::Component::m_map, and Mantid::Geometry::CompAssembly::remove().

◆ saveDetectorSetInfoToNexus()

void Mantid::Geometry::Instrument::saveDetectorSetInfoToNexus ( ::NeXus::File *  file,
const std::vector< detid_t > &  detIDs 
) const
private

Save information about a set of detectors to Nexus.

Definition at line 949 of file Instrument.cpp.

References getDetectors(), getSample(), and Mantid::Kernel::V3D::getSpherical().

Referenced by saveNexus().

◆ saveNexus()

void Mantid::Geometry::Instrument::saveNexus ( ::NeXus::File *  file,
const std::string &  group 
) const

Save the instrument to an open NeXus file.

This saves the name, valid date, source xml file name, and the full XML text of the definition file. It also saves the parameter map, in the case of a parametrized instrument.

Parameters
file:: open NeXus file
group:: name of the group to create

Definition at line 889 of file Instrument.cpp.

References Mantid::Geometry::g_log, getDetectorIDs(), Mantid::Geometry::Component::getName(), getXmlText(), isMonitorViaIndex(), Mantid::Geometry::Component::isParametrized(), makeLegacyParameterMap(), saveDetectorSetInfoToNexus(), and Mantid::Kernel::Logger::warning().

◆ setDefaultView()

void Mantid::Geometry::Instrument::setDefaultView ( const std::string &  type)

Set the default type of the instrument view.

The possible values are: 3D, CYLINDRICAL_X, CYLINDRICAL_Y, CYLINDRICAL_Z, SPHERICAL_X, SPHERICAL_Y, SPHERICAL_Z

Parameters
type:: A string with one of the values: 3D, CYLINDRICAL_X, CYLINDRICAL_Y, CYLINDRICAL_Z, SPHERICAL_X, SPHERICAL_Y, SPHERICAL_Z Caseless. If a wrong value is given logs a warning and sets the view to "3D"

Definition at line 1026 of file Instrument.cpp.

References Mantid::Geometry::g_log, m_defaultView, type(), and Mantid::Kernel::Logger::warning().

◆ setDefaultViewAxis()

void Mantid::Geometry::Instrument::setDefaultViewAxis ( const std::string &  axis)
inline

Retrieves from which side the instrument to be viewed from when the instrument viewer first starts, possibilities are "Z+, Z-, X+, ...".

Definition at line 157 of file Instrument.h.

◆ setFilename()

void Mantid::Geometry::Instrument::setFilename ( const std::string &  filename)

Set the path to the original IDF .xml file that was loaded for this instrument.

Definition at line 848 of file Instrument.cpp.

References m_filename, m_instr, and Mantid::Geometry::Component::m_map.

◆ setPhysicalInstrument()

void Mantid::Geometry::Instrument::setPhysicalInstrument ( std::unique_ptr< Instrument physInst)

INDIRECT GEOMETRY INSTRUMENTS ONLY: Sets the physical instrument.

The holding instrument is then the 'neutronic' one, and is used in all algorithms.

Parameters
physInstA pointer to the physical instrument object.

Definition at line 173 of file Instrument.cpp.

References Mantid::Geometry::Component::m_map, and m_physicalInstrument.

◆ setReferenceFrame()

void Mantid::Geometry::Instrument::setReferenceFrame ( std::shared_ptr< ReferenceFrame frame)

Set reference Frame.

Setter for the reference frame.

Parameters
frame: reference frame object to use.

Definition at line 1004 of file Instrument.cpp.

References m_referenceFrame.

◆ setValidFromDate()

void Mantid::Geometry::Instrument::setValidFromDate ( const Types::Core::DateAndTime &  val)

Set the date from which the instrument definition begins to be valid.

Parameters
val:: date
val:: date and time
Exceptions
InstrumentDefinitionErrorThrown if date is earlier than 1900-01-31 23:59:01

Definition at line 1042 of file Instrument.cpp.

References m_filename, and m_ValidFrom.

◆ setValidToDate()

void Mantid::Geometry::Instrument::setValidToDate ( const Types::Core::DateAndTime &  val)
inline

Set the date at which the instrument definition is no longer valid.

Parameters
val:: date

Definition at line 180 of file Instrument.h.

◆ setXmlText()

void Mantid::Geometry::Instrument::setXmlText ( const std::string &  XmlText)

Set the Contents of the IDF .xml file that was loaded for this instrument.

Definition at line 865 of file Instrument.cpp.

References m_instr, Mantid::Geometry::Component::m_map, and m_xmlText.

◆ type()

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

String description of the type of component.

Reimplemented from Mantid::Geometry::ICompAssembly.

Definition at line 50 of file Instrument.h.

Referenced by setDefaultView().

◆ validateComponentProperties()

bool Mantid::Geometry::Instrument::validateComponentProperties ( IComponent_const_sptr  component) const
private

Member Data Documentation

◆ m_componentInfo

std::shared_ptr<const ComponentInfo> Mantid::Geometry::Instrument::m_componentInfo {nullptr}
private

Pointer to the ComponentInfo object. May be NULL.

Definition at line 305 of file Instrument.h.

Referenced by makeBeamline(), and parseTreeAndCacheBeamline().

◆ m_defaultView

std::string Mantid::Geometry::Instrument::m_defaultView
private

Stores the default type of the instrument view: 3D or one of the "unwrapped".

Definition at line 272 of file Instrument.h.

Referenced by setDefaultView().

◆ m_defaultViewAxis

std::string Mantid::Geometry::Instrument::m_defaultViewAxis
private

Stores from which side the instrument will be viewed from, initially in the instrument viewer, possibilities are "Z+, Z-, X+, ...".

Definition at line 275 of file Instrument.h.

◆ m_detectorCache

std::vector<std::tuple<detid_t, IDetector_const_sptr, bool> > Mantid::Geometry::Instrument::m_detectorCache
private

Map which holds detector-IDs and pointers to detector components, and monitor flags.

Definition at line 244 of file Instrument.h.

Referenced by getDetectorIDs(), getDetectors(), getMinMaxDetectorIDs(), getMonitors(), getNumberDetectors(), getPlottable(), isMonitorViaIndex(), markAsDetector(), markAsDetectorFinalize(), markAsDetectorIncomplete(), markAsMonitor(), and removeDetector().

◆ m_detectorInfo

std::shared_ptr<const DetectorInfo> Mantid::Geometry::Instrument::m_detectorInfo {nullptr}
private

Pointer to the DetectorInfo object. May be NULL.

Definition at line 302 of file Instrument.h.

Referenced by makeBeamline(), and parseTreeAndCacheBeamline().

◆ m_filename

std::string Mantid::Geometry::Instrument::m_filename
mutableprivate

Path to the original IDF .xml file that was loaded for this instrument.

Definition at line 289 of file Instrument.h.

Referenced by getFilename(), setFilename(), and setValidFromDate().

◆ m_instr

std::shared_ptr<const Instrument> Mantid::Geometry::Instrument::m_instr
private

◆ m_isPhysicalInstrument

bool Mantid::Geometry::Instrument::m_isPhysicalInstrument {false}
private

Flag - is this the physical rather than neutronic instrument.

Definition at line 308 of file Instrument.h.

◆ m_logfileCache

InstrumentParameterCache Mantid::Geometry::Instrument::m_logfileCache
private

To store info about the parameters defined in IDF.

Indexed according to logfile-IDs, which equals logfile filename minus the run number and file extension

Definition at line 257 of file Instrument.h.

◆ m_logfileUnit

std::map<std::string, std::string> Mantid::Geometry::Instrument::m_logfileUnit
private

Store units used by users to specify angles in IDFs and associated parameter files.

By default this one is empty meaning that the default of angle=degree etc are used see http://www.mantidproject.org/IDF However if map below contains e.g. <"angle", "radian"> it means that all "angle"-parameters in the _logfileCache are assumed to have been specified by the user in radian (not degrees)

Definition at line 268 of file Instrument.h.

◆ m_map_nonconst

std::shared_ptr<ParameterMap> Mantid::Geometry::Instrument::m_map_nonconst
private

Non-const pointer to the parameter map.

Definition at line 281 of file Instrument.h.

Referenced by getParameterMap(), and getPhysicalInstrument().

◆ m_physicalInstrument

std::shared_ptr<const Instrument> Mantid::Geometry::Instrument::m_physicalInstrument
private

Pointer to the physical instrument, where this differs from the 'neutronic' one (indirect geometry)

Definition at line 296 of file Instrument.h.

Referenced by getPhysicalInstrument(), and setPhysicalInstrument().

◆ m_referenceFrame

std::shared_ptr<ReferenceFrame> Mantid::Geometry::Instrument::m_referenceFrame
private

Pointer to the reference frame object.

Definition at line 299 of file Instrument.h.

Referenced by getReferenceFrame(), and setReferenceFrame().

◆ m_sampleCache

const IComponent* Mantid::Geometry::Instrument::m_sampleCache
private

Purpose to hold copy of samplePos component.

For now assumed to be just one component

Definition at line 252 of file Instrument.h.

Referenced by getSample(), hasSample(), Instrument(), markAsSamplePos(), and validateComponentProperties().

◆ m_sourceCache

const IComponent* Mantid::Geometry::Instrument::m_sourceCache
private

Purpose to hold copy of source component.

For now assumed to be just one component

Definition at line 248 of file Instrument.h.

Referenced by getSource(), hasSource(), Instrument(), markAsSource(), and validateComponentProperties().

◆ m_ValidFrom

Types::Core::DateAndTime Mantid::Geometry::Instrument::m_ValidFrom
private

the date from which the instrument definition begins to be valid.

Definition at line 284 of file Instrument.h.

Referenced by setValidFromDate().

◆ m_ValidTo

Types::Core::DateAndTime Mantid::Geometry::Instrument::m_ValidTo
private

the date at which the instrument definition is no longer valid.

Definition at line 286 of file Instrument.h.

◆ m_xmlText

std::string Mantid::Geometry::Instrument::m_xmlText
mutableprivate

Contents of the IDF .xml file that was loaded for this instrument.

Definition at line 292 of file Instrument.h.

Referenced by getXmlText(), and setXmlText().


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