Peak.h 5.43 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"
Owen Arnold's avatar
Owen Arnold committed
10
11
#include "MantidDataObjects/PeakShape.h"
#include <boost/scoped_ptr.hpp>
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
123
124
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;
125

126
127
  /// Name of the parent bank
  std::string m_BankName;
128

129
130
  /// ID of the detector
  int m_DetectorID;
131

132
133
  /// H of the peak
  double m_H;
134

135
136
  /// K of the peak
  double m_K;
137

138
139
  /// L of the peak
  double m_L;
140

141
142
  /// Integrated peak intensity
  double m_Intensity;
143

144
145
  /// Error (sigma) on peak intensity
  double m_SigmaIntensity;
146

147
148
  /// Count in the bin at the peak
  double m_BinCount;
149

150
151
  /// Initial energy of neutrons at the peak
  double m_InitialEnergy;
152

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

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

159
160
161
  /// 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;
162

163
164
  /// Originating run number for this peak
  int m_RunNumber;
165

166
167
  /// Integrated monitor count over TOF range for this run
  double m_MonitorCount;
168

169
170
  /// Cached row in the detector
  int m_Row;
171

172
173
  /// Cached column in the detector
  int m_Col;
174

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

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

187
188
  /// List of contributing detectors IDs
  std::set<int> m_detIDs;
Owen Arnold's avatar
Owen Arnold committed
189
190
191

  /// Peak shape
  //boost::scoped_ptr<PeakShape> m_peakShape;
192
};
193
194
195
196

} // namespace Mantid
} // namespace DataObjects

197
#endif /* MANTID_DATAOBJECTS_PEAK_H_ */