Peak.h 4.55 KB
Newer Older
1
2
3
#ifndef MANTID_DATAOBJECTS_PEAK_H_
#define MANTID_DATAOBJECTS_PEAK_H_
    
4
#include "MantidGeometry/IInstrument.h"
5
6
#include "MantidGeometry/Math/Matrix.h"
#include "MantidGeometry/V3D.h"
7
#include "MantidKernel/PhysicalConstants.h"
8
#include "MantidKernel/System.h"
9
10
11
12
13
14
15
16
17
18
19
20


namespace Mantid
{
namespace DataObjects
{

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

27
28
    Peak(Mantid::Geometry::IInstrument_sptr m_inst, Mantid::Geometry::V3D QSampleFrame, double detectorDistance=1.0);
    Peak(Mantid::Geometry::IInstrument_sptr m_inst, Mantid::Geometry::V3D QSampleFrame, Mantid::Geometry::Matrix<double> goniometer, double detectorDistance=1.0);
Janik Zikovsky's avatar
Janik Zikovsky committed
29
    Peak(Mantid::Geometry::IInstrument_sptr m_inst, int m_DetectorID, double m_Wavelength);
30
    Peak(Mantid::Geometry::IInstrument_sptr m_inst, int m_DetectorID, double m_Wavelength, Mantid::Geometry::V3D HKL);
31
    Peak(Mantid::Geometry::IInstrument_sptr m_inst, int m_DetectorID, double m_Wavelength, Mantid::Geometry::V3D HKL, Mantid::Geometry::Matrix<double> goniometer);
32
33
34
35

    // Copy constructor is compiler-provided.
    //    Peak(const Peak & other);
    virtual ~Peak();
36

37
38
    void setInstrument(Mantid::Geometry::IInstrument_sptr inst);

39
    int getDetectorID() const;
40
41
42
43
44
45
    void setDetectorID(int m_DetectorID);
    Mantid::Geometry::IDetector_sptr getDetector() const;
    Mantid::Geometry::IInstrument_sptr getInstrument() const;

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

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

57
58
59
    Mantid::Geometry::V3D getQLabFrame() const;
    Mantid::Geometry::V3D getQSampleFrame() const;

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

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

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

73
74
75
    double getIntensity() const;
    double getSigmaIntensity() const;

76
    void setIntensity(double m_Intensity);
77
    void setSigmaIntensity(double m_SigmaIntensity);
78

79
80
81
    double getBinCount() const;
    void setBinCount(double m_BinCount);

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

85
86
87
    std::string getBankName() const;
    int getRow() const;
    int getCol() const;
88

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

93
  protected:
94
95
    /// Shared pointer to the instrument (for calculating some values )
    Mantid::Geometry::IInstrument_sptr m_inst;
96

97
98
    /// Detector pointed to
    Mantid::Geometry::IDetector_sptr m_det;
99

100
101
102
    /// Name of the parent bank
    std::string m_BankName;

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

115
116
117
118
    /// Integrated peak intensity
    double m_Intensity;

    /// Error (sigma) on peak intensity
119
    double m_SigmaIntensity;
120

121
122
123
    /// Count in the bin at the peak
    double m_BinCount;

124
125
126
127
128
129
    /// 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;

130
    /// Orientation matrix of the goniometer angles.
131
132
133
134
    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;
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

    /// 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;

152
153
154
155
156
157
158
  };


} // namespace Mantid
} // namespace DataObjects

#endif  /* MANTID_DATAOBJECTS_PEAK_H_ */