src/modules/DepositionLaser/DepositionLaserModule.hpp

Definition of [DepositionLaser] module. More…

Namespaces

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

Classes

Name
class allpix::DepositionLaserModule
Module to do function.

Detailed Description

Definition of [DepositionLaser] 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

Contains minimal dummy module to use as a start for the development of your own module

Refer to the User’s Manual for more details.

Source code


#include <map>
#include <optional>
#include <string>
#include <utility>

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

#include "TH1D.h"
#include "TH2D.h"
#include "TH3D.h"
#include "tools/ROOT.h"

namespace allpix {
    class DepositionLaserModule : public Module {

        enum class BeamGeometry {
            CYLINDRICAL,
            CONVERGING,
        };

        // Data to return from tracking algorithms
        struct PhotonHit { // NOLINT
            std::shared_ptr<Detector> detector;
            ROOT::Math::XYZPoint entry_global;
            ROOT::Math::XYZPoint hit_global;
            double time_to_entry;
            double time_to_hit;
        };

    public:
        DepositionLaserModule(Configuration& config, Messenger* messenger, GeometryManager* geo_manager);

        void initialize() override;

        void run(Event* event) override;

        void finalize() override;

    private:
        std::optional<std::pair<double, double>> intersect_with_sensor(const std::shared_ptr<const Detector>& detector,
                                                                       const ROOT::Math::XYZPoint& position_global,
                                                                       const ROOT::Math::XYZVector& direction_global) const;

        std::optional<std::pair<double, std::string>>
        intersect_with_passives(const ROOT::Math::XYZPoint& position_global,
                                const ROOT::Math::XYZVector& direction_global) const;

        ROOT::Math::XYZVector intersection_normal_vector(const std::shared_ptr<const Detector>& detector,
                                                         const ROOT::Math::XYZPoint& position_global) const;

        std::pair<ROOT::Math::XYZPoint, ROOT::Math::XYZVector> generate_photon_geometry(Event* event);

        std::optional<PhotonHit>
        track(const ROOT::Math::XYZPoint& position, const ROOT::Math::XYZVector& direction, double penetration_depth) const;

        // General module members
        GeometryManager* geo_manager_;
        Messenger* messenger_;

        // Laser parameters
        ROOT::Math::XYZPoint source_position_{};
        ROOT::Math::XYZVector beam_direction_{};
        double beam_waist_;

        BeamGeometry beam_geometry_{};
        double beam_convergence_angle_;
        double focal_distance_;

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

        size_t group_photons_;

        // Histograms
        bool output_plots_;
        Histogram<TH2D> h_intensity_sourceplane_{};
        Histogram<TH2D> h_intensity_focalplane_{};
        Histogram<TH1D> h_angular_phi_{};
        Histogram<TH1D> h_angular_theta_{};
        Histogram<TH1D> h_pulse_shape_{};
        std::map<const std::shared_ptr<Detector>, Histogram<TH3D>> h_deposited_charge_shapes_;
    };
} // namespace allpix

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