|
Mantid
|
This class stores information about the sample used in particular run. More...
#include <Sample.h>
Public Member Functions | |
| void | addSample (const std::shared_ptr< Sample > &childSample) |
| Adds a sample to the list. | |
| const std::string & | getName () const |
| Returns the name of the sample. | |
| const Geometry::IObject & | getShape () const |
| Return the sample shape. | |
| const Geometry::IObject_sptr | getShapePtr () const |
| Return a pointer to the sample shape. | |
| bool | hasShape () const |
| Check if sample has a valid shape. | |
| int | loadNexus (Nexus::File *file, const std::string &group) |
| Load the object from an open NeXus file. | |
| Sample & | operator= (const Sample &rhs) |
| Assignment operator. | |
| Sample & | operator[] (const int index) |
| index operator for accessing multiple samples | |
| Sample () | |
| Default constructor. | |
| Sample (const Sample ©) | |
| Copy constructor. | |
| void | saveNexus (Nexus::File *file, const std::string &group) const |
| Save the object to an open NeXus file. | |
| void | setName (const std::string &name) |
| Set the name of the sample. | |
| void | setShape (const Geometry::IObject_sptr &shape) |
| Update the shape of the object. | |
| std::size_t | size () const |
| the number of samples | |
| ~Sample () | |
| Destructor. | |
Material properties. | |
| const Kernel::Material & | getMaterial () const |
| Return the material (convenience method) | |
Access the environment information | |
| bool | hasEnvironment () const |
| const Geometry::SampleEnvironment & | getEnvironment () const |
| Get a reference to the sample's environment. | |
| void | setEnvironment (std::shared_ptr< Geometry::SampleEnvironment > env) |
| Set the environment used to contain the sample. | |
Access the sample's lattice structure and orientation | |
| const Geometry::OrientedLattice & | getOrientedLattice () const |
| Get a reference to the sample's OrientedLattice. | |
| Geometry::OrientedLattice & | getOrientedLattice () |
| Get a reference to the sample's OrientedLattice. | |
| void | setOrientedLattice (std::unique_ptr< Geometry::OrientedLattice > lattice) |
| Set the pointer to OrientedLattice defining the sample's lattice and orientation. | |
| bool | hasOrientedLattice () const |
Access the sample's crystal structure | |
| const Geometry::CrystalStructure & | getCrystalStructure () const |
| void | setCrystalStructure (const Geometry::CrystalStructure &newCrystalStructure) |
| Resets the internal pointer to the new CrystalStructure (it's copied). | |
| bool | hasCrystalStructure () const |
| Returns true if the sample actually holds a CrystalStructure. | |
| void | clearCrystalStructure () |
| Destroys the internally stored CrystalStructure-object. | |
Legacy functions | |
| std::string | m_name |
| The sample name. | |
| Geometry::IObject_sptr | m_shape |
| The sample shape object. | |
| std::shared_ptr< Geometry::SampleEnvironment > | m_environment |
| An owned pointer to the SampleEnvironment object. | |
| std::unique_ptr< Geometry::OrientedLattice > | m_lattice |
| Pointer to the OrientedLattice of the sample, NULL if not set. | |
| std::unique_ptr< Geometry::CrystalStructure > | m_crystalStructure |
| CrystalStructure of the sample. | |
| std::vector< std::shared_ptr< Sample > > | m_samples |
| Vector of child samples. | |
| int | m_geom_id |
| The sample geometry flag. | |
| double | m_thick |
| The sample thickness from the SPB_STRUCT in the raw file. | |
| double | m_height |
| The sample height from the SPB_STRUCT in the raw file. | |
| double | m_width |
| The sample width from the SPB_STRUCT in the raw file. | |
| void | setGeometryFlag (int geom_id) |
| Sets the geometry flag. | |
| int | getGeometryFlag () const |
| Returns the geometry flag. | |
| void | setThickness (double thick) |
| Sets the thickness. | |
| double | getThickness () const |
| Returns the thickness. | |
| void | setHeight (double height) |
| Sets the height. | |
| double | getHeight () const |
| Returns the height. | |
| void | setWidth (double width) |
| Sets the width. | |
| double | getWidth () const |
| Returns the width. | |
| void | clearOrientedLattice () |
| Delete the oriented lattice. | |
| bool | operator== (const Sample &other) const |
| bool | operator!= (const Sample &other) const |
This class stores information about the sample used in particular run.
It is a type of ObjComponent meaning it has a shape, a position and a material.
| Mantid::API::Sample::Sample | ( | ) |
| Mantid::API::Sample::Sample | ( | const Sample & | copy | ) |
Copy constructor.
| copy | :: const reference to the sample object |
Definition at line 37 of file Sample.cpp.
References getCrystalStructure(), getOrientedLattice(), hasCrystalStructure(), m_crystalStructure, and m_lattice.
|
default |
Destructor.
| void Mantid::API::Sample::addSample | ( | const std::shared_ptr< Sample > & | childSample | ) |
Adds a sample to the list.
Adds a sample to the sample collection.
| childSample | The child sample to be added |
Definition at line 278 of file Sample.cpp.
References m_samples.
Referenced by loadNexus().
| void Mantid::API::Sample::clearCrystalStructure | ( | ) |
Destroys the internally stored CrystalStructure-object.
Definition at line 201 of file Sample.cpp.
References m_crystalStructure.
Referenced by export_Sample().
| void Mantid::API::Sample::clearOrientedLattice | ( | ) |
Delete the oriented lattice.
Definition at line 407 of file Sample.cpp.
References m_lattice.
Referenced by Mantid::Crystal::ClearUB::clearSingleExperimentInfo(), and export_Sample().
| const Geometry::CrystalStructure & Mantid::API::Sample::getCrystalStructure | ( | ) | const |
Definition at line 180 of file Sample.cpp.
References hasCrystalStructure(), and m_crystalStructure.
Referenced by export_Sample(), Sample(), and Mantid::Crystal::PredictPeaks::setStructureFactorCalculatorFromSample().
| const SampleEnvironment & Mantid::API::Sample::getEnvironment | ( | ) | const |
Get a reference to the sample's environment.
Return a reference to the sample environment that this sample is attached to.
| std::runtime_error | If the environment has not been defined |
Definition at line 135 of file Sample.cpp.
References m_environment.
Referenced by Mantid::Algorithms::AbsorptionCorrection::constructSample(), Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::constructSample(), Mantid::Algorithms::CopySample::copyParameters(), Mantid::Algorithms::BeamProfileFactory::createBeamProfile(), export_Sample(), Mantid::DataHandling::LoadSampleEnvironment::loadEnvironmentFromSTL(), Mantid::Algorithms::MCInteractionStatistics::MCInteractionStatistics(), Mantid::DataHandling::SetSample::setSampleEnvironmentFromFile(), and Mantid::DataHandling::SetSample::setSampleEnvironmentFromXML().
| int Mantid::API::Sample::getGeometryFlag | ( | ) | const |
Returns the geometry flag.
Get the geometry flag that is specified in the raw file within the SPB_STRUCT 1 = cylinder, 2 = flat plate, 3 = disc, 4 = single crystal.
Definition at line 215 of file Sample.cpp.
References m_geom_id.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), and export_Sample().
| double Mantid::API::Sample::getHeight | ( | ) | const |
Returns the height.
Get the height value.
Definition at line 239 of file Sample.cpp.
References m_height.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), and export_Sample().
| const Material & Mantid::API::Sample::getMaterial | ( | ) | const |
Return the material (convenience method)
Return the material.
Definition at line 126 of file Sample.cpp.
References m_shape.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), Mantid::DataHandling::SetSample::setSampleShape(), and Mantid::DataHandling::CreateSampleShape::setSampleShape().
| const std::string & Mantid::API::Sample::getName | ( | ) | const |
Returns the name of the sample.
Definition at line 85 of file Sample.cpp.
References m_name.
Referenced by Mantid::Algorithms::CompareWorkspaces::checkSample(), Mantid::Algorithms::CopySample::copyParameters(), and export_Sample().
| OrientedLattice & Mantid::API::Sample::getOrientedLattice | ( | ) |
Get a reference to the sample's OrientedLattice.
Return a reference to the OrientedLattice of this sample.
| std::runtime_error | If the OrientedLattice has not been defined |
Definition at line 164 of file Sample.cpp.
References m_lattice.
| const OrientedLattice & Mantid::API::Sample::getOrientedLattice | ( | ) | const |
Get a reference to the sample's OrientedLattice.
Return a const reference to the OrientedLattice of this sample.
| std::runtime_error | If the OrientedLattice has not been defined |
Definition at line 153 of file Sample.cpp.
References m_lattice.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), Mantid::DataObjects::LeanElasticPeaksWorkspace::createPeakHKL(), Mantid::DataObjects::PeaksWorkspace::createPeakHKL(), Mantid::Crystal::PredictPeaks::exec(), Mantid::Crystal::PredictSatellitePeaks::exec(), Mantid::Crystal::PredictSatellitePeaks::exec_peaks(), export_Sample(), Mantid::DataObjects::PeaksWorkspace::peakInfo(), Sample(), Mantid::Crystal::PredictPeaks::setStructureFactorCalculatorFromSample(), and Mantid::API::ExperimentInfo::toString().
| const IObject & Mantid::API::Sample::getShape | ( | ) | const |
Return the sample shape.
Get a reference to the sample shape object.
It is assumed that this is defined within its own coordinate system with its centre at [0,0,0]
Definition at line 101 of file Sample.cpp.
References m_shape.
Referenced by Mantid::Algorithms::AbsorptionCorrection::constructSample(), Mantid::Algorithms::PaalmanPingsAbsorptionCorrection::constructSample(), Mantid::Algorithms::CopySample::copyParameters(), Mantid::Algorithms::BeamProfileFactory::createBeamProfile(), and Mantid::Algorithms::EstimateScatteringVolumeCentreOfMass::extractValidSampleObject().
| const IObject_sptr Mantid::API::Sample::getShapePtr | ( | ) | const |
Return a pointer to the sample shape.
Get a pointer to the sample shape object.
It is assumed that this is defined within its own coordinate system with its centre at [0,0,0]
Definition at line 109 of file Sample.cpp.
References m_shape.
Referenced by export_Sample(), and Mantid::Algorithms::EstimateScatteringVolumeCentreOfMass::extractValidSampleObject().
| double Mantid::API::Sample::getThickness | ( | ) | const |
Returns the thickness.
Get the thickness value.
Definition at line 227 of file Sample.cpp.
References m_thick.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), and export_Sample().
| double Mantid::API::Sample::getWidth | ( | ) | const |
Returns the width.
Get the height value.
Definition at line 251 of file Sample.cpp.
References m_width.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), and export_Sample().
| bool Mantid::API::Sample::hasCrystalStructure | ( | ) | const |
Returns true if the sample actually holds a CrystalStructure.
Definition at line 194 of file Sample.cpp.
References m_crystalStructure.
Referenced by export_Sample(), getCrystalStructure(), Sample(), and Mantid::Crystal::PredictPeaks::setStructureFactorCalculatorFromSample().
| bool Mantid::API::Sample::hasEnvironment | ( | ) | const |
Definition at line 128 of file Sample.cpp.
References m_environment.
Referenced by Mantid::Algorithms::BeamProfileFactory::createBeamProfile(), and export_Sample().
| bool Mantid::API::Sample::hasOrientedLattice | ( | ) | const |
Definition at line 178 of file Sample.cpp.
References m_lattice.
Referenced by Mantid::Crystal::ClearUB::clearSingleExperimentInfo(), Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), Mantid::API::MatrixWorkspace::hasOrientedLattice(), and saveNexus().
| bool Mantid::API::Sample::hasShape | ( | ) | const |
Check if sample has a valid shape.
Definition at line 93 of file Sample.cpp.
References m_shape.
Referenced by export_Sample().
| int Mantid::API::Sample::loadNexus | ( | Nexus::File * | file, |
| const std::string & | group | ||
| ) |
Load the object from an open NeXus file.
| file | :: open NeXus file |
| group | :: name of the group to open |
Definition at line 326 of file Sample.cpp.
References addSample(), Mantid::Geometry::ShapeFactory::createShape(), group, Mantid::Kernel::Material::loadNexus(), m_geom_id, m_height, m_lattice, m_name, m_shape, m_thick, m_width, Mantid::Kernel::Strings::strip(), and Mantid::Kernel::Strings::toString().
Referenced by Mantid::API::ExperimentInfo::loadSampleAndLogInfoNexus(), and Mantid::API::ExperimentInfo::loadSampleAndLogInfoNexus().
| bool Mantid::API::Sample::operator!= | ( | const Sample & | other | ) | const |
Definition at line 436 of file Sample.cpp.
References operator==().
Assignment operator.
| rhs | :: const reference to the sample object |
Definition at line 57 of file Sample.cpp.
References m_crystalStructure, m_environment, m_geom_id, m_height, m_lattice, m_name, m_samples, m_shape, m_thick, m_width, and rhs.
| bool Mantid::API::Sample::operator== | ( | const Sample & | other | ) | const |
Definition at line 413 of file Sample.cpp.
References Mantid::DataHandling::compare(), m_crystalStructure, m_environment, m_geom_id, m_height, m_lattice, m_name, m_samples, m_shape, m_thick, m_width, and Mantid::Geometry::x.
Referenced by operator!=().
| Sample & Mantid::API::Sample::operator[] | ( | const int | index | ) |
index operator for accessing multiple samples
Gets the desired sample, 0 is the current sample.
| index | The index of the desired sample |
Definition at line 258 of file Sample.cpp.
| void Mantid::API::Sample::saveNexus | ( | Nexus::File * | file, |
| const std::string & | group | ||
| ) | const |
Save the object to an open NeXus file.
| file | :: open NeXus file |
| group | :: name of the group to create |
Definition at line 285 of file Sample.cpp.
References group, hasOrientedLattice(), m_geom_id, m_height, m_lattice, m_name, m_samples, m_shape, m_thick, m_width, saveNexus(), and Mantid::Kernel::Strings::toString().
Referenced by Mantid::API::ExperimentInfo::saveExperimentInfoNexus(), Mantid::API::ExperimentInfo::saveExperimentInfoNexus(), and saveNexus().
| void Mantid::API::Sample::setCrystalStructure | ( | const Geometry::CrystalStructure & | newCrystalStructure | ) |
Resets the internal pointer to the new CrystalStructure (it's copied).
Definition at line 189 of file Sample.cpp.
References m_crystalStructure.
Referenced by export_Sample().
| void Mantid::API::Sample::setEnvironment | ( | std::shared_ptr< Geometry::SampleEnvironment > | env | ) |
Set the environment used to contain the sample.
Attach an environment onto this sample.
| env | :: A pointer to a created sample environment. This takes ownership of the object. |
Definition at line 147 of file Sample.cpp.
References m_environment.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), Mantid::DataHandling::LoadSampleEnvironment::loadEnvironmentFromSTL(), Mantid::DataHandling::SetSample::setSampleEnvironmentFromFile(), and Mantid::DataHandling::SetSample::setSampleEnvironmentFromXML().
| void Mantid::API::Sample::setGeometryFlag | ( | int | geom_id | ) |
Sets the geometry flag.
Set the geometry flag that is specfied in the raw file within the SPB_STRUCT 1 = cylinder, 2 = flat plate, 3 = disc, 4 = single crystal.
| geom_id | :: The flag for the geometry |
Definition at line 208 of file Sample.cpp.
References m_geom_id.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), and Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry().
| void Mantid::API::Sample::setHeight | ( | double | height | ) |
Sets the height.
Set the height value.
| height | :: The parameter e_height in the SPB_STRUCT |
Definition at line 233 of file Sample.cpp.
References height, and m_height.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), and Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry().
| void Mantid::API::Sample::setName | ( | const std::string & | name | ) |
Set the name of the sample.
Update the name of the sample.
| name | :: The name of the sample |
Definition at line 91 of file Sample.cpp.
Referenced by Mantid::Algorithms::CopySample::copyParameters().
| void Mantid::API::Sample::setOrientedLattice | ( | std::unique_ptr< Geometry::OrientedLattice > | lattice | ) |
Set the pointer to OrientedLattice defining the sample's lattice and orientation.
Attach an OrientedLattice onto this sample.
| lattice | :: A pointer to a OrientedLattice. |
Definition at line 175 of file Sample.cpp.
References m_lattice.
Referenced by Mantid::Algorithms::CopySample::copyParameters().
| void Mantid::API::Sample::setShape | ( | const Geometry::IObject_sptr & | shape | ) |
Update the shape of the object.
Set the object that describes the sample shape.
The object is defined within its own coordinate system
| shape | :: The object describing the shape |
Definition at line 115 of file Sample.cpp.
References Mantid::Geometry::ShapeFactory::createShape(), and m_shape.
Referenced by Mantid::Algorithms::AbsorptionCorrection::constructSample(), Mantid::Algorithms::CopySample::copyParameters(), Mantid::DataHandling::LoadSampleShape::exec(), export_Sample(), Mantid::DataHandling::SetSample::setSampleShape(), and Mantid::DataHandling::CreateSampleShape::setSampleShape().
| void Mantid::API::Sample::setThickness | ( | double | thick | ) |
Sets the thickness.
Set the thickness value.
| thick | :: The parameter e_thick in the SPB_STRUCT |
Definition at line 221 of file Sample.cpp.
References m_thick.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), and Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry().
| void Mantid::API::Sample::setWidth | ( | double | width | ) |
Sets the width.
Set the width value.
| width | :: The parameter e_width in the SPB_STRUCT |
Definition at line 245 of file Sample.cpp.
References m_width.
Referenced by Mantid::Algorithms::CopySample::copyParameters(), export_Sample(), and Mantid::DataHandling::LoadISISNexusHelper::loadSampleGeometry().
| std::size_t Mantid::API::Sample::size | ( | ) | const |
the number of samples
Gets the number of samples in this collection.
Definition at line 272 of file Sample.cpp.
References m_samples.
Referenced by export_Sample().
|
private |
CrystalStructure of the sample.
Definition at line 136 of file Sample.h.
Referenced by clearCrystalStructure(), getCrystalStructure(), hasCrystalStructure(), operator=(), operator==(), Sample(), and setCrystalStructure().
|
private |
An owned pointer to the SampleEnvironment object.
Definition at line 131 of file Sample.h.
Referenced by getEnvironment(), hasEnvironment(), operator=(), operator==(), and setEnvironment().
|
private |
The sample geometry flag.
Definition at line 142 of file Sample.h.
Referenced by getGeometryFlag(), loadNexus(), operator=(), operator==(), saveNexus(), and setGeometryFlag().
|
private |
The sample height from the SPB_STRUCT in the raw file.
Definition at line 146 of file Sample.h.
Referenced by getHeight(), loadNexus(), operator=(), operator==(), saveNexus(), and setHeight().
|
private |
Pointer to the OrientedLattice of the sample, NULL if not set.
Definition at line 133 of file Sample.h.
Referenced by clearOrientedLattice(), getOrientedLattice(), getOrientedLattice(), hasOrientedLattice(), loadNexus(), operator=(), operator==(), Sample(), saveNexus(), and setOrientedLattice().
|
private |
The sample name.
Definition at line 127 of file Sample.h.
Referenced by getName(), loadNexus(), operator=(), operator==(), saveNexus(), and setName().
|
private |
Vector of child samples.
Definition at line 139 of file Sample.h.
Referenced by addSample(), operator=(), operator==(), operator[](), saveNexus(), and size().
|
private |
The sample shape object.
Definition at line 129 of file Sample.h.
Referenced by getMaterial(), getShape(), getShapePtr(), hasShape(), loadNexus(), operator=(), operator==(), saveNexus(), and setShape().
|
private |
The sample thickness from the SPB_STRUCT in the raw file.
Definition at line 144 of file Sample.h.
Referenced by getThickness(), loadNexus(), operator=(), operator==(), saveNexus(), and setThickness().
|
private |
The sample width from the SPB_STRUCT in the raw file.
Definition at line 148 of file Sample.h.
Referenced by getWidth(), loadNexus(), operator=(), operator==(), saveNexus(), and setWidth().