-
Notifications
You must be signed in to change notification settings - Fork 122
/
LoadIsawPeaks.h
89 lines (69 loc) · 3.13 KB
/
LoadIsawPeaks.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
#ifndef MANTID_CRYSTAL_LOADISAWPEAKS_H_
#define MANTID_CRYSTAL_LOADISAWPEAKS_H_
#include "MantidKernel/System.h"
#include "MantidAPI/IFileLoader.h"
#include "MantidDataObjects/PeaksWorkspace.h"
namespace Mantid {
namespace Crystal {
/**
* Load an ISAW-style .peaks or .integrate file
* into a PeaksWorkspace
*
* @author Janik Zikovsky, SNS
* @date 2011-03-07 15:22:11.897153
*/
class DLLExport LoadIsawPeaks
: public API::IFileLoader<Kernel::FileDescriptor> {
public:
/// Algorithm's name for identification
const std::string name() const override { return "LoadIsawPeaks"; }
/// Summary of algorithms purpose
const std::string summary() const override {
return "Load an ISAW-style .peaks file into a PeaksWorkspace.";
}
/// Algorithm's version for identification
int version() const override { return 1; }
/// Algorithm's category for identification
const std::string category() const override {
return "Crystal\\DataHandling;DataHandling\\Isaw";
}
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::FileDescriptor &descriptor) const override;
private:
/// Initialise the properties
void init() override;
/// Run the algorithm
void exec() override;
/// Reads calibration/detector section and returns first word of next line
std::string ApplyCalibInfo(std::ifstream &in, std::string startChar,
Geometry::Instrument_const_sptr instr, double &T0);
/// Reads first line of peaks file and returns first word of next line
std::string readHeader(Mantid::DataObjects::PeaksWorkspace_sptr outWS,
std::ifstream &in, double &T0);
/// Read a single peak from peaks file
DataObjects::Peak readPeak(DataObjects::PeaksWorkspace_sptr outWS,
std::string &lastStr, std::ifstream &in,
int &seqNum, std::string bankName, double qSign);
int findPixelID(Geometry::Instrument_const_sptr inst, std::string bankName,
int col, int row);
/// Read the header of a peak block section, returns first word of next line
std::string readPeakBlockHeader(std::string lastStr, std::ifstream &in,
int &run, int &detName, double &chi,
double &phi, double &omega, double &monCount);
/// Append peaks from given file to given workspace
void appendFile(Mantid::DataObjects::PeaksWorkspace_sptr outWS,
std::string filename);
/// Compare number of peaks in given file to given workspace
/// Throws std::length_error on mismatch
void checkNumberPeaks(Mantid::DataObjects::PeaksWorkspace_sptr outWS,
std::string filename);
/// Local cache of bank IComponents used in file
std::map<std::string, boost::shared_ptr<const Geometry::IComponent>> m_banks;
/// Retrieve cached bank (or load and cache for next time)
boost::shared_ptr<const Geometry::IComponent> getCachedBankByName(
std::string bankname,
const boost::shared_ptr<const Geometry::Instrument> &inst);
};
} // namespace Mantid
} // namespace Crystal
#endif /* MANTID_CRYSTAL_LOADISAWPEAKS_H_ */