22#include <OpticalElement.h>
31 std::vector<uint32_t> m_photons;
32 std::vector<Complex> m_amplitude;
36 Real m_pxWidth = 15e-6;
37 Real m_pxHeight = 15e-6;
39 uint32_t m_maxCounts = 0;
44 unsigned int m_stride;
50 hit(Real x, Real y, Complex amplitude)
56 col = floor((x + .5 * m_width) / m_pxWidth);
57 row = floor((y + .5 * m_height) / m_pxHeight);
59 if (col < 0 || col >= m_cols || row < 0 || row >= m_rows)
62 ndx = col + row * m_stride;
64 m_amplitude[ndx] += amplitude;
66 E = (m_amplitude[ndx] * std::conj(m_amplitude[ndx])).real();
68 if (m_photons[ndx] > m_maxCounts)
69 m_maxCounts = m_photons[ndx];
89 DetectorStorage(
unsigned int cols,
unsigned int rows, Real width, Real height);
91 void setPixelDimensions(Real, Real);
92 void setResolution(
unsigned,
unsigned);
95 bool savePNG(std::string
const &)
const;
96 bool saveRawData(std::string
const &)
const;
97 bool saveAmplitude(std::string
const &)
const;
99 unsigned int cols()
const;
100 unsigned int rows()
const;
101 unsigned int stride()
const;
102 const uint32_t *data()
const;
103 const Complex *amplitude()
const;
112 virtual void cast(
RayBeam &)
const;
113 virtual std::string name()
const;
121 Real m_pxWidth = 15e-6;
122 Real m_pxHeight = 15e-6;
128 unsigned int m_rows = 512;
129 unsigned int m_cols = 512;
134 virtual bool propertyChanged(std::string
const &,
PropertyValue const &)
override;
144 virtual void nativeMaterialOpenGL(std::string
const &)
override;
145 virtual void renderOpenGL()
override;
148 virtual bool savePNG(std::string
const &)
const;
149 virtual bool saveRawData(std::string
const &)
const;
150 virtual bool saveAmplitude(std::string
const &)
const;
152 unsigned int cols()
const;
153 unsigned int rows()
const;
154 Real pxWidth()
const;
155 Real pxHeight()
const;
158 unsigned int stride()
const;
159 const uint32_t *data()
const;
160 const Complex *amplitude()
const;
162 uint32_t maxCounts()
const;
163 Real maxEnergy()
const;
166 RZ_DECLARE_OPTICAL_ELEMENT(
Detector);
Definition: Detector.h:106
Definition: Detector.h:116
Definition: Detector.h:30
Definition: Element.h:393
Definition: Element.h:173
Definition: MediumBoundary.h:35
Definition: OpticalElement.h:87
Definition: ReferenceFrame.h:59
Definition: RotatedFrame.h:25