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, code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00055    {
00056      momentum.setX(  0.0 );
00057      momentum.setY(  0.0 );
00058      momentum.setZ(  0.0 );
00059      energy        = 0.0;
00060      kineticEnergy = 0.0;
00061      mass          = 0.0;
00062      charge        = 0.0;
00063      timeOfFlight  = 0.0;
00064      side          = 0;
00065      flag          = false;
00066      code          = 0;
00067      particleDef   = NULL;
00068    }

G4GHEKinematicsVector::~G4GHEKinematicsVector (  )  [inline]

Definition at line 70 of file G4GHEKinematicsVector.hh.

00070 {}

G4GHEKinematicsVector::G4GHEKinematicsVector ( const G4GHEKinematicsVector p  )  [inline]

Definition at line 73 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00074    {
00075      momentum.setX( p.momentum.x() );
00076      momentum.setY( p.momentum.y() );
00077      momentum.setZ( p.momentum.z() );
00078      energy        = p.energy;
00079      kineticEnergy = p.kineticEnergy;
00080      mass          = p.mass;
00081      charge        = p.charge;
00082      timeOfFlight  = p.timeOfFlight;
00083      side          = p.side;
00084      flag          = p.flag;
00085      code          = p.code;
00086      particleDef   = p.particleDef;
00087    }


Member Function Documentation

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

Definition at line 361 of file G4GHEKinematicsVector.hh.

References charge, code, energy, kineticEnergy, mass, momentum, and particleDef.

00362    {
00363      momentum = p1.momentum + p2.momentum;
00364      energy = p1.energy + p2.energy;
00365      G4double b = energy*energy - momentum.mag2();
00366      if( b < 0 )
00367        mass = -1. * std::sqrt( -b );
00368      else
00369        mass = std::sqrt( b );
00370      kineticEnergy = std::max(0.,energy - mass);
00371      charge        = p1.charge + p2.charge;
00372      code          = p1.code   + p2.code;
00373      particleDef   = p1.particleDef;
00374    }

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

Definition at line 456 of file G4GHEKinematicsVector.hh.

References momentum.

00457    {
00458      momentum.setX( p1.momentum.x() + p2.momentum.x());
00459      momentum.setY( p1.momentum.y() + p2.momentum.y());
00460      momentum.setZ( p1.momentum.z() + p2.momentum.z());    
00461      return;
00462    }

G4double G4GHEKinematicsVector::Ang ( const G4GHEKinematicsVector p  )  [inline]

Definition at line 424 of file G4GHEKinematicsVector.hh.

References momentum.

00425    {
00426      G4double a = std::sqrt( momentum.mag2() * p.momentum.mag2() );
00427      if( a != 0.0 ) 
00428        {
00429          a = (momentum.x()*p.momentum.x() +
00430               momentum.y()*p.momentum.y() +
00431               momentum.z()*p.momentum.z()) / a;
00432          if( std::fabs(a) > 1.0 ) a<0.0 ? a=-1.0 : a=1.0;
00433        }
00434      return std::acos(a);
00435    }      

G4double G4GHEKinematicsVector::CosAng ( const G4GHEKinematicsVector p  )  [inline]

Definition at line 411 of file G4GHEKinematicsVector.hh.

References momentum.

00412    {
00413      G4double a = std::sqrt( momentum.mag2() * p.momentum.mag2() );
00414      if( a != 0.0 ) 
00415        {
00416          a = (momentum.x()*p.momentum.x() +
00417               momentum.y()*p.momentum.y() +
00418               momentum.z()*p.momentum.z()) / a;
00419          if( std::fabs(a) > 1.0 ) a<0.0 ? a=-1.0 : a=1.0;
00420        }
00421      return a;
00422    }

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

Definition at line 474 of file G4GHEKinematicsVector.hh.

References momentum.

