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

RadialStripDetector: implement current default: manual interpolation at sensor...

RadialStripDetector: implement current default: manual interpolation at sensor surface but not elsewhere
parent cea4ac03
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -249,3 +249,20 @@ bool RadialStripDetectorModel::areNeighbors(const Pixel::Index& seed,
    return (static_cast<size_t>(std::abs(row_seed_x - entrant.x())) <= distance) &&
           (static_cast<size_t>(std::abs(dist_y)) <= distance);
}

ROOT::Math::XYZPoint RadialStripDetectorModel::getSensorIntercept(const ROOT::Math::XYZPoint& inside,
                                                                  const ROOT::Math::XYZPoint& outside) const {

    auto check_position = outside;
    check_position.SetZ(inside.z());
    if(outside.z() > 0 && isWithinSensor(static_cast<ROOT::Math::XYZPoint>(check_position))) {
        // Carrier left sensor on the side of the sensor, interpolate end point on surface
        auto z_cur_border = std::fabs(outside.z() - getSensorSize().z() / 2.0);
        auto z_last_border = std::fabs(getSensorSize().z() / 2.0 - inside.z());
        auto z_total = z_cur_border + z_last_border;
        return (z_last_border / z_total) * static_cast<ROOT::Math::XYZVector>(outside) + (z_cur_border / z_total) * inside;
    } else {
        // Carrier left sensor on any order border, use last position inside instead
        return inside;
    }
}
+14 −0
Original line number Diff line number Diff line
@@ -207,6 +207,20 @@ namespace allpix {
         */
        bool isWithinSensor(const ROOT::Math::XYZPoint& position) const override;

        /**
         * @brief Calculate exit point of step outside sensor volume from one point inside the sensor (before step) and one
         * point outside (after step).
         * @throws std::invalid_argument if no intersection of track segment with sensor volume can be found
         * @param  inside Position before the step, inside the sensor volume
         * @param  outside  Position after the step, outside the sensor volume
         * @return Exit point of the sensor in local coordinates
         *
         * @note This method currently only interpolates the z coordinate between the last two points and returns the last
         * position inside otherwise
         */
        ROOT::Math::XYZPoint getSensorIntercept(const ROOT::Math::XYZPoint& inside,
                                                const ROOT::Math::XYZPoint& outside) const override;

        /**
         * @brief Returns if a local position is within the pixel implant region of the sensitive device
         * @param position Position in local coordinates of the detector model