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 53 of file G4INCLThreeVector.hh.


Constructor & Destructor Documentation

G4INCL::ThreeVector::ThreeVector (  )  [inline]

Definition at line 55 of file G4INCLThreeVector.hh.

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

00056         :x(0.0), y(0.0), z(0.0)
00057       {}

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

Definition at line 59 of file G4INCLThreeVector.hh.

00060         :x(ax), y(ay), z(az)
00061       {}


Member Function Documentation

G4double G4INCL::ThreeVector::dot ( const ThreeVector v  )  const [inline]

Dot product.

Definition at line 96 of file G4INCLThreeVector.hh.

References x, y, and z.

Referenced by G4INCL::Particle::boost(), G4INCL::ClusteringModelIntercomparison::clusterCanEscape(), G4INCL::BinaryCollisionAvatar::getChannel(), G4INCL::ClusteringModelIntercomparison::getCluster(), G4INCL::ReflectionChannel::getFinalState(), G4INCL::Particle::getInvariantMass(), G4INCL::Particle::getLongitudinalPosition(), G4INCL::StandardPropagationModel::getTime(), G4INCL::Particle::lorentzContract(), G4INCL::KinematicsUtils::momentumInCM(), and rotate().

00096                                                       {
00097         return (x*v.x + y*v.y + z*v.z);
00098       }

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

Definition at line 188 of file G4INCLThreeVector.hh.

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

00188                              {
00189         std::stringstream ss;
00190         ss <<"(vector3 " << x << " " << y << " " << z << ")";
00191         return ss.str();
00192       }

G4double G4INCL::ThreeVector::getX (  )  const [inline]

Definition at line 63 of file G4INCLThreeVector.hh.

Referenced by G4INCL::Cluster::boost(), G4INCL::Nucleus::fillEventInfo(), G4INCL::ReflectionChannel::getFinalState(), G4INCL::ElasticChannel::getFinalState(), G4INCL::DeltaProductionChannel::getFinalState(), and G4INCL::DeltaDecayChannel::getFinalState().

00063 { return x; }

G4double G4INCL::ThreeVector::getY (  )  const [inline]

Definition at line 64 of file G4INCLThreeVector.hh.

Referenced by G4INCL::Cluster::boost(), G4INCL::Nucleus::fillEventInfo(), G4INCL::ReflectionChannel::getFinalState(), G4INCL::ElasticChannel::getFinalState(), G4INCL::DeltaProductionChannel::getFinalState(), and G4INCL::DeltaDecayChannel::getFinalState().

00064 { return y; }

G4double G4INCL::ThreeVector::getZ (  )  const [inline]

Definition at line 65 of file G4INCLThreeVector.hh.

Referenced by G4INCL::ProjectileRemnant::addMostDynamicalSpectators(), G4INCL::Cluster::boost(), G4INCL::Nucleus::fillEventInfo(), G4INCL::ReflectionChannel::getFinalState(), G4INCL::ElasticChannel::getFinalState(), G4INCL::DeltaProductionChannel::getFinalState(), and G4INCL::DeltaDecayChannel::getFinalState().

00065 { return z; }

G4double G4INCL::ThreeVector::mag (  )  const [inline]

Get the length of the vector.

Definition at line 72 of file G4INCLThreeVector.hh.

Referenced by G4INCL::InteractionAvatar::bringParticleInside(), G4INCL::Nucleus::decayOutgoingDeltas(), G4INCL::CoulombNonRelativistic::distortOut(), G4INCL::Nucleus::fillEventInfo(), G4INCL::StandardPropagationModel::generateBinaryCollisionAvatar(), G4INCL::Particle::getBeta(), G4INCL::PauliStandard::getBlockingProbability(), G4INCL::ClusteringModelIntercomparison::getCluster(), G4INCL::DeltaProductionChannel::getFinalState(), G4INCL::DeltaDecayChannel::getFinalState(), G4INCL::KinematicsUtils::getLocalEnergy(), G4INCL::Nucleus::getSurfaceRadius(), G4INCL::StandardPropagationModel::shootComposite(), and G4INCL::StandardPropagationModel::shootParticle().

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

G4double G4INCL::ThreeVector::mag2 (  )  const [inline]

Get the square of the length.

Definition at line 77 of file G4INCLThreeVector.hh.