00475    {
00476      G4double px, py, pz;
00477      px = p1.momentum.y() * p2.momentum.z() - p1.momentum.z() * p2.momentum.y();
00478      py = p1.momentum.z() * p2.momentum.x() - p1.momentum.x() * p2.momentum.z();
00479      pz = p1.momentum.x() * p2.momentum.y() - p1.momentum.y() * p2.momentum.x();
00480      momentum.setX( px );
00481      momentum.setY( py );
00482      momentum.setZ( pz ); 
00483      return;
00484    }  

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

Definition at line 608 of file G4GHEKinematicsVector.hh.

References momentum, and G4InuclParticleNames::pp.

00610    {
00611      my = p1;
00612      mz = p2;
00613      momentum.setX(   my.momentum.y()*mz.momentum.z()
00614                     - my.momentum.z()*mz.momentum.y());
00615      momentum.setY(   my.momentum.z()*mz.momentum.x()
00616                     - my.momentum.x()*mz.momentum.z());
00617      momentum.setZ(   my.momentum.x()*mz.momentum.y()
00618                     - my.momentum.y()*mz.momentum.x());
00619      my.momentum.setX(   mz.momentum.y()*momentum.z()
00620                        - mz.momentum.z()*momentum.y());
00621      my.momentum.setY(   mz.momentum.z()*momentum.x()
00622                        - mz.momentum.x()*momentum.z());
00623      my.momentum.setZ(   mz.momentum.x()*momentum.y()
00624                        - mz.momentum.y()*momentum.x());
00625      G4double pp;
00626      pp = momentum.mag();
00627      if (pp > 0.)
00628         {
00629           pp = 1./pp; 
00630           momentum.setX( momentum.x()*pp );
00631           momentum.setY( momentum.y()*pp );
00632           momentum.setZ( momentum.z()*pp );
00633         }
00634      pp = my.momentum.mag();
00635      if (pp > 0.)
00636         {
00637           pp = 1./pp;
00638           my.momentum.setX( my.momentum.x()*pp );
00639           my.momentum.setY( my.momentum.y()*pp );
00640           my.momentum.setZ( my.momentum.z()*pp );
00641         }
00642      pp = mz.momentum.mag();
00643      if (pp > 0.)
00644         {
00645           pp = 1./pp;
00646           mz.momentum.setX( mz.momentum.x()*pp );
00647           mz.momentum.setY( mz.momentum.y()*pp );
00648           mz.momentum.setZ( mz.momentum.z()*pp );
00649         }
00650      return; 
00651    }  

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

Definition at line 579 of file G4GHEKinematicsVector.hh.

References momentum, G4INCL::Math::pi, and sqr().

00580    {
00581      G4double pt2 = sqr(p1.momentum.x()) + sqr(p1.momentum.y());
00582      if (pt2 > 0.0)
00583         {
00584           G4double ph, px, py, pz;
00585           G4double cost  = p2.momentum.z()/p2.momentum.mag(); 
00586           G4double sint  = 0.5 * (  std::sqrt(std::fabs((1.-cost)*(1.+cost))) 
00587                                   + std::sqrt(pt2)/p2.momentum.mag());
00588           (p2.momentum.y() < 0.) ? ph = 1.5*CLHEP::pi : ph = CLHEP::halfpi;
00589           if( p2.momentum.x() != 0.0) 
00590              ph = std::atan2(p2.momentum.y(),p2.momentum.x());             
00591           px =   cost*std::cos(ph)*p1.momentum.x() - std::sin(ph)*p1.momentum.y()
00592                + sint*std::cos(ph)*p1.momentum.z();
00593           py =   cost*std::sin(ph)*p1.momentum.x() + std::cos(ph)*p1.momentum.y()
00594                + sint*std::sin(ph)*p1.momentum.z();
00595           pz = - sint        *p1.momentum.x() 
00596                + cost        *p1.momentum.z();
00597           momentum.setX( px ); 
00598           momentum.setY( py );
00599           momentum.setZ( pz );     
00600         }
00601      else
00602         {
00603           momentum = p1.momentum;             
00604         } 
00605    }

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

