Commit 90ef9db3 authored by Håkan Wennlöf's avatar Håkan Wennlöf
Browse files

FIxed bugs that popped up when using the fix

parent b00b2541
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@
#include <string>
#include <type_traits>

#include <iostream>

#include "text.h"

using namespace allpix;
+2 −6
Original line number Diff line number Diff line
@@ -12,12 +12,11 @@
#include "text.h"

#include <cmath>
#include <iostream>

namespace allpix {
    /**
     * @throws std::overflow_error If the converted unit overflows the requested type
     * @throws std::invalid_argument If the resulting product of value and unit is not an integral value
     * @throws std::invalid_argument If the resulting product of an input integer value and unit is not an integral value
     *
     * The unit type is internally converted to the type \ref Units::UnitType. After multiplying the unit, the output is
     * checked for overflow problems before the type is converted back to the original type.
@@ -29,13 +28,10 @@ namespace allpix {
            throw std::overflow_error("unit conversion overflows the type");
        }
        if constexpr(!std::is_integral_v<T>) {
            std::cout << "--- Regular one used! Input: " << inp << std::endl;
            std::cout << "--- Regular one used! Value: " << out << std::endl;
            return static_cast<T>(out);
        } else {
            // If the input is an integral value: check so that it doesn't have decimals after applying the unit
            if constexpr(std::is_integral_v<T>) {
                std::cout << "--- INteger one used! Input: " << inp << std::endl;
                std::cout << "--- INteger one used! Value: " << out << std::endl;
                if(out != static_cast<T>(out)) {
                    throw std::invalid_argument("Cannot use integer value with non-integer internal unit; the combination " +
                                                std::to_string(inp) + " " + str + " is invalid.");
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ CapacitiveTransferModule::CapacitiveTransferModule(Configuration& config,
    config_.setDefault("output_plots", 0);
    config_.setDefault("cross_coupling", true);
    config_.setDefault("nominal_gap", 0.0);
    config_.setDefault("max_depth_distance", Units::get(5, "um"));
    config_.setDefault("max_depth_distance", Units::get<double>(5, "um"));
    config_.setDefault("minimum_gap", config_.get<double>("nominal_gap"));

    cross_coupling_ = config_.get<bool>("cross_coupling");
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ DefaultDigitizerModule::DefaultDigitizerModule(Configuration& config,

    // TDC configuration
    config_.setDefault<int>("tdc_resolution", 0);
    config_.setDefault<int>("tdc_smearing", Units::get(50, "ps"));
    config_.setDefault<double>("tdc_smearing", Units::get(50.0, "ps"));
    config_.setDefault<double>("tdc_offset", Units::get(0, "ns"));
    config_.setDefault<double>("tdc_slope", Units::get(10, "ns"));
    config_.setDefault<bool>("allow_zero_tdc", false);
@@ -118,7 +118,7 @@ DefaultDigitizerModule::DefaultDigitizerModule(Configuration& config,
    allow_zero_qdc_ = config_.get<bool>("allow_zero_qdc");

    tdc_resolution_ = config_.get<int>("tdc_resolution");
    tdc_smearing_ = config_.get<unsigned int>("tdc_smearing");
    tdc_smearing_ = config_.get<double>("tdc_smearing");
    tdc_offset_ = config_.get<double>("tdc_offset");
    tdc_slope_ = config_.get<double>("tdc_slope");
    allow_zero_tdc_ = config_.get<bool>("allow_zero_tdc");
+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ namespace allpix {
        bool allow_zero_qdc_{};

        int tdc_resolution_{};
        unsigned int tdc_smearing_{};
        double tdc_smearing_{};
        double tdc_offset_{};
        double tdc_slope_{};
        bool allow_zero_tdc_{};
Loading