Loading src/core/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ ADD_LIBRARY( geometry/DetectorModel.cpp geometry/PixelDetectorModel.cpp geometry/GeometryManager.cpp geometry/BrickwallPixelDetectorModel.cpp geometry/HexagonalPixelDetectorModel.cpp geometry/RadialStripDetectorModel.cpp geometry/StaggeredPixelDetectorModel.cpp Allpix.cpp) # Link the dependencies Loading src/core/geometry/DetectorModel.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -12,10 +12,10 @@ #include "DetectorModel.hpp" #include "core/module/exceptions.h" #include "core/geometry/BrickwallPixelDetectorModel.hpp" #include "core/geometry/HexagonalPixelDetectorModel.hpp" #include "core/geometry/PixelDetectorModel.hpp" #include "core/geometry/RadialStripDetectorModel.hpp" #include "core/geometry/StaggeredPixelDetectorModel.hpp" #include "tools/liang_barsky.h" #include <Math/Translation3D.h> Loading Loading @@ -56,8 +56,8 @@ std::shared_ptr<DetectorModel> DetectorModel::factory(const std::string& name, c model = std::make_shared<RadialStripDetectorModel>(name, assembly, reader, config); } else if(geometry == "hexagonal") { model = std::make_shared<HexagonalPixelDetectorModel>(name, assembly, reader, config); } else if(geometry == "brickwall") { model = std::make_shared<BrickwallPixelDetectorModel>(name, assembly, reader, config); } else if(geometry == "staggered") { model = std::make_shared<StaggeredPixelDetectorModel>(name, assembly, reader, config); } else { LOG(FATAL) << "Model file " << config.getFilePath() << " geometry parameter is not valid"; // FIXME: The model can probably be silently ignored if we have more model readers later Loading src/core/geometry/BrickwallPixelDetectorModel.cpp→src/core/geometry/StaggeredPixelDetectorModel.cpp +10 −10 Original line number Diff line number Diff line /** * @file * @brief Implementation of a brick wall pixel detector model * @brief Implementation of a staggered pixel detector model * * @copyright Copyright (c) 2025 CERN and the Allpix Squared authors. * This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md". Loading @@ -9,12 +9,12 @@ * SPDX-License-Identifier: MIT */ #include "BrickwallPixelDetectorModel.hpp" #include "StaggeredPixelDetectorModel.hpp" #include "core/module/exceptions.h" using namespace allpix; BrickwallPixelDetectorModel::BrickwallPixelDetectorModel(std::string type, StaggeredPixelDetectorModel::StaggeredPixelDetectorModel(std::string type, const std::shared_ptr<DetectorAssembly>& assembly, const ConfigReader& reader, const Configuration& config) Loading @@ -29,7 +29,7 @@ BrickwallPixelDetectorModel::BrickwallPixelDetectorModel(std::string type, } } ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getMatrixCenter() const { ROOT::Math::XYZPoint StaggeredPixelDetectorModel::getMatrixCenter() const { // Matrix center is shifted by the pixel offset along x - if the offset is negative, because then the origin of the // local coordinate system not the leftmost pixel anymore, the matrix center is calculated relative to the local origin return {getMatrixSize().x() / 2.0 - getPixelSize().x() / 2.0 + (offset_ < 0 ? offset_ : 0.) * getPixelSize().x(), Loading @@ -37,7 +37,7 @@ ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getMatrixCenter() const { 0}; } ROOT::Math::XYZVector BrickwallPixelDetectorModel::getMatrixSize() const { ROOT::Math::XYZVector StaggeredPixelDetectorModel::getMatrixSize() const { // Matrix size is extended in x by the pixel offset: return {(getNPixels().x() + std::fabs(offset_)) * getPixelSize().x(), getNPixels().y() * getPixelSize().y(), 0}; } Loading @@ -46,7 +46,7 @@ ROOT::Math::XYZVector BrickwallPixelDetectorModel::getMatrixSize() const { * Faster implementation of matrix lookup for local coordinate positions than going through the pixel index * This is quite easy for rectangular pixels and matrices. */ bool BrickwallPixelDetectorModel::isWithinMatrix(const ROOT::Math::XYZPoint& position) const { bool StaggeredPixelDetectorModel::isWithinMatrix(const ROOT::Math::XYZPoint& position) const { // Check if we have an odd or even row bool odd_row = (static_cast<int>(std::lround(position.y() / pixel_size_.y())) % 2) != 0; Loading @@ -61,14 +61,14 @@ bool BrickwallPixelDetectorModel::isWithinMatrix(const ROOT::Math::XYZPoint& pos return true; } ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getPixelCenter(const int x, const int y) const { ROOT::Math::XYZPoint StaggeredPixelDetectorModel::getPixelCenter(const int x, const int y) const { auto size = getPixelSize(); auto local_x = size.x() * (x + ((y % 2) != 0 ? offset_ : 0.)); auto local_y = size.y() * y; return {local_x, local_y, 0}; } std::pair<int, int> BrickwallPixelDetectorModel::getPixelIndex(const ROOT::Math::XYZPoint& position) const { std::pair<int, int> StaggeredPixelDetectorModel::getPixelIndex(const ROOT::Math::XYZPoint& position) const { // Check if we have an odd or even row bool odd_row = (static_cast<int>(std::lround(position.y() / pixel_size_.y())) % 2) != 0; Loading @@ -77,7 +77,7 @@ std::pair<int, int> BrickwallPixelDetectorModel::getPixelIndex(const ROOT::Math: return {pixel_x, pixel_y}; } std::set<Pixel::Index> BrickwallPixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> StaggeredPixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> neighbors; #pragma GCC diagnostic push Loading @@ -102,7 +102,7 @@ std::set<Pixel::Index> BrickwallPixelDetectorModel::getNeighbors(const Pixel::In return neighbors; } bool BrickwallPixelDetectorModel::areNeighbors(const Pixel::Index& seed, bool StaggeredPixelDetectorModel::areNeighbors(const Pixel::Index& seed, const Pixel::Index& entrant, const size_t distance) const { // Along y, it's just adjacent rows Loading src/core/geometry/BrickwallPixelDetectorModel.hpp→src/core/geometry/StaggeredPixelDetectorModel.hpp +5 −5 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ * SPDX-License-Identifier: MIT */ #ifndef ALLPIX_BRICKWALL_PIXEL_DETECTOR_MODEL_H #define ALLPIX_BRICKWALL_PIXEL_DETECTOR_MODEL_H #ifndef ALLPIX_Staggered_PIXEL_DETECTOR_MODEL_H #define ALLPIX_Staggered_PIXEL_DETECTOR_MODEL_H #include <array> #include <string> Loading @@ -28,7 +28,7 @@ namespace allpix { * @ingroup DetectorModels * @brief Model of a pixel detector with a brick wall layout. */ class BrickwallPixelDetectorModel : public PixelDetectorModel { class StaggeredPixelDetectorModel : public PixelDetectorModel { public: /** * @brief Constructs the pixel detector model Loading @@ -37,7 +37,7 @@ namespace allpix { * @param reader Configuration reader with description of the model * @param config Configuration reference holding the unnamed section of detector configuration */ explicit BrickwallPixelDetectorModel(std::string type, explicit StaggeredPixelDetectorModel(std::string type, const std::shared_ptr<DetectorAssembly>& assembly, const ConfigReader& reader, const Configuration& config); Loading Loading @@ -109,4 +109,4 @@ namespace allpix { }; } // namespace allpix #endif // ALLPIX_BRICKWALL_PIXEL_DETECTOR_MODEL_H #endif // ALLPIX_Staggered_PIXEL_DETECTOR_MODEL_H tools/weightingpotential_generator/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -40,9 +40,9 @@ ADD_EXECUTABLE( ${ALLPIX_SRC}/core/config/exceptions.cpp ${ALLPIX_SRC}/core/geometry/DetectorModel.cpp ${ALLPIX_SRC}/core/geometry/PixelDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/BrickwallPixelDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/HexagonalPixelDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/RadialStripDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/StaggeredPixelDetectorModel.cpp ${ALLPIX_SRC}/core/module/ThreadPool.cpp) # Include Eigen dependency Loading Loading
src/core/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ ADD_LIBRARY( geometry/DetectorModel.cpp geometry/PixelDetectorModel.cpp geometry/GeometryManager.cpp geometry/BrickwallPixelDetectorModel.cpp geometry/HexagonalPixelDetectorModel.cpp geometry/RadialStripDetectorModel.cpp geometry/StaggeredPixelDetectorModel.cpp Allpix.cpp) # Link the dependencies Loading
src/core/geometry/DetectorModel.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -12,10 +12,10 @@ #include "DetectorModel.hpp" #include "core/module/exceptions.h" #include "core/geometry/BrickwallPixelDetectorModel.hpp" #include "core/geometry/HexagonalPixelDetectorModel.hpp" #include "core/geometry/PixelDetectorModel.hpp" #include "core/geometry/RadialStripDetectorModel.hpp" #include "core/geometry/StaggeredPixelDetectorModel.hpp" #include "tools/liang_barsky.h" #include <Math/Translation3D.h> Loading Loading @@ -56,8 +56,8 @@ std::shared_ptr<DetectorModel> DetectorModel::factory(const std::string& name, c model = std::make_shared<RadialStripDetectorModel>(name, assembly, reader, config); } else if(geometry == "hexagonal") { model = std::make_shared<HexagonalPixelDetectorModel>(name, assembly, reader, config); } else if(geometry == "brickwall") { model = std::make_shared<BrickwallPixelDetectorModel>(name, assembly, reader, config); } else if(geometry == "staggered") { model = std::make_shared<StaggeredPixelDetectorModel>(name, assembly, reader, config); } else { LOG(FATAL) << "Model file " << config.getFilePath() << " geometry parameter is not valid"; // FIXME: The model can probably be silently ignored if we have more model readers later Loading
src/core/geometry/BrickwallPixelDetectorModel.cpp→src/core/geometry/StaggeredPixelDetectorModel.cpp +10 −10 Original line number Diff line number Diff line /** * @file * @brief Implementation of a brick wall pixel detector model * @brief Implementation of a staggered pixel detector model * * @copyright Copyright (c) 2025 CERN and the Allpix Squared authors. * This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md". Loading @@ -9,12 +9,12 @@ * SPDX-License-Identifier: MIT */ #include "BrickwallPixelDetectorModel.hpp" #include "StaggeredPixelDetectorModel.hpp" #include "core/module/exceptions.h" using namespace allpix; BrickwallPixelDetectorModel::BrickwallPixelDetectorModel(std::string type, StaggeredPixelDetectorModel::StaggeredPixelDetectorModel(std::string type, const std::shared_ptr<DetectorAssembly>& assembly, const ConfigReader& reader, const Configuration& config) Loading @@ -29,7 +29,7 @@ BrickwallPixelDetectorModel::BrickwallPixelDetectorModel(std::string type, } } ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getMatrixCenter() const { ROOT::Math::XYZPoint StaggeredPixelDetectorModel::getMatrixCenter() const { // Matrix center is shifted by the pixel offset along x - if the offset is negative, because then the origin of the // local coordinate system not the leftmost pixel anymore, the matrix center is calculated relative to the local origin return {getMatrixSize().x() / 2.0 - getPixelSize().x() / 2.0 + (offset_ < 0 ? offset_ : 0.) * getPixelSize().x(), Loading @@ -37,7 +37,7 @@ ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getMatrixCenter() const { 0}; } ROOT::Math::XYZVector BrickwallPixelDetectorModel::getMatrixSize() const { ROOT::Math::XYZVector StaggeredPixelDetectorModel::getMatrixSize() const { // Matrix size is extended in x by the pixel offset: return {(getNPixels().x() + std::fabs(offset_)) * getPixelSize().x(), getNPixels().y() * getPixelSize().y(), 0}; } Loading @@ -46,7 +46,7 @@ ROOT::Math::XYZVector BrickwallPixelDetectorModel::getMatrixSize() const { * Faster implementation of matrix lookup for local coordinate positions than going through the pixel index * This is quite easy for rectangular pixels and matrices. */ bool BrickwallPixelDetectorModel::isWithinMatrix(const ROOT::Math::XYZPoint& position) const { bool StaggeredPixelDetectorModel::isWithinMatrix(const ROOT::Math::XYZPoint& position) const { // Check if we have an odd or even row bool odd_row = (static_cast<int>(std::lround(position.y() / pixel_size_.y())) % 2) != 0; Loading @@ -61,14 +61,14 @@ bool BrickwallPixelDetectorModel::isWithinMatrix(const ROOT::Math::XYZPoint& pos return true; } ROOT::Math::XYZPoint BrickwallPixelDetectorModel::getPixelCenter(const int x, const int y) const { ROOT::Math::XYZPoint StaggeredPixelDetectorModel::getPixelCenter(const int x, const int y) const { auto size = getPixelSize(); auto local_x = size.x() * (x + ((y % 2) != 0 ? offset_ : 0.)); auto local_y = size.y() * y; return {local_x, local_y, 0}; } std::pair<int, int> BrickwallPixelDetectorModel::getPixelIndex(const ROOT::Math::XYZPoint& position) const { std::pair<int, int> StaggeredPixelDetectorModel::getPixelIndex(const ROOT::Math::XYZPoint& position) const { // Check if we have an odd or even row bool odd_row = (static_cast<int>(std::lround(position.y() / pixel_size_.y())) % 2) != 0; Loading @@ -77,7 +77,7 @@ std::pair<int, int> BrickwallPixelDetectorModel::getPixelIndex(const ROOT::Math: return {pixel_x, pixel_y}; } std::set<Pixel::Index> BrickwallPixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> StaggeredPixelDetectorModel::getNeighbors(const Pixel::Index& idx, const size_t distance) const { std::set<Pixel::Index> neighbors; #pragma GCC diagnostic push Loading @@ -102,7 +102,7 @@ std::set<Pixel::Index> BrickwallPixelDetectorModel::getNeighbors(const Pixel::In return neighbors; } bool BrickwallPixelDetectorModel::areNeighbors(const Pixel::Index& seed, bool StaggeredPixelDetectorModel::areNeighbors(const Pixel::Index& seed, const Pixel::Index& entrant, const size_t distance) const { // Along y, it's just adjacent rows Loading
src/core/geometry/BrickwallPixelDetectorModel.hpp→src/core/geometry/StaggeredPixelDetectorModel.hpp +5 −5 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ * SPDX-License-Identifier: MIT */ #ifndef ALLPIX_BRICKWALL_PIXEL_DETECTOR_MODEL_H #define ALLPIX_BRICKWALL_PIXEL_DETECTOR_MODEL_H #ifndef ALLPIX_Staggered_PIXEL_DETECTOR_MODEL_H #define ALLPIX_Staggered_PIXEL_DETECTOR_MODEL_H #include <array> #include <string> Loading @@ -28,7 +28,7 @@ namespace allpix { * @ingroup DetectorModels * @brief Model of a pixel detector with a brick wall layout. */ class BrickwallPixelDetectorModel : public PixelDetectorModel { class StaggeredPixelDetectorModel : public PixelDetectorModel { public: /** * @brief Constructs the pixel detector model Loading @@ -37,7 +37,7 @@ namespace allpix { * @param reader Configuration reader with description of the model * @param config Configuration reference holding the unnamed section of detector configuration */ explicit BrickwallPixelDetectorModel(std::string type, explicit StaggeredPixelDetectorModel(std::string type, const std::shared_ptr<DetectorAssembly>& assembly, const ConfigReader& reader, const Configuration& config); Loading Loading @@ -109,4 +109,4 @@ namespace allpix { }; } // namespace allpix #endif // ALLPIX_BRICKWALL_PIXEL_DETECTOR_MODEL_H #endif // ALLPIX_Staggered_PIXEL_DETECTOR_MODEL_H
tools/weightingpotential_generator/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -40,9 +40,9 @@ ADD_EXECUTABLE( ${ALLPIX_SRC}/core/config/exceptions.cpp ${ALLPIX_SRC}/core/geometry/DetectorModel.cpp ${ALLPIX_SRC}/core/geometry/PixelDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/BrickwallPixelDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/HexagonalPixelDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/RadialStripDetectorModel.cpp ${ALLPIX_SRC}/core/geometry/StaggeredPixelDetectorModel.cpp ${ALLPIX_SRC}/core/module/ThreadPool.cpp) # Include Eigen dependency Loading