Definition at line 487 of file G4GHEKinematicsVector.hh.

References momentum.

00488    {
00489      return (   p1.momentum.x() * p2.momentum.x()
00490               + p1.momentum.y() * p2.momentum.y()
00491               + p1.momentum.z() * p2.momentum.z() );
00492    }

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

Definition at line 438 of file G4GHEKinematicsVector.hh.

References energy, and momentum.

00439    {
00440      return (   p1.energy       * p2.energy
00441               - p1.momentum.x() * p2.momentum.x()
00442               - p1.momentum.y() * p2.momentum.y()
00443               - p1.momentum.z() * p2.momentum.z() );
00444    } 

void G4GHEKinematicsVector::Exch ( G4GHEKinematicsVector p1  )  [inline]

Definition at line 548 of file G4GHEKinematicsVector.hh.

00549    {
00550      G4GHEKinematicsVector mx = *this;
00551 //     mx.momentum.SetX( momentum.x());
00552 //     mx.momentum.SetY( momentum.y());
00553 //     mx.momentum.SetZ( momentum.z());
00554 //     mx.energy        = energy;
00555 //     mx.kineticEnergy = kineticEnergy;
00556 //     mx.mass          = mass;
00557 //     mx.charge        = charge;
00558 //     mx.timeOfFlight  = timeOfFlight;
00559 //     mx.side          = side;
00560 //     mx.flag          = flag;
00561 //     mx.code          = code; 
00562 //     momentum.setX( p1.momentum.x());
00563 //     momentum.setY( p1.momentum.y());
00564 //     momentum.setZ( p1.momentum.z());
00565 //     energy        = p1.energy;
00566 //     kineticEnergy = p1.kineticEnergy;
00567 //     mass          = p1.mass;
00568 //     charge        = p1.charge;
00569 //     timeOfFlight  = p1.timeOfFlight;
00570 //     side          = p1.side
00571 //     flag          = p1.flag;
00572 //     code          = p1.code;
00573      *this = p1;
00574      p1 = mx;
00575      return; 
00576    }      

G4double G4GHEKinematicsVector::GetCharge (  )  [inline]

Definition at line 311 of file G4GHEKinematicsVector.hh.

References charge.

00311 {return charge; }

G4int G4GHEKinematicsVector::GetCode (  )  [inline]

Definition at line 338 of file G4GHEKinematicsVector.hh.

References code.

00338 { return code; } 

G4double G4GHEKinematicsVector::GetEnergy (  )  [inline]

Definition at line 260 of file G4GHEKinematicsVector.hh.

References energy.

00260 {return energy;}

G4bool G4GHEKinematicsVector::getFlag (  )  [inline]

Definition at line 329 of file G4GHEKinematicsVector.hh.

References flag.

00329 { return flag; }

G4double G4GHEKinematicsVector::GetKineticEnergy (  )  [inline]

Definition at line 263 of file G4GHEKinematicsVector.hh.

References kineticEnergy.

00263 {return kineticEnergy;}

G4double G4GHEKinematicsVector::GetMass (  )  [inline]

Definition at line 305 of file G4GHEKinematicsVector.hh.

References mass.

00305 { return mass; }

const G4ParticleMomentum G4GHEKinematicsVector::GetMomentum ( void   )  const [inline]

Definition at line 123 of file G4GHEKinematicsVector.hh.

References momentum.

00123 { return momentum; }

G4ParticleDefinition* G4GHEKinematicsVector::GetParticleDef (  )  [inline]

Definition at line 341 of file G4GHEKinematicsVector.hh.

References particleDef.

00341 { return particleDef; } 

G4int G4GHEKinematicsVector::GetSide (  )  [inline]

Definition at line 323 of file G4GHEKinematicsVector.hh.

References side.

00323 { return side; }

G4double G4GHEKinematicsVector::GetTOF (  )  [inline]

Definition at line 317 of file G4GHEKinematicsVector.hh.

References timeOfFlight.

