/
LoadVulcanCalFile.h
106 lines (79 loc) · 3.05 KB
/
LoadVulcanCalFile.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
#ifndef MANTID_DATAHANDLING_LOADVULCANCALFILE_H_
#define MANTID_DATAHANDLING_LOADVULCANCALFILE_H_
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IAlgorithm.h"
#include "MantidAPI/MatrixWorkspace_fwd.h"
#include "MantidDataObjects/GroupingWorkspace.h"
#include "MantidDataObjects/MaskWorkspace.h"
#include "MantidDataObjects/OffsetsWorkspace.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/System.h"
#include "MantidDataObjects/EventWorkspace.h"
namespace Mantid {
namespace DataHandling {
enum VULCAN_OFFSET_LEVEL {
VULCAN_OFFSET_BANK,
VULCAN_OFFSET_MODULE,
VULCAN_OFFSET_STACK
};
/** Algorithm to load a 5-column ascii .cal file into up to 3 workspaces:
* a GroupingWorkspace, OffsetsWorkspace and/or MaskWorkspace.
*/
class DLLExport LoadVulcanCalFile : public API::Algorithm {
public:
LoadVulcanCalFile();
~LoadVulcanCalFile() override;
/// Algorithm's name for identification
const std::string name() const override { return "LoadVulcanCalFile"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Loads set of VULCAN's offset files into up to 3 workspaces: a "
"GroupingWorkspace, OffsetsWorkspace and/or MaskWorkspace.";
}
/// Algorithm's version for identification
int version() const override { return 1; }
/// Algorithm's category for identification
const std::string category() const override {
return "DataHandling\\Text;Diffraction\\DataHandling";
}
void getInstrument3WaysInit();
Geometry::Instrument_const_sptr getInstrument();
static void readCalFile(const std::string &calFileName,
Mantid::DataObjects::GroupingWorkspace_sptr groupWS,
Mantid::DataObjects::OffsetsWorkspace_sptr offsetsWS,
Mantid::DataObjects::MaskWorkspace_sptr maskWS);
private:
/// Initialise the properties
void init() override;
/// Run the algorithm
void exec() override;
void processInOutProperites();
/// Set up grouping workspace
void setupGroupingWorkspace();
/// Set up mask workspace
void setupMaskWorkspace();
void generateOffsetsWorkspace();
/// Read VULCAN's offset file
void readOffsetFile(std::map<detid_t, double> &map_detoffset);
void processOffsets(std::map<detid_t, double> map_detoffset);
/// Convert offsets from VUCLAN's offset to Mantid's
void convertOffsets();
Geometry::Instrument_const_sptr m_instrument;
/// Type of grouping
VULCAN_OFFSET_LEVEL m_groupingType;
std::string m_offsetFilename;
std::string m_badPixFilename;
DataObjects::OffsetsWorkspace_sptr m_tofOffsetsWS;
DataObjects::OffsetsWorkspace_sptr m_offsetsWS;
DataObjects::GroupingWorkspace_sptr m_groupWS;
DataObjects::MaskWorkspace_sptr m_maskWS;
// Verification tool
void alignEventWorkspace();
bool m_doAlignEventWS;
DataObjects::EventWorkspace_sptr m_eventWS;
// Map for bank: eff_L and theta (in degree)
std::map<int, std::pair<double, double>> m_effLTheta;
};
} // namespace Mantid
} // namespace DataHandling
#endif /* MANTID_DATAHANDLING_LOADVULCANCALFILE_H_ */