Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -40,29 +40,26 @@
|
||||
#ifndef G4VUserPhysicsList_hh
|
||||
#define G4VUserPhysicsList_hh 1
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "rundefs.hh"
|
||||
#include "tls.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4VUPLSplitter.hh"
|
||||
|
||||
#include "G4Threading.hh"
|
||||
#include "G4PhysicsModelCatalog.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "G4VUPLSplitter.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include "rundefs.hh"
|
||||
#include "tls.hh"
|
||||
|
||||
class G4UserPhysicsListMessenger;
|
||||
class G4PhysicsListHelper;
|
||||
class G4VProcess;
|
||||
|
||||
// Encapsulate the fields of class G4VUserPhysicsList that are per-thread.
|
||||
class G4VUPLData
|
||||
{
|
||||
// Encapsulate the fields of class G4VUserPhysicsList that are per-thread.
|
||||
|
||||
public:
|
||||
|
||||
void initialize();
|
||||
|
||||
G4ParticleTable::G4PTblDicIterator* _theParticleIterator = nullptr;
|
||||
@@ -106,231 +103,215 @@ using G4VUserPhysicsListSubInstanceManager = G4VUPLManager;
|
||||
class G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
|
||||
G4VUserPhysicsList();
|
||||
virtual ~G4VUserPhysicsList();
|
||||
|
||||
G4VUserPhysicsList(const G4VUserPhysicsList&);
|
||||
G4VUserPhysicsList& operator=(const G4VUserPhysicsList&);
|
||||
// Copy constructor and assignment operator.
|
||||
|
||||
// Each particle type will be instantiated.
|
||||
// This method is invoked by the RunManger.
|
||||
virtual void ConstructParticle() = 0;
|
||||
// Each particle type will be instantiated.
|
||||
// This method is invoked by the RunManger.
|
||||
|
||||
// By calling the "Construct" method,
|
||||
// process manager and processes are created.
|
||||
void Construct();
|
||||
// By calling the "Construct" method,
|
||||
// process manager and processes are created.
|
||||
|
||||
// Each physics process will be instantiated and
|
||||
// registered to the process manager of each particle type.
|
||||
// Invoked in the Construct() method.
|
||||
virtual void ConstructProcess() = 0;
|
||||
// Each physics process will be instantiated and
|
||||
// registered to the process manager of each particle type.
|
||||
// Invoked in the Construct() method.
|
||||
|
||||
// Sets a cut value for all particle types in the particle table.
|
||||
virtual void SetCuts();
|
||||
// Sets a cut value for all particle types in the particle table.
|
||||
|
||||
// Set/get the default cut value. Calling SetDefaultCutValue() causes
|
||||
// re-calcuration of cut values and physics tables just before the
|
||||
// next event loop.
|
||||
void SetDefaultCutValue(G4double newCutValue);
|
||||
G4double GetDefaultCutValue() const;
|
||||
// Set/get the default cut value. Calling SetDefaultCutValue() causes
|
||||
// re-calcuration of cut values and physics tables just before the
|
||||
// next event loop.
|
||||
|
||||
// Invoke BuildPhysicsTable for all processes for all particles.
|
||||
// In case of "Retrieve" flag is ON, PhysicsTable will be
|
||||
// retrieved from files.
|
||||
void BuildPhysicsTable();
|
||||
// Invoke BuildPhysicsTable for all processes for all particles.
|
||||
// In case of "Retrieve" flag is ON, PhysicsTable will be
|
||||
// retrieved from files.
|
||||
|
||||
// Prepare the PhysicsTable for specified particle type.
|
||||
void PreparePhysicsTable(G4ParticleDefinition*);
|
||||
// Prepare the PhysicsTable for specified particle type.
|
||||
|
||||
// Build the PhysicsTable for specified particle type.
|
||||
void BuildPhysicsTable(G4ParticleDefinition*);
|
||||
// Build the PhysicsTable for specified particle type.
|
||||
|
||||
// Store PhysicsTable together with both material and cut value
|
||||
// information in files under the specified directory.
|
||||
// Returns "true" if files are successfully created.
|
||||
G4bool StorePhysicsTable(const G4String& directory = ".");
|
||||
// Store PhysicsTable together with both material and cut value
|
||||
// information in files under the specified directory.
|
||||
// Returns "true" if files are successfully created.
|
||||
|
||||
// Return true if "Retrieve" flag is ON.
|
||||
// (i.e. PhysicsTable will be retrieved from files).
|
||||
G4bool IsPhysicsTableRetrieved() const;
|
||||
G4bool IsStoredInAscii() const;
|
||||
// Return true if "Retrieve" flag is ON.
|
||||
// (i.e. PhysicsTable will be retrieved from files).
|
||||
|
||||
// Get directory path for physics table files.
|
||||
const G4String& GetPhysicsTableDirectory() const;
|
||||
// Get directory path for physics table files.
|
||||
|
||||
// Set "Retrieve" flag. Directory path can be set together.
|
||||
// Null string (default) means directory is not changed
|
||||
// from the current value.
|
||||
void SetPhysicsTableRetrieved(const G4String& directory = "");
|
||||
void SetStoredInAscii();
|
||||
// Set "Retrieve" flag. Directory path can be set together.
|
||||
// Null string (default) means directory is not changed
|
||||
// from the current value.
|
||||
|
||||
// Reset "Retrieve" flag.
|
||||
void ResetPhysicsTableRetrieved();
|
||||
void ResetStoredInAscii();
|
||||
// Reset "Retrieve" flag.
|
||||
|
||||
// Print out the List of registered particles types.
|
||||
void DumpList() const;
|
||||
// Print out the List of registered particles types.
|
||||
|
||||
// Request to print out information of cut values.
|
||||
// Printing will be performed when all tables are made.
|
||||
void DumpCutValuesTable(G4int flag = 1);
|
||||
// Request to print out information of cut values.
|
||||
// Printing will be performed when all tables are made.
|
||||
|
||||
// Triggers the print-out requested by the above method.
|
||||
// This method must be invoked by RunManager at the proper moment.
|
||||
void DumpCutValuesTableIfRequested();
|
||||
// Triggers the print-out requested by the above method.
|
||||
// This method must be invoked by RunManager at the proper moment.
|
||||
|
||||
// Set/get control flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const;
|
||||
// Set/get control flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
|
||||
void UseCoupledTransportation(G4bool vl = true);
|
||||
|
||||
// Invokes default SetCuts() method.
|
||||
// Note: cut values will not be overwritten.
|
||||
// Use of default SetCuts() method is recommended.
|
||||
void SetCutsWithDefault();
|
||||
// Invokes default SetCuts() method.
|
||||
// Note: cut values will not be overwritten.
|
||||
// Use of default SetCuts() method is recommended.
|
||||
|
||||
// Sets a cut value for a particle type for the default region.
|
||||
void SetCutValue(G4double aCut, const G4String& pname);
|
||||
// Sets a cut value for a particle type for the default region.
|
||||
|
||||
// Gets a cut value for a particle type for the default region.
|
||||
G4double GetCutValue(const G4String& pname) const;
|
||||
// Gets a cut value for a particle type for the default region.
|
||||
|
||||
void SetCutValue(G4double aCut, const G4String& pname,
|
||||
const G4String& rname);
|
||||
// Sets a cut value for a particle type for a region.
|
||||
// Sets a cut value for a particle type for a region.
|
||||
void SetCutValue(G4double aCut, const G4String& pname, const G4String& rname);
|
||||
|
||||
void SetParticleCuts(G4double cut, G4ParticleDefinition* particle,
|
||||
G4Region* region = nullptr);
|
||||
void SetParticleCuts(G4double cut, const G4String& particleName,
|
||||
G4Region* region = nullptr);
|
||||
// Invoke SetCuts for specified particle for a region.
|
||||
// If the pointer to the region is NULL, the default region is used
|
||||
// In case of "Retrieve" flag is ON, cut values will be retrieved
|
||||
// from files.
|
||||
// Invoke SetCuts for specified particle for a region.
|
||||
// If the pointer to the region is NULL, the default region is used
|
||||
// In case of "Retrieve" flag is ON, cut values will be retrieved
|
||||
// from files.
|
||||
void SetParticleCuts(G4double cut, G4ParticleDefinition* particle, G4Region* region = nullptr);
|
||||
void SetParticleCuts(G4double cut, const G4String& particleName, G4Region* region = nullptr);
|
||||
|
||||
// Invoke SetCuts() for all particles in a region.
|
||||
void SetCutsForRegion(G4double aCut, const G4String& rname);
|
||||
// Invoke SetCuts() for all particles in a region.
|
||||
|
||||
// Gets/sets the flag for ApplyCuts().
|
||||
void SetApplyCuts(G4bool value, const G4String& name);
|
||||
G4bool GetApplyCuts(const G4String& name) const;
|
||||
// Gets/sets the flag for ApplyCuts().
|
||||
|
||||
// Remove and delete ProcessManagers for all particles in the
|
||||
// Particle Table.
|
||||
void RemoveProcessManager();
|
||||
// Remove and delete ProcessManagers for all particles in the
|
||||
// Particle Table.
|
||||
|
||||
// Remove and delete TrackingManagers for all particles in the
|
||||
// Particle Table.
|
||||
void RemoveTrackingManager();
|
||||
// Remove and delete TrackingManagers for all particles in the
|
||||
// Particle Table.
|
||||
|
||||
// Add process manager for particles created on-the-fly.
|
||||
void AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
G4ProcessManager* newManager = nullptr);
|
||||
// Add process manager for particles created on-the-fly.
|
||||
|
||||
// Check consistencies of list of particles.
|
||||
void CheckParticleList();
|
||||
// Check consistencies of list of particles.
|
||||
|
||||
void DisableCheckParticleList();
|
||||
|
||||
inline G4int GetInstanceID() const;
|
||||
static const G4VUPLManager& GetSubInstanceManager();
|
||||
// Used by Worker threads on the shared instance of physics-list
|
||||
// to initialise workers. Derived class re-implementing this method
|
||||
// must also call this base class method.
|
||||
|
||||
// Used by Worker threads on the shared instance of physics-list
|
||||
// to initialise workers. Derived class re-implementing this method
|
||||
// must also call this base class method.
|
||||
virtual void InitializeWorker();
|
||||
// Destroy thread-local data. Note that derived classes
|
||||
// implementing this method should still call this base class one.
|
||||
|
||||
// Destroy thread-local data. Note that derived classes
|
||||
// implementing this method should still call this base class one.
|
||||
virtual void TerminateWorker();
|
||||
|
||||
protected:
|
||||
|
||||
// User must invoke this method in his ConstructProcess()
|
||||
// implementation in order to enable particle transportation.
|
||||
void AddTransportation();
|
||||
// User must invoke this method in his ConstructProcess()
|
||||
// implementation in order to enable particle transportation.
|
||||
|
||||
// Register a process to the particle type
|
||||
// according to the ordering parameter table.
|
||||
// 'true' is returned if the process is registerd successfully.
|
||||
G4bool RegisterProcess(G4VProcess* process, G4ParticleDefinition* particle);
|
||||
// Register a process to the particle type
|
||||
// according to the ordering parameter table.
|
||||
// 'true' is returned if the process is registerd successfully.
|
||||
|
||||
// Build PhysicsTable for making the integral schema.
|
||||
void BuildIntegralPhysicsTable(G4VProcess*, G4ParticleDefinition*);
|
||||
// Build PhysicsTable for making the integral schema.
|
||||
|
||||
virtual void RetrievePhysicsTable(G4ParticleDefinition*,
|
||||
const G4String& directory,
|
||||
// Retrieve PhysicsTable from files for process belonging to the particle.
|
||||
// Normal BuildPhysics procedure of processes will be invoked, if it
|
||||
// fails (in case of process's RetrievePhysicsTable() returns false).
|
||||
virtual void RetrievePhysicsTable(G4ParticleDefinition*, const G4String& directory,
|
||||
G4bool ascii = false);
|
||||
// Retrieve PhysicsTable from files for process belonging to the particle.
|
||||
// Normal BuildPhysics procedure of processes will be invoked, if it
|
||||
// fails (in case of process's RetrievePhysicsTable() returns false).
|
||||
|
||||
// Adds new ProcessManager to all particles in the Particle Table.
|
||||
// This function is used in Construct().
|
||||
void InitializeProcessManager();
|
||||
// Adds new ProcessManager to all particles in the Particle Table.
|
||||
// This function is used in Construct().
|
||||
|
||||
G4ParticleTable::G4PTblDicIterator* GetParticleIterator() const;
|
||||
|
||||
protected:
|
||||
|
||||
// The particle table has the complete List of existing particle types.
|
||||
G4ParticleTable* theParticleTable = nullptr;
|
||||
// The particle table has the complete List of existing particle types.
|
||||
|
||||
G4int verboseLevel = 1;
|
||||
|
||||
// Default cut value for all particles
|
||||
G4double defaultCutValue = 1.0;
|
||||
// Default cut value for all particles
|
||||
G4bool isSetDefaultCutValue = false;
|
||||
|
||||
// Pointer to ProductionCutsTable.
|
||||
G4ProductionCutsTable* fCutsTable = nullptr;
|
||||
// Pointer to ProductionCutsTable.
|
||||
|
||||
// Flag to determine if physics table will be build from file or not.
|
||||
G4bool fRetrievePhysicsTable = false;
|
||||
// Flag to determine if physics table will be build from file or not.
|
||||
G4bool fStoredInAscii = true;
|
||||
|
||||
G4bool fIsCheckedForRetrievePhysicsTable = false;
|
||||
G4bool fIsRestoredCutValues = false;
|
||||
|
||||
// Directory name for physics table files.
|
||||
G4String directoryPhysicsTable = ".";
|
||||
// Directory name for physics table files.
|
||||
|
||||
// Flag for CheckParticleList().
|
||||
G4bool fDisableCheckParticleList = false;
|
||||
// Flag for CheckParticleList().
|
||||
|
||||
// MT data
|
||||
G4int g4vuplInstanceID = 0;
|
||||
G4RUN_DLL static G4VUPLManager subInstanceManager;
|
||||
// MT data
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
FixedStringLengthForStore = 32
|
||||
};
|
||||
};
|
||||
|
||||
// Inline methods implementations
|
||||
|
||||
inline void G4VUserPhysicsList::Construct()
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel > 1)
|
||||
G4cout << "G4VUserPhysicsList::Construct()" << G4endl;
|
||||
#endif
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel > 1) G4cout << "G4VUserPhysicsList::Construct()" << G4endl;
|
||||
#endif
|
||||
|
||||
if (G4Threading::IsMasterThread()) G4PhysicsModelCatalog::Initialize();
|
||||
|
||||
if ( G4Threading::IsMasterThread() ) G4PhysicsModelCatalog::Initialize();
|
||||
|
||||
InitializeProcessManager();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel > 1)
|
||||
G4cout << "Construct processes " << G4endl;
|
||||
#endif
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel > 1) G4cout << "Construct processes " << G4endl;
|
||||
#endif
|
||||
ConstructProcess();
|
||||
}
|
||||
|
||||
@@ -366,8 +347,8 @@ inline void G4VUserPhysicsList::SetStoredInAscii()
|
||||
|
||||
inline void G4VUserPhysicsList::ResetPhysicsTableRetrieved()
|
||||
{
|
||||
fRetrievePhysicsTable = false;
|
||||
fIsRestoredCutValues = false;
|
||||
fRetrievePhysicsTable = false;
|
||||
fIsRestoredCutValues = false;
|
||||
fIsCheckedForRetrievePhysicsTable = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user