Referenced by G4PionMinusAbsorptionAtRest::AtRestDoIt(), G4NeutronCaptureAtRest::AtRestDoIt(), G4KaonMinusAbsorption::AtRestDoIt(), G4AntiProtonAnnihilationAtRest::AtRestDoIt(), and G4AntiNeutronAnnihilationAtRest::AtRestDoIt().

00317 { return timeOfFlight; }

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

Definition at line 447 of file G4GHEKinematicsVector.hh.

References energy, momentum, and sqr().

00448    {
00449      return ( - sqr( p1.energy      - p2.energy)  
00450               + sqr(p1.momentum.x() - p2.momentum.x())
00451               + sqr(p1.momentum.y() - p2.momentum.y()) 
00452               + sqr(p1.momentum.z() - p2.momentum.z()) );
00453    }

G4double G4GHEKinematicsVector::Length (  )  [inline]

Definition at line 542 of file G4GHEKinematicsVector.hh.

References momentum.

00543    {
00544      return  momentum.mag() ;
00545    }

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

Definition at line 393 of file G4GHEKinematicsVector.hh.

References code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, sqr(), and timeOfFlight.

00394    {
00395      G4double a;
00396      a = ( p1.momentum.dot(p2.momentum)/(p2.energy+p2.mass) - p1.energy ) / p2.mass;
00397      momentum.setX( p1.momentum.x()+a*p2.momentum.x() );
00398      momentum.setY( p1.momentum.y()+a*p2.momentum.y() );
00399      momentum.setZ( p1.momentum.z()+a*p2.momentum.z() );
00400      energy = std::sqrt( sqr(p1.mass) + momentum.mag2() );
00401      mass = p1.mass;
00402      kineticEnergy = std::max(0.,energy - mass);
00403      timeOfFlight  = p1.timeOfFlight;
00404      side          = p1.side;
00405      flag          = p1.flag;
00406      code          = p1.code;
00407      particleDef   = p1.particleDef;
00408    }

void G4GHEKinematicsVector::Norz ( const G4GHEKinematicsVector p  )  [inline]

Definition at line 522 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00523    {
00524      G4double a =   p.momentum.mag2();
00525      if (a > 0.0) a = 1./std::sqrt(a);
00526      momentum.setX( a * p.momentum.x() );
00527      momentum.setY( a * p.momentum.y() );
00528      momentum.setZ( a * p.momentum.z() );
00529      mass          = p.mass;
00530      energy        = std::sqrt(momentum.mag2() + mass*mass);
00531      kineticEnergy = energy - mass;
00532      charge        = p.charge;
00533      timeOfFlight  = p.timeOfFlight;
00534      side          = p.side;
00535      flag          = p.flag;
00536      code          = p.code; 
00537      particleDef   = p.particleDef; 
00538      return;
00539    }

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

Definition at line 90 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00091    {
00092      if (this != &p)
00093      {
00094         momentum.setX( p.momentum.x() );
00095         momentum.setY( p.momentum.y() );
00096         momentum.setZ( p.momentum.z() );
00097         energy        = p.energy;
00098         kineticEnergy = p.kineticEnergy;
00099         mass          = p.mass;
00100         charge        = p.charge;
00101         timeOfFlight  = p.timeOfFlight;
00102         side          = p.side;
00103         flag          = p.flag;
00104         code          = p.code;
00105         particleDef   = p.particleDef;
00106      }
00107     return *this;
00108    }

void G4GHEKinematicsVector::Print ( G4int  L  )  [inline]

Definition at line 674 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, G4cout, G4endl, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00675    {
00676      G4cout << "G4GHEKinematicsVector: " 
00677           << L << " " << momentum.x() << " " <<  momentum.y() << " " <<  momentum.z() << " "
00678           << energy << " " << kineticEnergy << " " << mass << " " << charge << " " 
00679           << timeOfFlight << " " << side << " " << flag << " " << code << particleDef << G4endl;
00680      return;                         
00681    }

void G4GHEKinematicsVector::SetCharge ( G4double  c  )  [inline]

