Commit a94d0afc authored by Simon Spannagel's avatar Simon Spannagel
Browse files

PropagatedCharge: introduce new member CarrierState indicating fate of the carrier

parent cde27218
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -21,8 +21,10 @@ PropagatedCharge::PropagatedCharge(ROOT::Math::XYZPoint local_position,
                                   unsigned int charge,
                                   double local_time,
                                   double global_time,
                                   CarrierState state,
                                   const DepositedCharge* deposited_charge)
    : SensorCharge(std::move(local_position), std::move(global_position), type, charge, local_time, global_time) {
    : SensorCharge(std::move(local_position), std::move(global_position), type, charge, local_time, global_time),
      state_(state) {
    deposited_charge_ = PointerWrapper<DepositedCharge>(deposited_charge);
    if(deposited_charge != nullptr) {
        mc_particle_ = deposited_charge->mc_particle_;
@@ -35,6 +37,7 @@ PropagatedCharge::PropagatedCharge(ROOT::Math::XYZPoint local_position,
                                   std::map<Pixel::Index, Pulse> pulses,
                                   double local_time,
                                   double global_time,
                                   CarrierState state,
                                   const DepositedCharge* deposited_charge)
    : PropagatedCharge(std::move(local_position),
                       std::move(global_position),
@@ -47,6 +50,7 @@ PropagatedCharge::PropagatedCharge(ROOT::Math::XYZPoint local_position,
                                       }),
                       local_time,
                       global_time,
                       state,
                       deposited_charge) {
    pulses_ = std::move(pulses);
}
@@ -81,6 +85,10 @@ std::map<Pixel::Index, Pulse> PropagatedCharge::getPulses() const {
    return pulses_;
}

CarrierState PropagatedCharge::getState() const {
    return state_;
}

void PropagatedCharge::print(std::ostream& out) const {
    out << "--- Propagated charge information\n";
    SensorCharge::print(out);
+17 −1
Original line number Diff line number Diff line
@@ -19,6 +19,16 @@
#include "SensorCharge.hpp"

namespace allpix {

    /**
     * @brief State of the PropagatedCharge
     */
    enum class CarrierState {
        MOTION = 0, ///< The propagated charge carrier is in motion
        RECOMBINED, ///< The propagated charge carrier has recombined with the lattice
        TRAPPED,    ///< The propagated charge carrier is trapped temporarily
    };

    /**
     * @ingroup Objects
     * @brief Set of charges propagated through the sensor
@@ -43,6 +53,7 @@ namespace allpix {
                         unsigned int charge,
                         double local_time,
                         double global_time,
                         CarrierState state = CarrierState::MOTION,
                         const DepositedCharge* deposited_charge = nullptr);

        /**
@@ -61,6 +72,7 @@ namespace allpix {
                         std::map<Pixel::Index, Pulse> pulses,
                         double local_time,
                         double global_time,
                         CarrierState state = CarrierState::MOTION,
                         const DepositedCharge* deposited_charge = nullptr);

        /**
@@ -81,6 +93,8 @@ namespace allpix {
         */
        std::map<Pixel::Index, Pulse> getPulses() const;

        CarrierState getState() const;

        /**
         * @brief Print an ASCII representation of PropagatedCharge to the given stream
         * @param out Stream to print to
@@ -90,7 +104,7 @@ namespace allpix {
        /**
         * @brief ROOT class definition
         */
        ClassDefOverride(PropagatedCharge, 6); // NOLINT
        ClassDefOverride(PropagatedCharge, 7); // NOLINT
        /**
         * @brief Default constructor for ROOT I/O
         */
@@ -104,6 +118,8 @@ namespace allpix {
        PointerWrapper<MCParticle> mc_particle_;

        std::map<Pixel::Index, Pulse> pulses_;

        CarrierState state_{CarrierState::MOTION};
    };

    /**