Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::ThreeVector Class Reference

#include <G4INCLThreeVector.hh>

Public Member Functions

 ThreeVector ()
 
 ThreeVector (G4double ax, G4double ay, G4double az)
 
G4double getX () const
 
G4double getY () const
 
G4double getZ () const
 
G4double perp () const
 
G4double perp2 () const
 
G4double mag () const
 
G4double mag2 () const
 
G4double theta () const
 
G4double phi () const
 
G4double dot (const ThreeVector &v) const
 
ThreeVector vector (const ThreeVector &v) const
 
void setX (G4double ax)
 Set the x coordinate.
 
void setY (G4double ay)
 Set the y coordinate.
 
void setZ (G4double az)
 Set the z coordinate.
 
void operator+= (const ThreeVector &v)
 
ThreeVector operator- () const
 Unary minus operator.
 
void operator-= (const ThreeVector &v)
 
template<typename T >
void operator*= (const T c)
 
template<typename T >
void operator/= (const T c)
 
ThreeVector operator- (const ThreeVector &v) const
 
ThreeVector operator+ (const ThreeVector &v) const
 
ThreeVector operator/ (const G4double C) const
 
ThreeVector operator* (const G4double C) const
 
void rotate (const G4double angle, const ThreeVector &axis)
 Rotate the vector by a given angle around a given axis.
 
std::string print () const
 
std::string dump () const
 

Detailed Description

Definition at line 55 of file G4INCLThreeVector.hh.

Constructor & Destructor Documentation

◆ ThreeVector() [1/2]

G4INCL::ThreeVector::ThreeVector ( )
inline

Definition at line 57 of file G4INCLThreeVector.hh.

58 :x(0.0), y(0.0), z(0.0)
59 {}

Referenced by operator*(), operator+(), operator-(), operator/(), and vector().

◆ ThreeVector() [2/2]

G4INCL::ThreeVector::ThreeVector ( G4double  ax,
G4double  ay,
G4double  az 
)
inline

Definition at line 61 of file G4INCLThreeVector.hh.

62 :x(ax), y(ay), z(az)
63 {}

Member Function Documentation

◆ dot()

◆ dump()

std::string G4INCL::ThreeVector::dump ( ) const
inline

Definition at line 190 of file G4INCLThreeVector.hh.

190 {
191 std::stringstream ss;
192 ss <<"(vector3 " << x << " " << y << " " << z << ")";
193 return ss.str();
194 }

Referenced by G4INCL::Particle::dump().

◆ getX()

◆ getY()

◆ getZ()

◆ mag()

◆ mag2()

◆ operator*()

ThreeVector G4INCL::ThreeVector::operator* ( const G4double  C) const
inline

Definition at line 168 of file G4INCLThreeVector.hh.

168 {
169 return ThreeVector(x*C, y*C, z*C);
170 }

◆ operator*=()

template<typename T >
void G4INCL::ThreeVector::operator*= ( const c)
inline

Definition at line 140 of file G4INCLThreeVector.hh.

140 {
141 x *= c;
142 y *= c;
143 z *= c;
144 }

◆ operator+()

ThreeVector G4INCL::ThreeVector::operator+ ( const ThreeVector v) const
inline

Definition at line 157 of file G4INCLThreeVector.hh.

157 {
158 return ThreeVector(x+v.x, y+v.y, z+v.z);
159 }

◆ operator+=()

void G4INCL::ThreeVector::operator+= ( const ThreeVector v)
inline

Definition at line 122 of file G4INCLThreeVector.hh.

122 {
123 x += v.x;
124 y += v.y;
125 z += v.z;
126 }

◆ operator-() [1/2]

ThreeVector G4INCL::ThreeVector::operator- ( ) const
inline

Unary minus operator.

Definition at line 129 of file G4INCLThreeVector.hh.

129 {
130 return ThreeVector(-x,-y,-z);
131 }

◆ operator-() [2/2]

ThreeVector G4INCL::ThreeVector::operator- ( const ThreeVector v) const
inline

Definition at line 153 of file G4INCLThreeVector.hh.

153 {
154 return ThreeVector(x-v.x, y-v.y, z-v.z);
155 }

◆ operator-=()

void G4INCL::ThreeVector::operator-= ( const ThreeVector v)
inline