Definition at line 308 of file G4GHEKinematicsVector.hh.

References charge.

00308 { charge = c; return; }

void G4GHEKinematicsVector::SetCode ( G4int  c  )  [inline]

Definition at line 332 of file G4GHEKinematicsVector.hh.

References code.

00332 { code = c; return; }

void G4GHEKinematicsVector::SetEnergy ( G4double  e  )  [inline]

Definition at line 180 of file G4GHEKinematicsVector.hh.

References energy.

00180 { energy = e; return; }

void G4GHEKinematicsVector::SetEnergyAndUpdate ( G4double  e  )  [inline]

Definition at line 183 of file G4GHEKinematicsVector.hh.

References energy, G4UniformRand, kineticEnergy, mass, and momentum.

00184    {
00185      if (e <= mass)
00186        { 
00187          energy        = mass;
00188          kineticEnergy = 0.;
00189          momentum.setX(  0.);
00190          momentum.setY(  0.);
00191          momentum.setZ(  0.);
00192        }
00193      else
00194        {
00195          energy = e;
00196          kineticEnergy   = energy - mass;
00197          G4double momold = momentum.mag();
00198          G4double momnew = std::sqrt(energy*energy - mass*mass);
00199          if (momold == 0.)
00200            {
00201              G4double cost = 1.0- 2.0*G4UniformRand();
00202              G4double sint = std::sqrt(1. - cost*cost);
00203              G4double phi  = CLHEP::twopi* G4UniformRand();
00204              momentum.setX( momnew * sint * std::cos(phi));
00205              momentum.setY( momnew * sint * std::sin(phi));
00206              momentum.setZ( momnew * cost);
00207            }
00208          else
00209            {
00210              momnew /= momold;
00211              momentum.setX(momentum.x()*momnew);
00212              momentum.setY(momentum.y()*momnew);
00213              momentum.setZ(momentum.z()*momnew);
00214            }
00215        }    
00216      return;
00217    }

void G4GHEKinematicsVector::setFlag ( G4bool  f  )  [inline]

Definition at line 326 of file G4GHEKinematicsVector.hh.

References flag.

00326 { flag = f; return; }

void G4GHEKinematicsVector::SetKineticEnergy ( G4double  ekin  )  [inline]

Definition at line 220 of file G4GHEKinematicsVector.hh.

References kineticEnergy.

00220 { kineticEnergy = ekin; return; }

void G4GHEKinematicsVector::SetKineticEnergyAndUpdate ( G4double  ekin  )  [inline]

Definition at line 223 of file G4GHEKinematicsVector.hh.

References energy, G4UniformRand, kineticEnergy, mass, and momentum.

00224    {
00225      if (ekin <= 0.)
00226        { 
00227          energy        = mass;
00228          kineticEnergy = 0.;
00229          momentum.setX(  0.);
00230          momentum.setY(  0.);
00231          momentum.setZ(  0.);
00232        }
00233      else
00234        {
00235          energy = ekin + mass;
00236          kineticEnergy   = ekin;
00237          G4double momold = momentum.mag();
00238          G4double momnew = std::sqrt(energy*energy - mass*mass);
00239          if (momold == 0.)
00240            {
00241              G4double cost = 1.0-2.0*G4UniformRand();
00242              G4double sint = std::sqrt(1. - cost*cost);
00243              G4double phi  = CLHEP::twopi* G4UniformRand();
00244              momentum.setX( momnew * sint * std::cos(phi));
00245              momentum.setY( momnew * sint * std::sin(phi));
00246              momentum.setZ( momnew * cost);
00247            }
00248          else
00249            {
00250              momnew /= momold;
00251              momentum.setX(momentum.x()*momnew);
00252              momentum.setY(momentum.y()*momnew);
00253              momentum.setZ(momentum.z()*momnew);
00254            }
00255        }    
00256      return;
00257    }

void G4GHEKinematicsVector::SetMass ( G4double  mas  )  [inline]

