DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
|
#include <VolumeBuilder.hh>
Public Member Functions | |
G4VPhysicalVolume * | GetPlacement () final |
DerivedPtr | MakePlacement () |
DerivedPtr | PlaceAndFork () |
G4LogicalVolume * | GetLogicalVolume () final |
G4VSolid * | GetBaseSolid () final |
G4VSolid * | GetFinalSolid () final |
DerivedPtr | MakeLogicalVolume (G4Material *material=nullptr, G4String name=std::string()) |
DerivedPtr | MakeSolid () |
DerivedPtr | SetName (const G4String &name) |
DerivedPtr | AddUnion (const BuilderView &other, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
DerivedPtr | AddSubtraction (const BuilderView &other, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
DerivedPtr | AddIntersection (const BuilderView &other, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
DerivedPtr | AddBoolean (const BuilderView &other, bool is_subtraction=false, bool is_intersection=false, const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}, G4RotationMatrix *rotation=nullptr) |
DerivedPtr | SetMaterial (G4Material *material) |
DerivedPtr | SetColor (double r=0.5, double g=0.5, double b=0.5, double alpha=1.0) |
DerivedPtr | SetColor (const G4Colour &color) |
DerivedPtr | SetAlpha (G4double alpha) |
DerivedPtr | ForceSolid (bool x=true) |
DerivedPtr | SetVisibility (bool x=true) |
DerivedPtr | SetLogicalVolume (G4LogicalVolume *logical_volume) |
DerivedPtr | SetBooleanName (const G4String &name) |
DerivedPtr | SetPhysRotation (const G4RotationMatrix &rot) |
DerivedPtr | StackPhysRotation (const G4RotationMatrix &stacked_rot) |
DerivedPtr | SetPhysOffset (const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}) |
DerivedPtr | StackPhysOffset (const Unit3Vec &offset={CLHEP::mm, 0, 0, 0}) |
DerivedPtr | SetPhysTransform (const UnitlessG4Transform3D &new_transform) |
DerivedPtr | StackPhysTransform (const UnitlessG4Transform3D &new_transform) |
G4Transform3D | GetPhysTransform () const final |
DerivedPtr | OverridePlacementName (const G4String &pName) |
DerivedPtr | SetCopyNo (G4int pCopyNo) |
DerivedPtr | SetSurfaceCheck (G4bool pSurfChk) |
DerivedPtr | SetMother (const BuilderView &mother) |
DerivedPtr | SetAutoPlacementNaming (bool set) |
DerivedPtr | SetAutoCopyNo (bool set) |
DerivedPtr | ReflectZFinalSolid () |
DerivedPtr | ReflectZBaseSolid () |
virtual DerivedPtr | ForkAndReset (const G4String &new_name) const |
DerivedPtr | ForkForFinalSolid (const G4String &new_name) |
DerivedPtr | ForkForLogicalVolume (const G4String &new_name) |
DerivedPtr | ForkForPlacement (std::optional< int > copy_no=std::nullopt, const G4String &name_override="", bool parent_name_was_set=false) |
DerivedPtr | CopyPlacementConfigsFrom (const BuilderView &other) |
DerivedPtr | CopyVolumeConfigsFrom (const BuilderView &other) |
DerivedPtr | SetDefaultUnit (G4double unit) |
G4double | GetEffectiveDefaultUnit () const |
DerivedPtr | AddTo (BuilderViewList &list) const |
DerivedPtr | AddTo (StructureViewList &list) const |
DerivedPtr | AddTo (AssemblyPtr &assembly) const |
~VolumeBuilder () override | |
BuilderView | ToBuilderView () const override |
StructureView | ToStructureView () const override |
G4String | GetBuilderName () const |
template<typename U > | |
VolumeBuilder (const VolumeBuilder< U > &other) | |
template<typename T , std::enable_if_t< std::is_base_of_v< IStructureBuilder, T >, int > > | |
VolumeBuilder (const SharedPtr< T > &other, std::true_type) | |
std::shared_ptr< T > | shared_from_this () |
std::shared_ptr< const T > | shared_from_this () const |
void | set_shared_from_this_enabled (bool enabled) |
Protected Member Functions | |
G4VSolid * | SolidConstructor (const G4String &name) override=0 |
SharedPtr< IStructureBuilder > | clone_impl () const override |
Protected Attributes | |
std::atomic< bool > | is_enabled_ {true} |
Friends | |
template<typename > | |
class | VolumeBuilder |
class | VolumeBuilderReference |
class | Assembly |
template<typename > | |
class | StructureBuilder |
class | StructureBuilderReference |
class | RZBuilder |
class | BoxBuilder |
class | FromG4VSolid |
FromG4VSolidPtr | CreateFromG4VSolid (G4VSolid *solid) |
AssemblyPtr | CreateAssembly (G4String names) |
VolumeBuilder: Common functionality for volume builder classes.
Includes material and attribute setting, and union/subtraction methods. This is Not a user class. Only usable through inheritance to extend class functionality. Return most things by pointer to the derived class So we can chain operations (fluent interface).
U | CRTP paramter for the derived class. |
Definition at line 58 of file VolumeBuilder.hh.
|
override |
Destructor Normally does not delete volume objects.
Geant takes care of that.
Definition at line 114 of file VolumeBuilder.hpp.
Definition at line 83 of file VolumeBuilder.hpp.
VolumeBuilder | ( | const SharedPtr< T > & | other, |
std::true_type | |||
) |
Definition at line 100 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr AddTo | ( | BuilderViewList & | list | ) | const |
Definition at line 1005 of file VolumeBuilder.hpp.
|
overrideprotectedvirtual |
Implements IStructureBuilder.
Reimplemented in VolumeBuilderReference.
Definition at line 997 of file VolumeBuilder.hpp.
G4String GetBuilderName | ( | ) | const |
Definition at line 973 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr MakeLogicalVolume | ( | G4Material * | material = nullptr , |
G4String | name = std::string() |
||
) |
Basically never needed now.
Builds the logical volume and returns the builder. GetLogicalVolume(), or passing the builder to any consumer will trigger the build anyway.
material | Pointer to material to use. |
name | Optional explicit name for logical volume. Normally already derived from builder/solid name. |
Definition at line 129 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr MakePlacement | ( | ) |
Make a placed physical volume.
Retrieve it or make and retrieve with GetPlacement() Fails (throws) if already built. Make a copy first.
Definition at line 463 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr MakeSolid | ( | ) |
Make the G4VSolid.
Returns the builder. Use GetBaseSolid() to retrieve or make and retrieve it.
Definition at line 938 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr ReflectZBaseSolid | ( | ) |
Configure base solid to be flipped BEFORE applying booleans.
Definition at line 928 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr ReflectZFinalSolid | ( | ) |
Configure final solid to be flipped in z.
Definition at line 918 of file VolumeBuilder.hpp.
|
inlineinherited |
Definition at line 60 of file disableable_shared_from_this.hh.
VolumeBuilder< U >::DerivedPtr SetName | ( | const G4String & | name | ) |
SetName Sets name used for solid and derived product names.
name | The name |
Definition at line 403 of file VolumeBuilder.hpp.
|
inlineinherited |
Definition at line 44 of file disableable_shared_from_this.hh.
|
inlineinherited |
Definition at line 52 of file disableable_shared_from_this.hh.
|
overrideprotectedpure virtual |
polymorphic access to solid construction
Implements IStructureBuilder.
Implemented in BoxBuilder, RZBuilder, and VolumeBuilderReference.
VolumeBuilder< U >::DerivedPtr StackPhysOffset | ( | const Unit3Vec & | offset = {CLHEP::mm, 0, 0, 0} | ) |
Like SetPhysOffset but stacks with previous transformations in order applied.
Unlike with G4Transform multiplication, stacking is done in a way that allows mutiple objects to move together. The first transformations can set individual objects, and a uniform transformation can be applied to them all to create a rigid motion of the collection.
offset |
Definition at line 570 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr StackPhysRotation | ( | const G4RotationMatrix & | stacked_rot | ) |
Like SetPhysRotation but stacks with previous transformations in order applied.
Unlike with G4Transform multiplication, stacking is done in a way that allows mutiple objects to move together. The first transformations can set individual objects, and a uniform transformation can be applied to them all to create a rigid motion of the collection.
stacked_rot |
Definition at line 546 of file VolumeBuilder.hpp.
VolumeBuilder< U >::DerivedPtr StackPhysTransform | ( | const UnitlessG4Transform3D & | new_transform | ) |
Like SetPhysTransform but stacks with previous transformations in order applied.
new_transform |
Definition at line 586 of file VolumeBuilder.hpp.
|
overridevirtual |
Implements IStructureBuilder.
Reimplemented in VolumeBuilderReference.
Definition at line 978 of file VolumeBuilder.hpp.
|
overridevirtual |
Implements IStructureBuilder.
Definition at line 988 of file VolumeBuilder.hpp.
|
friend |
Definition at line 70 of file VolumeBuilder.hh.
|
friend |
Definition at line 77 of file VolumeBuilder.hh.
|
friend |
Assembly of strucures, ie builders and/or other assemblies.
Definition at line 25 of file Assembly.cc.
|
friend |
Constructor to make a builder from an Existing Geant solid.
solid | G4VSolid pointer |
Definition at line 25 of file FromG4VSolid.cc.
|
friend |
Definition at line 78 of file VolumeBuilder.hh.
|
friend |
Definition at line 76 of file VolumeBuilder.hh.
Definition at line 72 of file VolumeBuilder.hh.
|
friend |
Definition at line 73 of file VolumeBuilder.hh.
Definition at line 68 of file VolumeBuilder.hh.
|
friend |
Definition at line 69 of file VolumeBuilder.hh.
|
protectedinherited |
Definition at line 37 of file disableable_shared_from_this.hh.