24 : m_corner_pos(std::move(corner_pos)), m_width(std::move(width)), m_height(std::move(height))
26 m_normal = m_width.cross(m_height);
27 auto solid_angle_value = calculateSolidAngle();
28 m_solid_angle = solid_angle_value <= 0.0 ? 1.0 : solid_angle_value;
36 RectangularPixel* RectangularPixel::createZeroSizePixel(
double x,
double y)
const
41 kvector_t RectangularPixel::getK(
double x,
double y,
double wavelength)
const
44 double length = M_TWOPI / wavelength;
45 return normalizeLength(direction, length);
48 kvector_t RectangularPixel::getPosition(
double x,
double y)
const
50 return m_corner_pos + x * m_width + y * m_height;
53 double RectangularPixel::getIntegrationFactor(
double x,
double y)
const
55 if (m_solid_angle == 0.0)
58 double length = position.
mag();
59 return std::abs(position.
dot(m_normal)) / std::pow(length, 3) / m_solid_angle;
62 double RectangularPixel::getSolidAngle()
const
67 kvector_t RectangularPixel::normalizeLength(
const kvector_t direction,
double length)
const
69 return direction.
unit() * length;
72 double RectangularPixel::calculateSolidAngle()
const
74 kvector_t position = getPosition(0.5, 0.5);
75 double length = position.
mag();
76 return std::abs(position.
dot(m_normal)) / std::pow(length, 3);
Defines class IDetectorResolution.
Defines M_PI and some more mathematical constants.
Defines class RectangularPixel.
Defines class RegionOfInterest.
Defines class SimulationElement.
Defines some unit conversion factors and other constants in namespace Units.
auto dot(const BasicVector3D< U > &v) const
Returns dot product of vectors (antilinear in the first [=self] argument).
BasicVector3D< T > unit() const
Returns unit vector in direction of this. Throws for null vector.
double mag() const
Returns magnitude of the vector.
A pixel in a RectangularDetector.