Commit 54b957ad authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DetectorField: move specializations to tpp file, add one for maps

parent 6ae5b9de
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -75,19 +75,6 @@ namespace allpix {
     */
    template <typename T> void flip_vector_components(T& field, bool x, bool y);

    /*
     * Vector field template specialization of helper function for field flipping
     */
    template <> inline void flip_vector_components<ROOT::Math::XYZVector>(ROOT::Math::XYZVector& vec, bool x, bool y) {
        vec.SetXYZ((x ? -vec.x() : vec.x()), (y ? -vec.y() : vec.y()), vec.z());
    }

    /*
     * Scalar field template specialization of helper function for field flipping
     * Here, no inversion of the field components is required
     */
    template <> inline void flip_vector_components<double>(double&, bool, bool) {}

    /**
     * @brief Field instance of a detector
     *
+22 −0
Original line number Diff line number Diff line
@@ -256,4 +256,26 @@ namespace allpix {
        function_ = std::move(function);
        type_ = type;
    }

    /*
     * Vector field template specialization of helper function for field flipping
     */
    template <> inline void flip_vector_components<ROOT::Math::XYZVector>(ROOT::Math::XYZVector& vec, bool x, bool y) {
        vec.SetXYZ((x ? -vec.x() : vec.x()), (y ? -vec.y() : vec.y()), vec.z());
    }

    /*
     * Map field template specialization of helper function for field flipping.
     * This swaps the entries of the 5x5 map depending on whether it is flipped in that coordinate
     */
    template <> inline void flip_vector_components<std::array<double, 25>>(std::array<double, 25>&, bool, bool) {
        // FIXME need to flip map components here
    }

    /*
     * Scalar field template specialization of helper function for field flipping
     * Here, no inversion of the field components is required
     */
    template <> inline void flip_vector_components<double>(double&, bool, bool) {}

} // namespace allpix