Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4GHEKinematicsVector Class Reference

#include <G4GHEKinematicsVector.hh>

Collaboration diagram for G4GHEKinematicsVector:

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 LLL)
 

Public Attributes

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.

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

Here is the call graph for this function:

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.

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

Here is the call graph for this function:

Member Function Documentation

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

Definition at line 361 of file G4GHEKinematicsVector.hh.

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
tuple b
Definition: test.py:12
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

Here is the call graph for this function:

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

Definition at line 456 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

G4double G4GHEKinematicsVector::Ang ( const G4GHEKinematicsVector p)
inline

Definition at line 424 of file G4GHEKinematicsVector.hh.

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
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
double z() const
double y() const
double mag2() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4GHEKinematicsVector::CosAng ( const G4GHEKinematicsVector p)
inline

Definition at line 411 of file G4GHEKinematicsVector.hh.

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
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
double z() const
double y() const
double mag2() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

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

Definition at line 474 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

void G4GHEKinematicsVector::Defs ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2,
G4GHEKinematicsVector my,
G4GHEKinematicsVector mz 
)
inline

Definition at line 608 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

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

Definition at line 579 of file G4GHEKinematicsVector.hh.

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
static constexpr double halfpi
Definition: SystemOfUnits.h:56
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
double mag() const
static constexpr double pi
Definition: SystemOfUnits.h:54

Here is the call graph for this function:

G4double G4GHEKinematicsVector::Dot ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 487 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

G4double G4GHEKinematicsVector::Dot4 ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 438 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

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.

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

Definition at line 338 of file G4GHEKinematicsVector.hh.

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

Definition at line 260 of file G4GHEKinematicsVector.hh.

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

Definition at line 329 of file G4GHEKinematicsVector.hh.

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

Definition at line 263 of file G4GHEKinematicsVector.hh.

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

Definition at line 305 of file G4GHEKinematicsVector.hh.

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

Definition at line 123 of file G4GHEKinematicsVector.hh.

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

Definition at line 341 of file G4GHEKinematicsVector.hh.

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

Definition at line 323 of file G4GHEKinematicsVector.hh.

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

Definition at line 317 of file G4GHEKinematicsVector.hh.

317 { return timeOfFlight; }

Here is the caller graph for this function:

G4double G4GHEKinematicsVector::Impu ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector p2 
)
inline

Definition at line 447 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

G4double G4GHEKinematicsVector::Length ( )
inline

Definition at line 542 of file G4GHEKinematicsVector.hh.

543  {
544  return momentum.mag() ;
545  }
double mag() const

Here is the call graph for this function:

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

Definition at line 393 of file G4GHEKinematicsVector.hh.

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
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
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

Here is the call graph for this function:

void G4GHEKinematicsVector::Norz ( const G4GHEKinematicsVector p)
inline

Definition at line 522 of file G4GHEKinematicsVector.hh.

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
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
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

Here is the call graph for this function:

G4GHEKinematicsVector& G4GHEKinematicsVector::operator= ( const G4GHEKinematicsVector p)
inline

Definition at line 90 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

void G4GHEKinematicsVector::Print ( G4int  LLL)
inline

Definition at line 674 of file G4GHEKinematicsVector.hh.

675  {
676  G4cout << "G4GHEKinematicsVector: "
677  << LLL << " " << 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

Here is the call graph for this function:

void G4GHEKinematicsVector::SetCharge ( G4double  c)
inline

Definition at line 308 of file G4GHEKinematicsVector.hh.

308 { charge = c; return; }
tuple c
Definition: test.py:13
void G4GHEKinematicsVector::SetCode ( G4int  c)
inline

Definition at line 332 of file G4GHEKinematicsVector.hh.

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

Definition at line 180 of file G4GHEKinematicsVector.hh.

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

Definition at line 183 of file G4GHEKinematicsVector.hh.

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);
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:97
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
static constexpr double twopi
Definition: SystemOfUnits.h:55

Here is the call graph for this function:

void G4GHEKinematicsVector::setFlag ( G4bool  f)
inline

Definition at line 326 of file G4GHEKinematicsVector.hh.

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

Definition at line 220 of file G4GHEKinematicsVector.hh.

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

Definition at line 223 of file G4GHEKinematicsVector.hh.

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);
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:97
double y() const
double G4double
Definition: G4Types.hh:76
double mag() const
static constexpr double twopi
Definition: SystemOfUnits.h:55

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMass ( G4double  mas)
inline

Definition at line 266 of file G4GHEKinematicsVector.hh.

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

Definition at line 269 of file G4GHEKinematicsVector.hh.

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);
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:97
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
static constexpr double twopi
Definition: SystemOfUnits.h:55

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentum ( G4ParticleMomentum  mom)
inline

