Peak.h 5.3 KB
Newer Older
1
2
#ifndef MANTID_DATAOBJECTS_PEAK_H_
#define MANTID_DATAOBJECTS_PEAK_H_
3
4

#include "MantidAPI/IPeak.h"
5
#include "MantidGeometry/Instrument.h"
6
7
#include "MantidKernel/Matrix.h"
#include "MantidKernel/V3D.h"
8
#include "MantidKernel/PhysicalConstants.h"
9
#include "MantidKernel/System.h"
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
116
117
118
119
120
121
122
namespace Mantid {
namespace DataObjects {

/** Structure describing a single-crystal peak
 *
 * @author Janik Zikovsky
 * @date 2011-04-15 13:24:07.963491
 */
class DLLExport Peak : public API::IPeak {
public:
  /// Allow PeakColumn class to directly access members.
  friend class PeakColumn;

  Peak();
  Peak(Geometry::Instrument_const_sptr m_inst, Mantid::Kernel::V3D QLabFrame,
       double detectorDistance = 1.0);
  Peak(Geometry::Instrument_const_sptr m_inst, Mantid::Kernel::V3D QSampleFrame,
       Mantid::Kernel::Matrix<double> goniometer,
       double detectorDistance = 1.0);
  Peak(Geometry::Instrument_const_sptr m_inst, int m_DetectorID,
       double m_Wavelength);
  Peak(Geometry::Instrument_const_sptr m_inst, int m_DetectorID,
       double m_Wavelength, Mantid::Kernel::V3D HKL);
  Peak(Geometry::Instrument_const_sptr m_inst, int m_DetectorID,
       double m_Wavelength, Mantid::Kernel::V3D HKL,
       Mantid::Kernel::Matrix<double> goniometer);
  Peak(Geometry::Instrument_const_sptr m_inst, double scattering,
       double m_Wavelength);

  // Construct a peak from a reference to the interface
  explicit Peak(const API::IPeak &ipeak);
  virtual ~Peak();

  void setDetectorID(int id);
  int getDetectorID() const;
  void addContributingDetID(const int id);
  void removeContributingDetector(const int id);
  const std::set<int> &getContributingDetIDs() const;

  void setInstrument(Geometry::Instrument_const_sptr inst);
  Geometry::IDetector_const_sptr getDetector() const;
  Geometry::Instrument_const_sptr getInstrument() const;

  bool findDetector();

  int getRunNumber() const;
  void setRunNumber(int m_RunNumber);

  double getMonitorCount() const;
  void setMonitorCount(double m_MonitorCount);

  double getH() const;
  double getK() const;
  double getL() const;
  Mantid::Kernel::V3D getHKL() const;
  void setH(double m_H);
  void setK(double m_K);
  void setL(double m_L);
  void setBankName(std::string m_BankName);
  void setHKL(double H, double K, double L);
  void setHKL(Mantid::Kernel::V3D HKL);
  void resetHKL();

  Mantid::Kernel::V3D getQLabFrame() const;
  Mantid::Kernel::V3D getQSampleFrame() const;
  Mantid::Kernel::V3D getDetectorPosition() const;
  Mantid::Kernel::V3D getDetectorPositionNoCheck() const;

  void setQSampleFrame(Mantid::Kernel::V3D QSampleFrame,
                       double detectorDistance = 1.0);
  void setQLabFrame(Mantid::Kernel::V3D QLabFrame,
                    double detectorDistance = 1.0);

  void setWavelength(double wavelength);
  double getWavelength() const;
  double getScattering() const;
  double getDSpacing() const;
  double getTOF() const;

  double getInitialEnergy() const;
  double getFinalEnergy() const;
  void setInitialEnergy(double m_InitialEnergy);
  void setFinalEnergy(double m_FinalEnergy);

  double getIntensity() const;
  double getSigmaIntensity() const;

  void setIntensity(double m_Intensity);
  void setSigmaIntensity(double m_SigmaIntensity);

  double getBinCount() const;
  void setBinCount(double m_BinCount);

  Mantid::Kernel::Matrix<double> getGoniometerMatrix() const;
  void setGoniometerMatrix(Mantid::Kernel::Matrix<double> m_GoniometerMatrix);

  std::string getBankName() const;
  int getRow() const;
  int getCol() const;

  Mantid::Kernel::V3D getDetPos() const;
  double getL1() const;
  double getL2() const;

  double getValueByColName(const std::string &name) const;

private:
  /// Shared pointer to the instrument (for calculating some values )
  Geometry::Instrument_const_sptr m_inst;

  /// Detector pointed to
  Geometry::IDetector_const_sptr m_det;
123

124
125
  /// Name of the parent bank
  std::string m_BankName;
126

127
128
  /// ID of the detector
  int m_DetectorID;
129

130
131
  /// H of the peak
  double m_H;
132

133
134
  /// K of the peak
  double m_K;
135

136
137
  /// L of the peak
  double m_L;
138

139
140
  /// Integrated peak intensity
  double m_Intensity;
141

142
143
  /// Error (sigma) on peak intensity
  double m_SigmaIntensity;
144

145
146
  /// Count in the bin at the peak
  double m_BinCount;
147

148
149
  /// Initial energy of neutrons at the peak
  double m_InitialEnergy;
150

151
152
  /// Final energy of the neutrons at peak (normally same as m_InitialEnergy)
  double m_FinalEnergy;
153

154
155
  /// Orientation matrix of the goniometer angles.
  Mantid::Kernel::Matrix<double> m_GoniometerMatrix;
156

157
158
159
  /// Inverse of the goniometer rotation matrix; used to go from Q in lab frame
  /// to Q in sample frame
  Mantid::Kernel::Matrix<double> m_InverseGoniometerMatrix;
160

161
162
  /// Originating run number for this peak
  int m_RunNumber;
163

164
165
  /// Integrated monitor count over TOF range for this run
  double m_MonitorCount;
166

167
168
  /// Cached row in the detector
  int m_Row;
169

170
171
  /// Cached column in the detector
  int m_Col;
172

173
174
175
176
177
178
  /// Cached source position
  Mantid::Kernel::V3D sourcePos;
  /// Cached sample position
  Mantid::Kernel::V3D samplePos;
  /// Cached detector position
  Mantid::Kernel::V3D detPos;
179

180
181
182
183
  /// save values before setHKL is called for use in SortHKL
  double orig_H;
  double orig_K;
  double orig_L;
184

185
186
187
  /// List of contributing detectors IDs
  std::set<int> m_detIDs;
};
188
189
190
191

} // namespace Mantid
} // namespace DataObjects

192
#endif /* MANTID_DATAOBJECTS_PEAK_H_ */