Referenced by G4INCL::ProjectileRemnant::addMostDynamicalSpectators(), G4INCL::Particle::adjustEnergyFromMomentum(), G4INCL::Particle::adjustMomentumFromEnergy(), G4INCL::Particle::boost(), G4INCL::InteractionAvatar::bringParticleInside(), G4INCL::ClusteringModelIntercomparison::clusterCanEscape(), G4INCL::KinematicsUtils::energy(), G4INCL::Cluster::freezeInternalMotion(), G4INCL::PauliStandard::getBlockingProbability(), G4INCL::BinaryCollisionAvatar::getChannel(), G4INCL::ReflectionChannel::getFinalState(), G4INCL::PionNucleonChannel::getFinalState(), G4INCL::ElasticChannel::getFinalState(), G4INCL::Particle::getLongitudinalPosition(), G4INCL::StandardPropagationModel::getTime(), G4INCL::KinematicsUtils::invariantMass(), G4INCL::Particle::lorentzContract(), G4INCL::Particle::Particle(), G4INCL::Cluster::putParticlesOffShell(), G4INCL::KinematicsUtils::squareTotalEnergyInCM(), and G4INCL::Nucleus::useFusionKinematics().

00077 { return (x*x + y*y + z*z); }

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

Definition at line 166 of file G4INCLThreeVector.hh.

References ThreeVector().

00166                                                             {
00167         return ThreeVector(x*C, y*C, z*C);
00168       }

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

Definition at line 138 of file G4INCLThreeVector.hh.

00138                                            {
00139           x *= c;
00140           y *= c;
00141           z *= c;
00142         }

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

Definition at line 155 of file G4INCLThreeVector.hh.

References ThreeVector(), x, y, and z.

00155                                                                 {
00156         return ThreeVector(x+v.x, y+v.y, z+v.z);
00157       }

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

Definition at line 120 of file G4INCLThreeVector.hh.

References x, y, and z.

00120                                                     {
00121         x += v.x;
00122         y += v.y;
00123         z += v.z;
00124       }

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

Definition at line 151 of file G4INCLThreeVector.hh.

References ThreeVector(), x, y, and z.

00151                                                                 {
00152         return ThreeVector(x-v.x, y-v.y, z-v.z);
00153       }

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

Unary minus operator.

Definition at line 127 of file G4INCLThreeVector.hh.

References ThreeVector().

00127                                             {
00128         return ThreeVector(-x,-y,-z);
00129       }

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

Definition at line 131 of file G4INCLThreeVector.hh.

References x, y, and z.

00131                                                     {
00132         x -= v.x;
00133         y -= v.y;
00134         z -= v.z;
00135       }

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

Divides all components of the vector with a constant number.

Definition at line 162 of file G4INCLThreeVector.hh.

References ThreeVector().

00162                                                             {
00163         return ThreeVector(x/C, y/C, z/C);
00164       }

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

Definition at line 145 of file G4INCLThreeVector.hh.

00145                                            {
00146           x /= c;
00147           y /= c;
00148           z /= c;
00149         }

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

Definition at line 67 of file G4INCLThreeVector.hh.

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

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

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

Definition at line 68 of file G4INCLThreeVector.hh.

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

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

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

Phi angle

Definition at line 89 of file G4INCLThreeVector.hh.

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

00089                                   {
00090         return x == 0.0 && y == 0.0 ? 0.0 : std::atan2(y,x);
00091       }

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

Definition at line 182 of file G4INCLThreeVector.hh.

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

00182                               {
00183         std::stringstream ss;
00184         ss <<"(x = " << x << "   y = " << y << "   z = " << z <<")";
00185         return ss.str();
00186       }

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

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

Parameters:
angle the rotation angle
axis the rotation axis, which must be a unit vector

Definition at line 175 of file G4INCLThreeVector.hh.

References dot(), and vector().

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

00175                                                                         {
00176         // Use Rodrigues' formula
00177         const G4double cos = std::cos(angle);
00178         const G4double sin = std::sin(angle);
00179         (*this) = (*this) * cos + axis.vector(*this) * sin + axis * (axis.dot(*this)*(1.-cos));
00180       }

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

Set the x coordinate.

Definition at line 112 of file G4INCLThreeVector.hh.

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

00112 { x =  ax; }

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

Set the y coordinate.

Definition at line 115 of file G4INCLThreeVector.hh.

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

00115 { y =  ay; }

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

Set the z coordinate.

Definition at line 118 of file G4INCLThreeVector.hh.

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

00118 { z =  az; }

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

Theta angle

Definition at line 82 of file G4INCLThreeVector.hh.

References perp().

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

00082                                     {
00083         return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : std::atan2(perp(),z);
00084       }

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

Vector product.

Definition at line 103 of file G4INCLThreeVector.hh.

References ThreeVector(), x, y, and z.

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

00103                                                      {
00104         return ThreeVector(
00105             y*v.z - z*v.y,
00106             z*v.x - x*v.z,
00107             x*v.y - y*v.x
00108             );
00109       }


The documentation for this class was generated from the following file:
Generated on Mon May 27 17:54:09 2013 for Geant4 by  doxygen 1.4.7