Commit 61755a3d authored by Simon Heybrock's avatar Simon Heybrock
Browse files

Re #16454. getSpectrum as reference.

parent 8fe3898d
...@@ -173,68 +173,68 @@ public: ...@@ -173,68 +173,68 @@ public:
//---------------------------------------------------------------------- //----------------------------------------------------------------------
/// Return the underlying ISpectrum ptr at the given workspace index. /// Return the underlying ISpectrum ptr at the given workspace index.
virtual ISpectrum *getSpectrum(const size_t index) = 0; virtual ISpectrum &getSpectrum(const size_t index) = 0;
/// Return the underlying ISpectrum ptr (const version) at the given workspace /// Return the underlying ISpectrum ptr (const version) at the given workspace
/// index. /// index.
virtual const ISpectrum *getSpectrum(const size_t index) const = 0; virtual const ISpectrum &getSpectrum(const size_t index) const = 0;
// Methods for getting read-only access to the data. // Methods for getting read-only access to the data.
// Just passes through to the virtual dataX/Y/E function (const version) // Just passes through to the virtual dataX/Y/E function (const version)
/// Returns a read-only (i.e. const) reference to the specified X array /// Returns a read-only (i.e. const) reference to the specified X array
/// @param index :: workspace index to retrieve. /// @param index :: workspace index to retrieve.
const MantidVec &readX(std::size_t const index) const { const MantidVec &readX(std::size_t const index) const {
return getSpectrum(index)->dataX(); return getSpectrum(index).dataX();
} }
/// Returns a read-only (i.e. const) reference to the specified Y array /// Returns a read-only (i.e. const) reference to the specified Y array
/// @param index :: workspace index to retrieve. /// @param index :: workspace index to retrieve.
const MantidVec &readY(std::size_t const index) const { const MantidVec &readY(std::size_t const index) const {
return getSpectrum(index)->dataY(); return getSpectrum(index).dataY();
} }
/// Returns a read-only (i.e. const) reference to the specified E array /// Returns a read-only (i.e. const) reference to the specified E array
/// @param index :: workspace index to retrieve. /// @param index :: workspace index to retrieve.
const MantidVec &readE(std::size_t const index) const { const MantidVec &readE(std::size_t const index) const {
return getSpectrum(index)->dataE(); return getSpectrum(index).dataE();
} }
/// Returns a read-only (i.e. const) reference to the specified X error array /// Returns a read-only (i.e. const) reference to the specified X error array
/// @param index :: workspace index to retrieve. /// @param index :: workspace index to retrieve.
const MantidVec &readDx(size_t const index) const { const MantidVec &readDx(size_t const index) const {
return getSpectrum(index)->dataDx(); return getSpectrum(index).dataDx();
} }
/// Returns the x data /// Returns the x data
virtual MantidVec &dataX(const std::size_t index) { virtual MantidVec &dataX(const std::size_t index) {
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
return getSpectrum(index)->dataX(); return getSpectrum(index).dataX();
} }
/// Returns the y data /// Returns the y data
virtual MantidVec &dataY(const std::size_t index) { virtual MantidVec &dataY(const std::size_t index) {
return getSpectrum(index)->dataY(); return getSpectrum(index).dataY();
} }
/// Returns the error data /// Returns the error data
virtual MantidVec &dataE(const std::size_t index) { virtual MantidVec &dataE(const std::size_t index) {
return getSpectrum(index)->dataE(); return getSpectrum(index).dataE();
} }
/// Returns the x error data /// Returns the x error data
virtual MantidVec &dataDx(const std::size_t index) { virtual MantidVec &dataDx(const std::size_t index) {
return getSpectrum(index)->dataDx(); return getSpectrum(index).dataDx();
} }
/// Returns the x data const /// Returns the x data const
virtual const MantidVec &dataX(const std::size_t index) const { virtual const MantidVec &dataX(const std::size_t index) const {
return getSpectrum(index)->dataX(); return getSpectrum(index).dataX();
} }
/// Returns the y data const /// Returns the y data const
virtual const MantidVec &dataY(const std::size_t index) const { virtual const MantidVec &dataY(const std::size_t index) const {
return getSpectrum(index)->dataY(); return getSpectrum(index).dataY();
} }
/// Returns the error const /// Returns the error const
virtual const MantidVec &dataE(const std::size_t index) const { virtual const MantidVec &dataE(const std::size_t index) const {
return getSpectrum(index)->dataE(); return getSpectrum(index).dataE();
} }
/// Returns the error const /// Returns the error const
virtual const MantidVec &dataDx(const std::size_t index) const { virtual const MantidVec &dataDx(const std::size_t index) const {
return getSpectrum(index)->dataDx(); return getSpectrum(index).dataDx();
} }
virtual double getXMin() const; virtual double getXMin() const;
...@@ -243,48 +243,48 @@ public: ...@@ -243,48 +243,48 @@ public:
/// Returns a pointer to the x data /// Returns a pointer to the x data
virtual Kernel::cow_ptr<MantidVec> refX(const std::size_t index) const { virtual Kernel::cow_ptr<MantidVec> refX(const std::size_t index) const {
return getSpectrum(index)->ptrX(); return getSpectrum(index).ptrX();
} }
/// Returns a pointer to the dX (X Error) data /// Returns a pointer to the dX (X Error) data
virtual Kernel::cow_ptr<MantidVec> refDx(const std::size_t index) const { virtual Kernel::cow_ptr<MantidVec> refDx(const std::size_t index) const {
return getSpectrum(index)->ptrDx(); return getSpectrum(index).ptrDx();
} }
/// Set the specified X array to point to the given existing array /// Set the specified X array to point to the given existing array
virtual void setX(const std::size_t index, const MantidVec &X) { virtual void setX(const std::size_t index, const MantidVec &X) {
getSpectrum(index)->setX(X); getSpectrum(index).setX(X);
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
} }
/// Set the specified X array to point to the given existing array /// Set the specified X array to point to the given existing array
virtual void setX(const std::size_t index, const MantidVecPtr &X) { virtual void setX(const std::size_t index, const MantidVecPtr &X) {
getSpectrum(index)->setX(X); getSpectrum(index).setX(X);
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
} }
/// Set the specified X array to point to the given existing array /// Set the specified X array to point to the given existing array
virtual void setX(const std::size_t index, const MantidVecPtr::ptr_type &X) { virtual void setX(const std::size_t index, const MantidVecPtr::ptr_type &X) {
getSpectrum(index)->setX(X); getSpectrum(index).setX(X);
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
} }
/// Set the specified Dx (X Error) array to point to the given existing array /// Set the specified Dx (X Error) array to point to the given existing array
virtual void setDx(const std::size_t index, const MantidVec &Dx) { virtual void setDx(const std::size_t index, const MantidVec &Dx) {
getSpectrum(index)->setDx(Dx); getSpectrum(index).setDx(Dx);
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
} }
/// Set the specified Dx (X Error) array to point to the given existing array /// Set the specified Dx (X Error) array to point to the given existing array
virtual void setDx(const std::size_t index, const MantidVecPtr &Dx) { virtual void setDx(const std::size_t index, const MantidVecPtr &Dx) {
getSpectrum(index)->setDx(Dx); getSpectrum(index).setDx(Dx);
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
} }
/// Set the specified Dx (X Error) array to point to the given existing array /// Set the specified Dx (X Error) array to point to the given existing array
virtual void setDx(const std::size_t index, virtual void setDx(const std::size_t index,
const MantidVecPtr::ptr_type &Dx) { const MantidVecPtr::ptr_type &Dx) {
getSpectrum(index)->setDx(Dx); getSpectrum(index).setDx(Dx);
invalidateCommonBinsFlag(); invalidateCommonBinsFlag();
} }
...@@ -292,7 +292,7 @@ public: ...@@ -292,7 +292,7 @@ public:
@param index :: the workspace index to set. @param index :: the workspace index to set.
@param Y :: Y vector */ @param Y :: Y vector */
virtual void setData(const std::size_t index, const MantidVecPtr &Y) { virtual void setData(const std::size_t index, const MantidVecPtr &Y) {
getSpectrum(index)->setData(Y); getSpectrum(index).setData(Y);
} }
/** Sets the data in the workspace /** Sets the data in the workspace
...@@ -301,7 +301,7 @@ public: ...@@ -301,7 +301,7 @@ public:
@param E :: Error vector */ @param E :: Error vector */
virtual void setData(const std::size_t index, const MantidVecPtr &Y, virtual void setData(const std::size_t index, const MantidVecPtr &Y,
const MantidVecPtr &E) { const MantidVecPtr &E) {
getSpectrum(index)->setData(Y, E); getSpectrum(index).setData(Y, E);
} }
/** Sets the data in the workspace /** Sets the data in the workspace
...@@ -310,7 +310,7 @@ public: ...@@ -310,7 +310,7 @@ public:
@param E :: Error vector */ @param E :: Error vector */
virtual void setData(const std::size_t index, const MantidVecPtr::ptr_type &Y, virtual void setData(const std::size_t index, const MantidVecPtr::ptr_type &Y,
const MantidVecPtr::ptr_type &E) { const MantidVecPtr::ptr_type &E) {
getSpectrum(index)->setData(Y, E); getSpectrum(index).setData(Y, E);
} }
/** /**
...@@ -318,7 +318,7 @@ public: ...@@ -318,7 +318,7 @@ public:
* @param index: the workspace index * @param index: the workspace index
*/ */
virtual bool hasDx(const std::size_t index) const { virtual bool hasDx(const std::size_t index) const {
return getSpectrum(index)->hasDx(); return getSpectrum(index).hasDx();
} }
/// Generate the histogram or rebin the existing histogram. /// Generate the histogram or rebin the existing histogram.
......
...@@ -23,7 +23,7 @@ GeometryInfo GeometryInfoFactory::create(const size_t index) const { ...@@ -23,7 +23,7 @@ GeometryInfo GeometryInfoFactory::create(const size_t index) const {
// current (2016) instrument code there are memory allocations when getting // current (2016) instrument code there are memory allocations when getting
// the detector, so this additional allocation may be negligible, but we want // the detector, so this additional allocation may be negligible, but we want
// this class to be future proof. GeometryInfo should be kept small. // this class to be future proof. GeometryInfo should be kept small.
return {*this, *(m_workspace.getSpectrum(index))}; return {*this, m_workspace.getSpectrum(index)};
} }
const Geometry::Instrument &GeometryInfoFactory::getInstrument() const { const Geometry::Instrument &GeometryInfoFactory::getInstrument() const {
......
...@@ -717,7 +717,7 @@ void IFunction::setMatrixWorkspace( ...@@ -717,7 +717,7 @@ void IFunction::setMatrixWorkspace(
const Geometry::ParameterMap &paramMap = workspace->instrumentParameters(); const Geometry::ParameterMap &paramMap = workspace->instrumentParameters();
Geometry::IDetector_const_sptr det; Geometry::IDetector_const_sptr det;
size_t numDetectors = workspace->getSpectrum(wi)->getDetectorIDs().size(); size_t numDetectors = workspace->getSpectrum(wi).getDetectorIDs().size();
if (numDetectors > 1) { if (numDetectors > 1) {
// If several detectors are on this workspace index, just use the ID of // If several detectors are on this workspace index, just use the ID of
// the first detector // the first detector
...@@ -725,7 +725,7 @@ void IFunction::setMatrixWorkspace( ...@@ -725,7 +725,7 @@ void IFunction::setMatrixWorkspace(
// and not the group. Ask Roman. // and not the group. Ask Roman.
Instrument_const_sptr inst = workspace->getInstrument(); Instrument_const_sptr inst = workspace->getInstrument();
det = inst->getDetector( det = inst->getDetector(
*workspace->getSpectrum(wi)->getDetectorIDs().begin()); *workspace->getSpectrum(wi).getDetectorIDs().begin());
} else } else
// Get the detector (single) at this workspace index // Get the detector (single) at this workspace index
det = workspace->getDetector(wi); det = workspace->getDetector(wi);
......
...@@ -183,18 +183,18 @@ const std::string MatrixWorkspace::getTitle() const { ...@@ -183,18 +183,18 @@ const std::string MatrixWorkspace::getTitle() const {
void MatrixWorkspace::updateSpectraUsing(const SpectrumDetectorMapping &map) { void MatrixWorkspace::updateSpectraUsing(const SpectrumDetectorMapping &map) {
for (size_t j = 0; j < getNumberHistograms(); ++j) { for (size_t j = 0; j < getNumberHistograms(); ++j) {
auto spec = getSpectrum(j); auto &spec = getSpectrum(j);
try { try {
if (map.indexIsSpecNumber()) if (map.indexIsSpecNumber())
spec->setDetectorIDs( spec.setDetectorIDs(
map.getDetectorIDsForSpectrumNo(spec->getSpectrumNo())); map.getDetectorIDsForSpectrumNo(spec.getSpectrumNo()));
else else
spec->setDetectorIDs(map.getDetectorIDsForSpectrumIndex(j)); spec.setDetectorIDs(map.getDetectorIDsForSpectrumIndex(j));
} catch (std::out_of_range &e) { } catch (std::out_of_range &e) {
// Get here if the spectrum number is not in the map. // Get here if the spectrum number is not in the map.
spec->clearDetectorIDs(); spec.clearDetectorIDs();
g_log.debug(e.what()); g_log.debug(e.what());
g_log.debug() << "Spectrum number " << spec->getSpectrumNo() g_log.debug() << "Spectrum number " << spec.getSpectrumNo()
<< " not in map.\n"; << " not in map.\n";
} }
} }
...@@ -227,9 +227,9 @@ void MatrixWorkspace::rebuildSpectraMapping(const bool includeMonitors) { ...@@ -227,9 +227,9 @@ void MatrixWorkspace::rebuildSpectraMapping(const bool includeMonitors) {
const specnum_t specNo = specnum_t(index + 1); const specnum_t specNo = specnum_t(index + 1);
if (index < this->getNumberHistograms()) { if (index < this->getNumberHistograms()) {
ISpectrum *spec = getSpectrum(index); auto &spec = getSpectrum(index);
spec->setSpectrumNo(specNo); spec.setSpectrumNo(specNo);
spec->setDetectorID(detId); spec.setDetectorID(detId);
} }
index++; index++;
...@@ -428,7 +428,7 @@ bool MatrixWorkspace::hasGroupedDetectors() const { ...@@ -428,7 +428,7 @@ bool MatrixWorkspace::hasGroupedDetectors() const {
// Loop through the workspace index // Loop through the workspace index
for (size_t workspaceIndex = 0; workspaceIndex < this->getNumberHistograms(); for (size_t workspaceIndex = 0; workspaceIndex < this->getNumberHistograms();
workspaceIndex++) { workspaceIndex++) {
auto detList = getSpectrum(workspaceIndex)->getDetectorIDs(); auto detList = getSpectrum(workspaceIndex).getDetectorIDs();
if (detList.size() > 1) { if (detList.size() > 1) {
retVal = true; retVal = true;
break; break;
...@@ -456,7 +456,7 @@ detid2index_map MatrixWorkspace::getDetectorIDToWorkspaceIndexMap( ...@@ -456,7 +456,7 @@ detid2index_map MatrixWorkspace::getDetectorIDToWorkspaceIndexMap(
// Loop through the workspace index // Loop through the workspace index
for (size_t workspaceIndex = 0; workspaceIndex < this->getNumberHistograms(); for (size_t workspaceIndex = 0; workspaceIndex < this->getNumberHistograms();
++workspaceIndex) { ++workspaceIndex) {
auto detList = getSpectrum(workspaceIndex)->getDetectorIDs(); auto detList = getSpectrum(workspaceIndex).getDetectorIDs();
if (throwIfMultipleDets) { if (throwIfMultipleDets) {
if (detList.size() > 1) { if (detList.size() > 1) {
...@@ -509,8 +509,7 @@ std::vector<size_t> MatrixWorkspace::getDetectorIDToWorkspaceIndexVector( ...@@ -509,8 +509,7 @@ std::vector<size_t> MatrixWorkspace::getDetectorIDToWorkspaceIndexVector(
for (size_t workspaceIndex = 0; workspaceIndex < getNumberHistograms(); for (size_t workspaceIndex = 0; workspaceIndex < getNumberHistograms();
++workspaceIndex) { ++workspaceIndex) {
// Get the list of detectors from the WS index // Get the list of detectors from the WS index
const std::set<detid_t> &detList = const auto &detList = this->getSpectrum(workspaceIndex).getDetectorIDs();
this->getSpectrum(workspaceIndex)->getDetectorIDs();
if (throwIfMultipleDets && (detList.size() > 1)) if (throwIfMultipleDets && (detList.size() > 1))
throw std::runtime_error( throw std::runtime_error(
...@@ -552,7 +551,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromSpectra( ...@@ -552,7 +551,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromSpectra(
auto iter = spectraList.cbegin(); auto iter = spectraList.cbegin();
while (iter != spectraList.cend()) { while (iter != spectraList.cend()) {
for (size_t i = 0; i < this->getNumberHistograms(); ++i) { for (size_t i = 0; i < this->getNumberHistograms(); ++i) {
if (this->getSpectrum(i)->getSpectrumNo() == *iter) { if (this->getSpectrum(i).getSpectrumNo() == *iter) {
indexList.push_back(i); indexList.push_back(i);
break; break;
} }
...@@ -572,7 +571,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromSpectra( ...@@ -572,7 +571,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromSpectra(
size_t size_t
MatrixWorkspace::getIndexFromSpectrumNumber(const specnum_t specNo) const { MatrixWorkspace::getIndexFromSpectrumNumber(const specnum_t specNo) const {
for (size_t i = 0; i < this->getNumberHistograms(); ++i) { for (size_t i = 0; i < this->getNumberHistograms(); ++i) {
if (this->getSpectrum(i)->getSpectrumNo() == specNo) if (this->getSpectrum(i).getSpectrumNo() == specNo)
return i; return i;
} }
throw std::runtime_error("Could not find spectrum number in any spectrum."); throw std::runtime_error("Could not find spectrum number in any spectrum.");
...@@ -594,7 +593,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromDetectorIDs( ...@@ -594,7 +593,7 @@ std::vector<size_t> MatrixWorkspace::getIndicesFromDetectorIDs(
const std::vector<detid_t> &detIdList) const { const std::vector<detid_t> &detIdList) const {
std::map<detid_t, std::set<size_t>> detectorIDtoWSIndices; std::map<detid_t, std::set<size_t>> detectorIDtoWSIndices;
for (size_t i = 0; i < getNumberHistograms(); ++i) { for (size_t i = 0; i < getNumberHistograms(); ++i) {
auto detIDs = getSpectrum(i)->getDetectorIDs(); auto detIDs = getSpectrum(i).getDetectorIDs();
for (auto detID : detIDs) { for (auto detID : detIDs) {
detectorIDtoWSIndices[detID].insert(i); detectorIDtoWSIndices[detID].insert(i);
} }
...@@ -632,9 +631,9 @@ std::vector<specnum_t> MatrixWorkspace::getSpectraFromDetectorIDs( ...@@ -632,9 +631,9 @@ std::vector<specnum_t> MatrixWorkspace::getSpectraFromDetectorIDs(
// Go through every histogram // Go through every histogram
for (size_t i = 0; i < this->getNumberHistograms(); i++) { for (size_t i = 0; i < this->getNumberHistograms(); i++) {
if (this->getSpectrum(i)->hasDetectorID(detId)) { if (this->getSpectrum(i).hasDetectorID(detId)) {
foundDet = true; foundDet = true;
foundSpecNum = this->getSpectrum(i)->getSpectrumNo(); foundSpecNum = this->getSpectrum(i).getSpectrumNo();
break; break;
} }
} }
...@@ -752,14 +751,7 @@ requested workspace index does not have any associated detectors ...@@ -752,14 +751,7 @@ requested workspace index does not have any associated detectors
*/ */
Geometry::IDetector_const_sptr Geometry::IDetector_const_sptr
MatrixWorkspace::getDetector(const size_t workspaceIndex) const { MatrixWorkspace::getDetector(const size_t workspaceIndex) const {
const ISpectrum *spec = this->getSpectrum(workspaceIndex); const auto &dets = getSpectrum(workspaceIndex).getDetectorIDs();
if (!spec)
throw Kernel::Exception::NotFoundError("MatrixWorkspace::getDetector(): "
"NULL spectrum found at the given "
"workspace index.",
"");
const auto &dets = spec->getDetectorIDs();
Instrument_const_sptr localInstrument = getInstrument(); Instrument_const_sptr localInstrument = getInstrument();
if (!localInstrument) { if (!localInstrument) {
g_log.debug() << "No instrument defined.\n"; g_log.debug() << "No instrument defined.\n";
...@@ -999,15 +991,12 @@ void MatrixWorkspace::maskWorkspaceIndex(const std::size_t index) { ...@@ -999,15 +991,12 @@ void MatrixWorkspace::maskWorkspaceIndex(const std::size_t index) {
"MatrixWorkspace::maskWorkspaceIndex,index"); "MatrixWorkspace::maskWorkspaceIndex,index");
} }
ISpectrum *spec = this->getSpectrum(index); auto &spec = this->getSpectrum(index);
if (!spec)
throw std::invalid_argument(
"MatrixWorkspace::maskWorkspaceIndex() got a null Spectrum.");
// Virtual method clears the spectrum as appropriate // Virtual method clears the spectrum as appropriate
spec->clearData(); spec.clearData();
const auto dets = spec->getDetectorIDs(); const auto dets = spec.getDetectorIDs();
for (auto detId : dets) { for (auto detId : dets) {
try { try {
if (const Geometry::Detector *det = if (const Geometry::Detector *det =
...@@ -1613,7 +1602,7 @@ void MatrixWorkspace::saveSpectraMapNexus( ...@@ -1613,7 +1602,7 @@ void MatrixWorkspace::saveSpectraMapNexus(
std::size_t nDetectors = 0; std::size_t nDetectors = 0;
for (auto index : spec) { for (auto index : spec) {
nDetectors += nDetectors +=
this->getSpectrum(static_cast<size_t>(index))->getDetectorIDs().size(); this->getSpectrum(static_cast<size_t>(index)).getDetectorIDs().size();
} }
if (nDetectors < 1) { if (nDetectors < 1) {
...@@ -1643,11 +1632,11 @@ void MatrixWorkspace::saveSpectraMapNexus( ...@@ -1643,11 +1632,11 @@ void MatrixWorkspace::saveSpectraMapNexus(
// Workspace index // Workspace index
int si = spec[i]; int si = spec[i];
// Spectrum there // Spectrum there
const ISpectrum *spectrum = this->getSpectrum(si); const auto &spectrum = this->getSpectrum(si);
spectra[i] = int32_t(spectrum->getSpectrumNo()); spectra[i] = int32_t(spectrum.getSpectrumNo());
// The detectors in this spectrum // The detectors in this spectrum
const auto &detectorgroup = spectrum->getDetectorIDs(); const auto &detectorgroup = spectrum.getDetectorIDs();
const int ndet1 = static_cast<int>(detectorgroup.size()); const int ndet1 = static_cast<int>(detectorgroup.size());
detector_index[i + 1] = int32_t( detector_index[i + 1] = int32_t(
......
...@@ -67,7 +67,7 @@ double SpectraAxis::operator()(const std::size_t &index, ...@@ -67,7 +67,7 @@ double SpectraAxis::operator()(const std::size_t &index,
"SpectraAxis: Index out of range."); "SpectraAxis: Index out of range.");
} }
return static_cast<double>(m_parentWS->getSpectrum(index)->getSpectrumNo()); return static_cast<double>(m_parentWS->getSpectrum(index).getSpectrumNo());
} }
/** Sets the axis value at a given position /** Sets the axis value at a given position
...@@ -115,7 +115,7 @@ specnum_t SpectraAxis::spectraNo(const std::size_t &index) const { ...@@ -115,7 +115,7 @@ specnum_t SpectraAxis::spectraNo(const std::size_t &index) const {
"SpectraAxis: Index out of range."); "SpectraAxis: Index out of range.");
} }
return m_parentWS->getSpectrum(index)->getSpectrumNo(); return m_parentWS->getSpectrum(index).getSpectrumNo();
} }
/** Returns a map where spectra is the key and index is the value /** Returns a map where spectra is the key and index is the value
...@@ -129,7 +129,7 @@ spec2index_map SpectraAxis::getSpectraIndexMap() const { ...@@ -129,7 +129,7 @@ spec2index_map SpectraAxis::getSpectraIndexMap() const {
throw std::runtime_error("getSpectraIndexMap(), zero elements"); throw std::runtime_error("getSpectraIndexMap(), zero elements");
spec2index_map map; spec2index_map map;
for (size_t i = 0; i < nel; ++i) { for (size_t i = 0; i < nel; ++i) {
map.emplace(m_parentWS->getSpectrum(i)->getSpectrumNo(), i); map.emplace(m_parentWS->getSpectrum(i).getSpectrumNo(), i);
} }
return map; return map;
} }
...@@ -165,12 +165,12 @@ std::string SpectraAxis::label(const std::size_t &index) const { ...@@ -165,12 +165,12 @@ std::string SpectraAxis::label(const std::size_t &index) const {
/// returns min value defined on axis /// returns min value defined on axis
double SpectraAxis::getMin() const { double SpectraAxis::getMin() const {
return m_parentWS->getSpectrum(0)->getSpectrumNo(); return m_parentWS->getSpectrum(0).getSpectrumNo();
} }
/// returns max value defined on axis /// returns max value defined on axis
double SpectraAxis::getMax() const { double SpectraAxis::getMax() const {
return m_parentWS->getSpectrum(length() - 1)->getSpectrumNo(); return m_parentWS->getSpectrum(length() - 1).getSpectrumNo();