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. More... | |
const std::string & | getName () const |
Returns the name of the sample. More... | |
const Geometry::IObject & | getShape () const |
Return the sample shape. More... | |
const Geometry::IObject_sptr | getShapePtr () const |
Return a pointer to the sample shape. More... | |
bool | hasShape () const |
Check if sample has a valid shape. More... | |
int | loadNexus (::NeXus::File *file, const std::string &group) |
Load the object from an open NeXus file. More... | |
Sample & | operator= (const Sample &rhs) |
Assignment operator. More... | |
Sample & | operator[] (const int index) |
index operator for accessing multiple samples More... | |
Sample () | |
Default constructor. More... | |
Sample (const Sample ©) | |
Copy constructor. More... | |
void | saveNexus (::NeXus::File *file, const std::string &group) const |
Save the object to an open NeXus file. More... | |
void | setName (const std::string &name) |
Set the name of the sample. More... | |
void | setShape (const Geometry::IObject_sptr &shape) |
Update the shape of the object. More... | |
std::size_t | size () const |
the number of samples More... | |
~Sample () | |
Destructor. More... | |
Material properties. | |
const Kernel::Material & | getMaterial () const |
Return the material (convenience method) More... | |
Access the environment information | |
bool | hasEnvironment () const |
const Geometry::SampleEnvironment & | getEnvironment () const |
Get a reference to the sample's environment. More... | |
void | setEnvironment (std::shared_ptr< Geometry::SampleEnvironment > env) |
Set the environment used to contain the sample. More... | |
Access the sample's lattice structure and orientation | |
const Geometry::OrientedLattice & | getOrientedLattice () const |
Get a reference to the sample's OrientedLattice. More... | |
Geometry::OrientedLattice & | getOrientedLattice () |
Get a reference to the sample's OrientedLattice. More... | |
void | setOrientedLattice (std::unique_ptr< Geometry::OrientedLattice > lattice) |
Set the pointer to OrientedLattice defining the sample's lattice and orientation. More... | |
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). More... | |
bool | hasCrystalStructure () const |
Returns true if the sample actually holds a CrystalStructure. More... | |
void | clearCrystalStructure () |
Destroys the internally stored CrystalStructure-object. More... | |
Legacy functions | |
std::string | m_name |
The sample name. More... | |
Geometry::IObject_sptr | m_shape |
The sample shape object. More... | |
std::shared_ptr< Geometry::SampleEnvironment > | m_environment |
An owned pointer to the SampleEnvironment object. More... | |
std::unique_ptr< Geometry::OrientedLattice > | m_lattice |
Pointer to the OrientedLattice of the sample, NULL if not set. More... | |
std::unique_ptr< Geometry::CrystalStructure > | m_crystalStructure |
CrystalStructure of the sample. More... | |
std::vector< std::shared_ptr< Sample > > | m_samples |
Vector of child samples. More... | |
int | m_geom_id |
The sample geometry flag. More... | |
double | m_thick |
The sample thickness from the SPB_STRUCT in the raw file. More... | |
double | m_height |
The sample height from the SPB_STRUCT in the raw file. More... | |
double | m_width |
The sample width from the SPB_STRUCT in the raw file. More... | |
void | setGeometryFlag (int geom_id) |
Sets the geometry flag. More... | |
int | getGeometryFlag () const |
Returns the geometry flag. More... | |
void | setThickness (double thick) |
Sets the thickness. More... | |
double | getThickness () const |
Returns the thickness. More... | |
void | setHeight (double height) |
Sets the height. More... | |
double | getHeight () const |
Returns the height. More... | |
void | setWidth (double width) |
Sets the width. More... | |
double | getWidth () const |
Returns the width. More... | |
void | clearOrientedLattice () |
Delete the oriented lattice. More... | |
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 38 of file Sample.cpp.
References getCrystalStructure(), getOrientedLattice(), hasCrystalStructure(), m_crystalStructure, and m_lattice.
|
default |
Destructor.
References std::operator!=(), and std::operator==().
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 279 of file Sample.cpp.
References m_samples.
Referenced by loadNexus().
void Mantid::API::Sample::clearCrystalStructure | ( | ) |
Destroys the internally stored CrystalStructure-object.
Definition at line 202 of file Sample.cpp.
References m_crystalStructure.
Referenced by export_Sample().
void Mantid::API::Sample::clearOrientedLattice | ( | ) |
Delete the oriented lattice.
Definition at line 408 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 181 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 136 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::Algorithms::MCInteractionVolume::MCInteractionVolume(), 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 216 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 240 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 127 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 86 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 165 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 154 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 102 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 export_Sample().
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 110 of file Sample.cpp.
References m_shape.
double Mantid::API::Sample::getThickness | ( | ) | const |
Returns the thickness.
Get the thickness value.
Definition at line 228 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 252 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 195 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 129 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 179 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 94 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 327 of file Sample.cpp.
References addSample(), Mantid::Geometry::ShapeFactory::createShape(), 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().
bool Mantid::API::Sample::operator!= | ( | const Sample & | other | ) | const |
Definition at line 437 of file Sample.cpp.
References operator==().
Assignment operator.
rhs | :: const reference to the sample object |
Definition at line 58 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 414 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 259 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 286 of file Sample.cpp.
References 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(), 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 190 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 148 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 209 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 234 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 92 of file Sample.cpp.
References m_name.
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 176 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 116 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 222 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 246 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 273 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(), 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().