Commit 5ea4f489 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

ProjectionPropagation: avoid dividing by zero

(cherry picked from commit f76f5d56)
parent 2326f434
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -355,14 +355,13 @@ void ProjectionPropagationModule::run(Event* event) {
    }
    charge_lost = total_charge - total_projected_charge;

    if(total_charge > 0) {
    LOG(INFO) << "Total charge: " << total_charge << " (lost: " << charge_lost << ", "
                  << (charge_lost / total_charge * 100.) << "%)";
    }
              << (total_charge > 0 ? (charge_lost / total_charge * 100.) : 0) << "%)";

    LOG(DEBUG) << "Total count of propagated charge carriers: " << propagated_charges.size();

    if(output_plots_) {
        recombine_histo_->Fill(static_cast<double>(recombined_charges_count) / total_charge);
        recombine_histo_->Fill(total_charge > 0 ? (static_cast<double>(recombined_charges_count) / total_charge) : 0.);
    }

    // Create a new message with propagated charges