Definition at line 266 of file G4GHEKinematicsVector.hh.

References mass.

00266 { mass = mas; return; }

void G4GHEKinematicsVector::SetMassAndUpdate ( G4double  mas  )  [inline]

Definition at line 269 of file G4GHEKinematicsVector.hh.

References energy, G4UniformRand, kineticEnergy, mass, and momentum.

00270   {
00271     kineticEnergy = std::max(0., energy - mas);
00272     mass = mas;
00273     energy = kineticEnergy + mass;
00274     G4double momnew = std::sqrt(std::max(0., energy*energy - mass*mass));
00275     if ( momnew == 0.0) 
00276        {
00277          momentum.setX( 0.0 );
00278          momentum.setY( 0.0 );
00279          momentum.setZ( 0.0 );
00280        }
00281     else
00282        {
00283          G4double momold = momentum.mag();
00284          if (momold == 0.)
00285             { 
00286               G4double cost = 1.-2.*G4UniformRand();
00287               G4double sint = std::sqrt(1.-cost*cost);
00288               G4double phi  = CLHEP::twopi*G4UniformRand();
00289               momentum.setX( momnew*sint*std::cos(phi));
00290               momentum.setY( momnew*sint*std::sin(phi));
00291               momentum.setZ( momnew*cost);
00292             }
00293          else
00294             {
00295               momnew /= momold;
00296               momentum.setX( momentum.x()*momnew );
00297               momentum.setY( momentum.y()*momnew );
00298               momentum.setZ( momentum.z()*momnew );
00299             }
00300        }     
00301     return;
00302   }    

void G4GHEKinematicsVector::SetMomentum ( G4double  z  )  [inline]

Definition at line 164 of file G4GHEKinematicsVector.hh.

References momentum.

00165    {
00166      momentum.setZ( z );
00167      return;
00168    }

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

Definition at line 146 of file G4GHEKinematicsVector.hh.

References momentum.

00147    {
00148      momentum.setX( x );
00149      momentum.setY( y );
00150      return;
00151    }

void G4GHEKinematicsVector::SetMomentum ( G4double  x,
G4double  y,
G4double  z 
) [inline]

Definition at line 126 of file G4GHEKinematicsVector.hh.

References momentum.

00127    { 
00128      momentum.setX( x );
00129      momentum.setY( y );
00130      momentum.setZ( z );
00131      return;
00132    } 

void G4GHEKinematicsVector::SetMomentum ( G4ParticleMomentum  mom  )  [inline]

Definition at line 111 of file G4GHEKinematicsVector.hh.

References momentum.

00111 { momentum = mom; return; };

void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4double  z  )  [inline]

Definition at line 171 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, mass, and momentum.

00172    {
00173      momentum.setZ( z );
00174      energy = std::sqrt(mass*mass + momentum.mag2());
00175      kineticEnergy = std::max(0.,energy-mass);
00176      return;
00177    }

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

Definition at line 154 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, mass, and momentum.

00155    {
00156      momentum.setX( x );
00157      momentum.setY( y );
00158      energy = std::sqrt(mass*mass + momentum.mag2());
00159      kineticEnergy = std::max(0.,energy-mass);
00160      return;
00161    }

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

Definition at line 135 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, mass, and momentum.

00136    {
00137      momentum.setX( x );
00138      momentum.setY( y );
00139      momentum.setZ( z );
00140      energy        = std::sqrt(mass*mass + momentum.mag2());
00141      kineticEnergy = std::max(0.,energy-mass);
00142      return;
00143    }

void G4GHEKinematicsVector::SetMomentumAndUpdate ( G4ParticleMomentum  mom  )  [inline]

Definition at line 114 of file G4GHEKinematicsVector.hh.

References energy, kineticEnergy, mass, and momentum.

00115    {
00116      momentum      = mom;
00117      energy        = std::sqrt(mass*mass + momentum.mag2());
00118      kineticEnergy = std::max(0.,energy - mass);
00119      return;
00120    }

