Mantid
|
A minimal class to hold the mapping between the spectrum number and its related detector ID numbers for a dataset. More...
#include <SpectrumDetectorMapping.h>
Public Member Functions | |
const std::set< detid_t > & | getDetectorIDsForSpectrumIndex (const size_t spectrumIndex) const |
const std::set< detid_t > & | getDetectorIDsForSpectrumNo (const specnum_t spectrumNo) const |
const sdmap & | getMapping () const |
std::set< specnum_t > | getSpectrumNumbers () const |
bool | indexIsSpecNumber () const |
SpectrumDetectorMapping () | |
Default constructor;. More... | |
SpectrumDetectorMapping (const MatrixWorkspace_const_sptr &workspace, const bool useSpecNoIndex=true) | |
Constructor that fills the map from the spectrum-detector relationships in the given workspace. More... | |
SpectrumDetectorMapping (const specnum_t *const spectrumNumbers, const detid_t *const detectorIDs, size_t arrayLengths) | |
Constructor that fills the map from a pair c-style arrays. More... | |
SpectrumDetectorMapping (const std::vector< specnum_t > &spectrumNumbers, const std::vector< detid_t > &detectorIDs, const std::vector< detid_t > &ignoreDetIDs=std::vector< detid_t >()) | |
Constructor that fills the map from a pair of vectors, ignoring the IDs in the optional ignore list. More... | |
virtual | ~SpectrumDetectorMapping ()=default |
Private Types | |
using | sdmap = std::unordered_map< specnum_t, std::set< detid_t > > |
Private Member Functions | |
void | fillMapFromArray (const specnum_t *const spectrumNumbers, const detid_t *const detectorIDs, const size_t arrayLengths) |
Called by the c-array constructors to do the actual filling. More... | |
void | fillMapFromVector (const std::vector< specnum_t > &spectrumNumbers, const std::vector< detid_t > &detectorIDs, const std::vector< detid_t > &ignoreDetIDs) |
Called by the vector constructors to do the actual filling. More... | |
Private Attributes | |
bool | m_indexIsSpecNo |
sdmap | m_mapping |
The mapping of a spectrum number to zero or more detector IDs. More... | |
A minimal class to hold the mapping between the spectrum number and its related detector ID numbers for a dataset.
Normally, this mapping is contained within the collection of ISpectrum objects held by the workspace. This class can be useful when you want to pass just this information and not the entire workspace, or you want to store some mapping that related to spectra that are not yet, or no longer, contained in the workspace.
Definition at line 30 of file SpectrumDetectorMapping.h.
|
private |
Definition at line 31 of file SpectrumDetectorMapping.h.
|
explicit |
Constructor that fills the map from the spectrum-detector relationships in the given workspace.
std::invalid_argument | if a null workspace pointer is passed in |
Definition at line 16 of file SpectrumDetectorMapping.cpp.
References index, m_indexIsSpecNo, m_mapping, and workspace.
Mantid::API::SpectrumDetectorMapping::SpectrumDetectorMapping | ( | const std::vector< specnum_t > & | spectrumNumbers, |
const std::vector< detid_t > & | detectorIDs, | ||
const std::vector< detid_t > & | ignoreDetIDs = std::vector<detid_t>() |
||
) |
Constructor that fills the map from a pair of vectors, ignoring the IDs in the optional ignore list.
std::invalid_argument | if the spectrumNumbers & detectorIDs vectors are not of equal length |
Definition at line 40 of file SpectrumDetectorMapping.cpp.
References fillMapFromVector().
Mantid::API::SpectrumDetectorMapping::SpectrumDetectorMapping | ( | const specnum_t *const | spectrumNumbers, |
const detid_t *const | detectorIDs, | ||
size_t | arrayLengths | ||
) |
Constructor that fills the map from a pair c-style arrays.
Not safe! Prefer the vector constructor where possible!
std::invalid_argument | if a null array pointer is passed in |
Definition at line 56 of file SpectrumDetectorMapping.cpp.
References fillMapFromArray().
Mantid::API::SpectrumDetectorMapping::SpectrumDetectorMapping | ( | ) |
Default constructor;.
Definition at line 87 of file SpectrumDetectorMapping.cpp.
|
virtualdefault |
|
private |
Called by the c-array constructors to do the actual filling.
Definition at line 67 of file SpectrumDetectorMapping.cpp.
References m_mapping.
Referenced by SpectrumDetectorMapping().
|
private |
Called by the vector constructors to do the actual filling.
Definition at line 75 of file SpectrumDetectorMapping.cpp.
References m_mapping.
Referenced by SpectrumDetectorMapping().
const std::set< detid_t > & Mantid::API::SpectrumDetectorMapping::getDetectorIDsForSpectrumIndex | ( | const size_t | spectrumIndex | ) | const |
Definition at line 105 of file SpectrumDetectorMapping.cpp.
References m_indexIsSpecNo, and m_mapping.
Referenced by Mantid::API::MatrixWorkspace::updateSpectraUsing().
const std::set< detid_t > & Mantid::API::SpectrumDetectorMapping::getDetectorIDsForSpectrumNo | ( | const specnum_t | spectrumNo | ) | const |
Definition at line 99 of file SpectrumDetectorMapping.cpp.
References m_indexIsSpecNo, and m_mapping.
Referenced by Mantid::DataHandling::LoadISISNexus2::loadBlock(), Mantid::DataHandling::LoadISISNexus2::loadPeriodData(), Mantid::DataHandling::LoadEventNexusIndexSetup::makeIndexInfo(), and Mantid::API::MatrixWorkspace::updateSpectraUsing().
const SpectrumDetectorMapping::sdmap & Mantid::API::SpectrumDetectorMapping::getMapping | ( | ) | const |
Definition at line 111 of file SpectrumDetectorMapping.cpp.
References m_mapping.
Referenced by Mantid::DataHandling::LoadRawHelper::getmonitorSpectrumList().
std::set< specnum_t > Mantid::API::SpectrumDetectorMapping::getSpectrumNumbers | ( | ) | const |
Definition at line 90 of file SpectrumDetectorMapping.cpp.
References m_mapping.
Referenced by Mantid::DataHandling::LoadEventNexusIndexSetup::makeIndexInfo().
bool Mantid::API::SpectrumDetectorMapping::indexIsSpecNumber | ( | ) | const |
Definition at line 113 of file SpectrumDetectorMapping.cpp.
References m_indexIsSpecNo.
Referenced by Mantid::API::MatrixWorkspace::updateSpectraUsing().
|
private |
Definition at line 54 of file SpectrumDetectorMapping.h.
Referenced by getDetectorIDsForSpectrumIndex(), getDetectorIDsForSpectrumNo(), indexIsSpecNumber(), and SpectrumDetectorMapping().
|
private |
The mapping of a spectrum number to zero or more detector IDs.
Definition at line 56 of file SpectrumDetectorMapping.h.
Referenced by fillMapFromArray(), fillMapFromVector(), getDetectorIDsForSpectrumIndex(), getDetectorIDsForSpectrumNo(), getMapping(), getSpectrumNumbers(), and SpectrumDetectorMapping().