Commit afc3d5bf authored by Håkan Wennlöf's avatar Håkan Wennlöf Committed by Simon Spannagel
Browse files

Updated [DepositionPointCharge] to use doubles for the nubmer of eh-pairs per length

(cherry picked from commit e83edc26)
parent 1da98d71
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
namespace allpix {
    /**
     * @throws std::overflow_error If the converted unit overflows the requested type
     * @throws std::invalid_argument If the resulting product of an input integer value and unit is not an integral value
     * @throws allpix::LogicError 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.
+3 −3
Original line number Diff line number Diff line
@@ -84,8 +84,8 @@ void DepositionPointChargeModule::initialize() {
        step_size_ = sqrt((end_local - start_local).Mag2()) / granularity;

        // We should deposit the equivalent of about 80 e/h pairs per micro meter (80`000 per mm):
        auto eh_per_um = config_.get<unsigned int>("number_of_charges");
        carriers_ = static_cast<unsigned int>(eh_per_um * step_size_);
        auto eh_per_um = config_.get<double>("number_of_charges");
        carriers_ = static_cast<unsigned int>(std::round(eh_per_um * step_size_));
        LOG(INFO) << "Step size for MIP energy deposition: " << Units::display(step_size_, {"um", "mm"}) << ", depositing "
                  << carriers_ << " e/h pairs per step (" << Units::display(eh_per_um, "/um") << ")";

@@ -99,7 +99,7 @@ void DepositionPointChargeModule::initialize() {

    } else {
        config_.setDefault("number_of_charges", 1);
        carriers_ = config_.get<unsigned int>("number_of_charges");
        carriers_ = static_cast<unsigned int>(std::round(config_.get<double>("number_of_charges")));
    }

    // Set up the different scan methods