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

DetectorField: rename with repfix `PIXEL_`

parent 09fddf63
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -44,40 +44,40 @@ applied to the cell, and the following possibilities are available:
  The map is interpreted as field spanning the full Euclidean angle and aligned on the center of the pixel unit cell. No
  transformation is performed, but field values are obtained from the map with respect to the pixel center.

- `FULL_INVERSE`:
- `PIXEL_FULL_INVERSE`:
  The map is interpreted as full field, but with inverse alignment on the pixel corners as shown above. Consequently, the
  field value lookup from the four quadrants take into account their offset.

- `HALF_LEFT`:
- `PIXEL_HALF_LEFT`:
  The map represents the left Euclidean half-plane, aligned at the $`y`$ axis through the center of the pixel unit cell.
  Field values in the other half-plane are obtained by mirroring at the $`y`$ axis as indicated in the figure above.

- `HALF_RIGHT`:
- `PIXEL_HALF_RIGHT`:
  The map represents the right Euclidean half-plane, aligned at the $`y`$ axis through the center of the pixel unit cell.
  Field values in the other half-plane are obtained by mirroring at the $`y`$ axis as indicated in the figure above.

- `HALF_TOP`:
- `PIXEL_HALF_TOP`:
  The map represents the top Euclidean half-plane, aligned at the $`x`$ axis through the center of the pixel unit cell. Field
  values in the other half-plane are obtained by mirroring at the $`x`$ axis as indicated in the figure above.

- `HALF_BOTTOM`:
- `PIXEL_HALF_BOTTOM`:
  The map represents the bottom Euclidean half-plane, aligned at the $`x`$ axis through the center of the pixel unit cell.
  Field values in the other half-plane are obtained by mirroring at the $`x`$ axis as indicated in the figure above.

- `QUADRANT_I`:
- `PIXEL_QUADRANT_I`:
  The map represents the quadrant of the plane where both vector components have a positive sign. Field values in the other
  three quadrants are obtained by mirroring at the axes of the coordinate system as show in the figure above.

- `QUADRANT_II`:
- `PIXEL_QUADRANT_II`:
  The map represents the quadrant of the plane where the vector component $`x`$ has a negative and $`y`$ a positive sign.
  Field values in the other three quadrants are obtained by mirroring at the axes of the coordinate system as show in the
  figure above.

- `QUADRANT_III`:
- `PIXEL_QUADRANT_III`:
  The map represents the quadrant of the plane where both vector components have a negative sign. Field values in the other
  three quadrants are obtained by mirroring at the axes of the coordinate system as show in the figure above.

- `QUADRANT_IV`:
- `PIXEL_QUADRANT_IV`:
  The map represents the quadrant of the plane where the vector component $`x`$ has a positive and $`y`$ a negative sign.
  Field values in the other three quadrants are obtained by mirroring at the axes of the coordinate system as show in the
  figure above.
