2#ifndef STRUCTUREBUILDER_HH
3#define STRUCTUREBUILDER_HH
9#include <G4Transform3D.hh>
33#include "G4VPhysicalVolume.hh"
34#include <G4ThreeVector.hh>
106 std::optional<int> copy_no = std::nullopt
107 ,
const G4String &name_override =
"");
295 return {placement_configs_->rotation, placement_configs_->translation};
435 auto retval = i_dynamic_pointer_cast<U>(base_cloned_ptr);
446 template <
typename T,
typename std::enable_if_t<std::is_base_of_v<IStructureBuilder, T>,
456 G4VSolid *GetSolidPtr()
const {
471 bool was_placed_ =
false;
477 bool explicit_copyno_set_ =
false;
478 bool explicit_physical_copy_name_set_ =
false;
479 G4String placement_name_override_ =
"";
484 static constexpr bool has_ownership_{
false};
485 static constexpr bool enable_full_lazy_builds{
true};
490 [[nodiscard]] G4String GetLogicVolName()
const;
492 void ValidateForPVBuild(std::string
const &site = std::string());
493 void ValidatePlacementNotBuilt(
const std::string &operation)
const;
499 static void NoNameCheck(
const std::string &name,
const std::string &site) {
501 throw std::runtime_error(
"Error in " + site +
" ,"
502 "for builder named: " + name +
"\n"
503 " Must provide a new name");
Typesafe units, for VolumeBuilders, Geant, ETC !! No accidental mixing values and units.
A 3D vector that manages unit policy for parameter passing If constructed with a unit,...
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
A solid buider class that just wrap an existing G4VSolid.
a non-fluent polymorphic class to access the derived solid-builder from a base reference: This gets u...
Builder class for RZ mult-plane defined solids.
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
friend class StructureBuilderBase
DerivedPtr StackPhysTransform(const UnitlessG4Transform3D &stacked_transform)
Like SetPhysTransform but stacks with previous transformations in order applied.
G4VSolid * SolidConstructor(const G4String &name) override=0
polymorphic access to solid construction
DerivedPtr StackPhysOffset(const DLG4::VolumeBuilders::ThreeVecDimensioner &offset={0, 0, 0, VB::Length::mm})
Like SetPhysOffset but stacks with previous transformations in order applied.
DerivedPtr StackPhysRotation(const G4RotationMatrix &stacked_rot)
Like SetPhysRotation but stacks with previous transformations in order applied.
VB::Length GetEffectiveDefaultUnit() const
Get the structure default unit or global if not set.
~StructureBuilderBase() override
Destructor Normally does not delete volume objects.
DerivedPtr SetName(const G4String &name)
SetName Sets name used for solid and derived product names.
G4String GetBuilderName() const
DerivedPtr MakePlacement()
Make a placed physical volume.
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
VolumeBuilder: Common functionality for volume builder classes.
DerivedPtr CopyPlacementConfigsFrom(const VolumeBuilder &other)
This may help if reusing placement configs for a different structure.
Assembly CreateAssembly(G4String name)
Assembly of strucures, ie builders and/or other assemblies.
DerivedPtr ForkForPlacement(std::optional< int > copy_no=std::nullopt, const G4String &name_override="")
Calls MakeLogicalVolume() and creates a new builder instance with a copy of all placement-related con...
DerivedPtr ForkForLogicalVolume(const G4String &new_name)
Makes final solid (including booleans) if unbuilt and copies builder with products cleared for furthe...
DerivedPtr SetColor(const G4Colour &color)
DerivedPtr SetColor(double r=0.5, double g=0.5, double b=0.5, double alpha=1.0)
DerivedPtr SetVisibility(bool is_visible=true)
DerivedPtr SetAlpha(G4double alpha)
DerivedPtr SetMaterial(const VBHelpers::G4MaterialPtrOrString &material)
DerivedPtr ForceSolid(bool x=true)
DerivedPtr SetMother(const VolumeBuilder &mother)
Set the mother volume with a builder, or G4VPhysicalVolume or G4VLogicalVolume through implicit conve...
G4Transform3D GetPhysTransform() const
A helper to get the Physical Volume transform with units applied This is built from rotation and tran...
DerivedPtr SetAutoCopyNo(bool set)
Enable (disable for false) auto Physical Volume numbering, on by default.
DerivedPtr SetAutoPlacementNaming(bool set)
Enable auto Physical Volume naming.
DerivedPtr SetCopyNo(G4int pCopyNo)
Set the copy number for the placement.
DerivedPtr SetPhysOffset(const DLG4::VolumeBuilders::ThreeVecDimensioner &offset={0, 0, 0, VB::Length::mm})
Set the translation vector for placement.
DerivedPtr SetPhysRotation(const G4RotationMatrix &rot)
Set the rotation matrix for placement.
DerivedPtr SetPhysTransform(const UnitlessG4Transform3D &new_transform)
Set the G4Transform3D for placment The tranformation provided is meant to be UNITLESS unless you SetD...
DerivedPtr OverridePlacementName(const G4String &pName)
Set the placement name for the volume.
DerivedPtr PlaceAndFork()
An alias for MakePlacement and ClonePlacement Used for one or many unaltered placments in sequence,...
DerivedPtr SetSurfaceCheck(G4bool pSurfChk)
Set the surface check flag for the placement.
DerivedPtr SetDefaultUnit(VB::Length unit)
Set the per-Structure default unit for all later non-factory offsets.
G4Transform3D UnitlessG4Transform3D