Mantid
Loading...
Searching...
No Matches
ConvToMDEventsWS.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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//
15#include "MantidKernel/Matrix.h"
20
21namespace Mantid {
22// Forward declarations
23namespace API {
24class Progress;
25}
26namespace MDAlgorithms {
34// Class to process event workspace by direct conversion:
35
37public:
38 size_t initialize(const MDWSDescription &WSD, std::shared_ptr<MDEventWSWrapper> inWSWrapper, bool ignoreZeros,
39 bool useLogTimes) override;
40 void runConversion(API::Progress *pProgress) override;
41
42protected:
44
45private:
46 // function runs the conversion on
47 size_t conversionChunk(size_t workspaceIndex) override;
48 // the pointer to the source event workspace as event ws does not work through
49 // the public Matrix WS interface
52 template <class T> size_t convertEventList(size_t workspaceIndex);
53
54 virtual void appendEventsFromInputWS(API::Progress *pProgress, const API::BoxController_sptr &bc);
55 // Variables for getting log values at times and recomputing sample orientation
59 std::vector<std::unique_ptr<Kernel::TimeSeriesProperty<double>>> m_Logs;
60 std::vector<size_t> m_GonioIndex;
61 // Private method to update rotation matrix for a single event from log values
62 template <class T> bool setGoniometersFromLogs(const T &ev) {
63 if (!m_useLogTimes)
64 return true;
65 for (size_t axIdx = 0; axIdx < m_GonioIndex.size(); axIdx++) {
66 double logval = m_Logs[axIdx]->getSingleValue(ev->pulseTime());
67 if (std::isnan(logval))
68 return false;
70 }
73 m_QConverter->updateRotMat(m_tmpRot.getVector());
74 return true;
75 }
76};
77
78} // namespace MDAlgorithms
79} // namespace Mantid
Helper class for reporting progress from algorithms.
Definition Progress.h:25
Class to represent a particular goniometer setting, which is described by the rotation matrix.
Definition Goniometer.h:55
void setRotationAngle(const std::string &name, double value)
Set rotation angle for an axis using motor name.
const Kernel::DblMatrix & getR() const
Return global rotation matrix.
T Invert()
LU inversion routine.
Definition Matrix.cpp:924
std::vector< T > getVector() const
Definition Matrix.cpp:77
Class describes the interface to the methods, which perform conversion from usual workspaces to MDEve...
bool m_useLogTimes
Flag to use log values corresponding to event pulse time instead of average values.
The class specializes ConvToDataObjectsBase for the case when the conversion occurs from Events WS to...
std::vector< std::unique_ptr< Kernel::TimeSeriesProperty< double > > > m_Logs
size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros, bool useLogTimes) override
method sets up all internal variables necessary to convert from Event Workspace to MDEvent workspace
size_t convertEventList(size_t workspaceIndex)
function converts particular type of events into MD space and add these events to the workspace itsel...
size_t conversionChunk(size_t workspaceIndex) override
The method runs conversion for a single event list, corresponding to a particular workspace index.
DataObjects::EventWorkspace_const_sptr m_EventWS
virtual void appendEventsFromInputWS(API::Progress *pProgress, const API::BoxController_sptr &bc)
void runConversion(API::Progress *pProgress) override
method which starts the conversion procedure
helper class describes the properties of target MD workspace, which should be obtained as the result ...
std::shared_ptr< BoxController > BoxController_sptr
Shared ptr to BoxController.
std::shared_ptr< const EventWorkspace > EventWorkspace_const_sptr
shared pointer to a const Workspace2D
Helper class which provides the Collimation Length for SANS instruments.