Commit afa15e3a authored by Håkan Wennlöf's avatar Håkan Wennlöf
Browse files

Merge branch 'coverity' into 'master'

Fix Coverity Findings

See merge request allpix-squared/allpix-squared!945
parents 8cba7a1f cd157932
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ namespace allpix {

        private:
            std::atomic_bool valid_{true};
            mutable std::mutex mutex_;
            mutable std::mutex mutex_{};
            std::queue<T> queue_;
            std::set<uint64_t> completed_ids_;
            uint64_t current_id_{0};
@@ -276,7 +276,7 @@ namespace allpix {
        std::atomic_bool done_{false};

        std::atomic<unsigned int> run_cnt_{0};
        mutable std::mutex run_mutex_;
        mutable std::mutex run_mutex_{};
        std::condition_variable run_condition_;
        std::vector<std::thread> threads_;

+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ namespace allpix {
        std::string user_;
        std::string password_;
        std::string run_id_;
        int run_nr_;
        int run_nr_{0};
        bool timing_global_{};

        // Statistical information about number of objects
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ PrimariesReaderHepMC::PrimariesReaderHepMC(const Configuration& config) {
    } else if(model == FileModel::HEPMCTTREE) {
        file_path = config.getPathWithExtension("file_name", "root", true);
        reader_ = std::make_unique<HepMC3::ReaderRootTree>(file_path);
    } else {
        throw InvalidValueError(config, "model", "failed to instantiate file reader");
    }

    if(reader_->failed()) {
+3 −3
Original line number Diff line number Diff line
@@ -130,10 +130,10 @@ namespace allpix {

        size_t number_of_photons_;
        double wavelength_;
        double absorption_length_;
        double refractive_index_;
        double absorption_length_{0.};
        double refractive_index_{0.};
        double pulse_duration_;
        bool is_user_optics_;
        bool is_user_optics_{false};

        // Histograms
        bool output_plots_;
+4 −5
Original line number Diff line number Diff line
@@ -420,10 +420,9 @@ 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();

    // Output plots if required
@@ -432,7 +431,7 @@ void ProjectionPropagationModule::run(Event* event) {
    }

    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
Loading