Mantid
Loading...
Searching...
No Matches
SpectrumInfoItem.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidAPI/DllConfig.h"
10#include "MantidKernel/V3D.h"
11#include "MantidTypes/SpectrumDefinition.h"
12#include <type_traits>
13
14using Mantid::SpectrumDefinition;
16
17namespace Mantid {
18namespace API {
19
37template <typename T> class SpectrumInfoItem {
38
39public:
40 // Methods that can be called via the iterator
41 bool isMonitor() const { return m_spectrumInfo->isMonitor(m_index); }
42
43 bool isMasked() const { return m_spectrumInfo->isMasked(m_index); }
44
45 void setMasked(bool masked) {
46 static_assert(!std::is_const<T>::value, "Operation disabled on const T");
47 return m_spectrumInfo->setMasked(m_index, masked);
48 }
49
50 double twoTheta() const { return m_spectrumInfo->twoTheta(m_index); }
51
52 double signedTwoTheta() const { return m_spectrumInfo->signedTwoTheta(m_index); }
53
54 double l2() const { return m_spectrumInfo->l2(m_index); }
55
56 bool hasUniqueDetector() const { return m_spectrumInfo->hasUniqueDetector(m_index); }
57
58 bool hasDetectors() const { return m_spectrumInfo->hasDetectors(m_index); }
59
60 const Mantid::SpectrumDefinition &spectrumDefinition() const { return m_spectrumInfo->spectrumDefinition(m_index); }
61
62 Mantid::Kernel::V3D position() const { return m_spectrumInfo->position(m_index); }
63
64 SpectrumInfoItem(T &spectrumInfo, const size_t index) : m_spectrumInfo(&spectrumInfo), m_index(index) {}
65
66 // Non-owning pointer. A reference makes the class unable to define an
67 // assignment operator that we need.
69 size_t m_index;
70};
71
72} // namespace API
73} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Mantid::Kernel::V3D position() const
const Mantid::SpectrumDefinition & spectrumDefinition() const
SpectrumInfoItem(T &spectrumInfo, const size_t index)
Class for 3D vectors.
Definition: V3D.h:34
Helper class which provides the Collimation Length for SANS instruments.