-
Notifications
You must be signed in to change notification settings - Fork 122
/
PreprocessDetectorsToMD.h
70 lines (63 loc) · 3.02 KB
/
PreprocessDetectorsToMD.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidMDAlgorithms/DllConfig.h"
namespace Mantid {
namespace MDAlgorithms {
/**
This is helper algorithm used to preprocess detector's positions namely
to perform generic part of the transformation from a matrix workspace of a real
instrument to
physical MD workspace of an experimental results (e.g Q-space).
*/
class DLLExport PreprocessDetectorsToMD : public API::Algorithm {
public:
PreprocessDetectorsToMD();
/// Algorithm's name for identification
const std::string name() const override { return "PreprocessDetectorsToMD"; };
/// Summary of algorithms purpose
const std::string summary() const override {
return "Its a helper algorithm, used to make common part of transformation "
"from real to reciprocal space. "
"It is used by :ref:`algm-ConvertToMD` and "
":ref:`algm-ConvertToMDMinMaxLocal` algorithms to save time spent "
"on this transformation "
"when the algorithm used multiple times for multiple measurements "
"on the same instrument.";
}
/// Algorithm's version for identification
int version() const override { return 1; };
/// Algorithm's category for identification
const std::string category() const override { return "MDAlgorithms\\Utility"; }
private:
void init() override;
void exec() override;
/// the variable specifies if one needs to calculate efixed for detectors
/// (make sense for indirect instruments)
bool m_getEFixed;
/// the variable specifies if one needs to return the state of detector mask
/// e.g if the detector is masked
bool m_getIsMasked;
protected: // for testing
void processDetectorsPositions(const API::MatrixWorkspace_const_sptr &inputWS,
DataObjects::TableWorkspace_sptr &targWS);
void buildFakeDetectorsPositions(const API::MatrixWorkspace_const_sptr &inputWS,
DataObjects::TableWorkspace_sptr &targWS);
void updateMasksState(const API::MatrixWorkspace_const_sptr &inputWS, DataObjects::TableWorkspace_sptr &targWS);
// build a table workspace corresponding to the input matrix workspace
std::shared_ptr<DataObjects::TableWorkspace> createTableWorkspace(const API::MatrixWorkspace_const_sptr &inputWS);
bool isDetInfoLost(const Mantid::API::MatrixWorkspace_const_sptr &inWS2D) const;
// helper function to get efixed if it is there or not;
double getEi(const API::MatrixWorkspace_const_sptr &inputWS) const;
};
} // namespace MDAlgorithms
} // namespace Mantid