DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
|
#include <StructureBuilderReference.hh>
Public Member Functions | |
StructureBuilderReference & | operator= (const StructureBuilderReference &other)=delete |
DerivedPtr | MakePlacement () |
DerivedPtr | ForkForPlacement (std::optional< int > copy_no=std::nullopt, const G4String &name_override="") |
DerivedPtr | ForkForLogicalVolume (const G4String &new_name) |
DerivedPtr | PlaceAndFork () |
DerivedPtr | SetName (const G4String &name) |
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 is_visible=true) |
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 &stacked_transform) |
G4Transform3D | GetPhysTransform () const |
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 | CopyPlacementConfigsFrom (const BuilderView &other) |
DerivedPtr | SetDefaultUnit (G4double unit) |
G4double | GetEffectiveDefaultUnit () const |
G4String | GetBuilderName () const |
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 | |
SharedPtr< IStructureBuilder > | clone_impl () const override |
StructureView | ToStructureView () const override |
Protected Attributes | |
std::atomic< bool > | is_enabled_ {true} |
Friends | |
template<typename T > | |
class | VolumeBuilder |
template<typename T > | |
class | StructureBuilder |
template<typename T > | |
class | i_shared_ptr |
class | i_shared_ptr< StructureBuilderReference > |
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
Can hold other structures, creating placement hierarchies. Behaves like a buidler, but only for logical volume properties and placement related commands. You can set VisAtt on a structure, and can set offsets and rotations of the whole structure for placement.
While this base view only supports limited methods, it is fully polymorphic and builder objects internally can trigger their full build chain.
This derived clas really exists for parallelism with VolumeBuilderReference.
Definition at line 41 of file StructureBuilderReference.hh.
|
overrideprotectedvirtual |
Reimplemented from StructureBuilder< StructureBuilderReference >.
Definition at line 20 of file StructureBuilderReference.cc.
|
inherited |
This may help if reusing placement configs for a different structure.
Copies the placement configuration (rotation, translation, mother, etc.) from another structure. Does NOT copy any naming, as that would conflict. Also does NOT copy any products.
other | The builder instance to copy placement configuration from. |
|
inherited |
|
inherited |
Makes final solid (including booleans) if unbuilt and copies builder with products cleared for further construction.
Configurations from ALL stages (including later) are kept.
This one seems pretty specific, but could be useful for extending a boolean build more easily possibly
new_name | The base name for the new builder's logical and physical volumes. |
|
inherited |
Calls MakeLogicalVolume() and creates a new builder instance with a copy of all placement-related configs.
This will be called automatically by consecutive calls to MakePlacement(). All physical volume and (future?) derived products are reset to be rebuilt. Copy_no and placement name can be auto incremented (number only by default) or overridden.
The copy_no will be incremented.
copy_no | no arguments or std::nullopt to leave as auto. Must set on every use to get manual numbering. |
name_override | An optional name override for the physical volume. Leave blank to use auto controls instead. |
|
inherited |
|
inherited |
Get the structure default unit or global if not set.
|
inlineinherited |
A helper to get the Physical Volume transform with units applied This is built from rotation and translatin if they were provided, or from a transform if it was provided, with units applied as specified.
Basically allows you to get the unit-multiplied version for use in direct Geant calls.
Definition at line 290 of file StructureBuilder.hh.
|
inherited |
Make a placed physical volume.
Retrieve it or make and retrieve with GetPlacement() Fails (throws) if already built. Make a copy first.
|
delete |
|
inherited |
Set the placement name for the volume.
pName | Name for the placement. |
|
inherited |
An alias for MakePlacement and ClonePlacement Used for one or many unaltered placments in sequence, usually with auto naming and/or numbering.
|
inlineinherited |
Definition at line 60 of file disableable_shared_from_this.hh.
|
inherited |
alpha |
|
inherited |
Enable (disable for false) auto Physical Volume numbering, on by default.
Adds a copy number to every name. By default copy numbers auto increment. Or you can set explicit names and numbers in ClonePlacement.
set | True before setting. |
|
inherited |
Enable auto Physical Volume naming.
Adds a copy number to every name. By default copy numbers auto increment.
This will turn that off. Both makes no sense.
Or you can set explicit names and numbers in ClonePlacement.
set | False before setting. |
|
inherited |
color |
|
inherited |
|
inherited |
Set the copy number for the placement.
pCopyNo | Copy number. |
|
inherited |
Set the per-Structure default unit for all later non-factory offsets.
Use DLG4::VolumeBuilders::SetGlobalDefaultUnit() to set a default for all builders, or fall back to the initial default of CLHEP::mm.
unit | The unit to set, ex: CLHEP::mm |
|
inherited |
/**
material |
|
inherited |
Set the mother volume with a builder, or G4VPhysicalVolume or G4VLogicalVolume through implicit conversion.
This does NOT immediately force a build the mother builder, just pre-sets the relationship.
mother | olumeReferencePtrparameter accepts a builder or a G4VSolid through implicit ctor |
|
inherited |
SetName Sets name used for solid and derived product names.
name | The name |
|
inherited |
Set the translation vector for placement.
Using Set, rotation applies before translation, regardless of order set, just as in G4PVPlacement() You can pass (unit, x, y, z) or use the default unit with (x, y, z).
Examples: SetPhysOffset({CLHEP::cm, 1, 2, 3}) // 1cm, 2cm, 3cm SetPhysOffset({1, 2, 3}) // Uses default default unit (usually mm) SetDefaultUnit(CLHEP::cm); SetPhysOffset({1, 2, 3}) // 1cm, 2cm, 3cm SetDefaultUnit(1); SetPhysOffset({10*CLHEP::mm, 20*CLHEP::mm, 30*CLHEP::mm}) // Values already have units
offset | Translation vector. See method description for details. |
|
inherited |
Set the rotation matrix for placement.
Using Set, rotation applies before translation, regardless of order set, just as in G4PVPlacement()
rot | Pointer to the rotation matrix. |
|
inherited |
Set the G4Transform3D for placment The tranformation provided is meant to be UNITLESS unless you SetDefaultUnit(1).
Otherwise ex: SetDefaultUnit(CLHEP::cm) and proivde a UNITLESS transform. To supply units for each G4Tranform3D separately, just call SetDefaultUnit(unit) before each call. Will overwite/replace rotation and translation.
new_transform | Translation vector. |
|
inherited |
Set the surface check flag for the placement.
pSurfChk | Boolean flag for surface check. |
|
inherited |
is_visible |
|
inlineinherited |
Definition at line 44 of file disableable_shared_from_this.hh.
|
inlineinherited |
Definition at line 52 of file disableable_shared_from_this.hh.
|
inherited |
Like SetPhysOffset but stacks with previous transformations in order applied.
Note: Structures/Assebnlies stack transformations hierarchichicaly automatically.
This method is for manual hierarchical stacking calculations. It's probably redundant on assemblies in 99% of caases
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 |
|
inherited |
Like SetPhysRotation but stacks with previous transformations in order applied.
Note: Structures/Assebnlies stack transformations hierarchichicaly automatically.
This method is for manual hierarchical stacking calculations. It's probably redundant on assemblies in 99% of caases
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 |
|
inherited |
Like SetPhysTransform but stacks with previous transformations in order applied.
Note: Structures/Assebnlies stack transformations hierarchichicaly automatically.
This method is for manual hierarchical stacking calculations. It's probably redundant on assemblies in 99% of caases
stacked_transform |
|
overrideprotectedvirtual |
Reimplemented from StructureBuilder< StructureBuilderReference >.
Definition at line 40 of file StructureBuilderReference.cc.
|
friend |
Definition at line 48 of file StructureBuilderReference.hh.
|
friend |
Definition at line 48 of file StructureBuilderReference.hh.
|
friend |
Definition at line 45 of file StructureBuilderReference.hh.
|
friend |
Definition at line 43 of file StructureBuilderReference.hh.
|
protectedinherited |
Definition at line 37 of file disableable_shared_from_this.hh.