void G4GHEKinematicsVector::SetParticleDef ( G4ParticleDefinition c  )  [inline]

Definition at line 335 of file G4GHEKinematicsVector.hh.

References particleDef.

00335 { particleDef = c; return; }

void G4GHEKinematicsVector::SetSide ( G4int  sid  )  [inline]

Definition at line 320 of file G4GHEKinematicsVector.hh.

References side.

00320 { side = sid; return; }

void G4GHEKinematicsVector::SetTOF ( G4double  t  )  [inline]

Definition at line 314 of file G4GHEKinematicsVector.hh.

References timeOfFlight.

00314 { timeOfFlight = t; return; }

void G4GHEKinematicsVector::SetZero (  )  [inline]

Definition at line 344 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00345    {
00346      momentum.setX(  0.0 );
00347      momentum.setY(  0.0 );
00348      momentum.setZ(  0.0 );
00349      energy        = 0.0;
00350      kineticEnergy = 0.0;
00351      mass          = 0.0;
00352      charge        = 0.0;
00353      timeOfFlight  = 0.0;
00354      side          = 0;
00355      flag          = false;
00356      code          = 0;
00357      particleDef   = NULL;
00358    }

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

Definition at line 495 of file G4GHEKinematicsVector.hh.

References momentum.

00496    {
00497      momentum.setX( h * p.momentum.x());
00498      momentum.setY( h * p.momentum.y());
00499      momentum.setZ( h * p.momentum.z());
00500      return;
00501    }   

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

Definition at line 504 of file G4GHEKinematicsVector.hh.

References charge, code, energy, flag, kineticEnergy, mass, momentum, particleDef, side, and timeOfFlight.

00505    {
00506      momentum.setX( h * p.momentum.x());
00507      momentum.setY( h * p.momentum.y());
00508      momentum.setZ( h * p.momentum.z());
00509      mass          = p.mass;
00510      energy        = std::sqrt(momentum.mag2() + mass*mass);
00511      kineticEnergy = energy - mass;
00512      charge        = p.charge;
00513      timeOfFlight  = p.timeOfFlight;
00514      side          = p.side;
00515      flag          = p.flag;
00516      code          = p.code;
00517      particleDef   = p.particleDef;
00518      return;
00519    }

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

Definition at line 377 of file G4GHEKinematicsVector.hh.

References charge, code, energy, kineticEnergy, mass, momentum, and particleDef.

00378    {
00379      momentum = p1.momentum - p2.momentum;
00380      energy = p1.energy - p2.energy;
00381      G4double b = energy*energy - momentum.mag2();
00382      if( b < 0 )
00383        mass = -1. * std::sqrt( -b );
00384      else
00385        mass = std::sqrt( b );
00386      kineticEnergy = std::max(0.,energy - mass);
00387      charge        = p1.charge - p2.charge;
00388      code          = p1.code   - p2.code;
00389      particleDef   = p1.particleDef;
00390    }

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

Definition at line 465 of file G4GHEKinematicsVector.hh.

References momentum.

00466    {
00467      momentum.setX( p1.momentum.x() - p2.momentum.x());
00468      momentum.setY( p1.momentum.y() - p2.momentum.y());
00469      momentum.setZ( p1.momentum.z() - p2.momentum.z());
00470      return;
00471    }

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.

00656    {
00657      double px, py, pz;
00658      px =   mx.momentum.x()*p1.momentum.x()
00659           + mx.momentum.y()*p1.momentum.y()
00660           + mx.momentum.z()*p1.momentum.z();
00661      py =   my.momentum.x()*p1.momentum.x()
00662           + my.momentum.y()*p1.momentum.y()
00663           + my.momentum.z()*p1.momentum.z();
00664      pz =   mz.momentum.x()*p1.momentum.x()
00665           + mz.momentum.y()*p1.momentum.y()
00666           + mz.momentum.z()*p1.momentum.z();
00667      momentum.setX( px );
00668      momentum.setY( py );
00669      momentum.setZ( pz );
00670      return;
00671    }                 


