DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Unit3Vec Class Reference

#include <VolumeBuilderTypes.hh>

Public Member Functions

 Unit3Vec (double x, double y, double z)
 
 Unit3Vec (double u, double x, double y, double z)
 
 Unit3Vec (double u, const Unitless3Vec &vec)
 
G4ThreeVector apply_units (const double dflt_unit) const
 

Public Attributes

double x
 
double y
 
double z
 
std::optional< double > units
 

Detailed Description

A 3D vector that carries its own unit information.

Stores unit, x, y, z as separate values. Can be constructed from 3 values (gets default unit) or 4 values (explicit unit first)

Definition at line 111 of file VolumeBuilderTypes.hh.

Constructor & Destructor Documentation

◆ Unit3Vec() [1/3]

Unit3Vec ( double  x,
double  y,
double  z 
)
inline

◆ Unit3Vec() [2/3]

Unit3Vec ( double  u,
double  x,
double  y,
double  z 
)
inline

Definition at line 121 of file VolumeBuilderTypes.hh.

121 : x(x), y(y), z(z), units(u) {
122 }

◆ Unit3Vec() [3/3]

Unit3Vec ( double  u,
const Unitless3Vec vec 
)
inline

Definition at line 124 of file VolumeBuilderTypes.hh.

124 :
125 x(vec.getX()), y(vec.getY()), z(vec.getZ()), units(u) {
126 }

Member Function Documentation

◆ apply_units()

G4ThreeVector apply_units ( const double  dflt_unit) const
inline

Definition at line 128 of file VolumeBuilderTypes.hh.

128 {
129 auto vec = G4ThreeVector(0, 0, 0);
130 auto unit = this->units.value_or(dflt_unit);
131 vec.setX(this->x * unit);
132 vec.setY(this->y * unit);
133 vec.setZ(this->z * unit);
134 return vec;
135 }

Member Data Documentation

◆ units

std::optional<double> units

Definition at line 114 of file VolumeBuilderTypes.hh.

◆ x

double x

Definition at line 113 of file VolumeBuilderTypes.hh.

◆ y

double y

Definition at line 113 of file VolumeBuilderTypes.hh.

◆ z

double z

Definition at line 113 of file VolumeBuilderTypes.hh.


The documentation for this class was generated from the following file: