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 <VolumeBuildersTypes.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 115 of file VolumeBuildersTypes.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 125 of file VolumeBuildersTypes.hh.

125 : x(x), y(y), z(z), units(u) {
126 }

◆ Unit3Vec() [3/3]

Unit3Vec ( double  u,
const Unitless3Vec vec 
)
inline

Definition at line 128 of file VolumeBuildersTypes.hh.

128 :
129 x(vec.getX()), y(vec.getY()), z(vec.getZ()), units(u) {
130 }

Member Function Documentation

◆ apply_units()

G4ThreeVector apply_units ( const double  dflt_unit) const
inline

Definition at line 132 of file VolumeBuildersTypes.hh.

132 {
133 auto vec = G4ThreeVector(0, 0, 0);
134 auto unit = this->units.value_or(dflt_unit);
135 vec.setX(this->x * unit);
136 vec.setY(this->y * unit);
137 vec.setZ(this->z * unit);
138 return vec;
139 }

Member Data Documentation

◆ units

std::optional<double> units

Definition at line 118 of file VolumeBuildersTypes.hh.

◆ x

double x

Definition at line 117 of file VolumeBuildersTypes.hh.

◆ y

double y

Definition at line 117 of file VolumeBuildersTypes.hh.

◆ z

double z

Definition at line 117 of file VolumeBuildersTypes.hh.


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