Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields
G4GHEKinematicsVector Class Reference

#include <G4GHEKinematicsVector.hh>

Public Member Functions

 G4GHEKinematicsVector ()
 
 ~G4GHEKinematicsVector ()
 
 G4GHEKinematicsVector (const G4GHEKinematicsVector &p)
 
G4GHEKinematicsVectoroperator= (const G4GHEKinematicsVector &p)
 
void SetMomentum (G4ParticleMomentum mom)
 
void SetMomentumAndUpdate (G4ParticleMomentum mom)
 
const G4ParticleMomentum GetMomentum () const
 
void SetMomentum (G4double x, G4double y, G4double z)
 
void SetMomentumAndUpdate (G4double x, G4double y, G4double z)
 
void SetMomentum (G4double x, G4double y)
 
void SetMomentumAndUpdate (G4double x, G4double y)
 
void SetMomentum (G4double z)
 
void SetMomentumAndUpdate (G4double z)
 
void SetEnergy (G4double e)
 
void SetEnergyAndUpdate (G4double e)
 
void SetKineticEnergy (G4double ekin)
 
void SetKineticEnergyAndUpdate (G4double ekin)
 
G4double GetEnergy ()
 
G4double GetKineticEnergy ()
 
void SetMass (G4double mas)
 
void SetMassAndUpdate (G4double mas)
 
G4double GetMass ()
 
void SetCharge (G4double c)
 
G4double GetCharge ()
 
void SetTOF (G4double t)
 
G4double GetTOF ()
 
void SetSide (G4int sid)
 
G4int GetSide ()
 
void setFlag (G4bool f)
 
G4bool getFlag ()
 
void SetCode (G4int c)
 
void SetParticleDef (G4ParticleDefinition *c)
 
G4int GetCode ()
 
G4ParticleDefinitionGetParticleDef ()
 
void SetZero ()
 
