Commit 3e295421 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Inline template specializations in DetectorField

parent 8248aed2
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ ADD_LIBRARY(
    config/ConfigManager.cpp
    config/OptionParser.cpp
    geometry/Detector.cpp
    geometry/DetectorField.cpp
    geometry/DetectorModel.cpp
    geometry/PixelDetectorModel.cpp
    geometry/GeometryManager.cpp
+0 −28
Original line number Diff line number Diff line
/**
 * @file
 * @brief Implementation of detector fields
 *
 * @copyright Copyright (c) 2018-2022 CERN and the Allpix Squared authors.
 * This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
 * In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
 * Intergovernmental Organization or submit itself to any jurisdiction.
 * SPDX-License-Identifier: MIT
 */

#include "DetectorField.hpp"

namespace allpix {

    /*
     * Vector field template specialization of helper function for field flipping
     */
    template <> 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 <> void flip_vector_components<double>(double&, bool, bool) {}
} // namespace allpix
+13 −0
Original line number Diff line number Diff line
@@ -74,6 +74,19 @@ 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
     *