Mantid
Loading...
Searching...
No Matches
ScanningWorkspaceBuilder.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 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
10#include "MantidDataObjects/DllConfig.h"
11#include "MantidIndexing/IndexInfo.h"
13#include "MantidKernel/Quat.h"
14#include "MantidKernel/V3D.h"
15
16#include <vector>
17
18namespace Mantid {
19namespace DataObjects {
20
39class MANTID_DATAOBJECTS_DLL ScanningWorkspaceBuilder {
40public:
41 enum class IndexingType { Default, TimeOriented, DetectorOriented };
42
43 ScanningWorkspaceBuilder(const std::shared_ptr<const Geometry::Instrument> &instrument, const size_t nTimeIndexes,
44 const size_t nBins, const bool isPointData = false);
45
46 void setHistogram(HistogramData::Histogram histogram);
47
48 void setTimeRanges(std::vector<std::pair<Types::Core::DateAndTime, Types::Core::DateAndTime>> timeRanges);
49 void setTimeRanges(const Types::Core::DateAndTime &startTime, const std::vector<double> &durations);
50 void setPositions(std::vector<std::vector<Kernel::V3D>> positions);
51 void setRotations(std::vector<std::vector<Kernel::Quat>> rotations);
52 void setRelativeRotationsForScans(const std::vector<double> &relativeRotations, const Kernel::V3D &rotationPosition,
53 const Kernel::V3D &rotationAxis);
54
55 void setIndexingType(const IndexingType indexingType);
56
57 API::MatrixWorkspace_sptr buildWorkspace() const;
58
59private:
62 size_t m_nBins;
63
64 std::shared_ptr<const Geometry::Instrument> m_instrument;
65
66 HistogramData::Histogram m_histogram;
67
68 std::vector<std::pair<Types::Core::DateAndTime, Types::Core::DateAndTime>> m_timeRanges;
69 std::vector<std::vector<Kernel::V3D>> m_positions;
70 std::vector<std::vector<Kernel::Quat>> m_rotations;
71
72 std::vector<double> m_instrumentAngles;
75
77
78 void buildOutputComponentInfo(Geometry::ComponentInfo &outputComponentInfo) const;
79
80 void buildPositions(Geometry::DetectorInfo &outputDetectorInfo) const;
81 void buildRotations(Geometry::DetectorInfo &outputDetectorInfo) const;
82 void buildRelativeRotationsForScans(Geometry::DetectorInfo &outputDetectorInfo) const;
83
84 void createTimeOrientedIndexInfo(API::MatrixWorkspace &ws) const;
85 void createDetectorOrientedIndexInfo(API::MatrixWorkspace &ws) const;
86
87 void verifyTimeIndexSize(const size_t timeIndexSize, const std::string &description) const;
88 void verifyDetectorSize(const size_t detectorSize, const std::string &description) const;
89 void validateInputs() const;
90};
91
92} // namespace DataObjects
93} // namespace Mantid
Base MatrixWorkspace Abstract Class.
ScanningWorkspaceBuilder : This is a helper class to make it easy to build a scanning workspace (a wo...
std::vector< std::pair< Types::Core::DateAndTime, Types::Core::DateAndTime > > m_timeRanges
std::shared_ptr< const Geometry::Instrument > m_instrument
std::vector< std::vector< Kernel::V3D > > m_positions
std::vector< std::vector< Kernel::Quat > > m_rotations
ComponentInfo : Provides a component centric view on to the instrument.
Definition: ComponentInfo.h:40
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
Definition: DetectorInfo.h:49
Class for 3D vectors.
Definition: V3D.h:34
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.