Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
+4 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EvtBiasMechanism.cc,v 2.3 1998/11/18 11:06:41 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4EvtBiasMechanism.cc,v 1.2 1999/04/13 09:44:26 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -29,7 +29,7 @@
G4EvtBiasMechanism::G4EvtBiasMechanism(const G4String& name, G4int mulFactor):
G4VEvtBiasMechanism(name),
MultiplicationForSecondaries(mulFactor),
particleToBeBiased(NULL)
particleToBeBiased(0)
{
}
@@ -47,7 +47,7 @@ G4EvtBiasMechanism::~G4EvtBiasMechanism()
G4VParticleChange* G4EvtBiasMechanism::ApplyMath( G4VParticleChange* pChange,
const G4Step& aStep )
{
if (particleToBeBiased != NULL) {
if (particleToBeBiased != 0) {
G4int currentNumberOfSecondaries = pChange->GetNumberOfSecondaries();
G4int totalNumberOfSecondaries = currentNumberOfSecondaries;
G4int idx;
+4 -3
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Mars5GeVMechanism.cc,v 2.4 1998/12/12 12:52:49 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Mars5GeVMechanism.cc,v 1.2 1999/04/24 09:02:22 asaim Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -55,7 +55,8 @@ G4Mars5GeVMechanism::G4Mars5GeVMechanism(const G4String& name):
EthForIncident(5.0*GeV)
{
theParticleTable = G4ParticleTable::GetParticleTable();
ProtonMass = theParticleTable->FindParticle("proton")->GetPDGMass();
G4ParticleDefinition* pProton = theParticleTable->FindParticle("proton");
if(pProton) ProtonMass = pProton->GetPDGMass();
// set some constants
selec3.Eth = 1.0*MeV;
+96 -59
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleChange.cc,v 2.10 1998/12/16 12:21:47 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleChange.cc,v 1.6 1999/05/06 11:42:54 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -21,6 +21,7 @@
// Change default debug flag to false 10 May. 1998 H.Kurahige
// Add Track weight 12 Nov. 1998 H.Kurashige
// Activate CheckIt method for VERBOSE mode 14 Dec. 1998 H.Kurashige
// Modified CheckIt method for time 9 Feb. 1999 H.Kurashige
// --------------------------------------------------------------
#include "G4ParticleChange.hh"
@@ -33,28 +34,18 @@ G4bool G4ParticleChange::fUseEBForAll = false;
G4ParticleChange::G4ParticleChange():G4VParticleChange(false)
{
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChange::G4ParticleChange() " << endl;
G4cout << "G4ParticleChange::G4ParticleChange() " << endl;
}
#endif
}
G4ParticleChange::G4ParticleChange(G4bool useEB):G4VParticleChange(useEB)
{
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChange::G4ParticleChange() " << endl;
G4cout << "G4ParticleChange::G4ParticleChange() " << endl;
}
#endif
}
@@ -63,7 +54,7 @@ G4ParticleChange::~G4ParticleChange()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChange::~G4ParticleChange() " << endl;
G4cout << "G4ParticleChange::~G4ParticleChange() " << endl;
}
#endif
}
@@ -72,9 +63,9 @@ G4ParticleChange::~G4ParticleChange()
G4ParticleChange::G4ParticleChange(const G4ParticleChange &right): G4VParticleChange(right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChange:: copy constructor is called " << endl;
G4cout << "G4ParticleChange:: copy constructor is called " << endl;
}
theMomentumChange = right.theMomentumChange;
theMomentumDirectionChange = right.theMomentumDirectionChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theTimeChange = right.theTimeChange;
@@ -86,7 +77,7 @@ G4ParticleChange::G4ParticleChange(const G4ParticleChange &right): G4VParticleCh
G4ParticleChange & G4ParticleChange::operator=(const G4ParticleChange &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChange:: assignment operator is called " << endl;
G4cout << "G4ParticleChange:: assignment operator is called " << endl;
}
if (this != &right)
{
@@ -94,7 +85,7 @@ G4ParticleChange & G4ParticleChange::operator=(const G4ParticleChange &right)
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theMomentumChange = right.theMomentumChange;
theMomentumDirectionChange = right.theMomentumDirectionChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theTimeChange = right.theTimeChange;
@@ -132,7 +123,7 @@ void G4ParticleChange::AddSecondary(G4DynamicParticle* aParticle,
if (IsGoodForTracking) aTrack->SetGoodForTrackingFlag();
// Touchable is a temporary object, so you cannot keep the pointer
aTrack->SetTouchable(NULL);
aTrack->SetTouchable(0);
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
@@ -149,7 +140,7 @@ void G4ParticleChange::AddSecondary(G4DynamicParticle* aParticle,
if (IsGoodForTracking) aTrack->SetGoodForTrackingFlag();
// Touchable is a temporary object, so you cannot keep the pointer
aTrack->SetTouchable(NULL);
aTrack->SetTouchable(0);
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
@@ -166,7 +157,7 @@ void G4ParticleChange::AddSecondary(G4DynamicParticle* aParticle,
if (IsGoodForTracking) aTrack->SetGoodForTrackingFlag();
// Touchable is a temporary object, so you cannot keep the pointer
aTrack->SetTouchable(NULL);
aTrack->SetTouchable(0);
// add a secondary
G4VParticleChange::AddSecondary(aTrack);
@@ -190,7 +181,7 @@ void G4ParticleChange::Initialize(const G4Track& track)
// set Energy/Momentum etc. equal to those of the parent particle
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
theEnergyChange = pParticle->GetKineticEnergy();
theMomentumChange = pParticle->GetMomentumDirection();
theMomentumDirectionChange = pParticle->GetMomentumDirection();
thePolarizationChange = pParticle->GetPolarization();
theProperTimeChange = pParticle->GetProperTime();
@@ -214,7 +205,7 @@ G4Step* G4ParticleChange::UpdateStepForAlongStep(G4Step* pStep)
// So, the differences (delta) between these two states have to be
// calculated and be accumulated in PostStepPoint.
// Take note that the return type of GetMomentumChange is a
// Take note that the return type of GetMomentumDirectionChange is a
// pointer to G4ParticleMometum. Also it is a normalized
// momentum vector.
@@ -231,7 +222,7 @@ G4Step* G4ParticleChange::UpdateStepForAlongStep(G4Step* pStep)
if (energy > 0.0) {
// calculate new momentum
G4ThreeVector pMomentum = pPostStepPoint->GetMomentum()
+ ( CalcMomentum(theEnergyChange, theMomentumChange, mass)
+ ( CalcMomentum(theEnergyChange, theMomentumDirectionChange, mass)
- pPreStepPoint->GetMomentum());
G4double tMomentum = pMomentum.mag();
G4ThreeVector direction( pMomentum.x()/tMomentum,
@@ -262,7 +253,9 @@ G4Step* G4ParticleChange::UpdateStepForAlongStep(G4Step* pStep)
// update weight if use EB
pPostStepPoint->SetWeight( theWeightChange );
#ifdef G4VERBOSE
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
@@ -282,7 +275,7 @@ G4Step* G4ParticleChange::UpdateStepForPostStep(G4Step* pStep)
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// update kinetic energy and momentum direction
pPostStepPoint->SetMomentumDirection(theMomentumChange);
pPostStepPoint->SetMomentumDirection(theMomentumDirectionChange);
pPostStepPoint->SetKineticEnergy( theEnergyChange );
// update polarization
@@ -298,7 +291,9 @@ G4Step* G4ParticleChange::UpdateStepForPostStep(G4Step* pStep)
// update weight if use EB
pPostStepPoint->SetWeight( theWeightChange );
#ifdef G4VERBOSE
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
@@ -315,7 +310,7 @@ G4Step* G4ParticleChange::UpdateStepForAtRest(G4Step* pStep)
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// update kinetic energy and momentum direction
pPostStepPoint->SetMomentumDirection(theMomentumChange);
pPostStepPoint->SetMomentumDirection(theMomentumDirectionChange);
pPostStepPoint->SetKineticEnergy( theEnergyChange );
// update polarization
@@ -331,7 +326,9 @@ G4Step* G4ParticleChange::UpdateStepForAtRest(G4Step* pStep)
// update weight if use EB
pPostStepPoint->SetWeight( theWeightChange );
#ifdef G4VERBOSE
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
@@ -363,13 +360,13 @@ void G4ParticleChange::DumpInfo() const
<< setw(20) << theProperTimeChange/ns
<< endl;
G4cout << " Momentum Direct - x : "
<< setw(20) << theMomentumChange.x()
<< setw(20) << theMomentumDirectionChange.x()
<< endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << theMomentumChange.y()
<< setw(20) << theMomentumDirectionChange.y()
<< endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << theMomentumChange.z()
<< setw(20) << theMomentumDirectionChange.z()
<< endl;
G4cout << " Kinetic Energy (MeV): "
<< setw(20) << theEnergyChange/MeV
@@ -392,45 +389,85 @@ void G4ParticleChange::DumpInfo() const
G4bool G4ParticleChange::CheckIt(const G4Track& aTrack)
{
G4bool itsOK = true;
// if (theEnergyChange > aTrack.GetKineticEnergy()) {
// G4cout << " !!! the energy becomes larger than the initial energy !!!"
// << " : " << (theEnergyChange -aTrack.GetKineticEnergy())/MeV
// << "MeV " <<endl;
// itsOK = false;
// }
if ( (theEnergyChange >0.) &&
( abs(theMomentumChange.mag2()-1.0) > perMillion ) ){
G4cout << " !!! the Momentum Change is not unit vector !!!!"
<< " : " << theMomentumChange.mag()
<< endl;
itsOK = false;
G4bool exitWithError = false;
G4double accuracy;
// check
// MomentumDirection should be unit vector
G4bool itsOKforMomentum = true;
if ( theEnergyChange >0.) {
accuracy = abs(theMomentumDirectionChange.mag2()-1.0);
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the Momentum Change is not unit vector !!" << endl;
G4cout << " Difference: " << accuracy << endl;
itsOKforMomentum = false;
if (accuracy > accuracyForException) exitWithError = true;
}
}
if (theTimeChange < aTrack.GetGlobalTime()) {
G4cout << " !!! the global time goes back !!!"
<< " : " << aTrack.GetGlobalTime()/ns
<< " -> " << theTimeChange/ns
<< "[ns] " <<endl;
itsOK = false;
// Both global and proper time should not go back
G4bool itsOKforGlobalTime = true;
accuracy = (aTrack.GetGlobalTime()- theTimeChange)/ns;
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the global time goes back !!" << endl;
G4cout << " Difference: " << accuracy << "[ns] " <<endl;
itsOKforGlobalTime = false;
if (accuracy > accuracyForException) exitWithError = true;
}
if (theProperTimeChange < aTrack.GetProperTime()) {
G4cout << " !!! the poper time goes back !!!"
<< " : " << aTrack.GetProperTime()/ns
<< " -> " << theProperTimeChange/ns
<< "[ns] " <<endl;
itsOK = false;
G4bool itsOKforProperTime = true;
accuracy = (aTrack.GetProperTime() - theProperTimeChange )/ns;
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the proper time goes back !!" << endl;
G4cout << " Difference: " << accuracy << "[ns] " <<endl;
itsOKforProperTime = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// Kinetic Energy should not be negative
G4bool itsOKforEnergy = true;
accuracy = -1.0*theEnergyChange/MeV;
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChange::CheckIt : ";
G4cout << "the kinetic energy is negative !!" << endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<endl;
itsOKforEnergy = false;
if (accuracy > accuracyForException) exitWithError = true;
}
G4bool itsOK = itsOKforMomentum && itsOKforEnergy && itsOKforProperTime && itsOKforGlobalTime;
// dump out information of this particle change
if (!itsOK) {
G4cout << " G4ParticleChange::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
G4Exception("G4ParticleChange::CheckIt");
}
// Exit with error
if (exitWithError) G4Exception("G4ParticleChange::CheckIt");
//correction
if (!itsOKforMomentum) {
G4double vmag = theMomentumDirectionChange.mag();
theMomentumDirectionChange = (1./vmag)*theMomentumDirectionChange;
}
if (!itsOKforGlobalTime) {
theTimeChange = aTrack.GetGlobalTime();
}
if (!itsOKforProperTime) {
theProperTimeChange = aTrack.GetProperTime();
}
if (!itsOKforEnergy) {
theEnergyChange = 0.0;
}
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
return itsOK;
}
+51 -8
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleChangeForDecay.cc,v 2.2 1998/07/20 06:11:57 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleChangeForDecay.cc,v 1.3 1999/05/06 11:42:55 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -31,7 +31,7 @@ G4ParticleChangeForDecay::G4ParticleChangeForDecay():G4VParticleChange()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForDecay::G4ParticleChangeForDecay() " << endl;
G4cout << "G4ParticleChangeForDecay::G4ParticleChangeForDecay() " << endl;
}
#endif
}
@@ -40,22 +40,21 @@ G4ParticleChangeForDecay::~G4ParticleChangeForDecay()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForDecay::~G4ParticleChangeForDecay() " << endl;
G4cout << "G4ParticleChangeForDecay::~G4ParticleChangeForDecay() " << endl;
}
#endif
}
// copy and assignment operators are implemented as "shallow copy"
G4ParticleChangeForDecay::G4ParticleChangeForDecay(const G4ParticleChangeForDecay &right)
G4ParticleChangeForDecay::G4ParticleChangeForDecay(const G4ParticleChangeForDecay &right): G4VParticleChange(right)
{
*this = right;
theTimeChange = right.theTimeChange;
}
G4ParticleChangeForDecay & G4ParticleChangeForDecay::operator=(const G4ParticleChangeForDecay &right)
{
if (this != &right)
{
if (this != &right){
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
@@ -63,6 +62,8 @@ G4ParticleChangeForDecay & G4ParticleChangeForDecay::operator=(const G4ParticleC
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
theTimeChange = right.theTimeChange;
}
return *this;
}
@@ -117,6 +118,12 @@ G4Step* G4ParticleChangeForDecay::UpdateStepForAtRest(G4Step* pStep)
pPostStepPoint->AddProperTime( theTimeChange
- pPreStepPoint->GetGlobalTime());
#ifdef G4VERBOSE
G4Track* aTrack = pStep->GetTrack();
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
@@ -132,6 +139,42 @@ void G4ParticleChangeForDecay::DumpInfo() const
<< endl;
}
G4bool G4ParticleChangeForDecay::CheckIt(const G4Track& aTrack)
{
G4bool exitWithError = false;
G4double accuracy;
// global time should not go back
G4bool itsOK =true;
accuracy = -1.0*(theTimeChange - aTrack.GetGlobalTime())/ns;
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChangeForDecay::CheckIt : ";
G4cout << "the global time goes back !!" << endl;
G4cout << " Difference: " << accuracy << "[ns] " <<endl;
itsOK = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// dump out information of this particle change
if (!itsOK) {
G4cout << " G4ParticleChangeForDecay::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
}
// Exit with error
if (exitWithError) G4Exception("G4ParticleChangeForDecay::CheckIt");
// correction
if (!itsOK) {
theTimeChange = aTrack.GetGlobalTime();
}
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
return itsOK;
}
+46 -11
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleChangeForLoss.cc,v 2.1 1998/12/02 17:20:26 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleChangeForLoss.cc,v 1.3 1999/05/06 11:42:56 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -31,7 +31,7 @@ G4ParticleChangeForLoss::G4ParticleChangeForLoss():G4VParticleChange()
debugFlag = false;
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForLoss::G4ParticleChangeForLoss() " << endl;
G4cout << "G4ParticleChangeForLoss::G4ParticleChangeForLoss() " << endl;
}
#endif
}
@@ -40,7 +40,7 @@ G4ParticleChangeForLoss::~G4ParticleChangeForLoss()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForLoss::~G4ParticleChangeForLoss() " << endl;
G4cout << "G4ParticleChangeForLoss::~G4ParticleChangeForLoss() " << endl;
}
#endif
}
@@ -49,7 +49,7 @@ G4ParticleChangeForLoss::~G4ParticleChangeForLoss()
G4ParticleChangeForLoss::G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right): G4VParticleChange(right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForLoss:: copy constructor is called " << endl;
G4cout << "G4ParticleChangeForLoss:: copy constructor is called " << endl;
}
theEnergyChange = right.theEnergyChange;
}
@@ -58,10 +58,18 @@ G4ParticleChangeForLoss::G4ParticleChangeForLoss(const G4ParticleChangeForLoss &
G4ParticleChangeForLoss & G4ParticleChangeForLoss::operator=(const G4ParticleChangeForLoss &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForLoss:: assignment operator is called " << endl;
G4cout << "G4ParticleChangeForLoss:: assignment operator is called " << endl;
}
if (this != &right)
{
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
theEnergyChange = right.theEnergyChange;
theLocalEnergyDeposit = right.theLocalEnergyDeposit ;
}
@@ -113,7 +121,9 @@ G4Step* G4ParticleChangeForLoss::UpdateStepForAlongStep(G4Step* pStep)
pPostStepPoint->SetKineticEnergy(0.0);
}
#ifdef G4VERBOSE
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
@@ -137,17 +147,36 @@ void G4ParticleChangeForLoss::DumpInfo() const
G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
{
G4bool itsOK = true;
if (theEnergyChange > aTrack.GetKineticEnergy()) {
G4cout << " !!! the energy becomes larger than the initial energy !!!"
<< " : " << (theEnergyChange -aTrack.GetKineticEnergy())/MeV
<< "MeV " <<endl;
G4bool exitWithError = false;
G4double accuracy;
// Energy should not be lager than initial value
accuracy = ( theEnergyChange - aTrack.GetKineticEnergy())/MeV;
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChangeForLoss::CheckIt : ";
G4cout << "the energy becoes larger than the initial value !!" << endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<endl;
itsOK = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// dump out information of this particle change
if (!itsOK) {
G4cout << " G4ParticleChange::CheckIt " <<endl;
G4cout << " G4ParticleChangeForLoss::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
}
// Exit with error
if (exitWithError) G4Exception("G4ParticleChangeForLoss::CheckIt");
//correction
if (!itsOK) {
theEnergyChange = aTrack.GetKineticEnergy();
}
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
return itsOK;
}
@@ -156,3 +185,9 @@ G4bool G4ParticleChangeForLoss::CheckIt(const G4Track& aTrack)
+72 -20
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleChangeForMSC.cc,v 2.1 1998/12/02 17:20:25 urban Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleChangeForMSC.cc,v 1.4 1999/05/06 11:42:57 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -30,7 +30,7 @@ G4ParticleChangeForMSC::G4ParticleChangeForMSC():G4VParticleChange()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForMSC::G4ParticleChangeForMSC() " << endl;
G4cout << "G4ParticleChangeForMSC::G4ParticleChangeForMSC() " << endl;
}
#endif
}
@@ -39,7 +39,7 @@ G4ParticleChangeForMSC::~G4ParticleChangeForMSC()
{
#ifdef G4VERBOSE
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForMSC::~G4ParticleChangeForMSC() " << endl;
G4cout << "G4ParticleChangeForMSC::~G4ParticleChangeForMSC() " << endl;
}
#endif
}
@@ -48,9 +48,11 @@ G4ParticleChangeForMSC::G4ParticleChangeForMSC(
const G4ParticleChangeForMSC &right): G4VParticleChange(right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForMSC:: copy constructor is called " << endl;
G4cout << "G4ParticleChangeForMSC:: copy constructor is called " << endl;
}
*this = right;
theMomentumDirectionChange = right.theMomentumDirectionChange;
thePositionChange = right.thePositionChange;
theTrueStepLength = right.theTrueStepLength;
}
// assignment operator
@@ -58,11 +60,19 @@ G4ParticleChangeForMSC & G4ParticleChangeForMSC::operator=(
const G4ParticleChangeForMSC &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForMSC:: assignment operator is called " << endl;
G4cout << "G4ParticleChangeForMSC:: assignment operator is called " << endl;
}
if (this != &right)
{
theMomentumChange = right.theMomentumChange;
{
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;
}
@@ -80,7 +90,7 @@ void G4ParticleChangeForMSC::Initialize(const G4Track& track)
// set Energy/Momentum etc. equal to those of the parent particle
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
theMomentumChange = pParticle->GetMomentumDirection();
theMomentumDirectionChange = pParticle->GetMomentumDirection();
// set Position equal to those of the parent track
thePositionChange = track.GetPosition();
@@ -112,11 +122,15 @@ G4Step* G4ParticleChangeForMSC::UpdateStepForPostStep(G4Step* pStep)
G4Track* aTrack = pStep->GetTrack();
// update momentum direction
pPostStepPoint->SetMomentumDirection(theMomentumChange);
pPostStepPoint->SetMomentumDirection(theMomentumDirectionChange);
// update position
pPostStepPoint->SetPosition( thePositionChange );
#ifdef G4VERBOSE
if (debugFlag) CheckIt(*aTrack);
#endif
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
}
@@ -147,20 +161,58 @@ void G4ParticleChangeForMSC::DumpInfo() const
G4cout << " Position - z (mm) : "
<< setw(20) << thePositionChange.z()/mm
<< endl;
G4cout << " Momentum Direct - x : "
<< setw(20) << theMomentumChange.x()
G4cout << " Momentum Direction - x : "
<< setw(20) << theMomentumDirectionChange.x()
<< endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << theMomentumChange.y()
G4cout << " Momentum Direction - y : "
<< setw(20) << theMomentumDirectionChange.y()
<< endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << theMomentumChange.z()
G4cout << " Momentum Direction - z : "
<< setw(20) << theMomentumDirectionChange.z()
<< endl;
}
G4bool G4ParticleChangeForMSC::CheckIt(const G4Track& aTrack)
{
G4bool itsOK = true;
G4bool exitWithError = false;
G4double accuracy;
// check
// MomentumDirection should be unit vector
accuracy = abs(theMomentumDirectionChange.mag2()-1.0);
if (accuracy > accuracyForWarning) {
G4cout << " G4ParticleChangeForMSC::CheckIt : ";
G4cout << "the Momentum Change is not unit vector !!" << endl;
G4cout << " Difference: " << accuracy << endl;
itsOK = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// dump out information of this particle change
if (!itsOK) {
G4cout << " G4ParticleChangeForMSC::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
}
// Exit with error
if (exitWithError) G4Exception("G4ParticleChangeForMSC::CheckIt");
//correction
if (!itsOK) {
G4double vmag = theMomentumDirectionChange.mag();
theMomentumDirectionChange = (1./vmag)*theMomentumDirectionChange;
}
itsOK = (itsOK) && G4VParticleChange::CheckIt(aTrack);
return itsOK;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleChangeForTransport.cc,v 2.8 1998/11/10 19:05:18 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleChangeForTransport.cc,v 1.4 1999/05/06 11:42:57 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -31,14 +31,14 @@
G4ParticleChangeForTransport::G4ParticleChangeForTransport():G4ParticleChange()
{
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForTransport::G4ParticleChangeForTransport() " << endl;
G4cout << "G4ParticleChangeForTransport::G4ParticleChangeForTransport() " << endl;
}
}
G4ParticleChangeForTransport::~G4ParticleChangeForTransport()
{
if (verboseLevel>2) {
G4cerr << "G4ParticleChangeForTransport::~G4ParticleChangeForTransport() " << endl;
G4cout << "G4ParticleChangeForTransport::~G4ParticleChangeForTransport() " << endl;
}
}
@@ -46,7 +46,7 @@ G4ParticleChangeForTransport::~G4ParticleChangeForTransport()
G4ParticleChangeForTransport::G4ParticleChangeForTransport(const G4ParticleChangeForTransport &right):G4ParticleChange(right)
{
if (verboseLevel>0) {
G4cerr << "G4ParticleChangeForTransport:: copy constructor is called " << endl;
G4cout << "G4ParticleChangeForTransport:: copy constructor is called " << endl;
}
theTouchableChange = right.theTouchableChange;
}
@@ -55,7 +55,7 @@ G4ParticleChangeForTransport::G4ParticleChangeForTransport(const G4ParticleChang
G4ParticleChangeForTransport & G4ParticleChangeForTransport::operator=(const G4ParticleChangeForTransport &right)
{
if (verboseLevel>1) {
G4cerr << "G4ParticleChangeForTransport:: assignment operator is called " << endl;
G4cout << "G4ParticleChangeForTransport:: assignment operator is called " << endl;
}
if (this != &right)
{
@@ -64,7 +64,7 @@ G4ParticleChangeForTransport & G4ParticleChangeForTransport::operator=(const G4P
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theTouchableChange = right.theTouchableChange;
theMomentumChange = right.theMomentumChange;
theMomentumDirectionChange = right.theMomentumDirectionChange;
thePolarizationChange = right.thePolarizationChange;
thePositionChange = right.thePositionChange;
theTimeChange = right.theTimeChange;
@@ -84,8 +84,8 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAtRest(G4Step* pStep)
{
// Nothing happens for AtRestDoIt
if (verboseLevel>0) {
G4cerr << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called" << endl;
G4cerr << " Nothing happens for this method " << endl;
G4cout << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called" << endl;
G4cout << " Nothing happens for this method " << endl;
}
// Update the G4Step specific attributes
return UpdateStepInfo(pStep);
@@ -105,13 +105,13 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
// calculated and be accumulated in PostStepPoint.
// Take note that the return type of GetMomentumChange is a
// pointer to G4ParticleMomentum. Also it is a normalized
// pointer to G4ThreeVector. Also it is a normalized
// momentum vector.
G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
G4Track* aTrack = pStep->GetTrack();
G4double mass = mass = aTrack->GetDynamicParticle()->GetMass();
G4double mass = aTrack->GetDynamicParticle()->GetMass();
// uodate kinetic energy
// now assume that no energy change in transportation
@@ -127,7 +127,7 @@ G4Step* G4ParticleChangeForTransport::UpdateStepForAlongStep(G4Step* pStep)
// calculate new momentum
G4ThreeVector pMomentum = pPostStepPoint->GetMomentum()
+ ( CalcMomentum(theEnergyChange, theMomentumChange, mass)
+ ( CalcMomentum(theEnergyChange, theMomentumDirectionChange, mass)
- pPreStepPoint->GetMomentum());
G4double tMomentum_inv = 1.0 / pMomentum.mag();
pPostStepPoint->SetMomentumDirection(pMomentum*tMomentum_inv);
@@ -205,4 +205,3 @@ void G4ParticleChangeForTransport::DumpInfo() const
+2 -140
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Step.cc,v 2.3 1998/11/18 11:06:46 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Step.cc,v 1.3 1999/04/28 12:28:45 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
@@ -30,7 +30,6 @@
// ---------------------------------------------------------------
#include "G4Step.hh"
#include "G4VProcess.hh"
////////////////
G4Step::G4Step()
@@ -47,140 +46,3 @@ G4Step::~G4Step()
delete fpPreStepPoint;
delete fpPostStepPoint;
}
/////////////////////////////
void G4Step::ShowStep() const
/////////////////////////////
{
// Show header
G4cout << endl;
G4cout << " ++G4Step Information " << endl;
G4cout.precision(3);
// Show G4Step specific information
G4cout << " Address of G4Track : " << fpTrack << endl;
G4cout << " Step Length (mm) : " << fpTrack->GetStepLength() << endl;
G4cout << " Energy Deposit (MeV) : " << fTotalEnergyDeposit << endl;
// Show G4StepPoint specific information
G4cout << " -------------------------------------------------------"
<< "----------------" << endl;
G4cout << " StepPoint Information " << setw(20) << "PreStep"
<< setw(20) << "PostStep" << endl;
G4cout << " -------------------------------------------------------"
<< "----------------" << endl;
G4cout << " Position - x (mm) : "
<< setw(20) << fpPreStepPoint->GetPosition().x()
<< setw(20) << fpPostStepPoint->GetPosition().x() << endl;
G4cout << " Position - y (mm) : "
<< setw(20) << fpPreStepPoint->GetPosition().y()
<< setw(20) << fpPostStepPoint->GetPosition().y() << endl;
G4cout << " Position - z (mm) : "
<< setw(20) << fpPreStepPoint->GetPosition().z()
<< setw(20) << fpPostStepPoint->GetPosition().z() << endl;
G4cout << " Global Time (ns) : "
<< setw(20) << fpPreStepPoint->GetGlobalTime()
<< setw(20) << fpPostStepPoint->GetGlobalTime() << endl;
G4cout << " Local Time (ns) : "
<< setw(20) << fpPreStepPoint->GetLocalTime()
<< setw(20) << fpPostStepPoint->GetLocalTime() << endl;
G4cout << " Proper Time (ns) : "
<< setw(20) << fpPreStepPoint->GetProperTime()
<< setw(20) << fpPostStepPoint->GetProperTime() << endl;
G4cout << " Momentum Direct - x : "
<< setw(20) << fpPreStepPoint->GetMomentumDirection().x()
<< setw(20) << fpPostStepPoint->GetMomentumDirection().x() << endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << fpPreStepPoint->GetMomentumDirection().y()
<< setw(20) << fpPostStepPoint->GetMomentumDirection().y() << endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << fpPreStepPoint->GetMomentumDirection().z()
<< setw(20) << fpPostStepPoint->GetMomentumDirection().z() << endl;
G4cout << " Momentum - x (MeV/c): "
<< setw(20) << fpPreStepPoint->GetMomentum().x()
<< setw(20) << fpPostStepPoint->GetMomentum().x() << endl;
G4cout << " Momentum - y (MeV/c): "
<< setw(20) << fpPreStepPoint->GetMomentum().y()
<< setw(20) << fpPostStepPoint->GetMomentum().y() << endl;
G4cout << " Momentum - z (MeV/c): "
<< setw(20) << fpPreStepPoint->GetMomentum().z()
<< setw(20) << fpPostStepPoint->GetMomentum().z() << endl;
G4cout << " Total Energy (MeV) : "
<< setw(20) << fpPreStepPoint->GetTotalEnergy()
<< setw(20) << fpPostStepPoint->GetTotalEnergy() << endl;
G4cout << " Kinetic Energy (MeV): "
<< setw(20) << fpPreStepPoint->GetKineticEnergy()
<< setw(20) << fpPostStepPoint->GetKineticEnergy() << endl;
G4cout << " Velocity (mm/ns) : "
<< setw(20) << fpPreStepPoint->GetVelocity()
<< setw(20) << fpPostStepPoint->GetVelocity() << endl;
G4cout << " Volume Name : "
<< setw(20) << fpPreStepPoint->GetPhysicalVolume()->GetName()
<< setw(20) << fpPostStepPoint->GetPhysicalVolume()->GetName() << endl;
G4cout << " Safety (mm) : "
<< setw(20) << fpPreStepPoint->GetSafety()
<< setw(20) << fpPostStepPoint->GetSafety() << endl;
G4cout << " Polarization - x : "
<< setw(20) << fpPreStepPoint->GetPolarization().x()
<< setw(20) << fpPostStepPoint->GetPolarization().x() << endl;
G4cout << " Polarization - y : "
<< setw(20) << fpPreStepPoint->GetPolarization().y()
<< setw(20) << fpPostStepPoint->GetPolarization().y() << endl;
G4cout << " Polarization - Z : "
<< setw(20) << fpPreStepPoint->GetPolarization().z()
<< setw(20) << fpPostStepPoint->GetPolarization().z() << endl;
G4cout << " Weight : "
<< setw(20) << fpPreStepPoint->GetWeight()
<< setw(20) << fpPostStepPoint->GetWeight() << endl;
G4cout << " Step Status : " ;
G4StepStatus tStepStatus = fpPreStepPoint->GetStepStatus();
if( tStepStatus == fGeomBoundary ){
G4cout << setw(20) << "Geom Limit";
} else if ( tStepStatus == fAlongStepDoItProc ){
G4cout << setw(20) << "AlongStep Proc.";
} else if ( tStepStatus == fPostStepDoItProc ){
G4cout << setw(20) << "PostStep Proc";
} else if ( tStepStatus == fAtRestDoItProc ){
G4cout << setw(20) << "AtRest Proc";
} else if ( tStepStatus == fUndefined ){
G4cout << setw(20) << "Undefined";
}
tStepStatus = fpPostStepPoint->GetStepStatus();
if( tStepStatus == fGeomBoundary ){
G4cout << setw(20) << "Geom Limit";
} else if ( tStepStatus == fAlongStepDoItProc ){
G4cout << setw(20) << "AlongStep Proc.";
} else if ( tStepStatus == fPostStepDoItProc ){
G4cout << setw(20) << "PostStep Proc";
} else if ( tStepStatus == fAtRestDoItProc ){
G4cout << setw(20) << "AtRest Proc";
} else if ( tStepStatus == fUndefined ){
G4cout << setw(20) << "Undefined";
}
G4cout << endl;
G4cout << " Process defined Step: " ;
if( fpPreStepPoint->GetProcessDefinedStep() == NULL ){
G4cout << setw(20) << "Undefined";
} else {
G4cout << setw(20) << fpPreStepPoint->GetProcessDefinedStep()
->GetProcessName();
}
if( fpPostStepPoint->GetProcessDefinedStep() == NULL){
G4cout << setw(20) << "Undefined";
} else {
G4cout << setw(20) << fpPostStepPoint->GetProcessDefinedStep()
->GetProcessName();
}
G4cout << endl;
G4cout << " -------------------------------------------------------"
<< "----------------" << endl;
}
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4StepPoint.cc,v 2.1 1998/07/12 03:08:56 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4StepPoint.cc,v 1.1 1999/01/07 16:14:27 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Track.cc,v 2.2 1998/11/18 11:06:48 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Track.cc,v 1.1 1999/01/07 16:14:27 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
+49
View File
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VEvtBiasMechanism.cc,v 1.1 1999/04/13 09:47:11 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// For information related to this code contact:
// CERN, CN Division, ASD Group
//
//
// ------------------------------------------------------------
// Implemented for the new scheme 13 Apr. 1999 H.Kurahige
#include "G4VEvtBiasMechanism.hh"
G4VEvtBiasMechanism::G4VEvtBiasMechanism(const G4String& name):
theEBName(name)
{
}
G4VEvtBiasMechanism::G4VEvtBiasMechanism(const G4VEvtBiasMechanism& right)
{
theEBName = right.theEBName;
}
G4VEvtBiasMechanism::~G4VEvtBiasMechanism()
{
}
+101 -8
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VParticleChange.cc,v 2.3 1998/11/18 11:06:49 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VParticleChange.cc,v 1.3 1999/05/06 11:42:58 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -25,6 +25,9 @@
#include "G4TrackFastVector.hh"
#include "G4Mars5GeVMechanism.hh"
const G4double G4VParticleChange::accuracyForWarning = 1.0e-9;
const G4double G4VParticleChange::accuracyForException = 0.001;
G4VParticleChange::G4VParticleChange():
theNumberOfSecondaries(0),
theSizeOftheListOfSecondaries(G4TrackFastVectorSize),
@@ -32,10 +35,15 @@ G4VParticleChange::G4VParticleChange():
theSteppingControlFlag(NormalCondition),
theLocalEnergyDeposit(0.0),
theParentWeight(1.0),
theEBMechanism(NULL),
theEBMechanism(0),
fUseEB(false),
verboseLevel(1)
{
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
theListOfSecondaries = new G4TrackFastVector();
}
@@ -46,10 +54,16 @@ G4VParticleChange::G4VParticleChange(G4bool useEB):
theSteppingControlFlag(NormalCondition),
theLocalEnergyDeposit(0.0),
theParentWeight(1.0),
fUseEB(useEB),
verboseLevel(1)
{
theListOfSecondaries = new G4TrackFastVector();
fUseEB = useEB;
// debug flag (activate CheckIt() )
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
theListOfSecondaries = new G4TrackFastVector();
// register G4EvtBiasMechanism as a default
theEBMechanism = new G4Mars5GeVMechanism();
}
@@ -67,19 +81,44 @@ G4VParticleChange::~G4VParticleChange() {
if ( (*theListOfSecondaries)[index] ) delete (*theListOfSecondaries)[index] ;
}
}
if (theEBMechanism !=NULL) delete theEBMechanism;
if (theEBMechanism !=0) delete theEBMechanism;
delete theListOfSecondaries;
}
// copy and assignment operators are implemented as "shallow copy"
G4VParticleChange::G4VParticleChange(const G4VParticleChange &right)
G4VParticleChange::G4VParticleChange(const G4VParticleChange &right):
theNumberOfSecondaries(0),
theSizeOftheListOfSecondaries(G4TrackFastVectorSize),
theStatusChange(fAlive),
theSteppingControlFlag(NormalCondition),
theLocalEnergyDeposit(0.0),
theParentWeight(1.0),
fUseEB(false),
verboseLevel(1)
{
*this = right;
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
theListOfSecondaries = right.theListOfSecondaries;
theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
theNumberOfSecondaries = right.theNumberOfSecondaries;
theStatusChange = right.theStatusChange;
theTrueStepLength = right.theTrueStepLength;
theLocalEnergyDeposit = right.theLocalEnergyDeposit;
theSteppingControlFlag = right.theSteppingControlFlag;
}
G4VParticleChange & G4VParticleChange::operator=(const G4VParticleChange &right)
{
debugFlag = false;
#ifdef G4VERBOSE
// activate CHeckIt if in VERBOSE mode
debugFlag = true;
#endif
if (this != &right)
{
theListOfSecondaries = right.theListOfSecondaries;
@@ -136,6 +175,7 @@ void G4VParticleChange::DumpInfo() const
G4cout << " Energy Deposit (MeV): "
<< setw(20) << theLocalEnergyDeposit/MeV
<< endl;
G4cout << " Track Status : "
<< setw(20);
if( theStatusChange == fAlive ){
@@ -167,6 +207,59 @@ void G4VParticleChange::DumpInfo() const
G4cout << endl;
}
G4bool G4VParticleChange::CheckIt(const G4Track& aTrack)
{
G4bool exitWithError = false;
G4double accuracy;
G4double newEnergyDeposit;
// Energy deposit should not be negative
G4bool itsOKforEnergy = true;
accuracy = -1.0*theLocalEnergyDeposit/MeV;
if (accuracy > accuracyForWarning) {
G4cout << " G4VParticleChange::CheckIt : ";
G4cout << "the energy deposit is negative !!" << endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<endl;
itsOKforEnergy = false;
if (accuracy > accuracyForException) exitWithError = true;
}
// true path length should not be negative
G4bool itsOKforStepLength = true;
accuracy = -1.0*theTrueStepLength/mm;
if (accuracy > accuracyForWarning) {
G4cout << " G4VParticleChange::CheckIt : ";
G4cout << "the true step length is negative !!" << endl;
G4cout << " Difference: " << accuracy << "[MeV] " <<endl;
itsOKforStepLength = false;
if (accuracy > accuracyForException) exitWithError = true;
}
G4bool itsOK = itsOKforStepLength && itsOKforEnergy ;
// dump out information of this particle change
if (! itsOK ){
G4cout << " G4VParticleChange::CheckIt " <<endl;
G4cout << " pointer : " << this <<endl ;
DumpInfo();
}
// Exit with error
if (exitWithError) G4Exception("G4VParticleChange::CheckIt");
// correction
if ( !itsOKforStepLength ) {
theTrueStepLength = (1.e-12)*mm;
}
if ( !itsOKforEnergy ) {
theLocalEnergyDeposit = 0.0;
}
return itsOK;
}