Mantid
|
ScanningWorkspaceBuilder : This is a helper class to make it easy to build a scanning workspace (a workspace with moving detectors), where all the information about the scan is known in advance. More...
#include <ScanningWorkspaceBuilder.h>
Public Types | |
enum class | IndexingType { Default , TimeOriented , DetectorOriented } |
Public Member Functions | |
API::MatrixWorkspace_sptr | buildWorkspace () const |
Verify everything has been set that is required and return the workspace. More... | |
ScanningWorkspaceBuilder (const std::shared_ptr< const Geometry::Instrument > &instrument, const size_t nTimeIndexes, const size_t nBins, const bool isPointData=false) | |
Create the scanning workspace builder. More... | |
void | setHistogram (HistogramData::Histogram histogram) |
Set a histogram to be used for all the workspace spectra. More... | |
void | setIndexingType (const IndexingType indexingType) |
Set the indexing type, either to time or detector oriented indexing. More... | |
void | setPositions (std::vector< std::vector< Kernel::V3D > > positions) |
Supply a vector of vectors which contain positions. More... | |
void | setRelativeRotationsForScans (const std::vector< double > &relativeRotations, const Kernel::V3D &rotationPosition, const Kernel::V3D &rotationAxis) |
Set a vector of rotations corresponding to each time index. More... | |
void | setRotations (std::vector< std::vector< Kernel::Quat > > rotations) |
Supply a vector of vectors which contain rotations. More... | |
void | setTimeRanges (const Types::Core::DateAndTime &startTime, const std::vector< double > &durations) |
Set time ranges from a start time and a vector of durations. More... | |
void | setTimeRanges (std::vector< std::pair< Types::Core::DateAndTime, Types::Core::DateAndTime > > timeRanges) |
Set time ranges from a vector of start time, end time pairs. More... | |
Private Member Functions | |
void | buildOutputComponentInfo (Geometry::ComponentInfo &outputComponentInfo) const |
void | buildPositions (Geometry::DetectorInfo &outputDetectorInfo) const |
void | buildRelativeRotationsForScans (Geometry::DetectorInfo &outputDetectorInfo) const |
void | buildRotations (Geometry::DetectorInfo &outputDetectorInfo) const |
void | createDetectorOrientedIndexInfo (API::MatrixWorkspace &ws) const |
void | createTimeOrientedIndexInfo (API::MatrixWorkspace &ws) const |
void | validateInputs () const |
void | verifyDetectorSize (const size_t detectorSize, const std::string &description) const |
void | verifyTimeIndexSize (const size_t timeIndexSize, const std::string &description) const |
Private Attributes | |
HistogramData::Histogram | m_histogram |
IndexingType | m_indexingType |
std::shared_ptr< const Geometry::Instrument > | m_instrument |
std::vector< double > | m_instrumentAngles |
size_t | m_nBins |
size_t | m_nDetectors |
size_t | m_nTimeIndexes |
std::vector< std::vector< Kernel::V3D > > | m_positions |
Kernel::V3D | m_rotationAxis |
Kernel::V3D | m_rotationPosition |
std::vector< std::vector< Kernel::Quat > > | m_rotations |
std::vector< std::pair< Types::Core::DateAndTime, Types::Core::DateAndTime > > | m_timeRanges |
ScanningWorkspaceBuilder : This is a helper class to make it easy to build a scanning workspace (a workspace with moving detectors), where all the information about the scan is known in advance.
The constructor takes the arguments for the basic construction, then checks are made for consistency as other information about the scanning workspace is set.
Things that must be set for successful building:
Some helper methods exist for specific cases, such as the whole instrument rotating around the sample.
One current limitation to note here, that is not a general restriction within Mantid, is that every detector must have the same set of time indexes.
Definition at line 39 of file ScanningWorkspaceBuilder.h.
|
strong |
Enumerator | |
---|---|
Default | |
TimeOriented | |
DetectorOriented |
Definition at line 41 of file ScanningWorkspaceBuilder.h.
Mantid::DataObjects::ScanningWorkspaceBuilder::ScanningWorkspaceBuilder | ( | const std::shared_ptr< const Geometry::Instrument > & | instrument, |
const size_t | nTimeIndexes, | ||
const size_t | nBins, | ||
const bool | isPointData = false |
||
) |
Create the scanning workspace builder.
Time ranges must still be set before this can be used.
instrument | A pointer to the base instrument for the workspace |
nTimeIndexes | The number of time indexes to create |
nBins | The number of bins (or points) for each spectrum |
isPointData | If true will use points for the x-axis instead of bins |
Definition at line 35 of file ScanningWorkspaceBuilder.cpp.
References m_histogram.
|
private |
Definition at line 219 of file ScanningWorkspaceBuilder.cpp.
References m_histogram, m_instrument, m_nDetectors, m_nTimeIndexes, m_timeRanges, and Mantid::Geometry::ComponentInfo::merge().
Referenced by buildWorkspace().
|
private |
Definition at line 236 of file ScanningWorkspaceBuilder.cpp.
References m_nDetectors, m_nTimeIndexes, m_positions, and Mantid::Geometry::DetectorInfo::setPosition().
Referenced by buildWorkspace().
|
private |
Definition at line 244 of file ScanningWorkspaceBuilder.cpp.
References Mantid::Geometry::DetectorInfo::isMonitor(), m_instrumentAngles, m_rotationAxis, m_rotationPosition, position, Mantid::Geometry::DetectorInfo::position(), Mantid::Kernel::Quat::rotate(), Mantid::Geometry::DetectorInfo::rotation(), rotation, Mantid::Geometry::DetectorInfo::scanCount(), Mantid::Geometry::DetectorInfo::setPosition(), Mantid::Geometry::DetectorInfo::setRotation(), and Mantid::Geometry::DetectorInfo::size().
Referenced by buildWorkspace().
|
private |
Definition at line 228 of file ScanningWorkspaceBuilder.cpp.
References m_nDetectors, m_nTimeIndexes, m_rotations, and Mantid::Geometry::DetectorInfo::setRotation().
Referenced by buildWorkspace().
MatrixWorkspace_sptr Mantid::DataObjects::ScanningWorkspaceBuilder::buildWorkspace | ( | ) | const |
Verify everything has been set that is required and return the workspace.
Definition at line 183 of file ScanningWorkspaceBuilder.cpp.
References buildOutputComponentInfo(), buildPositions(), buildRelativeRotationsForScans(), buildRotations(), createDetectorOrientedIndexInfo(), createTimeOrientedIndexInfo(), Default, DetectorOriented, m_histogram, m_indexingType, m_instrument, m_instrumentAngles, m_nDetectors, m_nTimeIndexes, m_positions, m_rotations, m_timeRanges, TimeOriented, and validateInputs().
|
private |
Definition at line 275 of file ScanningWorkspaceBuilder.cpp.
References Mantid::API::MatrixWorkspace::indexInfo(), m_nDetectors, m_nTimeIndexes, and Mantid::API::MatrixWorkspace::setIndexInfo().
Referenced by buildWorkspace().
|
private |
Definition at line 261 of file ScanningWorkspaceBuilder.cpp.
References Mantid::API::MatrixWorkspace::indexInfo(), m_nDetectors, m_nTimeIndexes, and Mantid::API::MatrixWorkspace::setIndexInfo().
Referenced by buildWorkspace().
void Mantid::DataObjects::ScanningWorkspaceBuilder::setHistogram | ( | HistogramData::Histogram | histogram | ) |
Set a histogram to be used for all the workspace spectra.
This can be used to set the correct bin edges, but only if the binning is identical for every spectra.
histogram | A histogram with bin edges defined |
Definition at line 52 of file ScanningWorkspaceBuilder.cpp.
References m_histogram, and m_nBins.
void Mantid::DataObjects::ScanningWorkspaceBuilder::setIndexingType | ( | const IndexingType | indexingType | ) |
Set the indexing type, either to time or detector oriented indexing.
indexingType | An index type enum |
Definition at line 171 of file ScanningWorkspaceBuilder.cpp.
References Default, and m_indexingType.
void Mantid::DataObjects::ScanningWorkspaceBuilder::setPositions | ( | std::vector< std::vector< Kernel::V3D > > | positions | ) |
Supply a vector of vectors which contain positions.
The inner vectors should contain the position for each time index, the outer vector the vector for each detector.
positions | A vector of vectors containing positions |
Definition at line 101 of file ScanningWorkspaceBuilder.cpp.
References m_instrumentAngles, m_positions, verifyDetectorSize(), and verifyTimeIndexSize().
void Mantid::DataObjects::ScanningWorkspaceBuilder::setRelativeRotationsForScans | ( | const std::vector< double > & | relativeRotations, |
const Kernel::V3D & | rotationPosition, | ||
const Kernel::V3D & | rotationAxis | ||
) |
Set a vector of rotations corresponding to each time index.
These angles rotate the detector banks around the source, setting the corresponding positions and rotations of the detectors.
Here explicit assumptions are made - that the source is at (0, 0, 0), and the rotation is in the X-Z plane. This corresponds to the common case of moving detectors to increase angular coverage.
relativeRotations | a vector of angles, the size matching the number of time indexes |
rotationPosition | the position to rotate around, e.g. the sample position |
rotationAxis | the axis to rotate around. e.g. the vertical axis to rotate the instrument in the horizontal plane |
Definition at line 152 of file ScanningWorkspaceBuilder.cpp.
References m_instrumentAngles, m_positions, m_rotationAxis, m_rotationPosition, m_rotations, and verifyTimeIndexSize().
void Mantid::DataObjects::ScanningWorkspaceBuilder::setRotations | ( | std::vector< std::vector< Kernel::Quat > > | rotations | ) |
Supply a vector of vectors which contain rotations.
The inner vectors should contain the rotation for each time index, the outer vector the vector for each detector.
rotations | A vector of vectors containing rotations |
Definition at line 122 of file ScanningWorkspaceBuilder.cpp.
References m_instrumentAngles, m_rotations, verifyDetectorSize(), and verifyTimeIndexSize().
void Mantid::DataObjects::ScanningWorkspaceBuilder::setTimeRanges | ( | const Types::Core::DateAndTime & | startTime, |
const std::vector< double > & | durations | ||
) |
Set time ranges from a start time and a vector of durations.
startTime | A DateAndTime object corresponding to the start of the first scan |
durations | A vector of doubles containing the duration in seconds |
Definition at line 78 of file ScanningWorkspaceBuilder.cpp.
References m_nTimeIndexes, setTimeRanges(), and verifyTimeIndexSize().
void Mantid::DataObjects::ScanningWorkspaceBuilder::setTimeRanges | ( | std::vector< std::pair< Types::Core::DateAndTime, Types::Core::DateAndTime > > | timeRanges | ) |
Set time ranges from a vector of start time, end time pairs.
timeRanges | A vector of DateAndTime pairs, corresponding to the start and end times |
Definition at line 65 of file ScanningWorkspaceBuilder.cpp.
References m_timeRanges, and verifyTimeIndexSize().
Referenced by setTimeRanges().
|
private |
Definition at line 301 of file ScanningWorkspaceBuilder.cpp.
References m_timeRanges.
Referenced by buildWorkspace().
|
private |
Definition at line 295 of file ScanningWorkspaceBuilder.cpp.
References m_nDetectors.
Referenced by setPositions(), and setRotations().
|
private |
Definition at line 289 of file ScanningWorkspaceBuilder.cpp.
References m_nTimeIndexes.
Referenced by setPositions(), setRelativeRotationsForScans(), setRotations(), and setTimeRanges().
|
private |
Definition at line 66 of file ScanningWorkspaceBuilder.h.
Referenced by buildOutputComponentInfo(), buildWorkspace(), ScanningWorkspaceBuilder(), and setHistogram().
|
private |
Definition at line 76 of file ScanningWorkspaceBuilder.h.
Referenced by buildWorkspace(), and setIndexingType().
|
private |
Definition at line 64 of file ScanningWorkspaceBuilder.h.
Referenced by buildOutputComponentInfo(), and buildWorkspace().
|
private |
Definition at line 72 of file ScanningWorkspaceBuilder.h.
Referenced by buildRelativeRotationsForScans(), buildWorkspace(), setPositions(), setRelativeRotationsForScans(), and setRotations().
|
private |
Definition at line 62 of file ScanningWorkspaceBuilder.h.
Referenced by setHistogram().
|
private |
Definition at line 60 of file ScanningWorkspaceBuilder.h.
Referenced by buildOutputComponentInfo(), buildPositions(), buildRotations(), buildWorkspace(), createDetectorOrientedIndexInfo(), createTimeOrientedIndexInfo(), and verifyDetectorSize().
|
private |
Definition at line 61 of file ScanningWorkspaceBuilder.h.
Referenced by buildOutputComponentInfo(), buildPositions(), buildRotations(), buildWorkspace(), createDetectorOrientedIndexInfo(), createTimeOrientedIndexInfo(), setTimeRanges(), and verifyTimeIndexSize().
|
private |
Definition at line 69 of file ScanningWorkspaceBuilder.h.
Referenced by buildPositions(), buildWorkspace(), setPositions(), and setRelativeRotationsForScans().
|
private |
Definition at line 73 of file ScanningWorkspaceBuilder.h.
Referenced by buildRelativeRotationsForScans(), and setRelativeRotationsForScans().
|
private |
Definition at line 74 of file ScanningWorkspaceBuilder.h.
Referenced by buildRelativeRotationsForScans(), and setRelativeRotationsForScans().
|
private |
Definition at line 70 of file ScanningWorkspaceBuilder.h.
Referenced by buildRotations(), buildWorkspace(), setRelativeRotationsForScans(), and setRotations().
|
private |
Definition at line 68 of file ScanningWorkspaceBuilder.h.
Referenced by buildOutputComponentInfo(), buildWorkspace(), setTimeRanges(), and validateInputs().