Peak.h 5.44 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


namespace Mantid
{
namespace DataObjects
{

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

28
    Peak();
29
30
31
32
33
    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);
34
    Peak(Geometry::Instrument_const_sptr m_inst, double scattering, double m_Wavelength);
35

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

40
    void setDetectorID(int id);
41
    int getDetectorID() const;
42
43
44
45
46
    void addContributingDetID(const int id);
    void removeContributingDetector(const int id);
    const std::set<int> & getContributingDetIDs() const;

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

50
    bool findDetector();
51

52
53
    int getRunNumber() const;
    void setRunNumber(int m_RunNumber);
54

55
56
57
    double getMonitorCount() const;
    void setMonitorCount( double m_MonitorCount );

58
59
60
    double getH() const;
    double getK() const;
    double getL() const;
61
    Mantid::Kernel::V3D getHKL() const;
62
63
64
    void setH(double m_H);
    void setK(double m_K);
    void setL(double m_L);
65
    void setBankName(std::string m_BankName);
66
    void setHKL(double H, double K, double L);
67
    void setHKL(Mantid::Kernel::V3D HKL);
68
    void resetHKL();
69

70
71
    Mantid::Kernel::V3D getQLabFrame() const;
    Mantid::Kernel::V3D getQSampleFrame() const;
72
    Mantid::Kernel::V3D getDetectorPosition() const;
Owen Arnold's avatar
Owen Arnold committed
73
    Mantid::Kernel::V3D getDetectorPositionNoCheck() const;
74

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

78
79
    void setWavelength(double wavelength);
    double getWavelength() const;
80
    double getScattering() const;
81
82
83
84
85
    double getDSpacing() const;
    double getTOF() const;

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

89
90
91
    double getIntensity() const;
    double getSigmaIntensity() const;

92
    void setIntensity(double m_Intensity);
93
    void setSigmaIntensity(double m_SigmaIntensity);
94

95
96
97
    double getBinCount() const;
    void setBinCount(double m_BinCount);

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

101
102
103
    std::string getBankName() const;
    int getRow() const;
    int getCol() const;
104

105
    Mantid::Kernel::V3D getDetPos() const;
106
    double getL1() const;
Janik Zikovsky's avatar
Janik Zikovsky committed
107
    double getL2() const;
108

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

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

115
    /// Detector pointed to
116
    Geometry::IDetector_const_sptr m_det;
117

118
119
120
    /// Name of the parent bank
    std::string m_BankName;

121
122
123
124
125
126
127
128
129
130
131
132
    /// ID of the detector
    int m_DetectorID;

    /// H of the peak
    double m_H;

    /// K of the peak
    double m_K;

    /// L of the peak
    double m_L;

133
134
135
136
    /// Integrated peak intensity
    double m_Intensity;

    /// Error (sigma) on peak intensity
137
    double m_SigmaIntensity;
138

139
140
141
    /// Count in the bin at the peak
    double m_BinCount;

142
143
144
145
146
147
    /// Initial energy of neutrons at the peak
    double m_InitialEnergy;

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

148
    /// Orientation matrix of the goniometer angles.
149
    Mantid::Kernel::Matrix<double> m_GoniometerMatrix;
150
151

    /// Inverse of the goniometer rotation matrix; used to go from Q in lab frame to Q in sample frame
152
    Mantid::Kernel::Matrix<double> m_InverseGoniometerMatrix;
153
154
155
156

    /// Originating run number for this peak
    int m_RunNumber;

157
158
159
    /// Integrated monitor count over TOF range for this run
    double m_MonitorCount;

160
161
162
163
164
165
166
    /// Cached row in the detector
    int m_Row;

    /// Cached column in the detector
    int m_Col;

    /// Cached source position
167
    Mantid::Kernel::V3D sourcePos;
168
    /// Cached sample position
169
    Mantid::Kernel::V3D samplePos;
170
    /// Cached detector position
171
    Mantid::Kernel::V3D detPos;
172
173
174
175
176
    
    /// save values before setHKL is called for use in SortHKL
    double orig_H;
    double orig_K;
    double orig_L;
177

178
179
    /// List of contributing detectors IDs
    std::set<int> m_detIDs;
180
181
182
183
184
185
186
  };


} // namespace Mantid
} // namespace DataObjects

#endif  /* MANTID_DATAOBJECTS_PEAK_H_ */