Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
+166 -176
View File
@@ -23,37 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4RunManagerKernel
//
// Class description:
//
// This is a class for mandatory control of the Geant4 kernel.
//
// This class is constructed by G4RunManager. If a user adopts his/her own
// class instead of G4RunManager, this class must be instantiated by at the
// very beginning of the application and must be deleted at the very end.
// In addition, the following methods must be invoked in the proper order:
// DefineWorldVolume()
// InitializePhysics()
// RunInitialization()
// RunTermination()
//
// User must provide his/her own classes derived from the following abstract
// class and register it to G4RunManagerKernel:
// G4VUserPhysicsList - Particle types, Processes and Cuts
//
// G4RunManagerKernel does not have any event loop. Handling of events
// is managed by G4RunManager.
// class description:
//
// This is a class for mandatory control of GEANT4 kernel.
//
// This class is constructed by G4RunManager. If a user uses his/her own
// class instead of G4RunManager, this class must be instantiated by
// him/herself at the very beginning of the application and must be deleted
// at the very end of the application. Also, following methods must be
// invoked in the proper order.
// DefineWorldVolume
// InitializePhysics
// RunInitialization
// RunTermination
//
// User must provide his/her own classes derived from the following
// abstract class and register it to the RunManagerKernel.
// G4VUserPhysicsList - Particle types, Processes and Cuts
//
// G4RunManagerKernel does not have any eveny loop. Handling of events
// is managed by G4RunManager.
//
// Author: M.Asai, 1 August 2003
// --------------------------------------------------------------------
#ifndef G4RunManagerKernel_hh
#define G4RunManagerKernel_hh 1
#ifndef G4RunManagerKernel_h
#define G4RunManagerKernel_h 1
#include "globals.hh"
#include "G4EventManager.hh"
class G4VUserPhysicsList;
class G4VPhysicalVolume;
class G4Region;
class G4ExceptionHandler;
@@ -61,185 +61,175 @@ class G4StackManager;
class G4TrackingManager;
class G4PrimaryTransformer;
#include "G4EventManager.hh"
#include "globals.hh"
class G4RunManagerKernel
{
public: // with description
static G4RunManagerKernel* GetRunManagerKernel();
// Static method which returns the singleton pointer of G4RunManagerKernel or
// its derived class.
public:
private:
static G4ThreadLocal G4RunManagerKernel* fRunManagerKernel;
static G4RunManagerKernel* GetRunManagerKernel();
// Static method returning the singleton pointer of
// G4RunManagerKernel or its derived class.
public: // with description
G4RunManagerKernel();
virtual ~G4RunManagerKernel();
// The constructor and the destructor. The user must construct this class
// object at the beginning of his/her main() and must delete it at the
// bottom of the main(), unless he/she used G4RunManager.
public:
enum RMKType
{
sequentialRMK,
masterRMK,
workerRMK
};
G4RunManagerKernel();
virtual ~G4RunManagerKernel();
// The constructor and the destructor. The user must construct this class
// object at the beginning of his/her main() and must delete it at the
// bottom of the main(), unless he/she used G4RunManager.
protected:
// Constructor to be used by derived classes
G4RunManagerKernel(RMKType rmkType);
RMKType runManagerKernelType;
void DefineWorldVolume(G4VPhysicalVolume* worldVol,
G4bool topologyIsChanged = true);
public: // with description
void DefineWorldVolume(G4VPhysicalVolume* worldVol,
G4bool topologyIsChanged = true);
void WorkerDefineWorldVolume(G4VPhysicalVolume* worldVol,
G4bool topologyIsChanged = true);
// This method must be invoked if the geometry setup has been changed
// between runs. The flag "topologyIsChanged" will specify if the
// geometry topology is different from the original one used in the
// previous run; if not, it must be set to false, so that the original
// optimisation and navigation history is preserved. This method is
// invoked also at initialisation.
void WorkerDefineWorldVolume(G4VPhysicalVolume* worldVol,
G4bool topologyIsChanged = true);
void SetPhysics(G4VUserPhysicsList* uPhys);
// This method must be invoked at least once with a valid concrete
// implementation of user physics list.
// This method must be invoked if the geometry setup has been changed between
// runs. The flag 'topologyIsChanged' will specify if the geometry topology is
// different from the original one used in the previous run; if not, it must
// be set to false, so that the original optimisation and navigation history
// is preserved. This method is invoked also at initialisation.
void InitializePhysics();
// This method must be invoked at least once to build physics processes.
void SetPhysics(G4VUserPhysicsList* uPhys);
// This method must be invoked at least once by the user with a valid
// concrete implementation of user physics list.
G4bool RunInitialization(G4bool fakeRun = false);
// Trigger geometry closing and physics table constructions.
// It returns TRUE if all procedures went well.
void InitializePhysics();
// This method must be invoked at least once by the user to build physics
// processes.
void RunTermination();
// Set the application state to 'Idle' so that the user can modify
// physics/geometry.
G4bool RunInitialization(G4bool fakeRun = false);
// Trigger geometry closing and physics table constructions.
// It returns TRUE if all procedures went well.
void UpdateRegion();
// Update region list. This method is mandatory before invoking the
// following two dump methods.
// At RunInitialization(), this method is automatically invoked.
void RunTermination();
// Set the application state to G4State_Idle so that the user can modify
// physics/geometry.
void DumpRegion(const G4String& rname) const;
// Dump information of a region.
public:
void WorkerUpdateWorldVolume();
void DumpRegion(G4Region* region = nullptr) const;
// Dump information of a region.
// If the pointer is NULL, all regions are shown.
protected:
void SetupDefaultRegion();
// Called by DefineWorldVolume
void SetupPhysics();
void ResetNavigator();
void BuildPhysicsTables(G4bool fakeRun);
void CheckRegions();
void WorkerUpdateWorldVolume();
public: // with description
void UpdateRegion();
// Update region list.
// This method is mandatory before invoking following two dump methods.
// At RunInitialization(), this method is automatically invoked, and thus
// the user needs not invoke.
inline void GeometryHasBeenModified() { geometryNeedsToBeClosed = true; }
// This method must be invoked (or equivalent UI commands can be used)
// in case the user changes his/her detector geometry.
// This method is automatically invoked from DefineWorldVolume().
void DumpRegion(const G4String& rname) const;
// Dump information of a region.
inline void PhysicsHasBeenModified() { physicsNeedsToBeReBuilt = true; }
// This method must be invoked in case the user changes his/her physics
// process(es), e.g. (in)activate some processes. Once this method is
// invoked, regardless of cuts changed or not, BuildPhysicsTable() of
// a PhysicsList is invoked for refreshing all physics tables.
void DumpRegion(G4Region* region = 0) const;
// Dump information of a region.
// If the pointer is NULL, all regions are shown.
private:
G4VUserPhysicsList* physicsList;
G4VPhysicalVolume* currentWorld;
G4bool geometryInitialized;
G4bool physicsInitialized;
G4bool geometryToBeOptimized;
G4bool physicsNeedsToBeReBuilt;
G4int verboseLevel;
G4int numberOfParallelWorld;
G4EventManager* eventManager;
G4ExceptionHandler* defaultExceptionHandler;
G4String versionString;
protected:
G4Region* defaultRegion;
G4Region* defaultRegionForParallelWorld;
G4bool geometryNeedsToBeClosed;
public: // with description
inline void GeometryHasBeenModified() { geometryNeedsToBeClosed = true; }
// This method must be invoked (or equivalent UI commands can be used)
// in case the user changes his/her detector geometry.
// This method is automatically invoked from DefineWorldVolume() method.
inline void PhysicsHasBeenModified() { physicsNeedsToBeReBuilt = true; }
// This method must be invoked in case the user changes his/her physics
// process(es), e.g. (in)activate some processes. Once this method is
// invoked, regardless of cuts are changed or not, BuildPhysicsTable()
// of PhysicsList is invoked for refreshing all physics tables.
public:
inline G4EventManager* GetEventManager() const { return eventManager; }
inline G4StackManager* GetStackManager() const
{
return eventManager->GetStackManager();
}
inline G4TrackingManager* GetTrackingManager() const
{
return eventManager->GetTrackingManager();
}
inline void SetPrimaryTransformer(G4PrimaryTransformer* pt)
{
eventManager->SetPrimaryTransformer(pt);
}
inline G4PrimaryTransformer* GetPrimaryTransformer() const
{
return eventManager->GetPrimaryTransformer();
}
inline const G4String& GetVersionString() const { return versionString; }
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
inline void SetGeometryToBeOptimized(G4bool vl)
{
if(geometryToBeOptimized != vl)
inline G4EventManager* GetEventManager() const { return eventManager; }
inline G4StackManager* GetStackManager() const
{
geometryToBeOptimized = vl;
geometryNeedsToBeClosed = true;
return eventManager->GetStackManager();
}
inline G4TrackingManager* GetTrackingManager() const
{
return eventManager->GetTrackingManager();
}
inline void SetPrimaryTransformer(G4PrimaryTransformer* pt)
{
eventManager->SetPrimaryTransformer(pt);
}
inline G4PrimaryTransformer* GetPrimaryTransformer() const
{
return eventManager->GetPrimaryTransformer();
}
}
inline G4int GetNumberOfParallelWorld() const
{
return numberOfParallelWorld;
}
inline void SetNumberOfParallelWorld(G4int i) { numberOfParallelWorld = i; }
inline const G4String& GetVersionString() const { return versionString; }
inline G4VUserPhysicsList* GetPhysicsList() const { return physicsList; }
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
inline G4VPhysicalVolume* GetCurrentWorld() const { return currentWorld; }
inline void SetGeometryToBeOptimized(G4bool vl)
{
if(geometryToBeOptimized != vl)
{
geometryToBeOptimized = vl;
geometryNeedsToBeClosed = true;
}
}
private:
void CheckRegularGeometry();
G4bool ConfirmCoupledTransportation();
void SetScoreSplitter();
inline G4int GetNumberOfParallelWorld() const
{
return numberOfParallelWorld;
}
inline void SetNumberOfParallelWorld(G4int i) { numberOfParallelWorld = i; }
G4int numberOfStaticAllocators;
inline G4VUserPhysicsList* GetPhysicsList() const { return physicsList; }
public:
inline G4int GetNumberOfStaticAllocators() const
{
return numberOfStaticAllocators;
}
inline G4VPhysicalVolume* GetCurrentWorld() const { return currentWorld; }
protected:
virtual void SetupShadowProcess() const;
// This method will setup the G4VProcesses
// instances to have a reference to the process instance
// created by the master thread. See G4VProcess::GetMasterProcess
inline G4int GetNumberOfStaticAllocators() const
{
return numberOfStaticAllocators;
}
void PropagateGenericIonID();
enum RMKType
{
sequentialRMK,
masterRMK,
workerRMK
};
protected:
G4RunManagerKernel(RMKType rmkType);
// Constructor to be used by derived classes.
void SetupDefaultRegion();
// Called by DefineWorldVolume().
void SetupPhysics();
void ResetNavigator();
void BuildPhysicsTables(G4bool fakeRun);
void CheckRegions();
virtual void SetupShadowProcess() const;
// This method will setup the G4VProcesses instances to have a reference
// to the process instance created by the master thread.
// See G4VProcess::GetMasterProcess().
void PropagateGenericIonID();
private:
void CheckRegularGeometry();
G4bool ConfirmCoupledTransportation();
void SetScoreSplitter();
protected:
RMKType runManagerKernelType;
G4Region* defaultRegion = nullptr;
G4Region* defaultRegionForParallelWorld = nullptr;
G4bool geometryNeedsToBeClosed = true;
private:
G4VUserPhysicsList* physicsList = nullptr;
G4VPhysicalVolume* currentWorld = nullptr;
G4bool geometryInitialized = false;
G4bool physicsInitialized = false;
G4bool geometryToBeOptimized = true;
G4bool physicsNeedsToBeReBuilt = true;
G4int verboseLevel = 0;
G4int numberOfParallelWorld = 0;
G4EventManager* eventManager = nullptr;
G4ExceptionHandler* defaultExceptionHandler = nullptr;
G4String versionString = "";
static G4ThreadLocal G4RunManagerKernel* fRunManagerKernel;
G4int numberOfStaticAllocators = 0;
};
#endif