Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -16,6 +16,22 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
October 31st, 2021 J. Hahnfeld (event-V10-07-08)
|
||||
- G4EventManager: Make StackTracks public
|
||||
|
||||
October 25th, 2021 B.Morgan (event-V10-07-07)
|
||||
- Use G4StrUtil functions replacing deprecated G4String member functions
|
||||
|
||||
October 21st, 2021 J. Hahnfeld (event-V10-07-06)
|
||||
- G4EventManager: Hand over track to custom tracking manager,
|
||||
if registered for the particle
|
||||
|
||||
October 18th, 2021 B.Morgan (event-V10-07-05)
|
||||
- Use std::string member functions from G4String in place of synonyms
|
||||
|
||||
August 21th, 2021 V.Ivanchenko (event-V10-07-04)
|
||||
- G4SPSEneDistribution - use more optimal access to G4PhysicsVector
|
||||
|
||||
June 7th, 2021 M. Asai (event-V10-07-03)
|
||||
- Fix the default value of /gps/ang/maxphi command. Addressing to
|
||||
the bug report 2383.
|
||||
|
||||
@@ -88,6 +88,10 @@ class G4EventManager
|
||||
// object has valid primary vertices/particles, they will be added to
|
||||
// the given "trackvector" input.
|
||||
|
||||
void StackTracks(G4TrackVector* trackVector, G4bool IDhasAlreadySet= false);
|
||||
// Helper function to stack a vector of tracks for processing in the
|
||||
// current event.
|
||||
|
||||
inline const G4Event* GetConstCurrentEvent()
|
||||
{ return currentEvent; }
|
||||
inline G4Event* GetNonconstCurrentEvent()
|
||||
@@ -156,7 +160,6 @@ class G4EventManager
|
||||
private:
|
||||
|
||||
void DoProcessing(G4Event* anEvent);
|
||||
void StackTracks(G4TrackVector* trackVector, G4bool IDhasAlreadySet= false);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ G4AdjointStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
{
|
||||
G4ClassificationOfNewTrack classification = fUrgent;
|
||||
G4String partType = aTrack->GetParticleDefinition()->GetParticleType();
|
||||
adjoint_mode = partType.contains(G4String("adjoint"));
|
||||
adjoint_mode = G4StrUtil::contains(partType, "adjoint");
|
||||
if (!adjoint_mode )
|
||||
{
|
||||
if (!reclassification_stage)
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "G4ios.hh"
|
||||
#include "G4EvManMessenger.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VTrackingManager.hh"
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "G4UserStackingAction.hh"
|
||||
#include "G4SDManager.hh"
|
||||
@@ -43,6 +45,8 @@
|
||||
#include "G4Profiler.hh"
|
||||
#include "G4TiMemory.hh"
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
G4ThreadLocal G4EventManager* G4EventManager::fpEventManager = nullptr;
|
||||
|
||||
G4EventManager* G4EventManager::GetEventManager()
|
||||
@@ -155,90 +159,128 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
G4cout << "!!!!!!! Now start processing an event !!!!!!!" << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4VTrajectory* previousTrajectory;
|
||||
while( (track=trackContainer->PopNextTrack(&previousTrajectory)) != nullptr )
|
||||
{ // Loop checking 12.28.2015 M.Asai
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 1 )
|
||||
{
|
||||
G4cout << "Track " << track << " (trackID " << track->GetTrackID()
|
||||
<< ", parentID " << track->GetParentID()
|
||||
<< ") is passed to G4TrackingManager." << G4endl;
|
||||
}
|
||||
#endif
|
||||
std::unordered_set<G4VTrackingManager *> trackingManagersToFlush;
|
||||
|
||||
tracking = true;
|
||||
trackManager->ProcessOneTrack( track );
|
||||
istop = track->GetTrackStatus();
|
||||
tracking = false;
|
||||
do
|
||||
{
|
||||
G4VTrajectory* previousTrajectory;
|
||||
while( (track=trackContainer->PopNextTrack(&previousTrajectory)) != nullptr )
|
||||
{ // Loop checking 12.28.2015 M.Asai
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 0 )
|
||||
{
|
||||
G4cout << "Track (trackID " << track->GetTrackID()
|
||||
<< ", parentID " << track->GetParentID()
|
||||
<< ") is processed with stopping code " << istop << G4endl;
|
||||
}
|
||||
#endif
|
||||
const G4ParticleDefinition* partDef = track->GetParticleDefinition();
|
||||
G4VTrackingManager* particleTrackingManager = partDef->GetTrackingManager();
|
||||
|
||||
G4VTrajectory* aTrajectory = nullptr;
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
aTrajectory = trackManager->GimmeTrajectory();
|
||||
|
||||
if(previousTrajectory != nullptr)
|
||||
{
|
||||
previousTrajectory->MergeTrajectory(aTrajectory);
|
||||
delete aTrajectory;
|
||||
aTrajectory = previousTrajectory;
|
||||
}
|
||||
if(aTrajectory&&(istop!=fStopButAlive)&&(istop!=fSuspend))
|
||||
{
|
||||
if(trajectoryContainer == nullptr)
|
||||
if (particleTrackingManager != nullptr)
|
||||
{
|
||||
trajectoryContainer = new G4TrajectoryContainer;
|
||||
currentEvent->SetTrajectoryContainer(trajectoryContainer);
|
||||
}
|
||||
trajectoryContainer->insert(aTrajectory);
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 1 )
|
||||
{
|
||||
G4cout << "Track " << track << " (trackID " << track->GetTrackID()
|
||||
<< ", parentID " << track->GetParentID()
|
||||
<< ") is handed over to custom TrackingManager." << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4TrackVector* secondaries = trackManager->GimmeSecondaries();
|
||||
switch (istop)
|
||||
{
|
||||
case fStopButAlive:
|
||||
case fSuspend:
|
||||
trackContainer->PushOneTrack( track, aTrajectory );
|
||||
StackTracks( secondaries );
|
||||
break;
|
||||
particleTrackingManager->HandOverOneTrack(track);
|
||||
// The particle's tracking manager may either track immediately or
|
||||
// defer processing until FlushEvent is called. Thus, we must neither
|
||||
// check the track's status nor stack secondaries.
|
||||
|
||||
case fPostponeToNextEvent:
|
||||
trackContainer->PushOneTrack( track );
|
||||
StackTracks( secondaries );
|
||||
break;
|
||||
// Remember this tracking manager to later call FlushEvent.
|
||||
trackingManagersToFlush.insert(particleTrackingManager);
|
||||
|
||||
case fStopAndKill:
|
||||
StackTracks( secondaries );
|
||||
delete track;
|
||||
break;
|
||||
|
||||
case fAlive:
|
||||
G4Exception("G4EventManager::DoProcessing", "Event004", JustWarning,
|
||||
"Illegal trackstatus returned from G4TrackingManager."\
|
||||
" Continue with simulation.");
|
||||
break;
|
||||
case fKillTrackAndSecondaries:
|
||||
if( secondaries )
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 1 )
|
||||
{
|
||||
for(std::size_t i=0; i<secondaries->size(); ++i)
|
||||
{ delete (*secondaries)[i]; }
|
||||
secondaries->clear();
|
||||
G4cout << "Track " << track << " (trackID " << track->GetTrackID()
|
||||
<< ", parentID " << track->GetParentID()
|
||||
<< ") is passed to G4TrackingManager." << G4endl;
|
||||
}
|
||||
delete track;
|
||||
break;
|
||||
#endif
|
||||
|
||||
tracking = true;
|
||||
trackManager->ProcessOneTrack( track );
|
||||
istop = track->GetTrackStatus();
|
||||
tracking = false;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 0 )
|
||||
{
|
||||
G4cout << "Track (trackID " << track->GetTrackID()
|
||||
<< ", parentID " << track->GetParentID()
|
||||
<< ") is processed with stopping code " << istop << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4VTrajectory* aTrajectory = nullptr;
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
aTrajectory = trackManager->GimmeTrajectory();
|
||||
|
||||
if(previousTrajectory != nullptr)
|
||||
{
|
||||
previousTrajectory->MergeTrajectory(aTrajectory);
|
||||
delete aTrajectory;
|
||||
aTrajectory = previousTrajectory;
|
||||
}
|
||||
if(aTrajectory&&(istop!=fStopButAlive)&&(istop!=fSuspend))
|
||||
{
|
||||
if(trajectoryContainer == nullptr)
|
||||
{
|
||||
trajectoryContainer = new G4TrajectoryContainer;
|
||||
currentEvent->SetTrajectoryContainer(trajectoryContainer);
|
||||
}
|
||||
trajectoryContainer->insert(aTrajectory);
|
||||
}
|
||||
#endif
|
||||
|
||||
G4TrackVector* secondaries = trackManager->GimmeSecondaries();
|
||||
switch (istop)
|
||||
{
|
||||
case fStopButAlive:
|
||||
case fSuspend:
|
||||
trackContainer->PushOneTrack( track, aTrajectory );
|
||||
StackTracks( secondaries );
|
||||
break;
|
||||
|
||||
case fPostponeToNextEvent:
|
||||
trackContainer->PushOneTrack( track );
|
||||
StackTracks( secondaries );
|
||||
break;
|
||||
|
||||
case fStopAndKill:
|
||||
StackTracks( secondaries );
|
||||
delete track;
|
||||
break;
|
||||
|
||||
case fAlive:
|
||||
G4Exception("G4EventManager::DoProcessing", "Event004", JustWarning,
|
||||
"Illegal trackstatus returned from G4TrackingManager."\
|
||||
" Continue with simulation.");
|
||||
break;
|
||||
case fKillTrackAndSecondaries:
|
||||
if( secondaries )
|
||||
{
|
||||
for(std::size_t i=0; i<secondaries->size(); ++i)
|
||||
{ delete (*secondaries)[i]; }
|
||||
secondaries->clear();
|
||||
}
|
||||
delete track;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flush all tracking managers, which may have deferred processing until now.
|
||||
for (G4VTrackingManager *tm : trackingManagersToFlush)
|
||||
{
|
||||
tm->FlushEvent();
|
||||
}
|
||||
trackingManagersToFlush.clear();
|
||||
|
||||
// Check if flushing one of the tracking managers stacked new secondaries.
|
||||
} while (trackContainer->GetNUrgentTrack() > 0);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 0 )
|
||||
@@ -352,7 +394,8 @@ void G4EventManager::ProcessOneEvent(G4TrackVector* trackVector,
|
||||
{
|
||||
std::ostringstream oss;
|
||||
CLHEP::HepRandom::saveFullState(oss);
|
||||
anEvent->SetRandomNumberStatus(*randStat=oss.str());
|
||||
(*randStat) = oss.str();
|
||||
anEvent->SetRandomNumberStatus(*randStat);
|
||||
}
|
||||
StackTracks(trackVector,false);
|
||||
DoProcessing(anEvent);
|
||||
|
||||
@@ -1514,7 +1514,7 @@ void G4GeneralParticleSourceMessenger::IonCommand(G4String newValues)
|
||||
fAtomicNumber = StoI(next());
|
||||
fAtomicMass = StoI(next());
|
||||
G4String sQ = next();
|
||||
if (sQ.isNull())
|
||||
if (sQ.empty())
|
||||
{
|
||||
fIonCharge = fAtomicNumber;
|
||||
}
|
||||
@@ -1522,7 +1522,7 @@ void G4GeneralParticleSourceMessenger::IonCommand(G4String newValues)
|
||||
{
|
||||
fIonCharge = StoI(sQ);
|
||||
sQ = next();
|
||||
if (sQ.isNull())
|
||||
if (sQ.empty())
|
||||
{
|
||||
fIonExciteEnergy = 0.0;
|
||||
}
|
||||
@@ -1563,7 +1563,7 @@ void G4GeneralParticleSourceMessenger::IonLvlCommand(G4String newValues)
|
||||
fAtomicNumberL = StoI(next());
|
||||
fAtomicMassL = StoI(next());
|
||||
G4String sQ = next();
|
||||
if (sQ.isNull())
|
||||
if (sQ.empty())
|
||||
{
|
||||
fIonChargeL = fAtomicNumberL;
|
||||
}
|
||||
@@ -1571,7 +1571,7 @@ void G4GeneralParticleSourceMessenger::IonLvlCommand(G4String newValues)
|
||||
{
|
||||
fIonChargeL = StoI(sQ);
|
||||
sQ = next();
|
||||
if (sQ.isNull())
|
||||
if (sQ.empty())
|
||||
{
|
||||
fIonEnergyLevel = 0;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void G4ParticleGunMessenger::IonLevelCommand(const G4String& newValues)
|
||||
fAtomicNumber = StoI(next());
|
||||
fAtomicMass = StoI(next());
|
||||
G4String sQ = next();
|
||||
if (sQ.isNull() || StoI(sQ)<0)
|
||||
if (sQ.empty() || StoI(sQ)<0)
|
||||
{
|
||||
fIonCharge = fAtomicNumber;
|
||||
}
|
||||
@@ -353,7 +353,7 @@ void G4ParticleGunMessenger::IonLevelCommand(const G4String& newValues)
|
||||
fIonCharge = StoI(sQ);
|
||||
}
|
||||
sQ = next();
|
||||
if (sQ.isNull())
|
||||
if (sQ.empty())
|
||||
{
|
||||
fIonEnergyLevel = 0;
|
||||
}
|
||||
@@ -389,18 +389,18 @@ void G4ParticleGunMessenger::IonCommand(const G4String& newValues)
|
||||
fIonExciteEnergy = 0.0;
|
||||
fIonFloatingLevelBase = '\0';
|
||||
G4String sQ = next();
|
||||
if (!(sQ.isNull()))
|
||||
if (!(sQ.empty()))
|
||||
{
|
||||
if (StoI(sQ)>=0)
|
||||
fIonCharge = StoI(sQ);
|
||||
|
||||
sQ = next();
|
||||
if (!(sQ.isNull()))
|
||||
if (!(sQ.empty()))
|
||||
{
|
||||
fIonExciteEnergy = StoD(sQ) * keV;
|
||||
|
||||
sQ = next();
|
||||
if (sQ.isNull()||sQ=="noFloat")
|
||||
if (sQ.empty()||sQ=="noFloat")
|
||||
{ fIonFloatingLevelBase = '\0'; }
|
||||
else
|
||||
{ fIonFloatingLevelBase = sQ[(std::size_t)0]; }
|
||||
|
||||
@@ -563,8 +563,8 @@ void G4SPSEneDistribution::ArbInterpolate(const G4String& IType)
|
||||
G4AutoLock l(&mutex);
|
||||
|
||||
IntType = IType;
|
||||
ArbEmax = ArbEnergyH.GetMaxLowEdgeEnergy();
|
||||
ArbEmin = ArbEnergyH.GetMinLowEdgeEnergy();
|
||||
ArbEmax = ArbEnergyH.GetMaxEnergy();
|
||||
ArbEmin = ArbEnergyH.Energy(0);
|
||||
|
||||
// Now interpolate points
|
||||
|
||||
|
||||
Reference in New Issue
Block a user