2 // ********************************************************************
 
    3 // * License and Disclaimer                                           *
 
    5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
 
    6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
 
    7 // * conditions of the Geant4 Software License,  included in the file *
 
    8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
 
    9 // * include a list of copyright holders.                             *
 
   11 // * Neither the authors of this software system, nor their employing *
 
   12 // * institutes,nor the agencies providing financial support for this *
 
   13 // * work  make  any representation or  warranty, express or implied, *
 
   14 // * regarding  this  software system or assume any liability for its *
 
   15 // * use.  Please see the license in the file  LICENSE  and URL above *
 
   16 // * for the full disclaimer and the limitation of liability.         *
 
   18 // * This  code  implementation is the result of  the  scientific and *
 
   19 // * technical work of the GEANT4 collaboration.                      *
 
   20 // * By using,  copying,  modifying or  distributing the software (or *
 
   21 // * any work based  on the software)  you  agree  to acknowledge its *
 
   22 // * use  in  resulting  scientific  publications,  and indicate your *
 
   23 // * acceptance of all terms of the Geant4 Software license.          *
 
   24 // ********************************************************************
 
   27 // $Id: G4ParticleChange.icc 68795 2013-04-05 13:24:46Z gcosmo $
 
   31  G4Step* G4ParticleChange::UpdateStepInfo(G4Step* pStep)
 
   33   return G4VParticleChange::UpdateStepInfo(pStep);
 
   37  G4double G4ParticleChange::GetEnergy() const
 
   39   return theEnergyChange;
 
   43  void G4ParticleChange::ProposeEnergy(G4double finalEnergy)
 
   45   theEnergyChange = finalEnergy;
 
   49  G4double G4ParticleChange::GetVelocity() const
 
   51    return theVelocityChange;
 
   55   void G4ParticleChange::ProposeVelocity(G4double finalVelocity)
 
   57    theVelocityChange = finalVelocity;
 
   58    isVelocityChanged = true;
 
   62  const G4ThreeVector* G4ParticleChange::GetMomentumDirection() const
 
   64   return &theMomentumDirectionChange;
 
   68  void G4ParticleChange::ProposeMomentumDirection(
 
   73   theMomentumDirectionChange.setX(Px);
 
   74   theMomentumDirectionChange.setY(Py);
 
   75   theMomentumDirectionChange.setZ(Pz);
 
   79  void G4ParticleChange::ProposeMomentumDirection(const G4ThreeVector& P)
 
   81   theMomentumDirectionChange = P;
 
   86  const G4ThreeVector* G4ParticleChange::GetPolarization() const
 
   88   return &thePolarizationChange;
 
   92  void G4ParticleChange::ProposePolarization( const G4ThreeVector& finalPoralization)
 
   94   thePolarizationChange = finalPoralization;
 
   98  void G4ParticleChange::ProposePolarization(
 
  103   thePolarizationChange.setX(Px);
 
  104   thePolarizationChange.setY(Py);
 
  105   thePolarizationChange.setZ(Pz);
 
  109  const G4ThreeVector* G4ParticleChange::GetPosition() const
 
  111   return &thePositionChange;
 
  115  void G4ParticleChange::ProposePosition(const G4ThreeVector& finalPosition)
 
  117   thePositionChange= finalPosition;
 
  121  void G4ParticleChange::ProposePosition(G4double x,G4double y, G4double z)
 
  123   thePositionChange.setX(x);
 
  124   thePositionChange.setY(y);
 
  125   thePositionChange.setZ(z);
 
  129   G4double  G4ParticleChange::GetProperTime() const
 
  131   return  theProperTimeChange;
 
  135   void G4ParticleChange::ProposeProperTime(G4double tau)
 
  137   theProperTimeChange = tau;
 
  141  G4ThreeVector G4ParticleChange::GetGlobalPosition(const G4ThreeVector& displacement) const
 
  143   return thePositionChange + displacement;
 
  147   void G4ParticleChange::ProposeGlobalTime(G4double t)
 
  149   theTimeChange = (t-theGlobalTime0) + theLocalTime0;
 
  153  G4double  G4ParticleChange::GetGlobalTime(G4double timeDelay) const
 
  155   //  Convert the time delay to the global time.
 
  156   return theGlobalTime0 + (theTimeChange-theLocalTime0) + timeDelay;
 
  160   void G4ParticleChange::ProposeLocalTime(G4double t)
 
  166  G4double  G4ParticleChange::GetLocalTime(G4double timeDelay) const
 
  168   //  Convert the time delay to the local time.
 
  169   return theTimeChange + timeDelay;
 
  173   G4double  G4ParticleChange::GetMass() const
 
  175   return  theMassChange;
 
  179   void G4ParticleChange::ProposeMass(G4double t)
 
  185   G4double  G4ParticleChange::GetCharge() const
 
  187   return  theChargeChange;
 
  191   void G4ParticleChange::ProposeCharge(G4double t)
 
  198   G4double G4ParticleChange::GetMagneticMoment() const
 
  200   return theMagneticMomentChange;
 
  204   void G4ParticleChange::ProposeMagneticMoment(G4double finalMagneticMoment)
 
  206   theMagneticMomentChange = finalMagneticMoment;
 
  210   G4ThreeVector G4ParticleChange::CalcMomentum(G4double          energy,
 
  211                                          G4ThreeVector   direction,
 
  215   G4double tMomentum = std::sqrt(energy*energy + 2*energy*mass);
 
  216   return direction*tMomentum;