Definition at line 133 of file G4INCLThreeVector.hh.

133 {
134 x -= v.x;
135 y -= v.y;
136 z -= v.z;
137 }

◆ operator/()

ThreeVector G4INCL::ThreeVector::operator/ ( const G4double  C) const
inline

Divides all components of the vector with a constant number.

Definition at line 164 of file G4INCLThreeVector.hh.

164 {
165 return ThreeVector(x/C, y/C, z/C);
166 }

◆ operator/=()

template<typename T >
void G4INCL::ThreeVector::operator/= ( const c)
inline

Definition at line 147 of file G4INCLThreeVector.hh.

147 {
148 x /= c;
149 y /= c;
150 z /= c;
151 }

◆ perp()

G4double G4INCL::ThreeVector::perp ( ) const
inline

Definition at line 69 of file G4INCLThreeVector.hh.

69{ return std::sqrt(x*x + y*y); }

Referenced by G4INCL::DeltaDecayChannel::getFinalState(), and theta().

◆ perp2()

G4double G4INCL::ThreeVector::perp2 ( ) const
inline

Definition at line 70 of file G4INCLThreeVector.hh.

70{ return x*x + y*y; }

Referenced by G4INCL::DeltaProductionChannel::getFinalState(), and G4INCL::ElasticChannel::getFinalState().

◆ phi()

G4double G4INCL::ThreeVector::phi ( ) const
inline

Phi angle

Definition at line 91 of file G4INCLThreeVector.hh.

91 {
92 return x == 0.0 && y == 0.0 ? 0.0 : std::atan2(y,x);
93 }

Referenced by G4INCL::Nucleus::fillEventInfo().

◆ print()

std::string G4INCL::ThreeVector::print ( ) const
inline

Definition at line 184 of file G4INCLThreeVector.hh.

184 {
185 std::stringstream ss;
186 ss <<"(x = " << x << " y = " << y << " z = " << z <<")";
187 return ss.str();
188 }

Referenced by G4INCL::Cluster::print(), and G4INCL::Particle::print().

◆ rotate()

void G4INCL::ThreeVector::rotate ( const G4double  angle,
const ThreeVector axis 
)
inline

Rotate the vector by a given angle around a given axis.

Parameters
anglethe rotation angle
axisthe rotation axis, which must be a unit vector

Definition at line 177 of file G4INCLThreeVector.hh.

177 {
178 // Use Rodrigues' formula
179 const G4double cos = std::cos(angle);
180 const G4double sin = std::sin(angle);
181 (*this) = (*this) * cos + axis.vector(*this) * sin + axis * (axis.dot(*this)*(1.-cos));
182 }
double G4double
Definition: G4Types.hh:64

Referenced by G4INCL::Particle::rotate().

◆ setX()

void G4INCL::ThreeVector::setX ( G4double  ax)
inline

Set the x coordinate.

Definition at line 114 of file G4INCLThreeVector.hh.

114{ x = ax; }

Referenced by G4INCL::Cluster::internalBoostToCM().

◆ setY()

void G4INCL::ThreeVector::setY ( G4double  ay)
inline

Set the y coordinate.

Definition at line 117 of file G4INCLThreeVector.hh.

117{ y = ay; }

Referenced by G4INCL::Cluster::internalBoostToCM().

◆ setZ()

void G4INCL::ThreeVector::setZ ( G4double  az)
inline

Set the z coordinate.

Definition at line 120 of file G4INCLThreeVector.hh.

120{ z = az; }

Referenced by G4INCL::Cluster::internalBoostToCM().

◆ theta()

G4double G4INCL::ThreeVector::theta ( ) const
inline

Theta angle

Definition at line 84 of file G4INCLThreeVector.hh.

84 {
85 return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : std::atan2(perp(),z);
86 }
G4double perp() const

Referenced by G4INCL::Nucleus::fillEventInfo().

◆ vector()

ThreeVector G4INCL::ThreeVector::vector ( const ThreeVector v) const
inline

Vector product.

Definition at line 105 of file G4INCLThreeVector.hh.

105 {
106 return ThreeVector(
107 y*v.z - z*v.y,
108 z*v.x - x*v.z,
109 x*v.y - y*v.x
110 );
111 }

Referenced by G4INCL::Particle::getAngularMomentum(), and rotate().


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