Loading src/core/geometry/DetectorModel.cpp +5 −16 Original line number Diff line number Diff line Loading @@ -87,20 +87,7 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly> auto offset = implant_config.get<XYVector>("offset", {0, 0}); auto orientation = implant_config.get<double>("orientation", 0.); // if(size.x() > pixel_size.x() || size.y() > pixel_size.y()) { // throw InvalidValueError(implant_config, "size", "implant size cannot be larger than pixel pitch"); // } // if(size.z() > getSensorSize().z()) { // throw InvalidValueError(implant_config, "size", "implant depth cannot be larger than sensor thickness"); // } // Offset of the collection diode implant from the pixel center, defaults to zero. // if(std::fabs(offset.x()) + size.x() / 2 > pixel_size.x() / 2 || // std::fabs(offset.y()) + size.y() / 2 > pixel_size.y() / 2) { // throw InvalidValueError(implant_config, "offset", "implant exceeds pixel cell. Reduce implant size or offset"); // } addImplant(imtype, shape, size, offset, orientation); addImplant(imtype, shape, size, offset, orientation, implant_config); } // Read support layers Loading Loading @@ -135,11 +122,13 @@ void DetectorModel::addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation) { double orientation, Configuration config) { // Calculate offset from sensor center - sign of the shift depends on whether it's on front- or backside: auto offset_z = (getSensorSize().z() - size.z()) / 2. * (type == Implant::Type::FRONTSIDE ? 1 : -1); ROOT::Math::XYZVector full_offset(offset.x(), offset.y(), offset_z); implants_.push_back(Implant(type, shape, std::move(size), full_offset, ROOT::Math::RotationZ(orientation))); implants_.push_back( Implant(type, shape, std::move(size), full_offset, ROOT::Math::RotationZ(orientation), std::move(config))); } bool DetectorModel::Implant::contains(const ROOT::Math::XYZVector& position) const { Loading src/core/geometry/DetectorModel.hpp +15 −4 Original line number Diff line number Diff line Loading @@ -122,6 +122,12 @@ namespace allpix { */ bool contains(const ROOT::Math::XYZVector& position) const; /** * @brief Fetch the configuration of this implant * @return Implant configuration */ const Configuration& getConfiguration() const { return config_; } /** * @brief calculate intersection of line segment with implant. The first intersection in the given direction is * returned. Loading @@ -141,14 +147,16 @@ namespace allpix { * @param size Size of the implant * @param offset Offset of the implant from the pixel center * @param orientation Rotation angle around the implant z-axis * @param config Configuration */ Implant(Type type, Shape shape, ROOT::Math::XYZVector size, ROOT::Math::XYZVector offset, ROOT::Math::RotationZ orientation) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation) { } ROOT::Math::RotationZ orientation, Configuration config) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation), config_(config) {} // Actual parameters returned Type type_; Loading @@ -156,6 +164,7 @@ namespace allpix { ROOT::Math::XYZVector size_; ROOT::Math::XYZVector offset_; ROOT::Math::RotationZ orientation_; Configuration config_; }; /** Loading Loading @@ -272,12 +281,14 @@ namespace allpix { * @param size Size of the implant * @param offset Offset of the implant from the pixel center * @param orientation Rotation angle around the implant z-axis * @param config Configuration of the implant */ void addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation); double orientation, Configuration config); /** * @brief Get total size of the pixel grid Loading Loading
src/core/geometry/DetectorModel.cpp +5 −16 Original line number Diff line number Diff line Loading @@ -87,20 +87,7 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly> auto offset = implant_config.get<XYVector>("offset", {0, 0}); auto orientation = implant_config.get<double>("orientation", 0.); // if(size.x() > pixel_size.x() || size.y() > pixel_size.y()) { // throw InvalidValueError(implant_config, "size", "implant size cannot be larger than pixel pitch"); // } // if(size.z() > getSensorSize().z()) { // throw InvalidValueError(implant_config, "size", "implant depth cannot be larger than sensor thickness"); // } // Offset of the collection diode implant from the pixel center, defaults to zero. // if(std::fabs(offset.x()) + size.x() / 2 > pixel_size.x() / 2 || // std::fabs(offset.y()) + size.y() / 2 > pixel_size.y() / 2) { // throw InvalidValueError(implant_config, "offset", "implant exceeds pixel cell. Reduce implant size or offset"); // } addImplant(imtype, shape, size, offset, orientation); addImplant(imtype, shape, size, offset, orientation, implant_config); } // Read support layers Loading Loading @@ -135,11 +122,13 @@ void DetectorModel::addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation) { double orientation, Configuration config) { // Calculate offset from sensor center - sign of the shift depends on whether it's on front- or backside: auto offset_z = (getSensorSize().z() - size.z()) / 2. * (type == Implant::Type::FRONTSIDE ? 1 : -1); ROOT::Math::XYZVector full_offset(offset.x(), offset.y(), offset_z); implants_.push_back(Implant(type, shape, std::move(size), full_offset, ROOT::Math::RotationZ(orientation))); implants_.push_back( Implant(type, shape, std::move(size), full_offset, ROOT::Math::RotationZ(orientation), std::move(config))); } bool DetectorModel::Implant::contains(const ROOT::Math::XYZVector& position) const { Loading
src/core/geometry/DetectorModel.hpp +15 −4 Original line number Diff line number Diff line Loading @@ -122,6 +122,12 @@ namespace allpix { */ bool contains(const ROOT::Math::XYZVector& position) const; /** * @brief Fetch the configuration of this implant * @return Implant configuration */ const Configuration& getConfiguration() const { return config_; } /** * @brief calculate intersection of line segment with implant. The first intersection in the given direction is * returned. Loading @@ -141,14 +147,16 @@ namespace allpix { * @param size Size of the implant * @param offset Offset of the implant from the pixel center * @param orientation Rotation angle around the implant z-axis * @param config Configuration */ Implant(Type type, Shape shape, ROOT::Math::XYZVector size, ROOT::Math::XYZVector offset, ROOT::Math::RotationZ orientation) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation) { } ROOT::Math::RotationZ orientation, Configuration config) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation), config_(config) {} // Actual parameters returned Type type_; Loading @@ -156,6 +164,7 @@ namespace allpix { ROOT::Math::XYZVector size_; ROOT::Math::XYZVector offset_; ROOT::Math::RotationZ orientation_; Configuration config_; }; /** Loading Loading @@ -272,12 +281,14 @@ namespace allpix { * @param size Size of the implant * @param offset Offset of the implant from the pixel center * @param orientation Rotation angle around the implant z-axis * @param config Configuration of the implant */ void addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation); double orientation, Configuration config); /** * @brief Get total size of the pixel grid Loading