Mantid
Loading...
Searching...
No Matches
SpectrumInfo.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 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"
12#include "MantidKernel/Unit.h"
13#include "MantidKernel/V3D.h"
15
16#include <memory>
17
18#include <vector>
19
20namespace Mantid {
21using detid_t = int32_t;
22class SpectrumDefinition;
23namespace Beamline {
24class SpectrumInfo;
25}
26namespace Geometry {
27class BoundingBox;
28class DetectorInfo;
29class IDetector;
30class Instrument;
31class ParameterMap;
32} // namespace Geometry
33namespace API {
34class ExperimentInfo;
35
54class MANTID_API_DLL SpectrumInfo {
55public:
56 SpectrumInfo(const Beamline::SpectrumInfo &spectrumInfo, const ExperimentInfo &experimentInfo,
57 Geometry::DetectorInfo &detectorInfo);
59
60 size_t size() const;
61 size_t detectorCount() const;
62
63 const SpectrumDefinition &spectrumDefinition(const size_t index) const;
64 const Kernel::cow_ptr<std::vector<SpectrumDefinition>> &sharedSpectrumDefinitions() const;
65
66 bool isMonitor(const size_t index) const;
67 bool isMasked(const size_t index) const;
68 double l2(const size_t index) const;
69 double twoTheta(const size_t index) const;
70 double signedTwoTheta(const size_t index) const;
71 double azimuthal(const size_t index) const;
72 double twoTheta(const size_t index, const Kernel::V3D &observer, const Kernel::V3D &axis) const;
73 double signedTwoTheta(const size_t index, const Kernel::V3D &observer, const Kernel::V3D &axis,
74 const Kernel::V3D &instrumentUp) const;
75 double signedTwoTheta(const size_t index, const Kernel::V3D &observer, const Kernel::V3D &axis) const;
76 double phi(const size_t index) const;
77 double phiOffset(const size_t index, const double offset) const;
78 std::pair<double, double> geographicalAngles(const size_t index) const;
79 Kernel::V3D position(const size_t index) const;
80 Kernel::UnitParametersMap diffractometerConstants(const size_t index, std::vector<detid_t> &uncalibratedDets) const;
81 Kernel::UnitParametersMap diffractometerConstants(const size_t index) const;
82 double difcUncalibrated(const size_t index) const;
83 bool hasDetectors(const size_t index) const;
84 bool hasUniqueDetector(const size_t index) const;
85 detid_t firstDetectorID(const size_t index) const;
86 size_t firstDetectorIndex(const size_t index) const;
87 Geometry::BoundingBox boundingBox(const size_t index) const;
88
89 void setMasked(const size_t index, bool masked);
90
91 // This is likely to be deprecated/removed with the introduction of
92 // Instrument-2.0: The concept of detector groups will probably be dropped so
93 // returning a single detector for a spectrum will not be possible anymore.
94 const Geometry::IDetector &detector(const size_t index) const;
95
96 // This does not really belong into SpectrumInfo, but it seems to be useful
97 // while Instrument-2.0 does not exist.
98 Kernel::V3D sourcePosition() const;
99 Kernel::V3D samplePosition() const;
100 double l1() const;
101
102 void getDetectorValues(const Kernel::Unit &inputUnit, const Kernel::Unit &outputUnit,
103 const Kernel::DeltaEMode::Type emode, const bool signedTheta, int64_t wsIndex,
105 void createDetectorIdLogMessages(const std::vector<detid_t> &detids, int64_t wsIndex) const;
106
109 const SpectrumInfoIterator<const SpectrumInfo> cbegin() const;
111
112 friend class ExperimentInfo;
113
114private:
115 [[deprecated("SpectrumInfo::getDetector has been deprecated in Mantid 7.1."
116 "See the 'Instrument Access via SpectrumInfo, DetectorInfo, ComponentInfo' concept page, "
117 "located at: https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html")]]
118 const Geometry::IDetector &getDetector(const size_t index) const;
119 const SpectrumDefinition &checkAndGetSpectrumDefinition(const size_t index) const;
120
123 const Beamline::SpectrumInfo &m_spectrumInfo;
124 mutable std::vector<std::shared_ptr<const Geometry::IDetector>> m_lastDetector;
125 mutable std::vector<size_t> m_lastIndex;
126};
127
130
131} // namespace API
132} // namespace Mantid
double position
Definition GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
IntArray detectorCount
PyObject * geographicalAngles(const SpectrumInfo &spectrumInfo, const size_t index)
This class is shared by a few Workspace types and holds information related to a particular experimen...
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
const ExperimentInfo & m_experimentInfo
Geometry::DetectorInfo & m_detectorInfo
std::vector< std::shared_ptr< const Geometry::IDetector > > m_lastDetector
std::vector< size_t > m_lastIndex
const Beamline::SpectrumInfo & m_spectrumInfo
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition BoundingBox.h:33
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Interface class for detector objects.
Definition IDetector.h:37
The base units (abstract) class.
Definition Unit.h:40
Class for 3D vectors.
Definition V3D.h:35
Implements a copy on write data template.
Definition cow_ptr.h:41
SpectrumInfoIterator< const SpectrumInfo > SpectrumInfoConstIt
SpectrumInfoIterator< SpectrumInfo > SpectrumInfoIt
std::unordered_map< UnitParams, double > UnitParametersMap
Definition Unit.h:29
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
Generate a tableworkspace to store the calibration results.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...
Definition DeltaEMode.h:29