Commit f686f1a3 authored by Paul Schütze's avatar Paul Schütze Committed by Simon Spannagel
Browse files

Move trapping time histogram filling

(cherry picked from commit 6b88d0e2)
parent 264a5f90
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -672,9 +672,6 @@ void GenericPropagationModule::run(Event* event) {
                LOG(DEBUG) << " Trapped " << charge_per_step << " at " << Units::display(final_position, {"mm", "um"})
                           << " in " << Units::display(time, "ns") << " time, removing";
                trapped_charges_count += charge_per_step;
                if(output_plots_) {
                    trapping_time_histo_->Fill(static_cast<double>(Units::convert(time, "ns")), charge_per_step);
                }
                continue;
            }

@@ -849,7 +846,12 @@ GenericPropagationModule::propagate(const ROOT::Math::XYZPoint& pos,
        auto [trapped, traptime] =
            trapping_(type, probability_distribution(random_generator), timestep, std::sqrt(efield.Mag2()));
        if(trapped) {
            if((initial_time + runge_kutta.getTime() + traptime) < integration_time_) {
            if(output_plots_) {
                trapping_time_histo_->Fill(static_cast<double>(Units::convert(runge_kutta.getTime(), "ns")), charge);
            }

            if((initial_time + runge_kutta.getTime() + detrap_time) < integration_time_) {
                LOG(DEBUG) << "De-trapping charge carrier after " << Units::display(detrap_time, {"ns", "us"});
                // De-trap and advance in time if still below integration time
                LOG(DEBUG) << "De-trapping charge carrier after " << Units::display(traptime, {"ns", "us"});
                runge_kutta.advanceTime(traptime);