/
IntegratePeaksCWSD.h
115 lines (89 loc) · 3.63 KB
/
IntegratePeaksCWSD.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 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
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/CompositeFunction.h"
#include "MantidAPI/IMDEventWorkspace_fwd.h"
#include "MantidDataObjects/MDEventWorkspace.h"
#include "MantidDataObjects/MaskWorkspace.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidKernel/System.h"
namespace Mantid {
namespace MDAlgorithms {
/** Integrate single-crystal peaks in reciprocal-space.
*
* @author Janik Zikovsky
* @date 2011-04-13 18:11:53.496539
*/
class DLLExport IntegratePeaksCWSD : public API::Algorithm {
public:
IntegratePeaksCWSD();
/// Algorithm's name for identification
const std::string name() const override { return "IntegratePeaksCWSD"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Integrate single-crystal peaks in reciprocal space, for "
"MDEventWorkspaces from reactor-source single crystal "
"diffractometer.";
}
/// Algorithm's version for identification
int version() const override { return 1; }
const std::vector<std::string> seeAlso() const override {
return {"IntegratePeaksHybrid", "IntegratePeaksMDHKL", "IntegratePeaksMD", "IntegratePeaksUsingClusters"};
}
/// Algorithm's category for identification
const std::string category() const override { return "MDAlgorithms\\Peaks;Crystal\\Integration"; }
private:
/// Initialise the properties
void init() override;
/// Run the algorithm
void exec() override;
/// Process and check input properties
void processInputs();
void simplePeakIntegration(const std::vector<detid_t> &vecMaskedDetID,
const std::map<int, signal_t> &run_monitor_map);
template <typename MDE, size_t nd>
void integrate(typename DataObjects::MDEventWorkspace<MDE, nd>::sptr ws,
const std::map<uint16_t, signal_t> &run_monitor_map);
/// Get the run/monitor counts map
std::map<int, signal_t> getMonitorCounts();
/// Get the run/measuring time map
std::map<int, double> getMeasureTime();
std::vector<detid_t> processMaskWorkspace(const DataObjects::MaskWorkspace_const_sptr &maskws);
void getPeakInformation();
DataObjects::PeaksWorkspace_sptr createOutputs();
void mergePeaks();
/// Implement this method to normalize the intensity of each Pt.
void normalizePeaksIntensities();
DataObjects::PeaksWorkspace_sptr createPeakworkspace(Kernel::V3D peakCenter, const API::IMDEventWorkspace_sptr &mdws);
/// Input MDEventWorkspace
Mantid::API::IMDEventWorkspace_sptr m_inputWS;
/// Input PeaksWorkspace
Mantid::DataObjects::PeaksWorkspace_sptr m_peaksWS;
/// Peak centers
bool m_haveMultipleRun;
/// a map for run number and normalization value (monitor or time)
std::map<int, double> m_runNormMap;
std::map<int, Kernel::V3D> m_runPeakCenterMap;
bool m_useSinglePeakCenterFmUser;
Kernel::V3D m_peakCenter;
double m_peakRadius;
bool m_doMergePeak;
bool m_normalizeByMonitor;
bool m_normalizeByTime; // NormalizeByTime
double m_scaleFactor; // ScaleFactor
/// Peaks
std::vector<DataObjects::Peak> m_vecPeaks;
/// Integrated peaks' intensity per run number
std::map<int, double> m_runPeakCountsMap;
DataObjects::MaskWorkspace_sptr m_maskWS;
std::vector<detid_t> vecMaskedDetID;
/// Peak workspace
bool m_haveInputPeakWS;
};
} // namespace MDAlgorithms
} // namespace Mantid