Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -54,7 +54,7 @@ G4AdjointTrackingAction::~G4AdjointTrackingAction()
|
||||
void G4AdjointTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
G4String partType = aTrack->GetParticleDefinition()->GetParticleType();
|
||||
if (partType.contains(G4String("adjoint")))
|
||||
if (G4StrUtil::contains(partType, "adjoint"))
|
||||
{
|
||||
is_adjoint_tracking_mode = true;
|
||||
theAdjointSteppingAction->SetPrimWeight(aTrack->GetWeight());
|
||||
@@ -94,7 +94,7 @@ void G4AdjointTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
|
||||
last_cos_th = last_direction.z();
|
||||
G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
|
||||
last_fwd_part_name= aPartDef->GetParticleName();
|
||||
last_fwd_part_name.remove(0,4);
|
||||
last_fwd_part_name.erase(0,4);
|
||||
last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()
|
||||
->FindParticle(last_fwd_part_name)->GetPDGEncoding();
|
||||
last_ekin = theAdjointSteppingAction->GetLastEkin();
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4PhysicsModelCatalog.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
@@ -284,7 +285,7 @@ std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
|
||||
values->push_back
|
||||
(G4AttValue("CMID",G4UIcommand::ConvertToString(fCreatorModelID),""));
|
||||
const G4String& creatorModelName =
|
||||
G4PhysicsModelCatalog::GetModelName(fCreatorModelID);
|
||||
G4PhysicsModelCatalog::GetModelNameFromID(fCreatorModelID);
|
||||
values->push_back(G4AttValue("CMN",creatorModelName,""));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -93,6 +93,8 @@ G4SteppingManager::G4SteppingManager()
|
||||
physIntLength = DBL_MAX;
|
||||
kCarTolerance = 0.5*G4GeometryTolerance::GetInstance()
|
||||
->GetSurfaceTolerance();
|
||||
|
||||
fNoProcess = new G4NoProcess;
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
|
||||
@@ -210,6 +210,7 @@ void G4SteppingManager::DefinePhysicalStepLength()
|
||||
//
|
||||
proposedSafety = DBL_MAX;
|
||||
G4double safetyProposedToAndByProcess = proposedSafety;
|
||||
G4bool delegateToTransportation = false;
|
||||
|
||||
for(std::size_t kp=0; kp<MAXofAlongStepLoops; ++kp)
|
||||
{
|
||||
@@ -237,10 +238,19 @@ void G4SteppingManager::DefinePhysicalStepLength()
|
||||
fStepStatus = fAlongStepDoItProc;
|
||||
fStep->GetPostStepPoint()->SetProcessDefinedStep(fCurrentProcess);
|
||||
}
|
||||
else if(fCurrentProcess->GetProcessType()==fParallel)
|
||||
{ // a parallel world is proposing the shortest but expecting Transportation
|
||||
// to win.
|
||||
delegateToTransportation = true;
|
||||
}
|
||||
|
||||
// Transportation is assumed to be the last process in the vector
|
||||
//
|
||||
if(kp == MAXofAlongStepLoops-1) { fStepStatus = fGeomBoundary; }
|
||||
// Transportation is winning
|
||||
if(kp == MAXofAlongStepLoops-1)
|
||||
{
|
||||
fStepStatus = fGeomBoundary;
|
||||
delegateToTransportation = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure to check the safety, even if Step is not limited
|
||||
@@ -259,6 +269,11 @@ void G4SteppingManager::DefinePhysicalStepLength()
|
||||
safetyProposedToAndByProcess = proposedSafety;
|
||||
}
|
||||
}
|
||||
if(delegateToTransportation)
|
||||
{
|
||||
fStepStatus = fGeomBoundary;
|
||||
fStep->GetPostStepPoint()->SetProcessDefinedStep(fCurrentProcess);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
@@ -315,102 +330,115 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
fStep->SetStepLength( 0. ); // the particle has stopped
|
||||
fTrack->SetStepLength( 0. );
|
||||
|
||||
// invoke selected process
|
||||
//
|
||||
for(std::size_t np=0; np<MAXofAtRestLoops; ++np)
|
||||
|
||||
// Condition to avoid that stable ions are handled by Radioactive Decay.
|
||||
// We use a very large time threshold (many orders of magnitude bigger than
|
||||
// the universe's age) but not DBL_MAX because shortestLifeTime can be
|
||||
// sometimes slightly smaller for stable ions.
|
||||
if(shortestLifeTime < 1.0e+100) // Unstable ion at rest: Radioactive Decay will decay it
|
||||
{
|
||||
// invoke selected process
|
||||
//
|
||||
// Note: DoItVector has inverse order against GetPhysIntVector
|
||||
// and SelectedAtRestDoItVector.
|
||||
//
|
||||
if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] != InActivated)
|
||||
for(std::size_t np=0; np<MAXofAtRestLoops; ++np)
|
||||
{
|
||||
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
|
||||
// Note: DoItVector has inverse order against GetPhysIntVector
|
||||
// and SelectedAtRestDoItVector.
|
||||
//
|
||||
fParticleChange->UpdateStepForAtRest(fStep);
|
||||
|
||||
// Now Store the secondaries from ParticleChange to SecondaryList
|
||||
|
||||
G4Track* tempSecondaryTrack;
|
||||
G4int num2ndaries;
|
||||
|
||||
num2ndaries = fParticleChange->GetNumberOfSecondaries();
|
||||
|
||||
for(G4int DSecLoop=0; DSecLoop< num2ndaries; ++DSecLoop)
|
||||
if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] != InActivated)
|
||||
{
|
||||
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
|
||||
|
||||
if(tempSecondaryTrack->GetDefinition()->GetApplyCutsFlag())
|
||||
{
|
||||
ApplyProductionCut(tempSecondaryTrack);
|
||||
}
|
||||
|
||||
// Set parentID
|
||||
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
|
||||
|
||||
// Set the process pointer which created this track
|
||||
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
|
||||
|
||||
// If this 2ndry particle has 'zero' kinetic energy, make sure
|
||||
// it invokes a rest process at the beginning of the tracking
|
||||
fCurrentProcess = (*fAtRestDoItVector)[np];
|
||||
fParticleChange = fCurrentProcess->AtRestDoIt(*fTrack, *fStep);
|
||||
|
||||
// Set the current process as a process which defined this Step length
|
||||
//
|
||||
if(tempSecondaryTrack->GetKineticEnergy() <= DBL_MIN)
|
||||
fStep->GetPostStepPoint()->SetProcessDefinedStep(fCurrentProcess);
|
||||
|
||||
// Update Step
|
||||
//
|
||||
fParticleChange->UpdateStepForAtRest(fStep);
|
||||
|
||||
// Now Store the secondaries from ParticleChange to SecondaryList
|
||||
|
||||
G4Track* tempSecondaryTrack;
|
||||
G4int num2ndaries;
|
||||
|
||||
num2ndaries = fParticleChange->GetNumberOfSecondaries();
|
||||
|
||||
for(G4int DSecLoop=0; DSecLoop< num2ndaries; ++DSecLoop)
|
||||
{
|
||||
G4ProcessManager* pm = tempSecondaryTrack->GetDefinition()
|
||||
->GetProcessManager();
|
||||
if(pm == nullptr)
|
||||
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
|
||||
|
||||
if(tempSecondaryTrack->GetDefinition()->GetApplyCutsFlag())
|
||||
{
|
||||
G4ExceptionDescription ED;
|
||||
ED << "A track without proper process manager is pushed\n"
|
||||
<< "into the track stack.\n"
|
||||
<< " Particle name : "
|
||||
<< tempSecondaryTrack->GetDefinition()->GetParticleName()
|
||||
<< " -- ";
|
||||
if(tempSecondaryTrack->GetParentID()<0)
|
||||
ApplyProductionCut(tempSecondaryTrack);
|
||||
}
|
||||
|
||||
// Set parentID
|
||||
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
|
||||
|
||||
// Set the process pointer which created this track
|
||||
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
|
||||
|
||||
// If this 2ndry particle has 'zero' kinetic energy, make sure
|
||||
// it invokes a rest process at the beginning of the tracking
|
||||
//
|
||||
if(tempSecondaryTrack->GetKineticEnergy() <= DBL_MIN)
|
||||
{
|
||||
G4ProcessManager* pm = tempSecondaryTrack->GetDefinition()
|
||||
->GetProcessManager();
|
||||
if(pm == nullptr)
|
||||
{
|
||||
ED << "created by a primary particle generator.";
|
||||
G4ExceptionDescription ED;
|
||||
ED << "A track without proper process manager is pushed\n"
|
||||
<< "into the track stack.\n"
|
||||
<< " Particle name : "
|
||||
<< tempSecondaryTrack->GetDefinition()->GetParticleName()
|
||||
<< " -- ";
|
||||
if(tempSecondaryTrack->GetParentID()<0)
|
||||
{
|
||||
ED << "created by a primary particle generator.";
|
||||
}
|
||||
else
|
||||
{
|
||||
const G4VProcess* vp = tempSecondaryTrack->GetCreatorProcess();
|
||||
if(vp != nullptr)
|
||||
{ ED << "created by " << vp->GetProcessName() << "."; }
|
||||
else
|
||||
{ ED << "creaded by unknown process."; }
|
||||
}
|
||||
G4Exception("G4SteppingManager::InvokeAtRestDoItProcs()",
|
||||
"Tracking10051", FatalException, ED);
|
||||
}
|
||||
if (pm->GetAtRestProcessVector()->entries()>0)
|
||||
{
|
||||
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
|
||||
fSecondary->push_back( tempSecondaryTrack );
|
||||
++fN2ndariesAtRestDoIt;
|
||||
}
|
||||
else
|
||||
{
|
||||
const G4VProcess* vp = tempSecondaryTrack->GetCreatorProcess();
|
||||
if(vp != nullptr)
|
||||
{ ED << "created by " << vp->GetProcessName() << "."; }
|
||||
else
|
||||
{ ED << "creaded by unknown process."; }
|
||||
delete tempSecondaryTrack;
|
||||
}
|
||||
G4Exception("G4SteppingManager::InvokeAtRestDoItProcs()",
|
||||
"Tracking10051", FatalException, ED);
|
||||
}
|
||||
if (pm->GetAtRestProcessVector()->entries()>0)
|
||||
{
|
||||
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
|
||||
fSecondary->push_back( tempSecondaryTrack );
|
||||
++fN2ndariesAtRestDoIt;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete tempSecondaryTrack;
|
||||
fSecondary->push_back( tempSecondaryTrack );
|
||||
++fN2ndariesAtRestDoIt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fSecondary->push_back( tempSecondaryTrack );
|
||||
++fN2ndariesAtRestDoIt;
|
||||
}
|
||||
} //end of loop on secondary
|
||||
} //end of loop on secondary
|
||||
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
|
||||
} // if(fSelectedAtRestDoItVector[np] != InActivated){
|
||||
} // for(std::size_t np=0; np<MAXofAtRestLoops; ++np){
|
||||
}
|
||||
else // Stable ion at rest
|
||||
{
|
||||
fStep->GetPostStepPoint()->SetProcessDefinedStep( fNoProcess );
|
||||
} // if(shortestLifeTime < 1.0e+100)
|
||||
|
||||
} // if(fSelectedAtRestDoItVector[np] != InActivated){
|
||||
} // for(std::size_t np=0; np<MAXofAtRestLoops; ++np){
|
||||
fStep->UpdateTrack();
|
||||
|
||||
fTrack->SetTrackStatus( fStopAndKill );
|
||||
|
||||
@@ -84,7 +84,7 @@ void G4SteppingVerbose::AtRestDoItInvoked()
|
||||
for(std::size_t np=0; np<MAXofAtRestLoops; ++np)
|
||||
{
|
||||
std::size_t npGPIL = MAXofAtRestLoops-np-1;
|
||||
if( (*fSelectedAtRestDoItVector)[npGPIL] == 2 )
|
||||
if( (*fSelectedAtRestDoItVector)[npGPIL] == G4ForceCondition::Forced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fAtRestDoItVector)[np];
|
||||
@@ -92,7 +92,7 @@ void G4SteppingVerbose::AtRestDoItInvoked()
|
||||
<< ptProcManager->GetProcessName()
|
||||
<< " (Forced)" << G4endl;
|
||||
}
|
||||
else if ( (*fSelectedAtRestDoItVector)[npGPIL] == 1 )
|
||||
else if ( (*fSelectedAtRestDoItVector)[npGPIL] == G4ForceCondition::NotForced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fAtRestDoItVector)[np];
|
||||
@@ -217,7 +217,7 @@ void G4SteppingVerbose::PostStepDoItAllDone()
|
||||
for(std::size_t np=0; np<MAXofPostStepLoops; ++np)
|
||||
{
|
||||
std::size_t npGPIL = MAXofPostStepLoops-np-1;
|
||||
if( (*fSelectedPostStepDoItVector)[npGPIL] == 2)
|
||||
if( (*fSelectedPostStepDoItVector)[npGPIL] == G4ForceCondition::Forced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fPostStepDoItVector)[np];
|
||||
@@ -225,7 +225,7 @@ void G4SteppingVerbose::PostStepDoItAllDone()
|
||||
<< ptProcManager->GetProcessName()
|
||||
<< " (Forced)" << G4endl;
|
||||
}
|
||||
else if ( (*fSelectedPostStepDoItVector)[npGPIL] == 1)
|
||||
else if ( (*fSelectedPostStepDoItVector)[npGPIL] == G4ForceCondition::NotForced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fPostStepDoItVector)[np];
|
||||
|
||||
@@ -190,7 +190,7 @@ void G4SteppingVerboseWithUnits::AtRestDoItInvoked()
|
||||
for(std::size_t np=0; np<MAXofAtRestLoops; ++np)
|
||||
{
|
||||
std::size_t npGPIL = MAXofAtRestLoops-np-1;
|
||||
if( (*fSelectedAtRestDoItVector)[npGPIL] == 2 )
|
||||
if( (*fSelectedAtRestDoItVector)[npGPIL] == G4ForceCondition::Forced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fAtRestDoItVector)[np];
|
||||
@@ -198,7 +198,7 @@ void G4SteppingVerboseWithUnits::AtRestDoItInvoked()
|
||||
<< ptProcManager->GetProcessName()
|
||||
<< " (Forced)" << G4endl;
|
||||
}
|
||||
else if ( (*fSelectedAtRestDoItVector)[npGPIL] == 1 )
|
||||
else if ( (*fSelectedAtRestDoItVector)[npGPIL] == G4ForceCondition::NotForced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fAtRestDoItVector)[np];
|
||||
@@ -319,7 +319,7 @@ void G4SteppingVerboseWithUnits::PostStepDoItAllDone()
|
||||
for(std::size_t np=0; np<MAXofPostStepLoops; ++np)
|
||||
{
|
||||
std::size_t npGPIL = MAXofPostStepLoops-np-1;
|
||||
if( (*fSelectedPostStepDoItVector)[npGPIL] == 2)
|
||||
if( (*fSelectedPostStepDoItVector)[npGPIL] == G4ForceCondition::Forced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fPostStepDoItVector)[np];
|
||||
@@ -327,7 +327,7 @@ void G4SteppingVerboseWithUnits::PostStepDoItAllDone()
|
||||
<< ptProcManager->GetProcessName()
|
||||
<< " (Forced)" << G4endl;
|
||||
}
|
||||
else if ( (*fSelectedPostStepDoItVector)[npGPIL] == 1)
|
||||
else if ( (*fSelectedPostStepDoItVector)[npGPIL] == G4ForceCondition::NotForced )
|
||||
{
|
||||
++npt;
|
||||
ptProcManager = (*fPostStepDoItVector)[np];
|
||||
|
||||
@@ -162,5 +162,5 @@ G4String G4TrackingMessenger::GetCurrentValue(G4UIcommand* command)
|
||||
return StoreTrajectoryCmd
|
||||
->ConvertToString(trackingManager->GetStoreTrajectory());
|
||||
}
|
||||
return G4String('\0');
|
||||
return G4String(1,'\0');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user