Loading doc/usermanual/05_geometry_detectors/02_models.md +0 −6 Original line number Diff line number Diff line Loading @@ -167,12 +167,6 @@ Implants allow for the following parameters: 2D values in the x-y plane, defining the offset of the implant from the center of the pixel cell. This parameter is optional and defaults to $`0, 0`$, i.e. a position at the pixel center be default. - `material`: The material of this implant. Defaults to silicon. It should be noted that Allpix Squared does not provide a set of materials to choose from; it is up to the modules using this parameter to implement the materials such that they can use it. [Chapter 7](../07_modules/_index.md) provides details about the materials supported by the geometry builder module `GeometryBuilderGeant4`. ### Support Layers Loading models/test_implants.conf +0 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ chip_excess_bottom = 150um [implant] size = 200um 400um 0um orientation = 0deg material = "silicon" type = "frontside" shape = "rectangle" Loading src/core/geometry/DetectorModel.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly> auto size = implant_config.get<XYZVector>("size"); auto offset = implant_config.get<XYVector>("offset", {0, 0}); auto orientation = implant_config.get<double>("orientation", 0.); auto material = implant_config.get<std::string>("material", "silicon"); // if(size.x() > pixel_size.x() || size.y() > pixel_size.y()) { // throw InvalidValueError(implant_config, "size", "implant size cannot be larger than pixel pitch"); Loading @@ -101,7 +100,7 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly> // throw InvalidValueError(implant_config, "offset", "implant exceeds pixel cell. Reduce implant size or offset"); // } addImplant(imtype, shape, size, offset, orientation, material); addImplant(imtype, shape, size, offset, orientation); } // Read support layers Loading Loading @@ -136,13 +135,11 @@ void DetectorModel::addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation, std::string material) { double orientation) { // 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), std::move(material))); implants_.push_back(Implant(type, shape, std::move(size), full_offset, ROOT::Math::RotationZ(orientation))); } bool DetectorModel::Implant::contains(const ROOT::Math::XYZVector& position) const { Loading src/core/geometry/DetectorModel.hpp +4 −14 Original line number Diff line number Diff line Loading @@ -103,11 +103,6 @@ namespace allpix { * @return Size of the implant */ ROOT::Math::XYZVector getSize() const { return size_; } /** * @brief Get the material of the implant * @return Implant material */ inline const std::string& getMaterial() const { return material_; } /** * @brief Return the type of the implant * @return implant type Loading Loading @@ -146,16 +141,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 material Material of the implant */ Implant(Type type, Shape shape, ROOT::Math::XYZVector size, ROOT::Math::XYZVector offset, ROOT::Math::RotationZ orientation, std::string material) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation), material_(std::move(material)) {} ROOT::Math::RotationZ orientation) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation) { } // Actual parameters returned Type type_; Loading @@ -163,7 +156,6 @@ namespace allpix { ROOT::Math::XYZVector size_; ROOT::Math::XYZVector offset_; ROOT::Math::RotationZ orientation_; std::string material_; }; /** Loading Loading @@ -280,14 +272,12 @@ 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 material Material of the implant */ void addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation, std::string material); double orientation); /** * @brief Get total size of the pixel grid Loading src/modules/GeometryBuilderGeant4/DetectorConstructionG4.cpp +0 −93 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ #include <G4IntersectionSolid.hh> #include <G4LogicalVolume.hh> #include <G4LogicalVolumeStore.hh> #include <G4MultiUnion.hh> #include <G4NistManager.hh> #include <G4PVDivision.hh> #include <G4PVPlacement.hh> Loading Loading @@ -209,98 +208,6 @@ void DetectorConstructionG4::build(const std::shared_ptr<G4LogicalVolume>& world model->getSensorSize().y() / 2.0, model->getSensorSize().z() / 2.0); solids_.push_back(sensor_box); /* IMPLANTS * excise implants from sensor volume and fill them with the implant material */ auto implants = model->getImplants(); // FIXME activate after solving open issues with this implementation! if(0) { // if(!implants.empty()) { size_t cnt = 0; // Collect all implants in a G4MultiUnion solid to subtract from sensor solid: auto implant_union = std::make_shared<G4MultiUnion>(); solids_.push_back(implant_union); for(const auto& implant : implants) { LOG(TRACE) << "Found implant with non-negligible depth, excising implants from sensor volume."; auto size = implant.getSize(); auto offset = implant.getOffset(); auto* material = materials.get(implant.getMaterial()); // Do not remove silicon from silicon if(implant.getMaterial() == "silicon") { LOG(DEBUG) << "Silicon implant, not excising"; continue; } LOG(DEBUG) << " - Implant " << cnt << "\t\t:\t" << Units::display(offset, {"mm", "um"}); // FIXME: We should extend the implant and shift it to avoid fake surfaces std::shared_ptr<G4VSolid> implant_box; if(implant.getShape() == DetectorModel::Implant::Shape::RECTANGLE) { implant_box = std::make_shared<G4Box>("implant_" + std::to_string(cnt) + "_box_" + name, size.x() / 2.0, size.y() / 2.0, size.z() / 2.0); } else { implant_box = std::make_shared<G4EllipticalTube>("implant_" + std::to_string(cnt) + "_box_" + name, size.x() / 2.0, size.y() / 2.0, size.z() / 2.0); } solids_.push_back(implant_box); solids_.push_back(implant_box); auto implant_log = make_shared_no_delete<G4LogicalVolume>( implant_box.get(), material, "implant_log_" + allpix::to_string(implant.getType()) + "_" + std::to_string(cnt) + "_" + name); geo_manager_->setExternalObject(name, "implant_log_" + allpix::to_string(implant.getType()) + "_" + std::to_string(cnt), implant_log); // Loop over pixel matrix to add the implant for every pixel for(unsigned int npix_x = 0; npix_x < model->getNPixels().x(); npix_x++) { for(unsigned int npix_y = 0; npix_y < model->getNPixels().y(); npix_y++) { std::string implant_name = std::to_string(cnt) + "_px" + std::to_string(npix_x) + "_" + std::to_string(npix_y); // Calculate transformation for the solid including possible offsets from pixel center G4ThreeVector translation( -model->getMatrixSize().x() / 2.0 + (npix_x + 0.5) * model->getPixelSize().x() + offset.x(), -model->getMatrixSize().y() / 2.0 + (npix_y + 0.5) * model->getPixelSize().y() + offset.y(), offset.z()); // Add the new solid to the MultiUnion: G4Transform3D transform(G4RotationMatrix(0, 0, implant.getOrientation().Angle()), translation); implant_union->AddNode(*implant_box, transform); // Place physical instance of implant extrusion in model: auto implant_phys = make_shared_no_delete<G4PVPlacement>(transform, implant_log.get(), "implant_" + implant_name + "_phys_" + name, // NOLINT wrapper_log.get(), false, 0, true); geo_manager_->setExternalObject(name, "implant_" + implant_name + "_phys", implant_phys); } } cnt++; } // Finalize the construction of the multi-union solid: implant_union->Voxelize(); G4Transform3D transform(G4RotationMatrix(), G4ThreeVector(0, 0, 0)); auto subtraction_solid = std::make_shared<G4SubtractionSolid>( "sensor_implant_subtraction_" + name, sensor_box.get(), implant_union.get(), transform); solids_.push_back(subtraction_solid); } } // Create the sensor logical volume Loading Loading
doc/usermanual/05_geometry_detectors/02_models.md +0 −6 Original line number Diff line number Diff line Loading @@ -167,12 +167,6 @@ Implants allow for the following parameters: 2D values in the x-y plane, defining the offset of the implant from the center of the pixel cell. This parameter is optional and defaults to $`0, 0`$, i.e. a position at the pixel center be default. - `material`: The material of this implant. Defaults to silicon. It should be noted that Allpix Squared does not provide a set of materials to choose from; it is up to the modules using this parameter to implement the materials such that they can use it. [Chapter 7](../07_modules/_index.md) provides details about the materials supported by the geometry builder module `GeometryBuilderGeant4`. ### Support Layers Loading
models/test_implants.conf +0 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ chip_excess_bottom = 150um [implant] size = 200um 400um 0um orientation = 0deg material = "silicon" type = "frontside" shape = "rectangle" Loading
src/core/geometry/DetectorModel.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly> auto size = implant_config.get<XYZVector>("size"); auto offset = implant_config.get<XYVector>("offset", {0, 0}); auto orientation = implant_config.get<double>("orientation", 0.); auto material = implant_config.get<std::string>("material", "silicon"); // if(size.x() > pixel_size.x() || size.y() > pixel_size.y()) { // throw InvalidValueError(implant_config, "size", "implant size cannot be larger than pixel pitch"); Loading @@ -101,7 +100,7 @@ DetectorModel::DetectorModel(std::string type, std::shared_ptr<DetectorAssembly> // throw InvalidValueError(implant_config, "offset", "implant exceeds pixel cell. Reduce implant size or offset"); // } addImplant(imtype, shape, size, offset, orientation, material); addImplant(imtype, shape, size, offset, orientation); } // Read support layers Loading Loading @@ -136,13 +135,11 @@ void DetectorModel::addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation, std::string material) { double orientation) { // 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), std::move(material))); implants_.push_back(Implant(type, shape, std::move(size), full_offset, ROOT::Math::RotationZ(orientation))); } bool DetectorModel::Implant::contains(const ROOT::Math::XYZVector& position) const { Loading
src/core/geometry/DetectorModel.hpp +4 −14 Original line number Diff line number Diff line Loading @@ -103,11 +103,6 @@ namespace allpix { * @return Size of the implant */ ROOT::Math::XYZVector getSize() const { return size_; } /** * @brief Get the material of the implant * @return Implant material */ inline const std::string& getMaterial() const { return material_; } /** * @brief Return the type of the implant * @return implant type Loading Loading @@ -146,16 +141,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 material Material of the implant */ Implant(Type type, Shape shape, ROOT::Math::XYZVector size, ROOT::Math::XYZVector offset, ROOT::Math::RotationZ orientation, std::string material) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation), material_(std::move(material)) {} ROOT::Math::RotationZ orientation) : type_(type), shape_(shape), size_(std::move(size)), offset_(std::move(offset)), orientation_(orientation) { } // Actual parameters returned Type type_; Loading @@ -163,7 +156,6 @@ namespace allpix { ROOT::Math::XYZVector size_; ROOT::Math::XYZVector offset_; ROOT::Math::RotationZ orientation_; std::string material_; }; /** Loading Loading @@ -280,14 +272,12 @@ 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 material Material of the implant */ void addImplant(const Implant::Type& type, const Implant::Shape& shape, ROOT::Math::XYZVector size, const ROOT::Math::XYVector& offset, double orientation, std::string material); double orientation); /** * @brief Get total size of the pixel grid Loading
src/modules/GeometryBuilderGeant4/DetectorConstructionG4.cpp +0 −93 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ #include <G4IntersectionSolid.hh> #include <G4LogicalVolume.hh> #include <G4LogicalVolumeStore.hh> #include <G4MultiUnion.hh> #include <G4NistManager.hh> #include <G4PVDivision.hh> #include <G4PVPlacement.hh> Loading Loading @@ -209,98 +208,6 @@ void DetectorConstructionG4::build(const std::shared_ptr<G4LogicalVolume>& world model->getSensorSize().y() / 2.0, model->getSensorSize().z() / 2.0); solids_.push_back(sensor_box); /* IMPLANTS * excise implants from sensor volume and fill them with the implant material */ auto implants = model->getImplants(); // FIXME activate after solving open issues with this implementation! if(0) { // if(!implants.empty()) { size_t cnt = 0; // Collect all implants in a G4MultiUnion solid to subtract from sensor solid: auto implant_union = std::make_shared<G4MultiUnion>(); solids_.push_back(implant_union); for(const auto& implant : implants) { LOG(TRACE) << "Found implant with non-negligible depth, excising implants from sensor volume."; auto size = implant.getSize(); auto offset = implant.getOffset(); auto* material = materials.get(implant.getMaterial()); // Do not remove silicon from silicon if(implant.getMaterial() == "silicon") { LOG(DEBUG) << "Silicon implant, not excising"; continue; } LOG(DEBUG) << " - Implant " << cnt << "\t\t:\t" << Units::display(offset, {"mm", "um"}); // FIXME: We should extend the implant and shift it to avoid fake surfaces std::shared_ptr<G4VSolid> implant_box; if(implant.getShape() == DetectorModel::Implant::Shape::RECTANGLE) { implant_box = std::make_shared<G4Box>("implant_" + std::to_string(cnt) + "_box_" + name, size.x() / 2.0, size.y() / 2.0, size.z() / 2.0); } else { implant_box = std::make_shared<G4EllipticalTube>("implant_" + std::to_string(cnt) + "_box_" + name, size.x() / 2.0, size.y() / 2.0, size.z() / 2.0); } solids_.push_back(implant_box); solids_.push_back(implant_box); auto implant_log = make_shared_no_delete<G4LogicalVolume>( implant_box.get(), material, "implant_log_" + allpix::to_string(implant.getType()) + "_" + std::to_string(cnt) + "_" + name); geo_manager_->setExternalObject(name, "implant_log_" + allpix::to_string(implant.getType()) + "_" + std::to_string(cnt), implant_log); // Loop over pixel matrix to add the implant for every pixel for(unsigned int npix_x = 0; npix_x < model->getNPixels().x(); npix_x++) { for(unsigned int npix_y = 0; npix_y < model->getNPixels().y(); npix_y++) { std::string implant_name = std::to_string(cnt) + "_px" + std::to_string(npix_x) + "_" + std::to_string(npix_y); // Calculate transformation for the solid including possible offsets from pixel center G4ThreeVector translation( -model->getMatrixSize().x() / 2.0 + (npix_x + 0.5) * model->getPixelSize().x() + offset.x(), -model->getMatrixSize().y() / 2.0 + (npix_y + 0.5) * model->getPixelSize().y() + offset.y(), offset.z()); // Add the new solid to the MultiUnion: G4Transform3D transform(G4RotationMatrix(0, 0, implant.getOrientation().Angle()), translation); implant_union->AddNode(*implant_box, transform); // Place physical instance of implant extrusion in model: auto implant_phys = make_shared_no_delete<G4PVPlacement>(transform, implant_log.get(), "implant_" + implant_name + "_phys_" + name, // NOLINT wrapper_log.get(), false, 0, true); geo_manager_->setExternalObject(name, "implant_" + implant_name + "_phys", implant_phys); } } cnt++; } // Finalize the construction of the multi-union solid: implant_union->Voxelize(); G4Transform3D transform(G4RotationMatrix(), G4ThreeVector(0, 0, 0)); auto subtraction_solid = std::make_shared<G4SubtractionSolid>( "sensor_implant_subtraction_" + name, sensor_box.get(), implant_union.get(), transform); solids_.push_back(subtraction_solid); } } // Create the sensor logical volume Loading