Import Geant4 6.1.0 source tree
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleChange.cc,v 1.24 2003/11/24 10:27:52 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleChangeForDecay.cc,v 1.9 2003/06/19 14:45:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
@@ -21,28 +21,31 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleChangeForLoss.cc,v 1.8 2003/06/19 14:45:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4ParticleChangeForLoss.cc,v 1.9 2004/01/20 15:29:41 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
|
||||
// --------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Modified:
|
||||
// 16.01.04 V.Ivanchenko update for model variant of energy loss
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
//
|
||||
#include "G4ParticleChangeForLoss.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4TrackFastVector.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
|
||||
G4ParticleChangeForLoss::G4ParticleChangeForLoss():G4VParticleChange()
|
||||
{
|
||||
theSteppingControlFlag = NormalCondition;
|
||||
debugFlag = false;
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2) {
|
||||
@@ -51,7 +54,7 @@ G4ParticleChangeForLoss::G4ParticleChangeForLoss():G4VParticleChange()
|
||||
#endif
|
||||
}
|
||||
|
||||
G4ParticleChangeForLoss::~G4ParticleChangeForLoss()
|
||||
G4ParticleChangeForLoss::~G4ParticleChangeForLoss()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2) {
|
||||
@@ -60,17 +63,21 @@ G4ParticleChangeForLoss::~G4ParticleChangeForLoss()
|
||||
#endif
|
||||
}
|
||||
|
||||
// copy constructor
|
||||
G4ParticleChangeForLoss::G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right): G4VParticleChange(right)
|
||||
G4ParticleChangeForLoss::G4ParticleChangeForLoss(
|
||||
const G4ParticleChangeForLoss &right): G4VParticleChange(right)
|
||||
{
|
||||
if (verboseLevel>1) {
|
||||
G4cout << "G4ParticleChangeForLoss:: copy constructor is called " << G4endl;
|
||||
}
|
||||
theEnergyChange = right.theEnergyChange;
|
||||
currentTrack = right.currentTrack;
|
||||
kinEnergy = right.kinEnergy;
|
||||
currentCharge = right.currentCharge;
|
||||
proposedMomentumDirection = right.proposedMomentumDirection;
|
||||
}
|
||||
|
||||
// assignemnt operator
|
||||
G4ParticleChangeForLoss & G4ParticleChangeForLoss::operator=(const G4ParticleChangeForLoss &right)
|
||||
// assignment operator
|
||||
G4ParticleChangeForLoss & G4ParticleChangeForLoss::operator=(
|
||||
const G4ParticleChangeForLoss &right)
|
||||
{
|
||||
if (verboseLevel>1) {
|
||||
G4cout << "G4ParticleChangeForLoss:: assignment operator is called " << G4endl;
|
||||
@@ -81,33 +88,19 @@ G4ParticleChangeForLoss & G4ParticleChangeForLoss::operator=(const G4ParticleCha
|
||||
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
|
||||
theNumberOfSecondaries = right.theNumberOfSecondaries;
|
||||
theStatusChange = right.theStatusChange;
|
||||
theTrueStepLength = right.theTrueStepLength;
|
||||
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
|
||||
theSteppingControlFlag = right.theSteppingControlFlag;
|
||||
|
||||
theEnergyChange = right.theEnergyChange;
|
||||
theLocalEnergyDeposit = right.theLocalEnergyDeposit ;
|
||||
|
||||
currentTrack = right.currentTrack;
|
||||
kinEnergy = right.kinEnergy;
|
||||
currentCharge = right.currentCharge;
|
||||
proposedMomentumDirection = right.proposedMomentumDirection;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// functions for Initialization
|
||||
//
|
||||
|
||||
void G4ParticleChangeForLoss::Initialize(const G4Track& track)
|
||||
{
|
||||
// use base class's method at first
|
||||
G4VParticleChange::Initialize(track);
|
||||
|
||||
// set Energy equal to those of the parent particle
|
||||
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
|
||||
theEnergyChange = pParticle->GetKineticEnergy();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for updating G4Step
|
||||
// methods for updating G4Step
|
||||
//
|
||||
|
||||
G4Step* G4ParticleChangeForLoss::UpdateStepForAlongStep(G4Step* pStep)
|
||||
@@ -115,37 +108,59 @@ G4Step* G4ParticleChangeForLoss::UpdateStepForAlongStep(G4Step* pStep)
|
||||
// A physics process always calculates the final state of the
|
||||
// particle relative to the initial state at the beginning
|
||||
// of the Step, i.e., based on information of G4Track (or
|
||||
// equivalently the PreStepPoint).
|
||||
// equivalently the PreStepPoint).
|
||||
// So, the differences (delta) between these two states have to be
|
||||
// calculated and be accumulated in PostStepPoint.
|
||||
|
||||
// calculated and be accumulated in PostStepPoint.
|
||||
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
|
||||
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
|
||||
// calculate new kinetic energy
|
||||
G4double energy = pPostStepPoint->GetKineticEnergy()
|
||||
+ (theEnergyChange - pPreStepPoint->GetKineticEnergy());
|
||||
G4double energy = pPostStepPoint->GetKineticEnergy()
|
||||
+ (kinEnergy - pStep->GetPreStepPoint()->GetKineticEnergy());
|
||||
|
||||
// update kinetic energy and momentum direction
|
||||
if (energy > 0.0) {
|
||||
pPostStepPoint->SetKineticEnergy( energy );
|
||||
} else {
|
||||
// stop case
|
||||
pPostStepPoint->SetKineticEnergy(0.0);
|
||||
}
|
||||
if (energy < 0.0) energy = 0.0;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (debugFlag) CheckIt(*aTrack);
|
||||
#endif
|
||||
pPostStepPoint->SetKineticEnergy( energy );
|
||||
pPostStepPoint->SetCharge( currentCharge );
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
return UpdateStepInfo(pStep);
|
||||
// Not necessary to check now
|
||||
//#ifdef G4VERBOSE
|
||||
// if (debugFlag) CheckIt(*aTrack);
|
||||
//#endif
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
|
||||
return pStep;
|
||||
}
|
||||
|
||||
G4Step* G4ParticleChangeForLoss::UpdateStepForPostStep(G4Step* pStep)
|
||||
{
|
||||
// A physics process always calculates the final state of the
|
||||
// particle relative to the initial state at the beginning
|
||||
// of the Step, i.e., based on information of G4Track (or
|
||||
// equivalently the PreStepPoint).
|
||||
// So, the differences (delta) between these two states have to be
|
||||
// calculated and be accumulated in PostStepPoint.
|
||||
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
|
||||
pPostStepPoint->SetKineticEnergy( kinEnergy );
|
||||
pPostStepPoint->SetCharge( currentCharge );
|
||||
pPostStepPoint->SetMomentumDirection( proposedMomentumDirection );
|
||||
|
||||
// Not necessary to check now
|
||||
//#ifdef G4VERBOSE
|
||||
// if (debugFlag) CheckIt(*aTrack);
|
||||
//#endif
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
|
||||
return pStep;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for printing messages
|
||||
// methods for printing messages
|
||||
//
|
||||
|
||||
void G4ParticleChangeForLoss::DumpInfo() const
|
||||
@@ -154,8 +169,20 @@ void G4ParticleChangeForLoss::DumpInfo() const
|
||||
G4VParticleChange::DumpInfo();
|
||||
|
||||
G4cout.precision(3);
|
||||
G4cout << " Kinetic Energy (MeV): "
|
||||
<< std::setw(20) << theEnergyChange/MeV
|
||||
G4cout << " Charge (eplus) : "
|
||||
<< std::setw(20) << currentCharge/eplus
|
||||
<< G4endl;
|
||||
G4cout << " Kinetic Energy (MeV): "
|
||||
<< std::setw(20) << kinEnergy/MeV
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direct - x : "
|
||||
<< std::setw(20) << proposedMomentumDirection.x()
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direct - y : "
|
||||
<< std::setw(20) << proposedMomentumDirection.y()
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direct - z : "
|
||||
<< std::setw(20) << proposedMomentumDirection.z()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -167,11 +194,11 @@ G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
|
||||
G4double accuracy;
|
||||
|
||||
// Energy should not be lager than initial value
|
||||
accuracy = ( theEnergyChange - aTrack.GetKineticEnergy())/MeV;
|
||||
accuracy = ( kinEnergy - aTrack.GetKineticEnergy())/MeV;
|
||||
if (accuracy > accuracyForWarning) {
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << " G4ParticleChangeForLoss::CheckIt : ";
|
||||
G4cout << "the energy becoes larger than the initial value !!" << G4endl;
|
||||
G4cout << "G4ParticleChangeForLoss::CheckIt: ";
|
||||
G4cout << "KinEnergy become larger than the initial value!" << G4endl;
|
||||
G4cout << " Difference: " << accuracy << "[MeV] " <<G4endl;
|
||||
#endif
|
||||
itsOK = false;
|
||||
@@ -180,8 +207,8 @@ G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
|
||||
|
||||
// dump out information of this particle change
|
||||
#ifdef G4VERBOSE
|
||||
if (!itsOK) {
|
||||
G4cout << " G4ParticleChangeForLoss::CheckIt " <<G4endl;
|
||||
if (!itsOK) {
|
||||
G4cout << "G4ParticleChangeForLoss::CheckIt " << G4endl;
|
||||
DumpInfo();
|
||||
}
|
||||
#endif
|
||||
@@ -196,21 +223,9 @@ G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
|
||||
|
||||
//correction
|
||||
if (!itsOK) {
|
||||
theEnergyChange = aTrack.GetKineticEnergy();
|
||||
kinEnergy = aTrack.GetKineticEnergy();
|
||||
}
|
||||
|
||||
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
|
||||
return itsOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleChangeForMSC.cc,v 1.10 2003/06/19 14:45:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4ParticleChangeForMSC.cc,v 1.11 2004/01/20 15:29:41 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -32,12 +32,12 @@
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// Implemented for the new scheme 23 Mar. 1998 H.Kurahige
|
||||
// Update for model variant of msc 16 Jan 2004 V.Ivanchenko
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include "G4ParticleChangeForMSC.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4TrackFastVector.hh"
|
||||
#include "G4DynamicParticle.hh"
|
||||
#include "G4ExceptionSeverity.hh"
|
||||
|
||||
@@ -50,7 +50,7 @@ G4ParticleChangeForMSC::G4ParticleChangeForMSC():G4VParticleChange()
|
||||
#endif
|
||||
}
|
||||
|
||||
G4ParticleChangeForMSC::~G4ParticleChangeForMSC()
|
||||
G4ParticleChangeForMSC::~G4ParticleChangeForMSC()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2) {
|
||||
@@ -65,9 +65,8 @@ G4ParticleChangeForMSC::G4ParticleChangeForMSC(
|
||||
if (verboseLevel>1) {
|
||||
G4cout << "G4ParticleChangeForMSC:: copy constructor is called " << G4endl;
|
||||
}
|
||||
theMomentumDirectionChange = right.theMomentumDirectionChange;
|
||||
thePositionChange = right.thePositionChange;
|
||||
theTrueStepLength = right.theTrueStepLength;
|
||||
theMomentumDirection = right.theMomentumDirection;
|
||||
thePosition = right.thePosition;
|
||||
}
|
||||
|
||||
// assignment operator
|
||||
@@ -78,86 +77,51 @@ G4ParticleChangeForMSC & G4ParticleChangeForMSC::operator=(
|
||||
G4cout << "G4ParticleChangeForMSC:: assignment operator is called " << G4endl;
|
||||
}
|
||||
if (this != &right)
|
||||
{
|
||||
{
|
||||
theListOfSecondaries = right.theListOfSecondaries;
|
||||
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
|
||||
theNumberOfSecondaries = right.theNumberOfSecondaries;
|
||||
theStatusChange = right.theStatusChange;
|
||||
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
|
||||
theSteppingControlFlag = right.theSteppingControlFlag;
|
||||
|
||||
|
||||
theMomentumDirectionChange = right.theMomentumDirectionChange;
|
||||
thePositionChange = right.thePositionChange;
|
||||
theTrueStepLength = right.theTrueStepLength;
|
||||
|
||||
theMomentumDirection = right.theMomentumDirection;
|
||||
thePosition = right.thePosition;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// functions for Initialization
|
||||
//
|
||||
|
||||
void G4ParticleChangeForMSC::Initialize(const G4Track& track)
|
||||
{
|
||||
// use base class's method at first
|
||||
G4VParticleChange::Initialize(track);
|
||||
|
||||
// set Energy/Momentum etc. equal to those of the parent particle
|
||||
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
|
||||
theMomentumDirectionChange = pParticle->GetMomentumDirection();
|
||||
|
||||
// set Position equal to those of the parent track
|
||||
thePositionChange = track.GetPosition();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for updating G4Step
|
||||
// methods for updating G4Step
|
||||
//
|
||||
|
||||
G4Step* G4ParticleChangeForMSC::UpdateStepForAlongStep(G4Step* pStep)
|
||||
{
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
pStep->SetStepLength(theTrueStepLength) ;
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
pStep->SetStepLength(theTrueStepLength);
|
||||
theStatusChange = pStep->GetTrack()->GetTrackStatus();
|
||||
return pStep;
|
||||
}
|
||||
|
||||
G4Step* G4ParticleChangeForMSC::UpdateStepForPostStep(G4Step* pStep)
|
||||
{
|
||||
{
|
||||
// A physics process always calculates the final state of the particle
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
|
||||
// Take note that the return type of GetMomentumChange is a
|
||||
// pointer to G4ParticleMometum. Also it is a normalized
|
||||
// momentum vector.
|
||||
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
|
||||
// update momentum direction
|
||||
pPostStepPoint->SetMomentumDirection(theMomentumDirectionChange);
|
||||
pPostStepPoint->SetMomentumDirection(theMomentumDirection);
|
||||
|
||||
// update position
|
||||
pPostStepPoint->SetPosition( thePositionChange );
|
||||
// update position
|
||||
pPostStepPoint->SetPosition( thePosition );
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (debugFlag) CheckIt(*aTrack);
|
||||
#endif
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
return UpdateStepInfo(pStep);
|
||||
// Update the G4Step specific attributes
|
||||
return pStep;
|
||||
}
|
||||
|
||||
G4Step* G4ParticleChangeForMSC::UpdateStepForAtRest(G4Step* pStep)
|
||||
{
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
return UpdateStepInfo(pStep);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for printing messages
|
||||
// methods for printing messages
|
||||
//
|
||||
|
||||
void G4ParticleChangeForMSC::DumpInfo() const
|
||||
@@ -166,23 +130,23 @@ void G4ParticleChangeForMSC::DumpInfo() const
|
||||
G4VParticleChange::DumpInfo();
|
||||
|
||||
G4cout.precision(3);
|
||||
G4cout << " Position - x (mm) : "
|
||||
<< std::setw(20) << thePositionChange.x()/mm
|
||||
<< G4endl;
|
||||
G4cout << " Position - y (mm) : "
|
||||
<< std::setw(20) << thePositionChange.y()/mm
|
||||
<< G4endl;
|
||||
G4cout << " Position - z (mm) : "
|
||||
<< std::setw(20) << thePositionChange.z()/mm
|
||||
G4cout << " Position - x (mm) : "
|
||||
<< std::setw(20) << thePosition.x()/mm
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direction - x : "
|
||||
<< std::setw(20) << theMomentumDirectionChange.x()
|
||||
G4cout << " Position - y (mm) : "
|
||||
<< std::setw(20) << thePosition.y()/mm
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direction - y : "
|
||||
<< std::setw(20) << theMomentumDirectionChange.y()
|
||||
G4cout << " Position - z (mm) : "
|
||||
<< std::setw(20) << thePosition.z()/mm
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direction - z : "
|
||||
<< std::setw(20) << theMomentumDirectionChange.z()
|
||||
G4cout << " Momentum Direct - x : "
|
||||
<< std::setw(20) << theMomentumDirection.x()
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direct - y : "
|
||||
<< std::setw(20) << theMomentumDirection.y()
|
||||
<< G4endl;
|
||||
G4cout << " Momentum Direct - z : "
|
||||
<< std::setw(20) << theMomentumDirection.z()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -194,10 +158,10 @@ G4bool G4ParticleChangeForMSC::CheckIt(const G4Track& aTrack)
|
||||
|
||||
G4double accuracy;
|
||||
|
||||
// check
|
||||
// check
|
||||
|
||||
// MomentumDirection should be unit vector
|
||||
accuracy = abs(theMomentumDirectionChange.mag2()-1.0);
|
||||
accuracy = abs(theMomentumDirection.mag2()-1.0);
|
||||
if (accuracy > accuracyForWarning) {
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << " G4ParticleChangeForMSC::CheckIt : ";
|
||||
@@ -210,7 +174,7 @@ G4bool G4ParticleChangeForMSC::CheckIt(const G4Track& aTrack)
|
||||
|
||||
// dump out information of this particle change
|
||||
#ifdef G4VERBOSE
|
||||
if (!itsOK) {
|
||||
if (!itsOK) {
|
||||
G4cout << " G4ParticleChangeForMSC::CheckIt " <<G4endl;
|
||||
DumpInfo();
|
||||
}
|
||||
@@ -225,11 +189,10 @@ G4bool G4ParticleChangeForMSC::CheckIt(const G4Track& aTrack)
|
||||
}
|
||||
//correction
|
||||
if (!itsOK) {
|
||||
G4double vmag = theMomentumDirectionChange.mag();
|
||||
theMomentumDirectionChange = (1./vmag)*theMomentumDirectionChange;
|
||||
G4double vmag = theMomentumDirection.mag();
|
||||
theMomentumDirection = (1./vmag)*theMomentumDirection;
|
||||
}
|
||||
|
||||
|
||||
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
|
||||
return itsOK;
|
||||
}
|
||||
|
||||
@@ -21,18 +21,19 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleChangeForTransport.cc,v 1.15 2003/06/16 17:13:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4ParticleChangeForTransport.cc,v 1.16 2004/01/20 15:29:41 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-06-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// Implemented for the new scheme 10 May. 1998 H.Kurahige
|
||||
// Correct tratment of fpNextTouchable 12 May. 1998 H.Kurashige
|
||||
// Change to the next volume only if energy>0 19 Jan. 2004 V.Ivanchenko
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include "G4ParticleChangeForTransport.hh"
|
||||
@@ -93,17 +94,17 @@ G4ParticleChangeForTransport & G4ParticleChangeForTransport::operator=(const G4P
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for updating G4Step
|
||||
// methods for updating G4Step
|
||||
//
|
||||
|
||||
G4Step* G4ParticleChangeForTransport::UpdateStepForAtRest(G4Step* pStep)
|
||||
{
|
||||
{
|
||||
// Nothing happens for AtRestDoIt
|
||||
if (verboseLevel>0) {
|
||||
G4cout << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called" << G4endl;
|
||||
G4cout << " Nothing happens for this method " << G4endl;
|
||||
G4cout << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called" << G4endl;
|
||||
G4cout << " Nothing happens for this method " << G4endl;
|
||||
}
|
||||
// Update the G4Step specific attributes
|
||||
// Update the G4Step specific attributes
|
||||
return UpdateStepInfo(pStep);
|
||||
}
|
||||
|
||||
@@ -120,39 +121,39 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
|
||||
// A physics process always calculates the final state of the
|
||||
// particle relative to the initial state at the beginning
|
||||
// of the Step, i.e., based on information of G4Track (or
|
||||
// equivalently the PreStepPoint).
|
||||
// equivalently the PreStepPoint).
|
||||
// So, the differences (delta) between these two states have to be
|
||||
// calculated and be accumulated in PostStepPoint.
|
||||
|
||||
// calculated and be accumulated in PostStepPoint.
|
||||
|
||||
// Take note that the return type of GetMomentumChange is a
|
||||
// pointer to G4ThreeVector. Also it is a normalized
|
||||
// pointer to G4ThreeVector. Also it is a normalized
|
||||
// momentum vector.
|
||||
|
||||
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
G4Track* aTrack = pStep->GetTrack();
|
||||
G4double mass = aTrack->GetDynamicParticle()->GetMass();
|
||||
|
||||
|
||||
// uodate kinetic energy
|
||||
// now assume that no energy change in transportation
|
||||
// However it is not true in electric fields
|
||||
// Case for changing energy will be implemented in future
|
||||
|
||||
|
||||
|
||||
// update momentum direction and energy
|
||||
if (isMomentumChanged) {
|
||||
G4double energy;
|
||||
energy= pPostStepPoint->GetKineticEnergy()
|
||||
+ (theEnergyChange - pPreStepPoint->GetKineticEnergy());
|
||||
energy= pPostStepPoint->GetKineticEnergy()
|
||||
+ (theEnergyChange - pPreStepPoint->GetKineticEnergy());
|
||||
|
||||
// calculate new momentum
|
||||
G4ThreeVector pMomentum = pPostStepPoint->GetMomentum()
|
||||
G4ThreeVector pMomentum = pPostStepPoint->GetMomentum()
|
||||
+ ( CalcMomentum(theEnergyChange, theMomentumDirectionChange, mass)
|
||||
- pPreStepPoint->GetMomentum());
|
||||
G4double tMomentum = pMomentum.mag();
|
||||
G4ThreeVector direction(1.0,0.0,0.0);
|
||||
G4ThreeVector direction(1.0,0.0,0.0);
|
||||
if( tMomentum > 0. ){
|
||||
G4double inv_Momentum= 1.0 / tMomentum;
|
||||
G4double inv_Momentum= 1.0 / tMomentum;
|
||||
direction= pMomentum * inv_Momentum;
|
||||
}
|
||||
pPostStepPoint->SetMomentumDirection(direction);
|
||||
@@ -166,22 +167,22 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
|
||||
// update polarization
|
||||
pPostStepPoint->AddPolarization( thePolarizationChange
|
||||
- pPreStepPoint->GetPolarization());
|
||||
|
||||
|
||||
// update position and time
|
||||
pPostStepPoint->AddPosition( thePositionChange
|
||||
pPostStepPoint->AddPosition( thePositionChange
|
||||
- pPreStepPoint->GetPosition() );
|
||||
pPostStepPoint->AddGlobalTime( theTimeChange
|
||||
- pPreStepPoint->GetGlobalTime());
|
||||
pPostStepPoint->AddLocalTime( theTimeChange
|
||||
- pPreStepPoint->GetGlobalTime());
|
||||
pPostStepPoint->AddProperTime( theProperTimeChange
|
||||
pPostStepPoint->AddLocalTime( theTimeChange
|
||||
- pPreStepPoint->GetGlobalTime());
|
||||
pPostStepPoint->AddProperTime( theProperTimeChange
|
||||
- pPreStepPoint->GetProperTime());
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (debugFlag) CheckIt(*aTrack);
|
||||
#endif
|
||||
|
||||
// Update the G4Step specific attributes
|
||||
// Update the G4Step specific attributes
|
||||
//pStep->SetStepLength( theTrueStepLength );
|
||||
// pStep->AddTotalEnergyDeposit( theLocalEnergyDeposit );
|
||||
pStep->SetControlFlag( theSteppingControlFlag );
|
||||
@@ -190,31 +191,33 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
|
||||
}
|
||||
|
||||
G4Step* G4ParticleChangeForTransport::UpdateStepForPostStep(G4Step* pStep)
|
||||
{
|
||||
{
|
||||
// A physics process always calculates the final state of the particle
|
||||
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
// Change volume if any kinetic energy remanes
|
||||
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
|
||||
if(pPostStepPoint->GetKineticEnergy() > 0.0) {
|
||||
|
||||
// update next touchable
|
||||
// (touchable can be changed only at PostStepDoIt)
|
||||
pPostStepPoint->SetTouchableHandle( theTouchableHandle );
|
||||
// update next touchable
|
||||
// (touchable can be changed only at PostStepDoIt)
|
||||
pPostStepPoint->SetTouchableHandle( theTouchableHandle );
|
||||
|
||||
pPostStepPoint->SetMaterial( theMaterialChange );
|
||||
pPostStepPoint->SetMaterialCutsCouple( theMaterialCutsCoupleChange );
|
||||
|
||||
// It used to call base class's method
|
||||
pPostStepPoint->SetMaterial( theMaterialChange );
|
||||
pPostStepPoint->SetMaterialCutsCouple( theMaterialCutsCoupleChange );
|
||||
}
|
||||
// It used to call base class's method
|
||||
// - but this would copy uninitialised data members
|
||||
// return G4ParticleChange::UpdateStepForPostStep(pStep);
|
||||
|
||||
// Copying what the base class does would instead
|
||||
// Copying what the base class does would instead
|
||||
// - also not useful
|
||||
// return G4VParticleChange::UpdateStepInfo(pStep);
|
||||
|
||||
return pStep;
|
||||
return pStep;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// methods for printing messages
|
||||
// methods for printing messages
|
||||
//
|
||||
|
||||
void G4ParticleChangeForTransport::DumpInfo() const
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Step.cc,v 1.5 2001/07/11 10:08:39 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4StepPoint.cc,v 1.9 2002/12/16 11:59:12 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Track.cc,v 1.19 2003/05/20 22:24:41 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VParticleChange.cc,v 1.15 2003/06/19 14:45:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
// $Id: G4VParticleChange.cc,v 1.16 2003/12/12 13:12:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -325,12 +325,12 @@ G4bool G4VParticleChange::CheckSecondary(G4Track& aTrack)
|
||||
}
|
||||
|
||||
|
||||
const G4double G4VParticleChange::GetAccuracyForWarning() const
|
||||
G4double G4VParticleChange::GetAccuracyForWarning() const
|
||||
{
|
||||
return accuracyForWarning;
|
||||
}
|
||||
|
||||
const G4double G4VParticleChange::GetAccuracyForException() const
|
||||
G4double G4VParticleChange::GetAccuracyForException() const
|
||||
{
|
||||
return accuracyForException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user