src/modules/DefaultDigitizer/DefaultDigitizerModule.hpp

Definition of default digitization module. More…

Namespaces

Name
allpix
Helper class to hold support layers for a detector model.

Classes

Name
class allpix::DefaultDigitizerModule
Module to simulate digitization of collected charges.

Detailed Description

Definition of default digitization module.

Copyright: Copyright (c) 2017-2024 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT

Source code


#ifndef ALLPIX_DEFAULT_DIGITIZER_MODULE_H
#define ALLPIX_DEFAULT_DIGITIZER_MODULE_H

#include <memory>
#include <string>

#include "core/config/Configuration.hpp"
#include "core/messenger/Messenger.hpp"
#include "core/module/Event.hpp"
#include "core/module/Module.hpp"

#include "objects/PixelCharge.hpp"

#include "tools/ROOT.h"

#include <TFormula.h>
#include <TH1D.h>
#include <TH2D.h>

namespace allpix {
    class DefaultDigitizerModule : public Module {
    public:
        DefaultDigitizerModule(Configuration& config, Messenger* messenger, std::shared_ptr<Detector> detector);

        void initialize() override;

        void run(Event*) override;

        void finalize() override;

    private:
        Messenger* messenger_;

        double time_of_arrival(const PixelCharge& pixel_charge, double threshold) const;

        // Configuration
        bool output_plots_{};

        unsigned int electronics_noise_{};
        std::unique_ptr<TFormula> gain_function_{};

        bool saturation_{};
        unsigned int saturation_mean_{}, saturation_width_{};

        unsigned int threshold_{}, threshold_smearing_{};

        int qdc_resolution_{};
        unsigned int qdc_smearing_{};
        double qdc_offset_{};
        double qdc_slope_{};
        bool allow_zero_qdc_{};

        int tdc_resolution_{};
        double tdc_smearing_{};
        double tdc_offset_{};
        double tdc_slope_{};
        bool allow_zero_tdc_{};

        // Statistics
        std::atomic<unsigned long long> total_hits_{};

        // Output histograms
        Histogram<TH1D> h_pxq, h_pxq_noise, h_gain, h_pxq_gain, h_thr, h_pxq_thr, h_pxq_sat, h_pxq_adc_smear, h_pxq_adc,
            h_px_toa, h_px_tdc_smear, h_px_tdc;
        Histogram<TH2D> h_calibration, h_toa_calibration;
    };
} // namespace allpix

#endif /* ALLPIX_DEFAULT_DIGITIZER_MODULE_H */

Updated on 2024-12-13 at 08:31:37 +0000