Commit 602d507d authored by Paul Schütze's avatar Paul Schütze
Browse files

Merge branch 'transient_followup' into 'master'

TransientPropagation: Remove Bricolage

See merge request allpix-squared/allpix-squared!601
parents 29d8e4d9 be465489
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -343,22 +343,14 @@ TransientPropagationModule::propagate(Event* event,
        // Check for overshooting outside the sensor and correct for it:
        if(!detector_->getModel()->isWithinSensor(static_cast<ROOT::Math::XYZPoint>(position))) {
            LOG(TRACE) << "Carrier outside sensor: " << Units::display(static_cast<ROOT::Math::XYZPoint>(position), {"nm"});
            // within_sensor = false;
            state = CarrierState::HALTED;

            auto check_position = position;
            check_position.z() = last_position.z();
            // Correct for position in z by interpolation to increase precision:
            if(detector_->getModel()->isWithinSensor(static_cast<ROOT::Math::XYZPoint>(check_position))) {
                // FIXME this currently depends in the direction of the drift
                if(position.z() > 0 && type == CarrierType::HOLE) {
                    LOG(DEBUG) << "Not stopping carrier " << type << " at "
                               << Units::display(static_cast<ROOT::Math::XYZPoint>(position), {"um"});
                } else if(position.z() < 0 && type == CarrierType::ELECTRON) {
                    LOG(DEBUG) << "Not stopping carrier " << type << " at "
                LOG(DEBUG) << "Stopping carrier " << type << " at "
                           << Units::display(static_cast<ROOT::Math::XYZPoint>(position), {"um"});
                } else {
                    state = CarrierState::HALTED;
                }

                // Carrier left sensor on top or bottom surface, interpolate
                auto z_cur_border = std::fabs(position.z() - model_->getSensorSize().z() / 2.0);
@@ -366,8 +358,6 @@ TransientPropagationModule::propagate(Event* event,
                auto z_total = z_cur_border + z_last_border;
                position = (z_last_border / z_total) * position + (z_cur_border / z_total) * last_position;
                LOG(TRACE) << "Moved carrier to: " << Units::display(static_cast<ROOT::Math::XYZPoint>(position), {"nm"});
            } else {
                state = CarrierState::HALTED;
            }
        }