Loading src/modules/TransientPropagation/TransientPropagationModule.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -402,7 +402,7 @@ TransientPropagationModule::propagate(Event* event, << " q = " << Units::display(induced, "e"); // Create pulse if it doesn't exist. Store induced charge in the returned pulse iterator auto pixel_map_iterator = pixel_map.emplace(pixel_index, Pulse(timestep_)); auto pixel_map_iterator = pixel_map.emplace(pixel_index, Pulse(timestep_, integration_time_)); try { pixel_map_iterator.first->second.addCharge(induced, initial_time + runge_kutta.getTime()); } catch(const PulseBadAllocException& e) { Loading src/objects/Pulse.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,16 @@ using namespace allpix; Pulse::Pulse(double time_bin) : bin_(time_bin), initialized_(true) {} Pulse::Pulse(double time_bin) noexcept : bin_(time_bin), initialized_(true) {} Pulse::Pulse(double time_bin, double total_time) : bin_(time_bin), initialized_(true) { auto bins = static_cast<size_t>(std::lround(total_time / bin_)); try { this->reserve(bins); } catch(const std::bad_alloc& e) { PulseBadAllocException(bins, total_time, e.what()); } } void Pulse::addCharge(double charge, double time) { // For uninitialized pulses, store all charge in the first bin: Loading src/objects/Pulse.hpp +10 −1 Original line number Diff line number Diff line Loading @@ -26,8 +26,17 @@ namespace allpix { public: /** * @brief Construct a new pulse * @param time_bin Length in time of a single bin of the pulse */ explicit Pulse(double time_bin); explicit Pulse(double time_bin) noexcept; /** * @brief * @param time_bin Length in time of a single bin of the pulse * @param total_time Expected total length of the pulse used to pre-allocate memory * @throws PulseBadAllocException if memory allocation failed */ Pulse(double time_bin, double total_time); /** * @brief Construct default pulse, uninitialized Loading Loading
src/modules/TransientPropagation/TransientPropagationModule.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -402,7 +402,7 @@ TransientPropagationModule::propagate(Event* event, << " q = " << Units::display(induced, "e"); // Create pulse if it doesn't exist. Store induced charge in the returned pulse iterator auto pixel_map_iterator = pixel_map.emplace(pixel_index, Pulse(timestep_)); auto pixel_map_iterator = pixel_map.emplace(pixel_index, Pulse(timestep_, integration_time_)); try { pixel_map_iterator.first->second.addCharge(induced, initial_time + runge_kutta.getTime()); } catch(const PulseBadAllocException& e) { Loading
src/objects/Pulse.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,16 @@ using namespace allpix; Pulse::Pulse(double time_bin) : bin_(time_bin), initialized_(true) {} Pulse::Pulse(double time_bin) noexcept : bin_(time_bin), initialized_(true) {} Pulse::Pulse(double time_bin, double total_time) : bin_(time_bin), initialized_(true) { auto bins = static_cast<size_t>(std::lround(total_time / bin_)); try { this->reserve(bins); } catch(const std::bad_alloc& e) { PulseBadAllocException(bins, total_time, e.what()); } } void Pulse::addCharge(double charge, double time) { // For uninitialized pulses, store all charge in the first bin: Loading
src/objects/Pulse.hpp +10 −1 Original line number Diff line number Diff line Loading @@ -26,8 +26,17 @@ namespace allpix { public: /** * @brief Construct a new pulse * @param time_bin Length in time of a single bin of the pulse */ explicit Pulse(double time_bin); explicit Pulse(double time_bin) noexcept; /** * @brief * @param time_bin Length in time of a single bin of the pulse * @param total_time Expected total length of the pulse used to pre-allocate memory * @throws PulseBadAllocException if memory allocation failed */ Pulse(double time_bin, double total_time); /** * @brief Construct default pulse, uninitialized Loading