void Add (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Sub (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Lor (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
G4double CosAng (const G4GHEKinematicsVector &p)
 
G4double Ang (const G4GHEKinematicsVector &p)
 
G4double Dot4 (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
G4double Impu (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Add3 (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Sub3 (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Cross (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
G4double Dot (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Smul (const G4GHEKinematicsVector &p, G4double h)
 
void SmulAndUpdate (const G4GHEKinematicsVector &p, G4double h)
 
void Norz (const G4GHEKinematicsVector &p)
 
G4double Length ()
 
void Exch (G4GHEKinematicsVector &p1)
 
void Defs1 (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2)
 
void Defs (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &p2, G4GHEKinematicsVector &my, G4GHEKinematicsVector &mz)
 
void Trac (const G4GHEKinematicsVector &p1, const G4GHEKinematicsVector &mx, const G4GHEKinematicsVector &my, const G4GHEKinematicsVector &mz)
 
void Print (G4int L)
 

Data Fields

G4ParticleMomentum momentum
 
G4double energy
 
G4double kineticEnergy
 
G4double mass
 
G4double charge
 
G4double timeOfFlight
 
G4int side
 
G4bool flag
 
G4int code
 
G4ParticleDefinitionparticleDef
 

Detailed Description

Definition at line 50 of file G4GHEKinematicsVector.hh.

Constructor & Destructor Documentation

G4GHEKinematicsVector::G4GHEKinematicsVector ( )
inline

Definition at line 54 of file G4GHEKinematicsVector.hh.

References charge, energy, flag, kineticEnergy, mass, momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, and timeOfFlight.

55  {
56  momentum.setX( 0.0 );
57  momentum.setY( 0.0 );
58  momentum.setZ( 0.0 );
59  energy = 0.0;
60  kineticEnergy = 0.0;
61  mass = 0.0;
62  charge = 0.0;
63  timeOfFlight = 0.0;
64  side = 0;
65  flag = false;
66  code = 0;
67  particleDef = NULL;
68  }
G4ParticleDefinition * particleDef
void setY(double)
void setZ(double)
void setX(double)
Definition: inftrees.h:24
G4GHEKinematicsVector::~G4GHEKinematicsVector ( )
inline

Definition at line 70 of file G4GHEKinematicsVector.hh.

70 {}
G4GHEKinematicsVector::G4GHEKinematicsVector ( const G4GHEKinematicsVector p)
inline

Definition at line 73 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, timeOfFlight, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

74  {
75  momentum.setX( p.momentum.x() );
76  momentum.setY( p.momentum.y() );
77  momentum.setZ( p.momentum.z() );
78  energy = p.energy;
80  mass = p.mass;
81  charge = p.charge;
83  side = p.side;
84  flag = p.flag;
85  code = p.code;
87  }
G4ParticleDefinition * particleDef
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
Definition: inftrees.h:24
double y() const

Member Function Documentation

void G4GHEKinematicsVector::Add ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 361 of file G4GHEKinematicsVector.hh.

References test::b, charge, code, energy, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), momentum, and particleDef.

362  {
363  momentum = p1.momentum + p2.momentum;
364  energy = p1.energy + p2.energy;
366  if( b < 0 )
367  mass = -1. * std::sqrt( -b );
368  else
369  mass = std::sqrt( b );
371  charge = p1.charge + p2.charge;
372  code = p1.code + p2.code;
374  }
G4ParticleDefinition * particleDef
Definition: inftrees.h:24
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
double G4double
Definition: G4Types.hh:76
void G4GHEKinematicsVector::Add3 ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 456 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

457  {
458  momentum.setX( p1.momentum.x() + p2.momentum.x());
459  momentum.setY( p1.momentum.y() + p2.momentum.y());
460  momentum.setZ( p1.momentum.z() + p2.momentum.z());
461  return;
462  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const
G4double G4GHEKinematicsVector::Ang ( const G4GHEKinematicsVector p)
inline

Definition at line 424 of file G4GHEKinematicsVector.hh.

References test::a, CLHEP::Hep3Vector::mag2(), momentum, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

425  {
426  G4double a = std::sqrt( momentum.mag2() * p.momentum.mag2() );
427  if( a != 0.0 )
428  {
429  a = (momentum.x()*p.momentum.x() +
430  momentum.y()*p.momentum.y() +
431  momentum.z()*p.momentum.z()) / a;
432  if( std::fabs(a) > 1.0 ) a<0.0 ? a=-1.0 : a=1.0;
433  }
434  return std::acos(a);
435  }
double x() const
double z() const
double y() const
double mag2() const
double G4double
Definition: G4Types.hh:76
G4double G4GHEKinematicsVector::CosAng ( const G4GHEKinematicsVector p)
inline

Definition at line 411 of file G4GHEKinematicsVector.hh.

References test::a, CLHEP::Hep3Vector::mag2(), momentum, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

412  {
413  G4double a = std::sqrt( momentum.mag2() * p.momentum.mag2() );
414  if( a != 0.0 )
415  {
416  a = (momentum.x()*p.momentum.x() +
417  momentum.y()*p.momentum.y() +
418  momentum.z()*p.momentum.z()) / a;
419  if( std::fabs(a) > 1.0 ) a<0.0 ? a=-1.0 : a=1.0;
420  }
421  return a;
422  }
double x() const
double z() const
double y() const
double mag2() const
double G4double
Definition: G4Types.hh:76
void G4GHEKinematicsVector::Cross ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 474 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

475  {
476  G4double px, py, pz;
477  px = p1.momentum.y() * p2.momentum.z() - p1.momentum.z() * p2.momentum.y();
478  py = p1.momentum.z() * p2.momentum.x() - p1.momentum.x() * p2.momentum.z();
479  pz = p1.momentum.x() * p2.momentum.y() - p1.momentum.y() * p2.momentum.x();
480  momentum.setX( px );
481  momentum.setY( py );
482  momentum.setZ( pz );
483  return;
484  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const
double G4double
Definition: G4Types.hh:76
void G4GHEKinematicsVector::Defs ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2,
G4GHEKinematicsVector my,
G4GHEKinematicsVector mz 
)
inline

Definition at line 608 of file G4GHEKinematicsVector.hh.

References CLHEP::Hep3Vector::mag(), momentum, G4InuclParticleNames::pp, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

610  {
611  my = p1;
612  mz = p2;
613  momentum.setX( my.momentum.y()*mz.momentum.z()
614  - my.momentum.z()*mz.momentum.y());
615  momentum.setY( my.momentum.z()*mz.momentum.x()
616  - my.momentum.x()*mz.momentum.z());
617  momentum.setZ( my.momentum.x()*mz.momentum.y()
618  - my.momentum.y()*mz.momentum.x());
619  my.momentum.setX( mz.momentum.y()*momentum.z()
620  - mz.momentum.z()*momentum.y());
621  my.momentum.setY( mz.momentum.z()*momentum.x()
622  - mz.momentum.x()*momentum.z());
623  my.momentum.setZ( mz.momentum.x()*momentum.y()
624  - mz.momentum.y()*momentum.x());
625  G4double pp;
626  pp = momentum.mag();
627  if (pp > 0.)
628  {
629  pp = 1./pp;
630  momentum.setX( momentum.x()*pp );
631  momentum.setY( momentum.y()*pp );
632  momentum.setZ( momentum.z()*pp );
633  }
634  pp = my.momentum.mag();
635  if (pp > 0.)
636  {
637  pp = 1./pp;
638  my.momentum.setX( my.momentum.x()*pp );
639  my.momentum.setY( my.momentum.y()*pp );
640  my.momentum.setZ( my.momentum.z()*pp );
641  }
642  pp = mz.momentum.mag();
643  if (pp > 0.)
644  {
645  pp = 1./pp;
646  mz.momentum.setX( mz.momentum.x()*pp );
647  mz.momentum.setY( mz.momentum.y()*pp );
648  mz.momentum.setZ( mz.momentum.z()*pp );
649  }
650  return;
651  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
void G4GHEKinematicsVector::Defs1 ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 579 of file G4GHEKinematicsVector.hh.

References CLHEP::Hep3Vector::mag(), momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), sqr(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

580  {
581  G4double pt2 = sqr(p1.momentum.x()) + sqr(p1.momentum.y());
582  if (pt2 > 0.0)
583  {
584  G4double ph, px, py, pz;
585  G4double cost = p2.momentum.z()/p2.momentum.mag();
586  G4double sint = 0.5 * ( std::sqrt(std::fabs((1.-cost)*(1.+cost)))
587  + std::sqrt(pt2)/p2.momentum.mag());
588  (p2.momentum.y() < 0.) ? ph = 1.5*CLHEP::pi : ph = CLHEP::halfpi;
589  if( p2.momentum.x() != 0.0)
590  ph = std::atan2(p2.momentum.y(),p2.momentum.x());
591  px = cost*std::cos(ph)*p1.momentum.x() - std::sin(ph)*p1.momentum.y()
592  + sint*std::cos(ph)*p1.momentum.z();
593  py = cost*std::sin(ph)*p1.momentum.x() + std::cos(ph)*p1.momentum.y()
594  + sint*std::sin(ph)*p1.momentum.z();
595  pz = - sint *p1.momentum.x()
596  + cost *p1.momentum.z();
597  momentum.setX( px );
598  momentum.setY( py );
599  momentum.setZ( pz );
600  }
601  else
602  {
603  momentum = p1.momentum;
604  }
605  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
double mag() const
G4double G4GHEKinematicsVector::Dot ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 487 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

488  {
489  return ( p1.momentum.x() * p2.momentum.x()
490  + p1.momentum.y() * p2.momentum.y()
491  + p1.momentum.z() * p2.momentum.z() );
492  }
double x() const
double z() const
double y() const
G4double G4GHEKinematicsVector::Dot4 ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 438 of file G4GHEKinematicsVector.hh.

References energy, momentum, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

439  {
440  return ( p1.energy * p2.energy
441  - p1.momentum.x() * p2.momentum.x()
442  - p1.momentum.y() * p2.momentum.y()
443  - p1.momentum.z() * p2.momentum.z() );
444  }
double x() const
double z() const
double y() const
void G4GHEKinematicsVector::Exch ( G4GHEKinematicsVector p1)
inline

Definition at line 548 of file G4GHEKinematicsVector.hh.

549  {
550  G4GHEKinematicsVector mx = *this;
551 // mx.momentum.SetX( momentum.x());
552 // mx.momentum.SetY( momentum.y());
553 // mx.momentum.SetZ( momentum.z());
554 // mx.energy = energy;
555 // mx.kineticEnergy = kineticEnergy;
556 // mx.mass = mass;
557 // mx.charge = charge;
558 // mx.timeOfFlight = timeOfFlight;
559 // mx.side = side;
560 // mx.flag = flag;
561 // mx.code = code;
562 // momentum.setX( p1.momentum.x());
563 // momentum.setY( p1.momentum.y());
564 // momentum.setZ( p1.momentum.z());
565 // energy = p1.energy;
566 // kineticEnergy = p1.kineticEnergy;
567 // mass = p1.mass;
568 // charge = p1.charge;
569 // timeOfFlight = p1.timeOfFlight;
570 // side = p1.side
571 // flag = p1.flag;
572 // code = p1.code;
573  *this = p1;
574  p1 = mx;
575  return;
576  }
G4double G4GHEKinematicsVector::GetCharge ( )
inline

Definition at line 311 of file G4GHEKinematicsVector.hh.

References charge.

311 {return charge; }
G4int G4GHEKinematicsVector::GetCode ( )
inline

Definition at line 338 of file G4GHEKinematicsVector.hh.

References code.

338 { return code; }
G4double G4GHEKinematicsVector::GetEnergy ( )
inline

Definition at line 260 of file G4GHEKinematicsVector.hh.

References energy.

260 {return energy;}
G4bool G4GHEKinematicsVector::getFlag ( )
inline

Definition at line 329 of file G4GHEKinematicsVector.hh.

References flag.

329 { return flag; }
G4double G4GHEKinematicsVector::GetKineticEnergy ( )
inline

Definition at line 263 of file G4GHEKinematicsVector.hh.

References kineticEnergy.

263 {return kineticEnergy;}
G4double G4GHEKinematicsVector::GetMass ( )
inline

Definition at line 305 of file G4GHEKinematicsVector.hh.

References mass.

305 { return mass; }
const G4ParticleMomentum G4GHEKinematicsVector::GetMomentum ( void  ) const
inline

Definition at line 123 of file G4GHEKinematicsVector.hh.

References momentum.

123 { return momentum; }
G4ParticleDefinition* G4GHEKinematicsVector::GetParticleDef ( )
inline

Definition at line 341 of file G4GHEKinematicsVector.hh.

References particleDef.

Referenced by G4MuonMinusCaptureAtRest::AtRestDoIt().

341 { return particleDef; }
G4ParticleDefinition * particleDef
G4int G4GHEKinematicsVector::GetSide ( )
inline

Definition at line 323 of file G4GHEKinematicsVector.hh.

References side.

323 { return side; }
G4double G4GHEKinematicsVector::GetTOF ( )
inline

Definition at line 317 of file G4GHEKinematicsVector.hh.

References timeOfFlight.

Referenced by G4AntiNeutronAnnihilationAtRest::AtRestDoIt().

317 { return timeOfFlight; }
G4double G4GHEKinematicsVector::Impu ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 447 of file G4GHEKinematicsVector.hh.

References energy, momentum, sqr(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

448  {
449  return ( - sqr( p1.energy - p2.energy)
450  + sqr(p1.momentum.x() - p2.momentum.x())
451  + sqr(p1.momentum.y() - p2.momentum.y())
452  + sqr(p1.momentum.z() - p2.momentum.z()) );
453  }
double x() const
double z() const
double y() const
T sqr(const T &x)
Definition: templates.hh:145
G4double G4GHEKinematicsVector::Length ( )
inline

Definition at line 542 of file G4GHEKinematicsVector.hh.

References CLHEP::Hep3Vector::mag(), and momentum.

543  {
544  return momentum.mag() ;
545  }
double mag() const
void G4GHEKinematicsVector::Lor ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 393 of file G4GHEKinematicsVector.hh.

References test::a, code, CLHEP::Hep3Vector::dot(), energy, flag, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, sqr(), timeOfFlight, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

394  {
395  G4double a;
396  a = ( p1.momentum.dot(p2.momentum)/(p2.energy+p2.mass) - p1.energy ) / p2.mass;
397  momentum.setX( p1.momentum.x()+a*p2.momentum.x() );
398  momentum.setY( p1.momentum.y()+a*p2.momentum.y() );
399  momentum.setZ( p1.momentum.z()+a*p2.momentum.z() );
400  energy = std::sqrt( sqr(p1.mass) + momentum.mag2() );
401  mass = p1.mass;
402  kineticEnergy = std::max(0.,energy - mass);
404  side = p1.side;
405  flag = p1.flag;
406  code = p1.code;
408  }
G4ParticleDefinition * particleDef
double x() const
double dot(const Hep3Vector &) const
void setY(double)
double z() const
void setZ(double)
void setX(double)
Definition: inftrees.h:24
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double y() const
double mag2() const
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
void G4GHEKinematicsVector::Norz ( const G4GHEKinematicsVector p)
inline

Definition at line 522 of file G4GHEKinematicsVector.hh.

References test::a, charge, code, energy, flag, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, timeOfFlight, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

523  {
524  G4double a = p.momentum.mag2();
525  if (a > 0.0) a = 1./std::sqrt(a);
526  momentum.setX( a * p.momentum.x() );
527  momentum.setY( a * p.momentum.y() );
528  momentum.setZ( a * p.momentum.z() );
529  mass = p.mass;
530  energy = std::sqrt(momentum.mag2() + mass*mass);
532  charge = p.charge;
534  side = p.side;
535  flag = p.flag;
536  code = p.code;
538  return;
539  }
G4ParticleDefinition * particleDef
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
Definition: inftrees.h:24
double y() const
double mag2() const
double G4double
Definition: G4Types.hh:76
G4GHEKinematicsVector& G4GHEKinematicsVector::operator= ( const G4GHEKinematicsVector p)
inline

Definition at line 90 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, timeOfFlight, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

91  {
92  if (this != &p)
93  {
94  momentum.setX( p.momentum.x() );
95  momentum.setY( p.momentum.y() );
96  momentum.setZ( p.momentum.z() );
97  energy = p.energy;
99  mass = p.mass;
100  charge = p.charge;
102  side = p.side;
103  flag = p.flag;
104  code = p.code;
106  }
107  return *this;
108  }
G4ParticleDefinition * particleDef
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
Definition: inftrees.h:24
double y() const
void G4GHEKinematicsVector::Print ( G4int  L)
inline

Definition at line 674 of file G4GHEKinematicsVector.hh.

References charge, energy, flag, G4cout, G4endl, kineticEnergy, mass, momentum, particleDef, side, timeOfFlight, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

675  {
676  G4cout << "G4GHEKinematicsVector: "
677  << L << " " << momentum.x() << " " << momentum.y() << " " << momentum.z() << " "
678  << energy << " " << kineticEnergy << " " << mass << " " << charge << " "
679  << timeOfFlight << " " << side << " " << flag << " " << code << particleDef << G4endl;
680  return;
681  }
G4ParticleDefinition * particleDef
double x() const
double z() const
G4GLOB_DLL std::ostream G4cout
Definition: inftrees.h:24
double y() const
#define G4endl
Definition: G4ios.hh:61
void G4GHEKinematicsVector::SetCharge ( G4double  c)
inline

Definition at line 308 of file G4GHEKinematicsVector.hh.

References test::c, and charge.

308 { charge = c; return; }
void G4GHEKinematicsVector::SetCode ( G4int  c)
inline

Definition at line 332 of file G4GHEKinematicsVector.hh.

References test::c.

332 { code = c; return; }
Definition: inftrees.h:24
void G4GHEKinematicsVector::SetEnergy ( G4double  e)
inline

Definition at line 180 of file G4GHEKinematicsVector.hh.

References energy.

180 { energy = e; return; }
void G4GHEKinematicsVector::SetEnergyAndUpdate ( G4double  e)
inline

Definition at line 183 of file G4GHEKinematicsVector.hh.

References energy, G4UniformRand, kineticEnergy, CLHEP::Hep3Vector::mag(), mass, momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

184  {
185  if (e <= mass)
186  {
187  energy = mass;
188  kineticEnergy = 0.;
189  momentum.setX( 0.);
190  momentum.setY( 0.);
191  momentum.setZ( 0.);
192  }
193  else
194  {
195  energy = e;
197  G4double momold = momentum.mag();
198  G4double momnew = std::sqrt(energy*energy - mass*mass);
199  if (momold == 0.)
200  {
201  G4double cost = 1.0- 2.0*G4UniformRand();
202  G4double sint = std::sqrt(1. - cost*cost);
203  G4double phi = CLHEP::twopi* G4UniformRand();
204  momentum.setX( momnew * sint * std::cos(phi));
205  momentum.setY( momnew * sint * std::sin(phi));
206  momentum.setZ( momnew * cost);
207  }
208  else
209  {
210  momnew /= momold;
211  momentum.setX(momentum.x()*momnew);
212  momentum.setY(momentum.y()*momnew);
213  momentum.setZ(momentum.z()*momnew);
214  }
215  }
216  return;
217  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
#define G4UniformRand()
Definition: Randomize.hh:87
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
void G4GHEKinematicsVector::setFlag ( G4bool  f)
inline

Definition at line 326 of file G4GHEKinematicsVector.hh.

References flag.

326 { flag = f; return; }
void G4GHEKinematicsVector::SetKineticEnergy ( G4double  ekin)
inline

Definition at line 220 of file G4GHEKinematicsVector.hh.

References kineticEnergy.

220 { kineticEnergy = ekin; return; }
void G4GHEKinematicsVector::SetKineticEnergyAndUpdate ( G4double  ekin)
inline

Definition at line 223 of file G4GHEKinematicsVector.hh.

References energy, G4UniformRand, kineticEnergy, CLHEP::Hep3Vector::mag(), mass, momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

224  {
225  if (ekin <= 0.)
226  {
227  energy = mass;
228  kineticEnergy = 0.;
229  momentum.setX( 0.);
230  momentum.setY( 0.);
231  momentum.setZ( 0.);
232  }
233  else
234  {
235  energy = ekin + mass;
236  kineticEnergy = ekin;
237  G4double momold = momentum.mag();
238  G4double momnew = std::sqrt(energy*energy - mass*mass);
239  if (momold == 0.)
240  {
241  G4double cost = 1.0-2.0*G4UniformRand();
242  G4double sint = std::sqrt(1. - cost*cost);
243  G4double phi = CLHEP::twopi* G4UniformRand();
244  momentum.setX( momnew * sint * std::cos(phi));
245  momentum.setY( momnew * sint * std::sin(phi));
246  momentum.setZ( momnew * cost);
247  }
248  else
249  {
250  momnew /= momold;
251  momentum.setX(momentum.x()*momnew);
252  momentum.setY(momentum.y()*momnew);
253  momentum.setZ(momentum.z()*momnew);
254  }
255  }
256  return;
257  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
#define G4UniformRand()
Definition: Randomize.hh:87
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
void G4GHEKinematicsVector::SetMass ( G4double  mas)
inline

Definition at line 266 of file G4GHEKinematicsVector.hh.

References mass.

266 { mass = mas; return; }
void G4GHEKinematicsVector::SetMassAndUpdate ( G4double  mas)
inline

Definition at line 269 of file G4GHEKinematicsVector.hh.

References energy, G4UniformRand, kineticEnergy, CLHEP::Hep3Vector::mag(), mass, G4INCL::Math::max(), momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

270  {
271  kineticEnergy = std::max(0., energy - mas);
272  mass = mas;
274  G4double momnew = std::sqrt(std::max(0., energy*energy - mass*mass));
275  if ( momnew == 0.0)
276  {
277  momentum.setX( 0.0 );
278  momentum.setY( 0.0 );
279  momentum.setZ( 0.0 );
280  }
281  else
282  {
283  G4double momold = momentum.mag();
284  if (momold == 0.)
285  {
286  G4double cost = 1.-2.*G4UniformRand();
287  G4double sint = std::sqrt(1.-cost*cost);
288  G4double phi = CLHEP::twopi*G4UniformRand();
289  momentum.setX( momnew*sint*std::cos(phi));
290  momentum.setY( momnew*sint*std::sin(phi));
291  momentum.setZ( momnew*cost);
292  }
293  else
294  {
295  momnew /= momold;
296  momentum.setX( momentum.x()*momnew );
297  momentum.setY( momentum.y()*momnew );
298  momentum.setZ( momentum.z()*momnew );
299  }
300  }
301  return;
302  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
#define G4UniformRand()
Definition: Randomize.hh:87
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
void G4GHEKinematicsVector::SetMomentum ( G4ParticleMomentum  mom)
inline

Definition at line 111 of file G4GHEKinematicsVector.hh.

References momentum.

111 { momentum = mom; return; };
void G4GHEKinematicsVector::SetMomentum ( G4double  x,
G4double  y,
G4double  z 
)
inline

Definition at line 126 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), and CLHEP::Hep3Vector::setZ().

127  {
128  momentum.setX( x );
129  momentum.setY( y );
130  momentum.setZ( z );
131  return;
132  }
G4double z
Definition: TRTMaterials.hh:39
void setY(double)
void setZ(double)
void setX(double)
void G4GHEKinematicsVector::SetMomentum ( G4double  x,
G4double  y 
)
inline

Definition at line 146 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), and CLHEP::Hep3Vector::setY().

147  {
148  momentum.setX( x );
149  momentum.setY( y );
150  return;
151  }
void setY(double)
void setX(double)
void G4GHEKinematicsVector::SetMomentum ( G4double  z)
inline

Definition at line 164 of file G4GHEKinematicsVector.hh.

References momentum, and CLHEP::Hep3Vector::setZ().

165  {
166  momentum.setZ( z );
167  return;
168  }
G4double z
Definition: TRTMaterials.hh:39
void setZ(double)
void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4ParticleMomentum  mom)
inline

Definition at line 114 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), and momentum.

115  {
116  momentum = mom;
117  energy = std::sqrt(mass*mass + momentum.mag2());
119  return;
120  }
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  x,
G4double  y,
G4double  z 
)
inline

Definition at line 135 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), and CLHEP::Hep3Vector::setZ().

136  {
137  momentum.setX( x );
138  momentum.setY( y );
139  momentum.setZ( z );
140  energy = std::sqrt(mass*mass + momentum.mag2());
142  return;
143  }
G4double z
Definition: TRTMaterials.hh:39
void setY(double)
void setZ(double)
void setX(double)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  x,
G4double  y 
)
inline

Definition at line 154 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), momentum, CLHEP::Hep3Vector::setX(), and CLHEP::Hep3Vector::setY().

155  {
156  momentum.setX( x );
157  momentum.setY( y );
158  energy = std::sqrt(mass*mass + momentum.mag2());
160  return;
161  }
void setY(double)
void setX(double)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  z)
inline

Definition at line 171 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), momentum, and CLHEP::Hep3Vector::setZ().

172  {
173  momentum.setZ( z );
174  energy = std::sqrt(mass*mass + momentum.mag2());
176  return;
177  }
G4double z
Definition: TRTMaterials.hh:39
void setZ(double)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
void G4GHEKinematicsVector::SetParticleDef ( G4ParticleDefinition c)
inline

Definition at line 335 of file G4GHEKinematicsVector.hh.

References test::c, and particleDef.

335 { particleDef = c; return; }
G4ParticleDefinition * particleDef
void G4GHEKinematicsVector::SetSide ( G4int  sid)
inline

Definition at line 320 of file G4GHEKinematicsVector.hh.

References side.

320 { side = sid; return; }
void G4GHEKinematicsVector::SetTOF ( G4double  t)
inline

Definition at line 314 of file G4GHEKinematicsVector.hh.

References timeOfFlight.

314 { timeOfFlight = t; return; }
void G4GHEKinematicsVector::SetZero ( )
inline

Definition at line 344 of file G4GHEKinematicsVector.hh.

References charge, energy, flag, kineticEnergy, mass, momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, and timeOfFlight.

345  {
346  momentum.setX( 0.0 );
347  momentum.setY( 0.0 );
348  momentum.setZ( 0.0 );
349  energy = 0.0;
350  kineticEnergy = 0.0;
351  mass = 0.0;
352  charge = 0.0;
353  timeOfFlight = 0.0;
354  side = 0;
355  flag = false;
356  code = 0;
357  particleDef = NULL;
358  }
G4ParticleDefinition * particleDef
void setY(double)
void setZ(double)
void setX(double)
Definition: inftrees.h:24
void G4GHEKinematicsVector::Smul ( const G4GHEKinematicsVector p,
G4double  h 
)
inline

Definition at line 495 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

496  {
497  momentum.setX( h * p.momentum.x());
498  momentum.setY( h * p.momentum.y());
499  momentum.setZ( h * p.momentum.z());
500  return;
501  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const
void G4GHEKinematicsVector::SmulAndUpdate ( const G4GHEKinematicsVector p,
G4double  h 
)
inline

Definition at line 504 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, momentum, particleDef, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), side, timeOfFlight, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

505  {
506  momentum.setX( h * p.momentum.x());
507  momentum.setY( h * p.momentum.y());
508  momentum.setZ( h * p.momentum.z());
509  mass = p.mass;
510  energy = std::sqrt(momentum.mag2() + mass*mass);
512  charge = p.charge;
514  side = p.side;
515  flag = p.flag;
516  code = p.code;
518  return;
519  }
G4ParticleDefinition * particleDef
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
Definition: inftrees.h:24
double y() const
double mag2() const
void G4GHEKinematicsVector::Sub ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 377 of file G4GHEKinematicsVector.hh.

References test::b, charge, code, energy, kineticEnergy, CLHEP::Hep3Vector::mag2(), mass, G4INCL::Math::max(), momentum, and particleDef.

378  {
379  momentum = p1.momentum - p2.momentum;
380  energy = p1.energy - p2.energy;
382  if( b < 0 )
383  mass = -1. * std::sqrt( -b );
384  else
385  mass = std::sqrt( b );
387  charge = p1.charge - p2.charge;
388  code = p1.code - p2.code;
390  }
G4ParticleDefinition * particleDef
Definition: inftrees.h:24
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
double G4double
Definition: G4Types.hh:76
void G4GHEKinematicsVector::Sub3 ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 465 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

466  {
467  momentum.setX( p1.momentum.x() - p2.momentum.x());
468  momentum.setY( p1.momentum.y() - p2.momentum.y());
469  momentum.setZ( p1.momentum.z() - p2.momentum.z());
470  return;
471  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const
void G4GHEKinematicsVector::Trac ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector mx,
const G4GHEKinematicsVector my,
const G4GHEKinematicsVector mz 
)
inline

Definition at line 654 of file G4GHEKinematicsVector.hh.

References momentum, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

656  {
657  double px, py, pz;
658  px = mx.momentum.x()*p1.momentum.x()
659  + mx.momentum.y()*p1.momentum.y()
660  + mx.momentum.z()*p1.momentum.z();
661  py = my.momentum.x()*p1.momentum.x()
662  + my.momentum.y()*p1.momentum.y()
663  + my.momentum.z()*p1.momentum.z();
664  pz = mz.momentum.x()*p1.momentum.x()
665  + mz.momentum.y()*p1.momentum.y()
666  + mz.momentum.z()*p1.momentum.z();
667  momentum.setX( px );
668  momentum.setY( py );
669  momentum.setZ( pz );
670  return;
671  }
double x() const
void setY(double)
double z() const
void setZ(double)
void setX(double)
double y() const

Field Documentation

G4double G4GHEKinematicsVector::charge
G4int G4GHEKinematicsVector::code
G4double G4GHEKinematicsVector::energy
G4bool G4GHEKinematicsVector::flag
G4double G4GHEKinematicsVector::kineticEnergy
G4double G4GHEKinematicsVector::mass
G4ParticleMomentum G4GHEKinematicsVector::momentum
G4ParticleDefinition* G4GHEKinematicsVector::particleDef
G4int G4GHEKinematicsVector::side
G4double G4GHEKinematicsVector::timeOfFlight

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