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

#include "MantidAPI/IPeak.h"
5
#include "MantidGeometry/IInstrument.h"
6
7
#include "MantidGeometry/Math/Matrix.h"
#include "MantidGeometry/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
29
30
31
32
    Peak(Mantid::Geometry::IInstrument_const_sptr m_inst, Mantid::Geometry::V3D QSampleFrame, double detectorDistance=1.0);
    Peak(Mantid::Geometry::IInstrument_const_sptr m_inst, Mantid::Geometry::V3D QSampleFrame, Mantid::Geometry::Matrix<double> goniometer, double detectorDistance=1.0);
    Peak(Mantid::Geometry::IInstrument_const_sptr m_inst, int m_DetectorID, double m_Wavelength);
    Peak(Mantid::Geometry::IInstrument_const_sptr m_inst, int m_DetectorID, double m_Wavelength, Mantid::Geometry::V3D HKL);
    Peak(Mantid::Geometry::IInstrument_const_sptr m_inst, int m_DetectorID, double m_Wavelength, Mantid::Geometry::V3D HKL, Mantid::Geometry::Matrix<double> goniometer);
33
34

    // Copy constructor is compiler-provided.
Roman Tolchenov's avatar
Roman Tolchenov committed
35
    Peak(const Peak & other);
36
    Peak(const API::IPeak & ipeak);
37
    virtual ~Peak();
38

39
    void setInstrument(Mantid::Geometry::IInstrument_const_sptr inst);
40

41
    int getDetectorID() const;
42
    void setDetectorID(int m_DetectorID);
43
44
    Mantid::Geometry::IDetector_const_sptr getDetector() const;
    Mantid::Geometry::IInstrument_const_sptr getInstrument() const;
45
46
47

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

49
50
51
    double getH() const;
    double getK() const;
    double getL() const;
52
    Mantid::Geometry::V3D getHKL();
53
54
55
    void setH(double m_H);
    void setK(double m_K);
    void setL(double m_L);
56
    void setHKL(double H, double K, double L);
57
    void setHKL(Mantid::Geometry::V3D HKL);
58

59
60
61
    Mantid::Geometry::V3D getQLabFrame() const;
    Mantid::Geometry::V3D getQSampleFrame() const;

62
63
64
    void setQSampleFrame(Mantid::Geometry::V3D QSampleFrame, double detectorDistance=1.0);
    void setQLabFrame(Mantid::Geometry::V3D QLabFrame, double detectorDistance=1.0);

65
66
67
68
69
70
71
    void setWavelength(double wavelength);
    double getWavelength() const;
    double getDSpacing() const;
    double getTOF() const;

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

75
76
77
    double getIntensity() const;
    double getSigmaIntensity() const;

78
    void setIntensity(double m_Intensity);
79
    void setSigmaIntensity(double m_SigmaIntensity);
80

81
82
83
    double getBinCount() const;
    void setBinCount(double m_BinCount);

84
85
    Mantid::Geometry::Matrix<double> getGoniometerMatrix() const;
    void setGoniometerMatrix(Mantid::Geometry::Matrix<double> m_GoniometerMatrix);
86

87
88
89
    std::string getBankName() const;
    int getRow() const;
    int getCol() const;
90

91
92
    Mantid::Geometry::V3D getDetPos() const;
    double getL1() const;
Janik Zikovsky's avatar
Janik Zikovsky committed
93
    double getL2() const;
94

95
  protected:
96
    /// Shared pointer to the instrument (for calculating some values )
97
    Mantid::Geometry::IInstrument_const_sptr m_inst;
98

99
    /// Detector pointed to
100
    Mantid::Geometry::IDetector_const_sptr m_det;
101

102
103
104
    /// Name of the parent bank
    std::string m_BankName;

105
106
107
108
109
110
111
112
113
114
115
116
    /// 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;

117
118
119
120
    /// Integrated peak intensity
    double m_Intensity;

    /// Error (sigma) on peak intensity
121
    double m_SigmaIntensity;
122

123
124
125
    /// Count in the bin at the peak
    double m_BinCount;

126
127
128
129
130
131
    /// 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;

132
    /// Orientation matrix of the goniometer angles.
133
134
135
136
    Mantid::Geometry::Matrix<double> m_GoniometerMatrix;

    /// Inverse of the goniometer rotation matrix; used to go from Q in lab frame to Q in sample frame
    Mantid::Geometry::Matrix<double> m_InverseGoniometerMatrix;
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

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

    /// Cached row in the detector
    int m_Row;

    /// Cached column in the detector
    int m_Col;

    /// Cached source position
    Mantid::Geometry::V3D sourcePos;
    /// Cached sample position
    Mantid::Geometry::V3D samplePos;
    /// Cached detector position
    Mantid::Geometry::V3D detPos;

154
155
156
157
158
159
160
  };


} // namespace Mantid
} // namespace DataObjects

#endif  /* MANTID_DATAOBJECTS_PEAK_H_ */