+12 −8
Original line number Diff line number Diff line
@@ -293,12 +293,16 @@ void Detector::check_field_match(std::array<double, 3> size,
    }

    // Check that the total field size is n*pitch:
    auto scale_x = field_scale[0] * (mapping == FieldMapping::FULL || mapping == FieldMapping::FULL_INVERSE ||
                                             mapping == FieldMapping::HALF_TOP || mapping == FieldMapping::HALF_BOTTOM
    auto scale_x =
        field_scale[0] * (mapping == FieldMapping::SENSOR || mapping == FieldMapping::PIXEL_FULL ||
                                  mapping == FieldMapping::PIXEL_FULL_INVERSE || mapping == FieldMapping::PIXEL_HALF_TOP ||
                                  mapping == FieldMapping::PIXEL_HALF_BOTTOM
                              ? 1.0
                              : 0.5);
    auto scale_y = field_scale[1] * (mapping == FieldMapping::FULL || mapping == FieldMapping::FULL_INVERSE ||
                                             mapping == FieldMapping::HALF_LEFT || mapping == FieldMapping::HALF_RIGHT
    auto scale_y =
        field_scale[1] * (mapping == FieldMapping::SENSOR || mapping == FieldMapping::PIXEL_FULL ||
                                  mapping == FieldMapping::PIXEL_FULL_INVERSE || mapping == FieldMapping::PIXEL_HALF_LEFT ||
                                  mapping == FieldMapping::PIXEL_HALF_RIGHT
                              ? 1.0
                              : 0.5);
    if(std::fabs(std::remainder(size[0] / scale_x, model_->getPixelSize().x())) > std::numeric_limits<double>::epsilon() ||
+17 −13
Original line number Diff line number Diff line
@@ -42,16 +42,20 @@ namespace allpix {
     * @brief Type of field maps
     */
    enum class FieldMapping {
        FULL = 0,     ///< The field map spans the full pixel plane
        FULL_INVERSE, ///< The field map spans the full pixel plane, but pixel centers are at field corners
        HALF_LEFT,    ///< The field map spans the left half of the volume and is mirrored along x
        HALF_RIGHT,   ///< The field map spans the right half of the volume and is mirrored along x
        HALF_TOP,     ///< The field map spans the top half of the volume and is mirrored along y
        HALF_BOTTOM,  ///< The field map spans the bottom half of the volume and is mirrored along y
        QUADRANT_I,   ///< The field map spans the top right quadrant of the volume and is mirrored to the other quadrants
        QUADRANT_II,  ///< The field map spans the top left quadrant of the volume and is mirrored to the other quadrants
        QUADRANT_III, ///< The field map spans the lower left quadrant of the volume and is mirrored to the other quadrants
        QUADRANT_IV,  ///< The field map spans the lower right quadrant of the volume and is mirrored to the other quadrants
        PIXEL_FULL = 0,     ///< The field map spans the full pixel plane
        PIXEL_FULL_INVERSE, ///< The field map spans the full pixel plane, but pixel centers are at field corners
        PIXEL_HALF_LEFT,    ///< The field map spans the left half of the volume and is mirrored along x
        PIXEL_HALF_RIGHT,   ///< The field map spans the right half of the volume and is mirrored along x
        PIXEL_HALF_TOP,     ///< The field map spans the top half of the volume and is mirrored along y
        PIXEL_HALF_BOTTOM,  ///< The field map spans the bottom half of the volume and is mirrored along y
        PIXEL_QUADRANT_I,   ///< The field map spans the top right quadrant of the volume and is mirrored to the other
                            ///< quadrants
        PIXEL_QUADRANT_II,  ///< The field map spans the top left quadrant of the volume and is mirrored to the other
                            ///< quadrants
        PIXEL_QUADRANT_III, ///< The field map spans the lower left quadrant of the volume and is mirrored to the other
                            ///< quadrants
        PIXEL_QUADRANT_IV,  ///< The field map spans the lower right quadrant of the volume and is mirrored to the other
                            ///< quadrants
        SENSOR, ///< The field is mapped to the full sensor, starting at the local coordinate origin. The field is
                ///< mirrored at its edges.
    };
@@ -177,7 +181,7 @@ namespace allpix {
         * * Scale of the field in x and y direction, defaults to one full pixel cell
         */
        std::array<size_t, 3> bins_{};
        FieldMapping mapping_{FieldMapping::FULL};
        FieldMapping mapping_{FieldMapping::PIXEL_FULL};
        std::array<double, 2> normalization_{{1., 1.}};
        std::array<double, 2> offset_{{0., 0.}};

+19 −17
Original line number Diff line number Diff line
@@ -97,37 +97,39 @@ namespace allpix {
        if(type_ == FieldType::GRID) {

            // Do we need to flip the position vector components?
            auto flip_x = (x > 0 && (mapping_ == FieldMapping::QUADRANT_II || mapping_ == FieldMapping::QUADRANT_III ||
                                     mapping_ == FieldMapping::HALF_LEFT)) ||
                          (x < 0 && (mapping_ == FieldMapping::QUADRANT_I || mapping_ == FieldMapping::QUADRANT_IV ||
                                     mapping_ == FieldMapping::HALF_RIGHT));
            auto flip_y = (y > 0 && (mapping_ == FieldMapping::QUADRANT_III || mapping_ == FieldMapping::QUADRANT_IV ||
                                     mapping_ == FieldMapping::HALF_BOTTOM)) ||
                          (y < 0 && (mapping_ == FieldMapping::QUADRANT_I || mapping_ == FieldMapping::QUADRANT_II ||
                                     mapping_ == FieldMapping::HALF_TOP));
            auto flip_x =
                (x > 0 && (mapping_ == FieldMapping::PIXEL_QUADRANT_II || mapping_ == FieldMapping::PIXEL_QUADRANT_III ||
                           mapping_ == FieldMapping::PIXEL_HALF_LEFT)) ||
                (x < 0 && (mapping_ == FieldMapping::PIXEL_QUADRANT_I || mapping_ == FieldMapping::PIXEL_QUADRANT_IV ||
                           mapping_ == FieldMapping::PIXEL_HALF_RIGHT));
            auto flip_y =
                (y > 0 && (mapping_ == FieldMapping::PIXEL_QUADRANT_III || mapping_ == FieldMapping::PIXEL_QUADRANT_IV ||
                           mapping_ == FieldMapping::PIXEL_HALF_BOTTOM)) ||
                (y < 0 && (mapping_ == FieldMapping::PIXEL_QUADRANT_I || mapping_ == FieldMapping::PIXEL_QUADRANT_II ||
                           mapping_ == FieldMapping::PIXEL_HALF_TOP));

            // Fold onto available field scale in the range [0 , 1] - flip coordinates if necessary
            auto px = (flip_x ? -1.0 : 1.0) * x * normalization_[0];
            auto py = (flip_y ? -1.0 : 1.0) * y * normalization_[1];

            if(mapping_ == FieldMapping::QUADRANT_II || mapping_ == FieldMapping::QUADRANT_III ||
               mapping_ == FieldMapping::HALF_LEFT) {
            if(mapping_ == FieldMapping::PIXEL_QUADRANT_II || mapping_ == FieldMapping::PIXEL_QUADRANT_III ||
               mapping_ == FieldMapping::PIXEL_HALF_LEFT) {
                px += 1.0;
            } else if(mapping_ == FieldMapping::FULL || mapping_ == FieldMapping::HALF_TOP ||
                      mapping_ == FieldMapping::HALF_BOTTOM) {
            } else if(mapping_ == FieldMapping::PIXEL_FULL || mapping_ == FieldMapping::PIXEL_HALF_TOP ||
                      mapping_ == FieldMapping::PIXEL_HALF_BOTTOM) {
                px += 0.5;
            }

            if(mapping_ == FieldMapping::QUADRANT_III || mapping_ == FieldMapping::QUADRANT_IV ||
               mapping_ == FieldMapping::HALF_BOTTOM) {
            if(mapping_ == FieldMapping::PIXEL_QUADRANT_III || mapping_ == FieldMapping::PIXEL_QUADRANT_IV ||
               mapping_ == FieldMapping::PIXEL_HALF_BOTTOM) {
                py += 1.0;
            } else if(mapping_ == FieldMapping::FULL || mapping_ == FieldMapping::HALF_LEFT ||
                      mapping_ == FieldMapping::HALF_RIGHT) {
            } else if(mapping_ == FieldMapping::PIXEL_FULL || mapping_ == FieldMapping::PIXEL_HALF_LEFT ||
                      mapping_ == FieldMapping::PIXEL_HALF_RIGHT) {
                py += 0.5;
            }

            // Shuffle quadrants for inverted maps
            if(mapping_ == FieldMapping::FULL_INVERSE) {
            if(mapping_ == FieldMapping::PIXEL_FULL_INVERSE) {
                px += (x >= 0 ? 0. : 1.0);
                py += (y >= 0 ? 0. : 1.0);
            }