Import Geant4 3.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SteppingManager.cc,v 1.10 2000/06/02 09:53:29 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4SteppingManager.cc,v 1.12 2001/02/08 07:48:39 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -58,12 +58,16 @@ G4SteppingManager::G4SteppingManager()
|
||||
KillVerbose = false;
|
||||
}
|
||||
#endif
|
||||
fSelectedAtRestDoItVector
|
||||
= new G4SelectedAtRestDoItVector(SIZEofSelectedDoIt);
|
||||
fSelectedAlongStepDoItVector
|
||||
= new G4SelectedAlongStepDoItVector(SIZEofSelectedDoIt);
|
||||
fSelectedPostStepDoItVector
|
||||
= new G4SelectedPostStepDoItVector(SIZEofSelectedDoIt);
|
||||
SetNavigator(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking());
|
||||
|
||||
fSelectedAtRestDoItVector
|
||||
= new G4SelectedAtRestDoItVector(SizeOfSelectedDoItVector);
|
||||
fSelectedAlongStepDoItVector
|
||||
= new G4SelectedAlongStepDoItVector(SizeOfSelectedDoItVector);
|
||||
fSelectedPostStepDoItVector
|
||||
= new G4SelectedPostStepDoItVector(SizeOfSelectedDoItVector);
|
||||
|
||||
SetNavigator(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking());
|
||||
|
||||
|
||||
@@ -0,0 +1,559 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the 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: G4SteppingManager2.cc,v 1.1 2001/02/08 07:56:40 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4SteppingManager.icc
|
||||
//
|
||||
// Description:
|
||||
// This class represents the manager who steers to move the give
|
||||
// particle from the TrackingManger by one Step.
|
||||
//
|
||||
// Contact:
|
||||
// Questions and comments to this code should be sent to
|
||||
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
|
||||
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ForceCondition.hh"
|
||||
#include "G4GPILSelection.hh"
|
||||
#include "G4SteppingControl.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
void G4SteppingManager::GetProcessNumber()
|
||||
/////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
G4ProcessManager* pm= fTrack->GetDefinition()->GetProcessManager();
|
||||
|
||||
// AtRestDoits
|
||||
MAXofAtRestLoops = pm->GetAtRestProcessVector()->entries();
|
||||
fAtRestDoItVector = pm->GetAtRestProcessVector(typeDoIt);
|
||||
fAtRestGetPhysIntVector = pm->GetAtRestProcessVector(typeGPIL);
|
||||
|
||||
// AlongStepDoits
|
||||
MAXofAlongStepLoops = pm->GetAlongStepProcessVector()->entries();
|
||||
fAlongStepDoItVector = pm->GetAlongStepProcessVector(typeDoIt);
|
||||
fAlongStepGetPhysIntVector = pm->GetAlongStepProcessVector(typeGPIL);
|
||||
|
||||
// PostStepDoits
|
||||
MAXofPostStepLoops = pm->GetPostStepProcessVector()->entries();
|
||||
fPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
|
||||
fPostStepGetPhysIntVector = pm->GetPostStepProcessVector(typeGPIL);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************
|
||||
//
|
||||
// Private Member Functions
|
||||
//
|
||||
// ************************************************************************
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
void G4SteppingManager::DefinePhysicalStepLength()
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
// ReSet the counter etc.
|
||||
PhysicalStep = DBL_MAX; // Initialize by a huge number
|
||||
physIntLength = DBL_MAX; // Initialize by a huge number
|
||||
#ifdef G4VERBOSE
|
||||
// !!!!! Verbose
|
||||
if(verboseLevel>0) fVerbose->DPSLStarted();
|
||||
#endif
|
||||
|
||||
// Obtain the user defined maximum allowed Step in the volume
|
||||
// 1997.12.13 adds argument for GetMaxAllowedStep by K.Kurashige
|
||||
G4UserLimits* ul= fCurrentVolume->GetLogicalVolume()->GetUserLimits();
|
||||
if (ul) {
|
||||
physIntLength = ul->GetMaxAllowedStep(*fTrack);
|
||||
#ifdef G4VERBOSE
|
||||
// !!!!! Verbose
|
||||
if(verboseLevel>0) fVerbose->DPSLUserLimit();
|
||||
#endif
|
||||
}
|
||||
|
||||
if(physIntLength < PhysicalStep ){
|
||||
PhysicalStep = physIntLength;
|
||||
fStepStatus = fUserDefinedLimit;
|
||||
fStep->GetPostStepPoint()
|
||||
->SetProcessDefinedStep(NULL);
|
||||
// Take note that the process pointer is 'NULL' if the Step
|
||||
// is defined by the user defined limit.
|
||||
}
|
||||
|
||||
// GPIL for PostStep
|
||||
fPostStepDoItProcTriggered = MAXofPostStepLoops;
|
||||
|
||||
for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
fCurrentProcess = (*fPostStepGetPhysIntVector)(np);
|
||||
if (fCurrentProcess== NULL) {
|
||||
(*fSelectedPostStepDoItVector)[np] = 0;
|
||||
continue;
|
||||
} // NULL means the process is inactivated by a user on fly.
|
||||
|
||||
physIntLength = fCurrentProcess->
|
||||
PostStepGPIL( *fTrack,
|
||||
fPreviousStepSize,
|
||||
&fCondition );
|
||||
#ifdef G4VERBOSE
|
||||
// !!!!! Verbose
|
||||
if(verboseLevel>0) fVerbose->DPSLPostStep();
|
||||
#endif
|
||||
|
||||
switch (fCondition) {
|
||||
case ExclusivelyForced:
|
||||
(*fSelectedPostStepDoItVector)[np] = 4;
|
||||
fStepStatus = fExclusivelyForcedProc;
|
||||
fStep->GetPostStepPoint()
|
||||
->SetProcessDefinedStep(fCurrentProcess);
|
||||
break;
|
||||
case Conditionally:
|
||||
(*fSelectedPostStepDoItVector)[np] = 3;
|
||||
break;
|
||||
case Forced:
|
||||
(*fSelectedPostStepDoItVector)[np] = 2;
|
||||
break;
|
||||
default:
|
||||
(*fSelectedPostStepDoItVector)[np] = 0;
|
||||
if(physIntLength < PhysicalStep ){
|
||||
PhysicalStep = physIntLength;
|
||||
fStepStatus = fPostStepDoItProc;
|
||||
fPostStepDoItProcTriggered = G4int(np);
|
||||
fStep->GetPostStepPoint()
|
||||
->SetProcessDefinedStep(fCurrentProcess);
|
||||
}
|
||||
}
|
||||
if (fCondition==ExclusivelyForced) return; // Take note the 'return' at here !!!
|
||||
}
|
||||
|
||||
if(fPostStepDoItProcTriggered<MAXofPostStepLoops)
|
||||
(*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] = 1;
|
||||
|
||||
|
||||
// GPIL for AlongStep
|
||||
proposedSafety = DBL_MAX;
|
||||
G4double safetyProposedToAndByProcess = proposedSafety;
|
||||
|
||||
for(size_t kp=0; kp < MAXofAlongStepLoops; kp++){
|
||||
fCurrentProcess = (*fAlongStepGetPhysIntVector)[kp];
|
||||
if (fCurrentProcess== NULL) continue;
|
||||
// NULL means the process is inactivated by a user on fly.
|
||||
|
||||
physIntLength = fCurrentProcess->
|
||||
AlongStepGPIL( *fTrack,
|
||||
fPreviousStepSize,
|
||||
PhysicalStep,
|
||||
safetyProposedToAndByProcess,
|
||||
&fGPILSelection );
|
||||
#ifdef G4VERBOSE
|
||||
// !!!!! Verbose
|
||||
if(verboseLevel>0) fVerbose->DPSLAlongStep();
|
||||
#endif
|
||||
if(physIntLength < PhysicalStep){
|
||||
PhysicalStep = physIntLength;
|
||||
|
||||
// Check if the process wants to be the GPIL winner. For example,
|
||||
// multi-scattering proposes Step limit, but won't be the winner.
|
||||
if(fGPILSelection==CandidateForSelection){
|
||||
fStepStatus = fAlongStepDoItProc;
|
||||
fStep->GetPostStepPoint()
|
||||
->SetProcessDefinedStep(fCurrentProcess);
|
||||
}
|
||||
|
||||
// Transportation is assumed to be the last process in the vector
|
||||
if(kp == MAXofAlongStepLoops-1) fStepStatus = fGeomBoundary;
|
||||
}
|
||||
|
||||
// Make sure to check the safety, even if Step is not limited
|
||||
// by this process. J. Apostolakis, June 20, 1998
|
||||
//
|
||||
if (safetyProposedToAndByProcess < proposedSafety)
|
||||
// proposedSafety keeps the smallest value:
|
||||
proposedSafety = safetyProposedToAndByProcess;
|
||||
else
|
||||
// safetyProposedToAndByProcess always proposes a valid safety:
|
||||
safetyProposedToAndByProcess = proposedSafety;
|
||||
|
||||
}
|
||||
} // void G4SteppingManager::DefinePhysicalStepLength() //
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
//////////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
// Select the rest process which has the shortest time before
|
||||
// it is invoked. In rest processes, GPIL()
|
||||
// returns the time before a process occurs.
|
||||
G4double lifeTime, shortestLifeTime;
|
||||
|
||||
fN2ndariesAtRestDoIt = 0;
|
||||
shortestLifeTime = DBL_MAX;
|
||||
|
||||
int NofInactiveProc=0;
|
||||
for( size_t ri=0 ; ri < MAXofAtRestLoops ; ri++ ){
|
||||
fCurrentProcess = (*fAtRestGetPhysIntVector)[ri];
|
||||
if (fCurrentProcess== NULL) {
|
||||
(*fSelectedAtRestDoItVector)[ri] = 0;
|
||||
NofInactiveProc++;
|
||||
continue;
|
||||
} // NULL means the process is inactivated by a user on fly.
|
||||
|
||||
lifeTime =
|
||||
fCurrentProcess->AtRestGPIL(
|
||||
*fTrack,
|
||||
&fCondition );
|
||||
if(fCondition==Forced){
|
||||
(*fSelectedAtRestDoItVector)[ri] = 2;
|
||||
}
|
||||
else{
|
||||
(*fSelectedAtRestDoItVector)[ri] = 0;
|
||||
if(lifeTime < shortestLifeTime ){
|
||||
shortestLifeTime = lifeTime;
|
||||
fAtRestDoItProcTriggered = G4int(int(ri));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at least one process is necessary to destory the particle
|
||||
// exit with warning
|
||||
if(NofInactiveProc==MAXofAtRestLoops){
|
||||
G4Exception("G4SteppingManager::InvokeAtRestDoItProcs: No AtRestDoIt process is active. " );
|
||||
}
|
||||
|
||||
(*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = 1;
|
||||
|
||||
fStep->SetStepLength( 0. ); //the particle has stopped
|
||||
fTrack->SetStepLength( 0. );
|
||||
|
||||
// invoke selected process
|
||||
for(size_t np=0; np < MAXofAtRestLoops; np++){
|
||||
//
|
||||
// Note: DoItVector has inverse order against GetPhysIntVector
|
||||
// and SelectedAtRestDoItVector.
|
||||
//
|
||||
if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] != 0){
|
||||
|
||||
|
||||
fCurrentProcess = (*fAtRestDoItVector)[np];
|
||||
fParticleChange
|
||||
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
|
||||
|
||||
// Set the current process as a process which defined this Step length
|
||||
fStep->GetPostStepPoint()
|
||||
->SetProcessDefinedStep(fCurrentProcess);
|
||||
|
||||
// Update Step
|
||||
fParticleChange->UpdateStepForAtRest(fStep);
|
||||
|
||||
// Now Store the secondaries from ParticleChange to SecondaryList
|
||||
G4Track* tempSecondaryTrack;
|
||||
G4bool tApplyCutFlag;
|
||||
G4double tProdThreshold;
|
||||
G4Material* tMaterial;
|
||||
G4double tBelowCutEnergyAndSafety;
|
||||
|
||||
fN2ndariesAtRestDoIt = fParticleChange->GetNumberOfSecondaries();
|
||||
|
||||
for(G4int DSecLoop=0 ; DSecLoop< fN2ndariesAtRestDoIt; DSecLoop++){
|
||||
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
|
||||
tApplyCutFlag = tempSecondaryTrack->GetDefinition()
|
||||
->GetApplyCutsFlag();
|
||||
|
||||
// Check if the particle should be passed without coherent cut
|
||||
if(tApplyCutFlag){
|
||||
tBelowCutEnergyAndSafety = false;
|
||||
tMaterial = fPostStepPoint->GetMaterial();
|
||||
tProdThreshold = tempSecondaryTrack->GetDefinition()
|
||||
-> GetEnergyThreshold(tMaterial);
|
||||
|
||||
if( tempSecondaryTrack->GetKineticEnergy()<tProdThreshold ){
|
||||
G4double currentRange
|
||||
= G4EnergyLossTables::GetRange(
|
||||
tempSecondaryTrack->GetDefinition(),
|
||||
tempSecondaryTrack->GetKineticEnergy(),
|
||||
tMaterial
|
||||
);
|
||||
if (currentRange < CalculateSafety() ){
|
||||
tBelowCutEnergyAndSafety = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( tBelowCutEnergyAndSafety ){
|
||||
if( !(tempSecondaryTrack->IsGoodForTracking()) ){
|
||||
|
||||
//// G4cout << "!! Warning - G4SteppingManager:" << G4endl;
|
||||
//// << " This physics process generated a secondary"
|
||||
//// << " of which energy is below cut but"
|
||||
//// << " GoodForTracking is off !!!!!" << G4endl;
|
||||
|
||||
// Add kinetic energy to the total energy deposit
|
||||
fStep->AddTotalEnergyDeposit(
|
||||
tempSecondaryTrack->GetKineticEnergy() );
|
||||
tempSecondaryTrack->SetKineticEnergy(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this 2ndry particle has 'zero' kinetic energy, make sure
|
||||
// it invokes a rest process at the beginning of the tracking
|
||||
if(tempSecondaryTrack->GetKineticEnergy() <= 0.){
|
||||
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
|
||||
}
|
||||
|
||||
// Set parentID
|
||||
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
|
||||
|
||||
// Set the process pointer which created this track
|
||||
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
|
||||
|
||||
fSecondary->push_back ( tempSecondaryTrack );
|
||||
}
|
||||
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
|
||||
} //if(fSelectedAtRestDoItVector[np] != 0){
|
||||
} //for(size_t np=0; np < MAXofAtRestLoops; np++){
|
||||
|
||||
fStep->UpdateTrack();
|
||||
|
||||
fTrack->SetTrackStatus( fStopAndKill );
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
void G4SteppingManager::InvokeAlongStepDoItProcs()
|
||||
/////////////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
// If the current Step is defined by a 'ExclusivelyForced'
|
||||
// PostStepDoIt, then don't invoke any AlongStepDoIt
|
||||
if(fStepStatus == fExclusivelyForcedProc){
|
||||
return; // Take note 'return' at here !!!
|
||||
}
|
||||
|
||||
// Invoke the all active continuous processes
|
||||
fN2ndariesAlongStepDoIt = 0;
|
||||
|
||||
for( size_t ci=0 ; ci<MAXofAlongStepLoops ; ci++ ){
|
||||
fCurrentProcess = (*fAlongStepDoItVector)[ci];
|
||||
if (fCurrentProcess== NULL) continue;
|
||||
// NULL means the process is inactivated by a user on fly.
|
||||
|
||||
fParticleChange
|
||||
= fCurrentProcess->AlongStepDoIt( *fTrack, *fStep );
|
||||
|
||||
// Update the PostStepPoint of Step according to ParticleChange
|
||||
fParticleChange->UpdateStepForAlongStep(fStep);
|
||||
#ifdef G4VERBOSE
|
||||
// !!!!! Verbose
|
||||
if(verboseLevel>0) fVerbose->AlongStepDoItOneByOne();
|
||||
#endif
|
||||
|
||||
// Now Store the secondaries from ParticleChange to SecondaryList
|
||||
G4Track* tempSecondaryTrack;
|
||||
G4bool tApplyCutFlag;
|
||||
G4double tProdThreshold;
|
||||
G4Material* tMaterial;
|
||||
G4double tBelowCutEnergyAndSafety;
|
||||
|
||||
fN2ndariesAlongStepDoIt = fParticleChange->GetNumberOfSecondaries();
|
||||
|
||||
for(G4int DSecLoop=0 ; DSecLoop< fN2ndariesAlongStepDoIt; DSecLoop++){
|
||||
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
|
||||
tApplyCutFlag = tempSecondaryTrack->GetDefinition()
|
||||
->GetApplyCutsFlag();
|
||||
|
||||
// Check if the particle should be passed without coherent cut
|
||||
if(tApplyCutFlag){
|
||||
tBelowCutEnergyAndSafety = false;
|
||||
tMaterial = fPostStepPoint->GetMaterial();
|
||||
tProdThreshold = tempSecondaryTrack->GetDefinition()
|
||||
-> GetEnergyThreshold(tMaterial);
|
||||
|
||||
if( tempSecondaryTrack->GetKineticEnergy()<tProdThreshold ){
|
||||
G4double currentRange
|
||||
= G4EnergyLossTables::GetRange(
|
||||
tempSecondaryTrack->GetDefinition(),
|
||||
tempSecondaryTrack->GetKineticEnergy(),
|
||||
tMaterial
|
||||
);
|
||||
if (currentRange < CalculateSafety() ){
|
||||
tBelowCutEnergyAndSafety = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( tBelowCutEnergyAndSafety ){
|
||||
if( !(tempSecondaryTrack->IsGoodForTracking()) ){
|
||||
|
||||
//// G4cout << "!! Warning - G4SteppingManager:" << G4endl;
|
||||
//// << " This physics process generated a secondary"
|
||||
//// << " of which energy is below cut but"
|
||||
//// << " GoodForTracking is off !!!!!" << G4endl;
|
||||
|
||||
// Add kinetic energy to the total energy deposit
|
||||
fStep->AddTotalEnergyDeposit(
|
||||
tempSecondaryTrack->GetKineticEnergy() );
|
||||
tempSecondaryTrack->SetKineticEnergy(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this 2ndry particle has 'zero' kinetic energy, make sure
|
||||
// it invokes a rest process at the beginning of the tracking
|
||||
if(tempSecondaryTrack->GetKineticEnergy() <= 0.){
|
||||
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
|
||||
}
|
||||
|
||||
// Set parentID
|
||||
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
|
||||
|
||||
// Set the process pointer which created this track
|
||||
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
|
||||
|
||||
fSecondary->push_back( tempSecondaryTrack );
|
||||
}
|
||||
|
||||
// Set the track status according to what the process defined
|
||||
fTrack->SetTrackStatus( fParticleChange->GetStatusChange() );
|
||||
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
void G4SteppingManager::InvokePostStepDoItProcs()
|
||||
////////////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
// Invoke the specified discrete processes
|
||||
fN2ndariesPostStepDoIt = 0;
|
||||
|
||||
for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
//
|
||||
// Note: DoItVector has inverse order against GetPhysIntVector
|
||||
// and SelectedPostStepDoItVector.
|
||||
//
|
||||
size_t npGPIL = MAXofPostStepLoops-np-1;
|
||||
|
||||
G4int tmp= (*fSelectedPostStepDoItVector)[npGPIL];
|
||||
if(tmp != 0){
|
||||
|
||||
if ( ((tmp == 1) && (fStepStatus == fPostStepDoItProc)) ||
|
||||
((tmp == 2) && (fStepStatus != fExclusivelyForcedProc)) ||
|
||||
((tmp == 3) && (fStepStatus == fAlongStepDoItProc)) ||
|
||||
((tmp == 4) && (fStepStatus == fExclusivelyForcedProc)) ) {
|
||||
|
||||
fCurrentProcess = (*fPostStepDoItVector)[np];
|
||||
fParticleChange
|
||||
= fCurrentProcess->PostStepDoIt( *fTrack, *fStep);
|
||||
|
||||
// Update PostStepPoint of Step according to ParticleChange
|
||||
fParticleChange->UpdateStepForPostStep(fStep);
|
||||
#ifdef G4VERBOSE
|
||||
// !!!!! Verbose
|
||||
if(verboseLevel>0) fVerbose->PostStepDoItOneByOne();
|
||||
#endif
|
||||
// Update G4Track according to ParticleChange after each PostStepDoIt
|
||||
fStep->UpdateTrack();
|
||||
|
||||
// Update safety after each invocation of PostStepDoIts
|
||||
fStep->GetPostStepPoint()->SetSafety( CalculateSafety() );
|
||||
|
||||
// Now Store the secondaries from ParticleChange to SecondaryList
|
||||
G4Track* tempSecondaryTrack;
|
||||
G4bool tApplyCutFlag;
|
||||
G4double tProdThreshold;
|
||||
G4Material* tMaterial;
|
||||
G4double tBelowCutEnergyAndSafety;
|
||||
|
||||
fN2ndariesPostStepDoIt = fParticleChange->GetNumberOfSecondaries();
|
||||
|
||||
for(G4int DSecLoop=0 ; DSecLoop< fN2ndariesPostStepDoIt; DSecLoop++){
|
||||
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
|
||||
tApplyCutFlag = tempSecondaryTrack->GetDefinition()
|
||||
->GetApplyCutsFlag();
|
||||
|
||||
// Check if the particle should be passed without coherent cut
|
||||
if(tApplyCutFlag){
|
||||
tBelowCutEnergyAndSafety = false;
|
||||
tMaterial = fPostStepPoint->GetMaterial();
|
||||
tProdThreshold = tempSecondaryTrack->GetDefinition()
|
||||
-> GetEnergyThreshold(tMaterial);
|
||||
|
||||
if( tempSecondaryTrack->GetKineticEnergy()<tProdThreshold ){
|
||||
G4double currentRange
|
||||
= G4EnergyLossTables::GetRange(
|
||||
tempSecondaryTrack->GetDefinition(),
|
||||
tempSecondaryTrack->GetKineticEnergy(),
|
||||
tMaterial
|
||||
);
|
||||
if (currentRange < CalculateSafety() ){
|
||||
tBelowCutEnergyAndSafety = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( tBelowCutEnergyAndSafety ){
|
||||
if( !(tempSecondaryTrack->IsGoodForTracking()) ){
|
||||
|
||||
//// G4cout << "!! Warning - G4SteppingManager:" << G4endl;
|
||||
//// << " This physics process generated a secondary"
|
||||
//// << " of which energy is below cut but"
|
||||
//// << " GoodForTracking is off !!!!!" << G4endl;
|
||||
|
||||
// Add kinetic energy to the total energy deposit
|
||||
fStep->AddTotalEnergyDeposit(
|
||||
tempSecondaryTrack->GetKineticEnergy() );
|
||||
tempSecondaryTrack->SetKineticEnergy(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this 2ndry particle has 'zero' kinetic energy, make sure
|
||||
// it invokes a rest process at the beginning of the tracking
|
||||
if(tempSecondaryTrack->GetKineticEnergy() <= 0.){
|
||||
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
|
||||
}
|
||||
|
||||
// Set parentID
|
||||
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
|
||||
|
||||
// Set the process pointer which created this track
|
||||
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
|
||||
|
||||
fSecondary->push_back( tempSecondaryTrack );
|
||||
}
|
||||
|
||||
// Set the track status according to what the process defined
|
||||
fTrack->SetTrackStatus( fParticleChange->GetStatusChange() );
|
||||
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
}
|
||||
} //if(*fSelectedPostStepDoItVector(np) != 0){
|
||||
|
||||
// Exit from PostStepLoop if the track has been killed
|
||||
if(fTrack->GetTrackStatus() == fStopAndKill) break;
|
||||
|
||||
} //for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4SteppingVerbose.cc,v 1.6 1999/12/15 14:53:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4SteppingVerbose.cc,v 1.7 2001/02/08 07:39:52 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -70,15 +70,15 @@ void G4SteppingVerbose::AtRestDoItInvoked()
|
||||
G4cout << " **List of AtRestDoIt invoked:" << G4endl;
|
||||
for(size_t np=0; np < MAXofAtRestLoops; np++){
|
||||
size_t npGPIL = MAXofAtRestLoops-np-1;
|
||||
if( (*fSelectedAtRestDoItVector)(npGPIL) == 2 ){
|
||||
if( (*fSelectedAtRestDoItVector)[npGPIL] == 2 ){
|
||||
npt++;
|
||||
ptProcManager = (*fAtRestDoItVector)(np);
|
||||
ptProcManager = (*fAtRestDoItVector)[np];
|
||||
G4cout << " # " << npt << " : "
|
||||
<< ptProcManager->GetProcessName()
|
||||
<< " (Forced)" << G4endl;
|
||||
} else if ( (*fSelectedAtRestDoItVector)(npGPIL) == 1 ){
|
||||
} else if ( (*fSelectedAtRestDoItVector)[npGPIL] == 1 ){
|
||||
npt++;
|
||||
ptProcManager = (*fAtRestDoItVector)(np);
|
||||
ptProcManager = (*fAtRestDoItVector)[np];
|
||||
G4cout << " # " << npt << " : "
|
||||
<< ptProcManager->GetProcessName() << G4endl;
|
||||
}
|
||||
@@ -89,8 +89,8 @@ void G4SteppingVerbose::AtRestDoItInvoked()
|
||||
if( fN2ndariesAtRestDoIt > 0 ){
|
||||
G4cout << " -- List of secondaries generated : "
|
||||
<< "(x,y,z,kE,t,PID) --" << G4endl;
|
||||
for( G4int lp1=(*fSecondary).entries()-fN2ndariesAtRestDoIt;
|
||||
lp1<(*fSecondary).entries(); lp1++){
|
||||
for( G4int lp1=(*fSecondary).size()-fN2ndariesAtRestDoIt;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< G4std::setw( 9)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") << " "
|
||||
@@ -141,10 +141,10 @@ void G4SteppingVerbose::AlongStepDoItAllDone()
|
||||
G4cout << " ++List of secondaries generated "
|
||||
<< "(x,y,z,kE,t,PID):"
|
||||
<< " No. of secodaries = "
|
||||
<< (*fSecondary).entries() << G4endl;
|
||||
<< (*fSecondary).size() << G4endl;
|
||||
|
||||
if((*fSecondary).entries()>0){
|
||||
for(G4int lp1=0; lp1<(*fSecondary).entries(); lp1++){
|
||||
if((*fSecondary).size()>0){
|
||||
for(G4int lp1=0; lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< G4std::setw( 9)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") << " "
|
||||
@@ -182,15 +182,15 @@ void G4SteppingVerbose::PostStepDoItAllDone()
|
||||
|
||||
for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
size_t npGPIL = MAXofPostStepLoops-np-1;
|
||||
if((*fSelectedPostStepDoItVector)(npGPIL) == 2){
|
||||
if( (*fSelectedPostStepDoItVector)[npGPIL] == 2){
|
||||
npt++;
|
||||
ptProcManager = (*fPostStepDoItVector)(np);
|
||||
ptProcManager = (*fPostStepDoItVector)[np];
|
||||
G4cout << " " << npt << ") "
|
||||
<< ptProcManager->GetProcessName()
|
||||
<< " (Forced)" << G4endl;
|
||||
} else if ((*fSelectedPostStepDoItVector)(npGPIL) == 1){
|
||||
} else if ( (*fSelectedPostStepDoItVector)[npGPIL] == 1){
|
||||
npt++;
|
||||
ptProcManager = (*fPostStepDoItVector)(np);
|
||||
ptProcManager = (*fPostStepDoItVector)[np];
|
||||
G4cout << " " << npt << ") "
|
||||
<< ptProcManager->GetProcessName() << G4endl;
|
||||
}
|
||||
@@ -201,12 +201,12 @@ void G4SteppingVerbose::PostStepDoItAllDone()
|
||||
G4cout << " ++List of secondaries generated "
|
||||
<< "(x,y,z,kE,t,PID):"
|
||||
<< " No. of secodaries = "
|
||||
<< (*fSecondary).entries() << G4endl;
|
||||
<< (*fSecondary).size() << G4endl;
|
||||
G4cout << " [Note]Secondaries from AlongStepDoIt included."
|
||||
<< G4endl;
|
||||
|
||||
if((*fSecondary).entries()>0){
|
||||
for(G4int lp1=0; lp1<(*fSecondary).entries(); lp1++){
|
||||
if((*fSecondary).size()>0){
|
||||
for(G4int lp1=0; lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< G4std::setw( 9)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length") << " "
|
||||
@@ -300,12 +300,12 @@ void G4SteppingVerbose::StepInfo()
|
||||
<< ",Along=" << G4std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << G4std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).entries()
|
||||
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(G4int lp1=(*fSecondary).entries()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).entries(); lp1++){
|
||||
for(G4int lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< G4std::setw( 9)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
|
||||
@@ -486,8 +486,8 @@ void G4SteppingVerbose::AlongStepDoItOneByOne()
|
||||
<< fN2ndariesAlongStepDoIt << G4endl;
|
||||
|
||||
if(fN2ndariesAlongStepDoIt>0){
|
||||
for(G4int lp1=(*fSecondary).entries()-fN2ndariesAlongStepDoIt;
|
||||
lp1<(*fSecondary).entries(); lp1++){
|
||||
for(G4int lp1=(*fSecondary).size()-fN2ndariesAlongStepDoIt;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< G4std::setw( 9)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
|
||||
@@ -532,8 +532,8 @@ void G4SteppingVerbose::PostStepDoItOneByOne()
|
||||
<< fN2ndariesPostStepDoIt << G4endl;
|
||||
|
||||
if(fN2ndariesPostStepDoIt>0){
|
||||
for(G4int lp1=(*fSecondary).entries()-fN2ndariesPostStepDoIt;
|
||||
lp1<(*fSecondary).entries(); lp1++){
|
||||
for(G4int lp1=(*fSecondary).size()-fN2ndariesPostStepDoIt;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< G4std::setw( 9)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TrackingManager.cc,v 1.5 1999/12/15 14:53:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4TrackingManager.cc,v 1.7 2001/02/09 01:35:06 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -55,8 +55,15 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
fpTrack = apValueG4Track;
|
||||
|
||||
// Clear 2ndary particle vector
|
||||
GimmeSecondaries()->clearAndDestroy();
|
||||
|
||||
// GimmeSecondaries()->clearAndDestroy();
|
||||
// G4std::vector<G4Track*>::iterator itr;
|
||||
G4int itr;
|
||||
// for(itr=GimmeSecondaries()->begin();itr=GimmeSecondaries()->end();itr++){
|
||||
for(itr=0;itr<GimmeSecondaries()->size();itr++){
|
||||
delete (*GimmeSecondaries())[itr];
|
||||
}
|
||||
GimmeSecondaries()->clear();
|
||||
|
||||
// Pre tracking user intervention process.
|
||||
fpTrajectory = NULL;
|
||||
if( fpUserTrackingAction != NULL ) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TrackingMessenger.cc,v 1.6 2000/01/23 09:51:36 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4TrackingMessenger.cc,v 1.7 2001/02/08 07:39:53 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Trajectory.cc,v 1.8 2000/01/26 04:20:34 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4Trajectory.cc,v 1.11 2001/02/09 01:38:14 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -57,8 +57,9 @@ G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
positionRecord = new G4RWTPtrOrderedVector<G4VTrajectoryPoint>;
|
||||
positionRecord->insert(new G4TrajectoryPoint(aTrack->GetPosition()));
|
||||
// positionRecord = new G4RWTPtrOrderedVector<G4VTrajectoryPoint>;
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
positionRecord->push_back(new G4TrajectoryPoint(aTrack->GetPosition()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
@@ -70,11 +71,14 @@ G4Trajectory::G4Trajectory(G4Trajectory & right)
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
positionRecord = new G4RWTPtrOrderedVector<G4VTrajectoryPoint>;
|
||||
for(int i=0;i<right.positionRecord->entries();i++)
|
||||
// positionRecord = new G4RWTPtrOrderedVector<G4VTrajectoryPoint>;
|
||||
// G4std::vector<G4VTrajectoryPoint*> *positionRecord;
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
|
||||
for(int i=0;i<right.positionRecord->size();i++)
|
||||
{
|
||||
G4TrajectoryPoint* rightPoint = (G4TrajectoryPoint*)((*(right.positionRecord))[i]);
|
||||
positionRecord->insert(new G4TrajectoryPoint(*rightPoint));
|
||||
positionRecord->push_back(new G4TrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +87,13 @@ G4Trajectory::G4Trajectory(G4Trajectory & right)
|
||||
G4Trajectory::~G4Trajectory()
|
||||
/////////////////////////////
|
||||
{
|
||||
positionRecord->clearAndDestroy();
|
||||
// positionRecord->clearAndDestroy();
|
||||
G4int i;
|
||||
for(i=0;i<positionRecord->size();i++){
|
||||
delete (*positionRecord)[i];
|
||||
}
|
||||
positionRecord->clear();
|
||||
|
||||
delete positionRecord;
|
||||
}
|
||||
|
||||
@@ -95,10 +105,10 @@ void G4Trajectory::ShowTrajectory() const
|
||||
<< ":ParentID=" << fParentID << G4endl;
|
||||
G4cout << "Particle name : " << ParticleName
|
||||
<< " Charge : " << PDGCharge << G4endl;
|
||||
G4cout << " Current trajectory has " << positionRecord->entries()
|
||||
G4cout << " Current trajectory has " << positionRecord->size()
|
||||
<< " points." << G4endl;
|
||||
|
||||
for( size_t i=0 ; i < positionRecord->entries() ; i++){
|
||||
for( size_t i=0 ; i < positionRecord->size() ; i++){
|
||||
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[i]);
|
||||
G4cout << "Point[" << i << "]"
|
||||
<< " Position= " << aTrajectoryPoint->GetPosition() << G4endl;
|
||||
@@ -116,7 +126,7 @@ void G4Trajectory::DrawTrajectory(G4int i_mode) const
|
||||
if(i_mode>=0)
|
||||
{
|
||||
G4Polyline pPolyline;
|
||||
for (int i = 0; i < positionRecord->entries() ; i++) {
|
||||
for (int i = 0; i < positionRecord->size() ; i++) {
|
||||
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[i]);
|
||||
pos = aTrajectoryPoint->GetPosition();
|
||||
pPolyline.append( pos );
|
||||
@@ -137,7 +147,7 @@ void G4Trajectory::DrawTrajectory(G4int i_mode) const
|
||||
|
||||
if(i_mode!=0)
|
||||
{
|
||||
for(int j=0; j<positionRecord->entries(); j++) {
|
||||
for(int j=0; j<positionRecord->size(); j++) {
|
||||
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[j]);
|
||||
pos = aTrajectoryPoint->GetPosition();
|
||||
G4Circle circle( pos );
|
||||
@@ -156,7 +166,7 @@ void G4Trajectory::DrawTrajectory(G4int i_mode) const
|
||||
void G4Trajectory::AppendStep(const G4Step* aStep)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
positionRecord->append( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
|
||||
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
|
||||
GetPosition() ));
|
||||
}
|
||||
|
||||
@@ -175,10 +185,13 @@ void G4Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
|
||||
G4Trajectory* seco = (G4Trajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
for(int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
|
||||
for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
|
||||
{
|
||||
positionRecord->append(seco->positionRecord->removeAt(1));
|
||||
positionRecord->push_back((*(seco->positionRecord))[i]);
|
||||
// positionRecord->push_back(seco->positionRecord->removeAt(1));
|
||||
}
|
||||
delete (*seco->positionRecord)[0];
|
||||
seco->positionRecord->clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TrajectoryPoint.cc,v 1.4 1999/12/15 14:53:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4TrajectoryPoint.cc,v 1.5 2001/02/08 07:39:53 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserSteppingAction.cc,v 1.4 1999/12/15 14:54:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4UserSteppingAction.cc,v 1.5 2001/02/08 07:39:53 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserTrackingAction.cc,v 1.4 1999/12/15 14:54:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4UserTrackingAction.cc,v 1.5 2001/02/08 07:39:53 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VSteppingVerbose.cc,v 1.4 2000/06/14 08:21:00 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4VSteppingVerbose.cc,v 1.5 2001/02/08 07:39:54 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user