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

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

Detailed Description

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.

Member Enumeration Documentation

◆ IndexingType

Enumerator
Default 
TimeOriented 
DetectorOriented 

Definition at line 41 of file ScanningWorkspaceBuilder.h.

Constructor & Destructor Documentation

◆ ScanningWorkspaceBuilder()

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.

Parameters
instrumentA pointer to the base instrument for the workspace
nTimeIndexesThe number of time indexes to create
nBinsThe number of bins (or points) for each spectrum
isPointDataIf true will use points for the x-axis instead of bins

Definition at line 35 of file ScanningWorkspaceBuilder.cpp.

References m_histogram.

Member Function Documentation

◆ buildOutputComponentInfo()

void Mantid::DataObjects::ScanningWorkspaceBuilder::buildOutputComponentInfo ( Geometry::ComponentInfo outputComponentInfo) const
private

◆ buildPositions()

void Mantid::DataObjects::ScanningWorkspaceBuilder::buildPositions ( Geometry::DetectorInfo outputDetectorInfo) const
private

◆ buildRelativeRotationsForScans()

void Mantid::DataObjects::ScanningWorkspaceBuilder::buildRelativeRotationsForScans ( Geometry::DetectorInfo outputDetectorInfo) const
private

◆ buildRotations()

void Mantid::DataObjects::ScanningWorkspaceBuilder::buildRotations ( Geometry::DetectorInfo outputDetectorInfo) const
private

◆ buildWorkspace()

MatrixWorkspace_sptr Mantid::DataObjects::ScanningWorkspaceBuilder::buildWorkspace ( ) const

◆ createDetectorOrientedIndexInfo()

void Mantid::DataObjects::ScanningWorkspaceBuilder::createDetectorOrientedIndexInfo ( API::MatrixWorkspace ws) const
private

◆ createTimeOrientedIndexInfo()

void Mantid::DataObjects::ScanningWorkspaceBuilder::createTimeOrientedIndexInfo ( API::MatrixWorkspace ws) const
private

◆ setHistogram()

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.

Parameters
histogramA histogram with bin edges defined

Definition at line 52 of file ScanningWorkspaceBuilder.cpp.

References m_histogram, and m_nBins.

◆ setIndexingType()

void Mantid::DataObjects::ScanningWorkspaceBuilder::setIndexingType ( const IndexingType  indexingType)

Set the indexing type, either to time or detector oriented indexing.

Parameters
indexingTypeAn index type enum

Definition at line 171 of file ScanningWorkspaceBuilder.cpp.

References Default, and m_indexingType.

◆ setPositions()

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.

Parameters
positionsA vector of vectors containing positions

Definition at line 101 of file ScanningWorkspaceBuilder.cpp.

References m_instrumentAngles, m_positions, verifyDetectorSize(), and verifyTimeIndexSize().

◆ setRelativeRotationsForScans()

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.

Parameters
relativeRotationsa vector of angles, the size matching the number of time indexes
rotationPositionthe position to rotate around, e.g. the sample position
rotationAxisthe 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().

◆ setRotations()

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.

Parameters
rotationsA vector of vectors containing rotations

Definition at line 122 of file ScanningWorkspaceBuilder.cpp.

References m_instrumentAngles, m_rotations, verifyDetectorSize(), and verifyTimeIndexSize().

◆ setTimeRanges() [1/2]

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.

Parameters
startTimeA DateAndTime object corresponding to the start of the first scan
durationsA vector of doubles containing the duration in seconds

Definition at line 78 of file ScanningWorkspaceBuilder.cpp.

References m_nTimeIndexes, setTimeRanges(), and verifyTimeIndexSize().

◆ setTimeRanges() [2/2]

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.

Parameters
timeRangesA 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().

◆ validateInputs()

void Mantid::DataObjects::ScanningWorkspaceBuilder::validateInputs ( ) const
private

Definition at line 301 of file ScanningWorkspaceBuilder.cpp.

References m_timeRanges.

Referenced by buildWorkspace().

◆ verifyDetectorSize()

void Mantid::DataObjects::ScanningWorkspaceBuilder::verifyDetectorSize ( const size_t  detectorSize,
const std::string &  description 
) const
private

Definition at line 295 of file ScanningWorkspaceBuilder.cpp.

References m_nDetectors.

Referenced by setPositions(), and setRotations().

◆ verifyTimeIndexSize()

void Mantid::DataObjects::ScanningWorkspaceBuilder::verifyTimeIndexSize ( const size_t  timeIndexSize,
const std::string &  description 
) const
private

Member Data Documentation

◆ m_histogram

HistogramData::Histogram Mantid::DataObjects::ScanningWorkspaceBuilder::m_histogram
private

◆ m_indexingType

IndexingType Mantid::DataObjects::ScanningWorkspaceBuilder::m_indexingType
private

Definition at line 76 of file ScanningWorkspaceBuilder.h.

Referenced by buildWorkspace(), and setIndexingType().

◆ m_instrument

std::shared_ptr<const Geometry::Instrument> Mantid::DataObjects::ScanningWorkspaceBuilder::m_instrument
private

Definition at line 64 of file ScanningWorkspaceBuilder.h.

Referenced by buildOutputComponentInfo(), and buildWorkspace().

◆ m_instrumentAngles

std::vector<double> Mantid::DataObjects::ScanningWorkspaceBuilder::m_instrumentAngles
private

◆ m_nBins

size_t Mantid::DataObjects::ScanningWorkspaceBuilder::m_nBins
private

Definition at line 62 of file ScanningWorkspaceBuilder.h.

Referenced by setHistogram().

◆ m_nDetectors

size_t Mantid::DataObjects::ScanningWorkspaceBuilder::m_nDetectors
private

◆ m_nTimeIndexes

size_t Mantid::DataObjects::ScanningWorkspaceBuilder::m_nTimeIndexes
private

◆ m_positions

std::vector<std::vector<Kernel::V3D> > Mantid::DataObjects::ScanningWorkspaceBuilder::m_positions
private

◆ m_rotationAxis

Kernel::V3D Mantid::DataObjects::ScanningWorkspaceBuilder::m_rotationAxis
private

◆ m_rotationPosition

Kernel::V3D Mantid::DataObjects::ScanningWorkspaceBuilder::m_rotationPosition
private

◆ m_rotations

std::vector<std::vector<Kernel::Quat> > Mantid::DataObjects::ScanningWorkspaceBuilder::m_rotations
private

◆ m_timeRanges

std::vector<std::pair<Types::Core::DateAndTime, Types::Core::DateAndTime> > Mantid::DataObjects::ScanningWorkspaceBuilder::m_timeRanges
private

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