Definition at line 111 of file G4GHEKinematicsVector.hh.

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

Definition at line 126 of file G4GHEKinematicsVector.hh.

127  {
128  momentum.setX( x );
129  momentum.setY( y );
130  momentum.setZ( z );
131  return;
132  }
tuple x
Definition: test.py:50
void setY(double)
void setZ(double)
void setX(double)
tuple z
Definition: test.py:28

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentum ( G4double  x,
G4double  y 
)
inline

Definition at line 146 of file G4GHEKinematicsVector.hh.

147  {
148  momentum.setX( x );
149  momentum.setY( y );
150  return;
151  }
tuple x
Definition: test.py:50
void setY(double)
void setX(double)

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentum ( G4double  z)
inline

Definition at line 164 of file G4GHEKinematicsVector.hh.

165  {
166  momentum.setZ( z );
167  return;
168  }
void setZ(double)
tuple z
Definition: test.py:28

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4ParticleMomentum  mom)
inline

Definition at line 114 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  x,
G4double  y,
G4double  z 
)
inline

Definition at line 135 of file G4GHEKinematicsVector.hh.

136  {
137  momentum.setX( x );
138  momentum.setY( y );
139  momentum.setZ( z );
140  energy = std::sqrt(mass*mass + momentum.mag2());
142  return;
143  }
tuple x
Definition: test.py:50
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
tuple z
Definition: test.py:28

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  x,
G4double  y 
)
inline

Definition at line 154 of file G4GHEKinematicsVector.hh.

155  {
156  momentum.setX( x );
157  momentum.setY( y );
158  energy = std::sqrt(mass*mass + momentum.mag2());
160  return;
161  }
tuple x
Definition: test.py:50
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

Here is the call graph for this function:

void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  z)
inline

Definition at line 171 of file G4GHEKinematicsVector.hh.

172  {
173  momentum.setZ( z );
174  energy = std::sqrt(mass*mass + momentum.mag2());
176  return;
177  }
void setZ(double)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double mag2() const
tuple z
Definition: test.py:28

Here is the call graph for this function:

void G4GHEKinematicsVector::SetParticleDef ( G4ParticleDefinition c)
inline

Definition at line 335 of file G4GHEKinematicsVector.hh.

335 { particleDef = c; return; }
G4ParticleDefinition * particleDef
tuple c
Definition: test.py:13
void G4GHEKinematicsVector::SetSide ( G4int  sid)
inline

Definition at line 320 of file G4GHEKinematicsVector.hh.

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

Definition at line 314 of file G4GHEKinematicsVector.hh.

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

Definition at line 344 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

void G4GHEKinematicsVector::Smul ( const G4GHEKinematicsVector p,
G4double  h 
)
inline

Definition at line 495 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

void G4GHEKinematicsVector::SmulAndUpdate ( const G4GHEKinematicsVector p,
G4double  h 
)
inline

Definition at line 504 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

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

Definition at line 377 of file G4GHEKinematicsVector.hh.

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
tuple b
Definition: test.py:12
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

Here is the call graph for this function:

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

Definition at line 465 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

void G4GHEKinematicsVector::Trac ( const G4GHEKinematicsVector p1,
const G4GHEKinematicsVector mx,
const G4GHEKinematicsVector my,
const G4GHEKinematicsVector mz 
)
inline

Definition at line 654 of file G4GHEKinematicsVector.hh.

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

Here is the call graph for this function:

Member Data Documentation

G4double G4GHEKinematicsVector::charge

Definition at line 687 of file G4GHEKinematicsVector.hh.

G4int G4GHEKinematicsVector::code

Definition at line 691 of file G4GHEKinematicsVector.hh.

G4double G4GHEKinematicsVector::energy

Definition at line 684 of file G4GHEKinematicsVector.hh.

G4bool G4GHEKinematicsVector::flag

Definition at line 690 of file G4GHEKinematicsVector.hh.

G4double G4GHEKinematicsVector::kineticEnergy

Definition at line 685 of file G4GHEKinematicsVector.hh.

G4double G4GHEKinematicsVector::mass

Definition at line 686 of file G4GHEKinematicsVector.hh.

G4ParticleMomentum G4GHEKinematicsVector::momentum

Definition at line 683 of file G4GHEKinematicsVector.hh.

G4ParticleDefinition* G4GHEKinematicsVector::particleDef

Definition at line 692 of file G4GHEKinematicsVector.hh.

G4int G4GHEKinematicsVector::side

Definition at line 689 of file G4GHEKinematicsVector.hh.

G4double G4GHEKinematicsVector::timeOfFlight

Definition at line 688 of file G4GHEKinematicsVector.hh.


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