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 DetectorInfo;
28class IDetector;
29class Instrument;
30class ParameterMap;
31} // namespace Geometry
32namespace API {
33class ExperimentInfo;
34
53class MANTID_API_DLL SpectrumInfo {
54public:
55 SpectrumInfo(const Beamline::SpectrumInfo &spectrumInfo, const ExperimentInfo &experimentInfo,
56 Geometry::DetectorInfo &detectorInfo);
58
59 size_t size() const;
60 size_t detectorCount() const;
61
62 const SpectrumDefinition &spectrumDefinition(const size_t index) const;
63 const Kernel::cow_ptr<std::vector<SpectrumDefinition>> &sharedSpectrumDefinitions() const;
64
65 bool isMonitor(const size_t index) const;
66 bool isMasked(const size_t index) const;
67 double l2(const size_t index) const;
68 double twoTheta(const size_t index) const;
69 double signedTwoTheta(const size_t index) const;
70 double azimuthal(const size_t index) const;
71 std::pair<double, double> geographicalAngles(const size_t index) const;
72 Kernel::V3D position(const size_t index) const;
73 Kernel::UnitParametersMap diffractometerConstants(const size_t index, std::vector<detid_t> &uncalibratedDets) const;
74 Kernel::UnitParametersMap diffractometerConstants(const size_t index) const;
75 double difcUncalibrated(const size_t index) const;
76 bool hasDetectors(const size_t index) const;
77 bool hasUniqueDetector(const size_t index) const;
78
79 void setMasked(const size_t index, bool masked);
80
81 // This is likely to be deprecated/removed with the introduction of
82 // Instrument-2.0: The concept of detector groups will probably be dropped so
83 // returning a single detector for a spectrum will not be possible anymore.
84 const Geometry::IDetector &detector(const size_t index) const;
85
86 // This does not really belong into SpectrumInfo, but it seems to be useful
87 // while Instrument-2.0 does not exist.
88 Kernel::V3D sourcePosition() const;
89 Kernel::V3D samplePosition() const;
90 double l1() const;
91
92 void getDetectorValues(const Kernel::Unit &inputUnit, const Kernel::Unit &outputUnit,
93 const Kernel::DeltaEMode::Type emode, const bool signedTheta, int64_t wsIndex,
95 void createDetectorIdLogMessages(const std::vector<detid_t> &detids, int64_t wsIndex) const;
96
101
102 friend class ExperimentInfo;
103
104private:
105 const Geometry::IDetector &getDetector(const size_t index) const;
106 const SpectrumDefinition &checkAndGetSpectrumDefinition(const size_t index) const;
107
110 const Beamline::SpectrumInfo &m_spectrumInfo;
111 mutable std::vector<std::shared_ptr<const Geometry::IDetector>> m_lastDetector;
112 mutable std::vector<size_t> m_lastIndex;
113};
114
117
118} // namespace API
119} // namespace Mantid
double position
Definition: GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
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....
Definition: SpectrumInfo.h:53
const ExperimentInfo & m_experimentInfo
Definition: SpectrumInfo.h:108
Geometry::DetectorInfo & m_detectorInfo
Definition: SpectrumInfo.h:109
std::vector< std::shared_ptr< const Geometry::IDetector > > m_lastDetector
Definition: SpectrumInfo.h:111
std::vector< size_t > m_lastIndex
Definition: SpectrumInfo.h:112
const Beamline::SpectrumInfo & m_spectrumInfo
Definition: SpectrumInfo.h:110
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Definition: DetectorInfo.h:49
Interface class for detector objects.
Definition: IDetector.h:43
The base units (abstract) class.
Definition: Unit.h:41
Class for 3D vectors.
Definition: V3D.h:34
Implements a copy on write data template.
Definition: cow_ptr.h:41
std::unordered_map< UnitParams, double > UnitParametersMap
Definition: Unit.h:30
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.
Definition: SpectrumInfo.h:21
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