Commit 478a6151 authored by Ben Bruers's avatar Ben Bruers Committed by Simon Spannagel
Browse files

Added reflection, add translation to implant

parent 7084d81e
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -619,12 +619,6 @@ TransientPropagationModule::propagate(Event* event,
        // Apply diffusion step
        auto diffusion = carrier_diffusion(std::sqrt(efield.Mag2()), doping, timestep_);
        position += diffusion;
        runge_kutta.setValue(position);

        // Update step length histogram
        if(output_plots_) {
            step_length_histo_->Fill(static_cast<double>(Units::convert(step.value.norm(), "um")));
        }

        // If charge carrier reaches implant, interpolate surface position for higher accuracy:
        if(auto implant = model_->isWithinImplant(static_cast<ROOT::Math::XYZPoint>(position))) {
@@ -647,10 +641,27 @@ TransientPropagationModule::propagate(Event* event,

            auto intercept = model_->getSensorIntercept(static_cast<ROOT::Math::XYZPoint>(last_position),
                                                        static_cast<ROOT::Math::XYZPoint>(position));

            if(state == CarrierState::HALTED) {
                position = Eigen::Vector3d(intercept.x(), intercept.y(), intercept.z());
            } else {
                // geom. reflection on x-y plane at upper sensor boundary (we have an implant on the lower edge)
                ROOT::Math::XYZPoint reflected_position(position.x(), position.y(), 2. * intercept.z() - position.z());
                position = Eigen::Vector3d(reflected_position.x(), reflected_position.y(), reflected_position.z());
                LOG(TRACE) << "Carrier was reflected on the top boundary of the sensor to: "
                           << Units::display(static_cast<ROOT::Math::XYZPoint>(position), {"nm"});
            }
            LOG(TRACE) << "Moved carrier to: " << Units::display(static_cast<ROOT::Math::XYZPoint>(position), {"nm"});
        }

        // update position according to reflection etc.
        runge_kutta.setValue(position);

        // Update step length histogram
        if(output_plots_) {
            step_length_histo_->Fill(static_cast<double>(Units::convert(step.value.norm(), "um")));
        }

        // Physics effects:

        // Check if charge carrier is still alive: