Skip to content
Snippets Groups Projects
Commit 23fe7452 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Core: RectangularDetector + few 'const'

parent 4ddf862d
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// BornAgain: simulate and fit scattering at grazing incidence // BornAgain: simulate and fit scattering at grazing incidence
// //
//! @file Core/Binning/IPixel.h //! @file Core/Binning/IPixel.h
//! @brief Defines interface IPixel. //! @brief Defines pure virtual interface IPixel (has no cpp file)
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
......
...@@ -81,9 +81,8 @@ size_t IDetector::totalSize() const ...@@ -81,9 +81,8 @@ size_t IDetector::totalSize() const
if (dim == 0) if (dim == 0)
return 0; return 0;
size_t result = 1; size_t result = 1;
for (size_t i_axis = 0; i_axis < dim; ++i_axis) { for (size_t i_axis = 0; i_axis < dim; ++i_axis)
result *= m_axes[i_axis]->size(); result *= m_axes[i_axis]->size();
}
return result; return result;
} }
......
...@@ -213,16 +213,16 @@ size_t RectangularDetector::indexOfSpecular(const Beam& beam) const ...@@ -213,16 +213,16 @@ size_t RectangularDetector::indexOfSpecular(const Beam& beam) const
{ {
if (dimension() != 2) if (dimension() != 2)
return totalSize(); return totalSize();
double alpha = beam.getAlpha(); const double alpha = beam.getAlpha();
double phi = beam.getPhi(); const double phi = beam.getPhi();
kvector_t k_spec = vecOfLambdaAlphaPhi(beam.getWavelength(), alpha, phi); const kvector_t k_spec = vecOfLambdaAlphaPhi(beam.getWavelength(), alpha, phi);
kvector_t normal_unit = m_normal_to_detector.unit(); const kvector_t normal_unit = m_normal_to_detector.unit();
double kd = k_spec.dot(normal_unit); const double kd = k_spec.dot(normal_unit);
if (kd <= 0.0) if (kd <= 0.0)
return totalSize(); return totalSize();
kvector_t k_orth = (k_spec / kd - normal_unit) * m_distance; const kvector_t k_orth = (k_spec / kd - normal_unit) * m_distance;
double u = k_orth.dot(m_u_unit) + m_u0; const double u = k_orth.dot(m_u_unit) + m_u0;
double v = k_orth.dot(m_v_unit) + m_v0; const double v = k_orth.dot(m_v_unit) + m_v0;
const IAxis& u_axis = getAxis(0); const IAxis& u_axis = getAxis(0);
const IAxis& v_axis = getAxis(1); const IAxis& v_axis = getAxis(1);
if (u_axis.contains(u) && v_axis.contains(v)) if (u_axis.contains(u) && v_axis.contains(v))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment