Commit 3b3c1f2e authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DetectorModel: rename some methods for clarity

parent 15565f2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ void Detector::build_transform() {
    // * The shift from the origin to the detector position
    ROOT::Math::Transform3D transform_center(rotation_center, translation_center);
    // Transform from locally centered to local coordinates
    ROOT::Math::Translation3D translation_local(static_cast<ROOT::Math::XYZVector>(model_->getCenter()));
    ROOT::Math::Translation3D translation_local(static_cast<ROOT::Math::XYZVector>(model_->getMatrixCenter()));
    ROOT::Math::Transform3D transform_local(translation_local);
    // Compute total transform local to global by first transforming local to locally centered and then to global coordinates
    transform_ = transform_center * transform_local.Inverse();
+7 −7
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ DetectorModel::DetectorModel(std::string type, ConfigReader reader) : type_(std:
    }
}

ROOT::Math::XYZPoint DetectorModel::getGeometricalCenter() const {
ROOT::Math::XYZPoint DetectorModel::getModelCenter() const {

    // Prepare detector assembly stack (sensor, chip, supports) with z-positions and thicknesses:
    std::vector<std::pair<double, double>> stack = {{getSensorCenter().z(), getSensorSize().z()},
@@ -91,7 +91,7 @@ ROOT::Math::XYZPoint DetectorModel::getGeometricalCenter() const {
    // half thickness)
    auto center =
        ((element_first.first - element_first.second / 2.0) + (element_last.first + element_last.second / 2.0)) / 2.0;
    return ROOT::Math::XYZPoint(getCenter().x(), getCenter().y(), center);
    return ROOT::Math::XYZPoint(getMatrixCenter().x(), getMatrixCenter().y(), center);
}

std::vector<Configuration> DetectorModel::getConfigurations() const {
@@ -144,10 +144,10 @@ ROOT::Math::XYZVector DetectorModel::getSize() const {
    }

    ROOT::Math::XYZVector size;
    size.SetX(2 * std::max(max.x() - getCenter().x(), getCenter().x() - min.x()));
    size.SetY(2 * std::max(max.y() - getCenter().y(), getCenter().y() - min.y()));
    size.SetZ((max.z() - getCenter().z()) +
              (getCenter().z() - min.z())); // max.z() is positive (chip side) and min.z() is negative (sensor side)
    size.SetX(2 * std::max(max.x() - getMatrixCenter().x(), getMatrixCenter().x() - min.x()));
    size.SetY(2 * std::max(max.y() - getMatrixCenter().y(), getMatrixCenter().y() - min.y()));
    size.SetZ((max.z() - getMatrixCenter().z()) +
              (getMatrixCenter().z() - min.z())); // max.z() is positive (chip side) and min.z() is negative (sensor side)
    return size;
}

@@ -166,7 +166,7 @@ std::vector<DetectorModel::SupportLayer> DetectorModel::getSupportLayers() const
            chip_offset += layer.size_.z();
        }

        layer.center_ = getCenter() + offset;
        layer.center_ = getMatrixCenter() + offset;
    }

    return ret_layers;
+10 −9
Original line number Diff line number Diff line
@@ -174,9 +174,10 @@ namespace allpix {
         *
         * The center coordinate corresponds to the \ref Detector::getPosition "position" in the global frame.
         */
        virtual ROOT::Math::XYZPoint getCenter() const {
            return {
                getGridSize().x() / 2.0 - getPixelSize().x() / 2.0, getGridSize().y() / 2.0 - getPixelSize().y() / 2.0, 0};
        virtual ROOT::Math::XYZPoint getMatrixCenter() const {
            return {getMatrixSize().x() / 2.0 - getPixelSize().x() / 2.0,
                    getMatrixSize().y() / 2.0 - getPixelSize().y() / 2.0,
                    0};
        }

        /**
@@ -184,7 +185,7 @@ namespace allpix {
         * @note This returns the center of the geometry model, i.e. including all support layers, passive readout chips et
         * cetera.
         */
        virtual ROOT::Math::XYZPoint getGeometricalCenter() const;
        virtual ROOT::Math::XYZPoint getModelCenter() const;

        /**
         * @brief Get size of the wrapper box around the model that contains all elements
@@ -238,7 +239,7 @@ namespace allpix {
         * @warning The grid has zero thickness
         * @note This is basically a 2D method, but provided in 3D because it is primarily used there
         */
        virtual ROOT::Math::XYZVector getGridSize() const {
        virtual ROOT::Math::XYZVector getMatrixSize() const {
            return {getNPixels().x() * getPixelSize().x(), getNPixels().y() * getPixelSize().y(), 0};
        }

@@ -253,7 +254,7 @@ namespace allpix {
            ROOT::Math::XYZVector excess_thickness((sensor_excess_.at(1) + sensor_excess_.at(3)),
                                                   (sensor_excess_.at(0) + sensor_excess_.at(2)),
                                                   sensor_thickness_);
            return getGridSize() + excess_thickness;
            return getMatrixSize() + excess_thickness;
        }
        /**
         * @brief Get center of the sensor in local coordinates
@@ -264,7 +265,7 @@ namespace allpix {
        virtual ROOT::Math::XYZPoint getSensorCenter() const {
            ROOT::Math::XYZVector offset(
                (sensor_excess_.at(1) - sensor_excess_.at(3)) / 2.0, (sensor_excess_.at(0) - sensor_excess_.at(2)) / 2.0, 0);
            return getCenter() + offset;
            return getMatrixCenter() + offset;
        }
        /**
         * @brief Set the thickness of the sensor
@@ -303,7 +304,7 @@ namespace allpix {
            ROOT::Math::XYZVector excess_thickness((sensor_excess_.at(1) + sensor_excess_.at(3)),
                                                   (sensor_excess_.at(0) + sensor_excess_.at(2)),
                                                   chip_thickness_);
            return getGridSize() + excess_thickness;
            return getMatrixSize() + excess_thickness;
        }
        /**
         * @brief Get center of the chip in local coordinates
@@ -315,7 +316,7 @@ namespace allpix {
            ROOT::Math::XYZVector offset((sensor_excess_.at(1) - sensor_excess_.at(3)) / 2.0,
                                         (sensor_excess_.at(0) - sensor_excess_.at(2)) / 2.0,
                                         getSensorSize().z() / 2.0 + getChipSize().z() / 2.0);
            return getCenter() + offset;
            return getMatrixCenter() + offset;
        }
        /**
         * @brief Set the thickness of the sensor
+2 −2
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ ROOT::Math::XYZPoint GeometryManager::getMinimumCoordinate() {
        std::array<int, 8> offset_z = {{1, -1, 1, -1, 1, -1, 1, -1}};

        for(size_t i = 0; i < 8; ++i) {
            auto point = model->getGeometricalCenter();
            auto point = model->getModelCenter();
            point.SetX(point.x() + offset_x.at(i) * model->getSize().x() / 2.0);
            point.SetY(point.y() + offset_y.at(i) * model->getSize().y() / 2.0);
            point.SetZ(point.z() + offset_z.at(i) * model->getSize().z() / 2.0);
@@ -207,7 +207,7 @@ ROOT::Math::XYZPoint GeometryManager::getMaximumCoordinate() {
        std::array<int, 8> offset_z = {{1, -1, 1, -1, 1, -1, 1, -1}};

        for(size_t i = 0; i < 8; ++i) {
            auto point = model->getGeometricalCenter();
            auto point = model->getModelCenter();
            point.SetX(point.x() + offset_x.at(i) * model->getSize().x() / 2.0);
            point.SetY(point.y() + offset_y.at(i) * model->getSize().y() / 2.0);
            point.SetZ(point.z() + offset_z.at(i) * model->getSize().z() / 2.0);
+3 −3
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ namespace allpix {
        ROOT::Math::XYZVector getChipSize() const override {
            ROOT::Math::XYZVector excess_thickness(
                (chip_excess_.at(1) + chip_excess_.at(3)), (chip_excess_.at(0) + chip_excess_.at(2)), chip_thickness_);
            return getGridSize() + excess_thickness;
            return getMatrixSize() + excess_thickness;
        }
        /**
         * @brief Get center of the chip in local coordinates
@@ -80,7 +80,7 @@ namespace allpix {
            ROOT::Math::XYZVector offset((chip_excess_.at(1) - chip_excess_.at(3)) / 2.0,
                                         (chip_excess_.at(0) - chip_excess_.at(2)) / 2.0,
                                         getSensorSize().z() / 2.0 + getChipSize().z() / 2.0 + getBumpHeight());
            return getCenter() + offset;
            return getMatrixCenter() + offset;
        }

        /**
@@ -146,7 +146,7 @@ namespace allpix {
        virtual ROOT::Math::XYZPoint getBumpsCenter() const {
            ROOT::Math::XYZVector offset(
                bump_offset_.x(), bump_offset_.y(), getSensorSize().z() / 2.0 + getBumpHeight() / 2.0);
            return getCenter() + offset;
            return getMatrixCenter() + offset;
        }
        /**
         * @brief Get the radius of the sphere of every individual bump bond (union solid with cylinder)
Loading