Commit 4199a50f authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DetectorField: makr as noexcept and inline one method

parent 827dfba3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -174,14 +174,14 @@ namespace allpix {
         * @param offset The calculated global index to start from
         * @note The index sequence is expanded to the number of elements requested, depending on the template instance
         */
        template <std::size_t... I> auto get_impl(size_t offset, std::index_sequence<I...>) const;
        template <std::size_t... I> inline auto get_impl(size_t offset, std::index_sequence<I...>) const noexcept;

        /**
         * @brief Helper function to calculate the field index based on the distance from its center and to return the values
         * @param dist Distance from the center of the field to obtain the values for, given in local coordinates
         * @return Value(s) of the field at the queried point
         */
        T get_field_from_grid(const ROOT::Math::XYZPoint& dist) const;
        T get_field_from_grid(const ROOT::Math::XYZPoint& dist) const noexcept;

        /**
         * Field properties
+3 −2
Original line number Diff line number Diff line
@@ -165,7 +165,8 @@ namespace allpix {

    // Maps the field indices onto the range of -d/2 < x < d/2, where d is the scale of the field in coordinate x.
    // This means, {x,y,z} = (0,0,0) is in the center of the field.
    template <typename T, size_t N> T DetectorField<T, N>::get_field_from_grid(const ROOT::Math::XYZPoint& dist) const {
    template <typename T, size_t N>
    T DetectorField<T, N>::get_field_from_grid(const ROOT::Math::XYZPoint& dist) const noexcept {

        // Compute indices
        // If the number of bins in x or y is 1, the field is assumed to be 2-dimensional and the respective index
@@ -201,7 +202,7 @@ namespace allpix {
     */
    template <typename T, size_t N>
    template <std::size_t... I>
    auto DetectorField<T, N>::get_impl(size_t offset, std::index_sequence<I...>) const {
    auto DetectorField<T, N>::get_impl(size_t offset, std::index_sequence<I...>) const noexcept {
        return T{(*field_)[offset + I]...};
    }