Field Documentation

G4double G4GHEKinematicsVector::charge

Definition at line 687 of file G4GHEKinematicsVector.hh.

Referenced by Add(), G4GHEKinematicsVector(), GetCharge(), Norz(), operator=(), Print(), SetCharge(), SetZero(), SmulAndUpdate(), and Sub().

G4int G4GHEKinematicsVector::code

Definition at line 691 of file G4GHEKinematicsVector.hh.

Referenced by Add(), G4GHEKinematicsVector(), GetCode(), Lor(), Norz(), operator=(), Print(), SetCode(), SetZero(), SmulAndUpdate(), and Sub().

G4double G4GHEKinematicsVector::energy

Definition at line 684 of file G4GHEKinematicsVector.hh.

Referenced by Add(), Dot4(), G4GHEKinematicsVector(), GetEnergy(), Impu(), Lor(), Norz(), operator=(), Print(), SetEnergy(), SetEnergyAndUpdate(), SetKineticEnergyAndUpdate(), SetMassAndUpdate(), SetMomentumAndUpdate(), SetZero(), SmulAndUpdate(), and Sub().

G4bool G4GHEKinematicsVector::flag

Definition at line 690 of file G4GHEKinematicsVector.hh.

Referenced by G4GHEKinematicsVector(), getFlag(), Lor(), Norz(), operator=(), Print(), setFlag(), SetZero(), and SmulAndUpdate().

G4double G4GHEKinematicsVector::kineticEnergy

Definition at line 685 of file G4GHEKinematicsVector.hh.

Referenced by Add(), G4GHEKinematicsVector(), GetKineticEnergy(), Lor(), Norz(), operator=(), Print(), SetEnergyAndUpdate(), SetKineticEnergy(), SetKineticEnergyAndUpdate(), SetMassAndUpdate(), SetMomentumAndUpdate(), SetZero(), SmulAndUpdate(), and Sub().

G4double G4GHEKinematicsVector::mass

Definition at line 686 of file G4GHEKinematicsVector.hh.

Referenced by Add(), G4GHEKinematicsVector(), GetMass(), Lor(), Norz(), operator=(), Print(), SetEnergyAndUpdate(), SetKineticEnergyAndUpdate(), SetMass(), SetMassAndUpdate(), SetMomentumAndUpdate(), SetZero(), SmulAndUpdate(), and Sub().

G4ParticleMomentum G4GHEKinematicsVector::momentum

Definition at line 683 of file G4GHEKinematicsVector.hh.

Referenced by Add(), Add3(), Ang(), CosAng(), Cross(), Defs(), Defs1(), Dot(), Dot4(), G4GHEKinematicsVector(), GetMomentum(), Impu(), Length(), Lor(), Norz(), operator=(), Print(), SetEnergyAndUpdate(), SetKineticEnergyAndUpdate(), SetMassAndUpdate(), SetMomentum(), SetMomentumAndUpdate(), SetZero(), Smul(), SmulAndUpdate(), Sub(), Sub3(), and Trac().

G4ParticleDefinition* G4GHEKinematicsVector::particleDef

Definition at line 692 of file G4GHEKinematicsVector.hh.

Referenced by Add(), G4GHEKinematicsVector(), GetParticleDef(), Lor(), Norz(), operator=(), Print(), SetParticleDef(), SetZero(), SmulAndUpdate(), and Sub().

G4int G4GHEKinematicsVector::side

Definition at line 689 of file G4GHEKinematicsVector.hh.

Referenced by G4GHEKinematicsVector(), GetSide(), Lor(), Norz(), operator=(), Print(), SetSide(), SetZero(), and SmulAndUpdate().

G4double G4GHEKinematicsVector::timeOfFlight

Definition at line 688 of file G4GHEKinematicsVector.hh.

Referenced by G4GHEKinematicsVector(), GetTOF(), Lor(), Norz(), operator=(), Print(), SetTOF(), SetZero(), and SmulAndUpdate().


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