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

Move trapping time histogram filling

parent 676c4969
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -337,9 +337,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;
            }

@@ -540,7 +537,12 @@ GenericPropagationModule::propagate(const ROOT::Math::XYZPoint& pos,
        // Check if the charge carrier has been trapped:
        auto trapped = 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);