DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
Functions
Units

Functions

template<typename T >
void SetGlobalDefaultUnit (T unit)
 
DerivedPtr SetDefaultUnit (VB::Length unit)
 
DerivedPtr SetDefaultUnit (Length unit)
 
Length GetEffectiveDefaultUnit () const
 

Detailed Description

Methods to set units used in geometry methods.

Methods are available for both VolumeBuilder and StructureBuilder (ie builders and assemblies).

Function Documentation

◆ GetEffectiveDefaultUnit()

template<typename U >
VB::Length GetEffectiveDefaultUnit ( ) const

Get the builder default unit or global if not set.

Returns
The active default unit.

Definition at line 905 of file VolumeBuilderBase.hpp.

905 {
906 auto temp = builder_configs_.get();
907 auto local = temp->default_unit;
908 // auto local = builder_configs_->default_unit;
909 auto global = DLG4::Units::global_default_unit<DLG4::Units::Length>;
910 G4double default_unit = local.value_or(global);
911 return Length(default_unit,Length::native);
912 }

◆ SetDefaultUnit() [1/2]

template<typename U >
VolumeBuilderBase< U >::DerivedPtr SetDefaultUnit ( VB::Length  unit)

Set the per-Builder 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 VB::Length::mm.

  • May not apply to values set before this is called.
  • Does not apply to factory units like CreateCenteredBoxBuilder();
    But should not be set and changed. Just use it once, early.
    Parameters
    unitThe VB::Length unit to set, ex: VB::Length::mm
    Returns
    The builder (allows chaining)

Definition at line 899 of file VolumeBuilderBase.hpp.

899 {
900 this->builder_configs_->default_unit = unit.Native();
901 return this->shared_from_this();
902 }
PropertySetter Native
Definition DLG4Units.hh:182

◆ SetDefaultUnit() [2/2]

template<typename U >
DerivedPtr SetDefaultUnit ( VB::Length  unit)

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 VB::Length::mm.

  • May not apply to values set before this is called.
  • Does not apply to factory units like CreateCenteredBoxBuilder();
    But should not be set and changed. Just use it once, early.
    Parameters
    unitThe VB::Length unit to set, ex: VB::Length::mm
    Returns
    The builder (allows chaining)

◆ SetGlobalDefaultUnit()

template<typename T >
void SetGlobalDefaultUnit ( unit)
inline

Set the default unit for all VolumeBuilder methods.

Definition at line 553 of file DLG4Units.hh.

553 {
554 // Compile-time gate
555 static_assert(std::is_base_of_v<DLG4::Units::UnitTag, T>,
556 "\n\n ERROR: SetGlobalDefaultUnit only accepts DLG4Unit types! \n"
557 " You tried to pass a type that does not inherit from UnitTag.\n");
558 DLG4::Units::global_default_unit<T> = unit.Native;
559 }