Commit 827dfba3 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DetectorModel: *do not copy the implant vector* just to make a simple lookup!

parent 2e560811
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -289,15 +289,14 @@ std::vector<SupportLayer> DetectorModel::getSupportLayers() const {
std::optional<DetectorModel::Implant> DetectorModel::isWithinImplant(const ROOT::Math::XYZPoint& local_pos) const {

    // Bail out if we have no implants - no need to transform coordinates:
    auto implants = getImplants();
    if(implants.empty()) {
    if(implants_.empty()) {
        return std::nullopt;
    }

    auto [xpixel, ypixel] = getPixelIndex(local_pos);
    auto inPixelPos = local_pos - getPixelCenter(xpixel, ypixel);

    for(const auto& implant : implants) {
    for(const auto& implant : implants_) {
        if(implant.contains(inPixelPos)) {
            return implant;
        }