Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -103,34 +103,30 @@ class G4MSSteppingAction : public G4UserSteppingAction
|
||||
/// except for the name, they are treated as different
|
||||
G4String material_name = { };
|
||||
/// Getter that returns the full material name
|
||||
G4String GetName(){return material_name;};
|
||||
const G4String& GetName() { return material_name; }
|
||||
/// Getter that returns the material name, splitted in blocks of length 'column_width'
|
||||
G4String GetName(G4int column_width)
|
||||
{
|
||||
G4int input_name_length = (G4int)material_name.length();
|
||||
if( input_name_length < column_width) return material_name;
|
||||
auto input_name_length = (G4int)material_name.length();
|
||||
if( input_name_length < column_width) { return material_name; }
|
||||
|
||||
G4String formated_name;
|
||||
|
||||
for (size_t i = 0; i < material_name.length(); i += column_width)
|
||||
G4String formatted_name;
|
||||
for (std::size_t i = 0; i < material_name.length(); i += column_width)
|
||||
{
|
||||
// for each block of characters of length 'column_width', append '\n'
|
||||
formated_name += material_name.substr(i, column_width);
|
||||
if (i + column_width < material_name.length())
|
||||
{
|
||||
formated_name += '\n';
|
||||
}
|
||||
// append spaces for last block of characters so its length corresponds to column_width
|
||||
else
|
||||
{
|
||||
formated_name+=G4String( column_width-(input_name_length%column_width),' ');
|
||||
}
|
||||
// for each block of characters of length 'column_width', append '\n'
|
||||
formatted_name += material_name.substr(i, column_width);
|
||||
if (i + column_width < material_name.length())
|
||||
{
|
||||
formatted_name += '\n';
|
||||
}
|
||||
// append spaces for last block of characters so its length corresponds to column_width
|
||||
else
|
||||
{
|
||||
formatted_name+=G4String( column_width-(input_name_length%column_width),' ');
|
||||
}
|
||||
}
|
||||
|
||||
return formated_name;
|
||||
|
||||
};
|
||||
|
||||
return formatted_name;
|
||||
}
|
||||
};
|
||||
std::vector<shape_mat_info_t> shape_mat_info_v;
|
||||
|
||||
|
||||
@@ -231,7 +231,6 @@ class G4MTRunManager : public G4RunManager
|
||||
|
||||
// Handling of master thread scoring worlds, access is needed by workers
|
||||
G4MTRUN_DLL static G4ScoringManager* masterScM;
|
||||
G4MTRUN_DLL static masterWorlds_t masterWorlds;
|
||||
// Singleton implementing master thread behavior
|
||||
G4MTRUN_DLL static G4MTRunManager* fMasterRM;
|
||||
|
||||
|
||||
@@ -96,10 +96,11 @@ class G4Run
|
||||
// Returns random number status at the beginning of this run.
|
||||
inline const G4String& GetRandomNumberStatus() const { return randomNumberStatus; }
|
||||
|
||||
// Returns the event vector.
|
||||
// Returns the event vector and related numbers.
|
||||
inline std::vector<const G4Event*>* GetEventVector() const { return eventVector; }
|
||||
inline G4int GetEventVectorSize() const
|
||||
{ return (eventVector!=nullptr) ? (G4int)(eventVector->size()) : 0; }
|
||||
G4int GetNumberOfKeptEvents() const;
|
||||
|
||||
inline void SetRunID(G4int id) { runID = id; }
|
||||
inline void SetNumberOfEventToBeProcessed(G4int n_ev) { numberOfEventToBeProcessed = n_ev; }
|
||||
|
||||
@@ -415,8 +415,9 @@ class G4RunManager
|
||||
|
||||
// if vl = 1 : status before primary particle generation is stored
|
||||
// if vl = 2 : status before event processing (after primary particle
|
||||
// generation) is stored if vl = 3 : both are stored if vl = 0 : none is
|
||||
// stored (default).
|
||||
// generation) is stored
|
||||
// if vl = 3 : both are stored
|
||||
// if vl = 0 : none is stored (default).
|
||||
inline void StoreRandomNumberStatusToG4Event(G4int vl)
|
||||
{
|
||||
storeRandomNumberStatusToG4Event = vl;
|
||||
@@ -441,7 +442,7 @@ class G4RunManager
|
||||
G4String shellCmd = "if not exist " + dirStr + " mkdir ";
|
||||
#endif
|
||||
shellCmd += dirStr;
|
||||
randomNumberStatusDir = dirStr;
|
||||
randomNumberStatusDir = std::move(dirStr);
|
||||
G4int sysret = system(shellCmd);
|
||||
if (sysret != 0) {
|
||||
G4String errmsg = "\"" + shellCmd + "\" returns non-zero value. Directory creation failed.";
|
||||
@@ -533,36 +534,57 @@ class G4RunManager
|
||||
virtual void RegisterSubEventType(G4int, G4int)
|
||||
{
|
||||
G4Exception("G4RunManager::RegisterSubEventType","RunSE1000",FatalException,
|
||||
"Base class method is invoked for a RunManager that is not sub-event paralle mode");
|
||||
"Base class method is invoked for a RunManager that is not sub-event parallel mode");
|
||||
}
|
||||
virtual void MergeTrajectories(const G4SubEvent*,const G4Event*)
|
||||
{
|
||||
G4Exception("G4RunManager::MergeTrajectories","RunSE1001",FatalException,
|
||||
"Base class method is invoked for a RunManager that is not sub-event parallel mode");
|
||||
}
|
||||
virtual void UpdateScoringForSubEvent(const G4SubEvent*,const G4Event*)
|
||||
{
|
||||
G4Exception("G4RunManager::UpdateScoringForSubEvent","RunSE1001",FatalException,
|
||||
"Base class method is invoked for a RunManager that is not sub-event paralle mode");
|
||||
"Base class method is invoked for a RunManager that is not sub-event parallel mode");
|
||||
}
|
||||
virtual const G4SubEvent* GetSubEvent(G4int, G4bool&,
|
||||
G4long&, G4long&, G4long&, G4bool)
|
||||
{
|
||||
G4Exception("G4RunManager::GetSubEvent","RunSE1002",FatalException,
|
||||
"Base class method is invoked for a RunManager that is not sub-event paralle mode");
|
||||
"Base class method is invoked for a RunManager that is not sub-event parallel mode");
|
||||
return nullptr;
|
||||
}
|
||||
virtual void SubEventFinished(const G4SubEvent*,const G4Event*)
|
||||
{
|
||||
G4Exception("G4RunManager::SubEventFinished","RunSE1003",FatalException,
|
||||
"Base class method is invoked for a RunManager that is not sub-event paralle mode");
|
||||
"Base class method is invoked for a RunManager that is not sub-event parallel mode");
|
||||
}
|
||||
virtual G4int GetSubEventType() const
|
||||
{
|
||||
G4Exception("G4RunManager::GetSubEventType","RunSE1010",FatalException,
|
||||
"Base class method is invoked for RunManager that is not a worker in sub-event paralle mode");
|
||||
"Base class method is invoked for RunManager that is not a worker in sub-event parallel mode");
|
||||
return -1;
|
||||
}
|
||||
virtual void SetSubEventType(G4int)
|
||||
{
|
||||
G4Exception("G4RunManager::SetSubEventType","RunSE1011",FatalException,
|
||||
"Base class method is invoked for RunManager that is not a worker in sub-event parallel mode");
|
||||
}
|
||||
virtual std::size_t GetMaxNTrack() const
|
||||
{ return 0; }
|
||||
virtual void TrajectoriesToBeMerged(G4bool)
|
||||
{
|
||||
G4Exception("G4RunManager::TrajectoriesToBeMerged","RunSE1001",FatalException,
|
||||
"Base class method is invoked for a RunManager that is not sub-event parallel mode");
|
||||
}
|
||||
|
||||
virtual void ReportEventDeletion(const G4Event* evt);
|
||||
|
||||
// Forcing geometry voxelization at the time of constructing geometry during
|
||||
// the initialization. If this is not set, voxelization is done when BeamOn
|
||||
// starts.
|
||||
inline void ResetNavigatorAtInitialization(G4bool val=true)
|
||||
{ if(kernel!=nullptr) kernel->ResetNavigatorAtInitialization(val); }
|
||||
|
||||
protected:
|
||||
// This constructor is called in case of multi-threaded build.
|
||||
G4RunManager(RMType rmType);
|
||||
@@ -651,6 +673,7 @@ class G4RunManager
|
||||
static G4ThreadLocal G4RunManager* fRunManager;
|
||||
|
||||
G4RunMessenger* runMessenger = nullptr;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -57,6 +57,8 @@ enum class G4RunManagerType : G4int
|
||||
TaskingOnly = 5,
|
||||
TBB = 6,
|
||||
TBBOnly = 7,
|
||||
SubEvt = 8,
|
||||
SubEvtOnly = 9,
|
||||
Default
|
||||
};
|
||||
|
||||
|
||||
@@ -150,6 +150,9 @@ class G4RunManagerKernel
|
||||
geometryNeedsToBeClosed = true;
|
||||
}
|
||||
}
|
||||
|
||||
inline void ResetNavigatorAtInitialization(G4bool val=true)
|
||||
{ resetNavigatorAtInitialization = val; }
|
||||
|
||||
inline G4int GetNumberOfParallelWorld() const { return numberOfParallelWorld; }
|
||||
inline void SetNumberOfParallelWorld(G4int i) { numberOfParallelWorld = i; }
|
||||
@@ -213,6 +216,8 @@ class G4RunManagerKernel
|
||||
static G4ThreadLocal G4RunManagerKernel* fRunManagerKernel;
|
||||
|
||||
G4int numberOfStaticAllocators = 0;
|
||||
|
||||
G4bool resetNavigatorAtInitialization = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
#include "G4TaskRunManager.hh"
|
||||
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
|
||||
class G4WorkerSubEvtRunManager;
|
||||
|
||||
class G4SubEvtRunManager : public G4TaskRunManager
|
||||
{
|
||||
@@ -77,11 +80,9 @@ class G4SubEvtRunManager : public G4TaskRunManager
|
||||
G4int SetUpNEvents(G4Event*, G4SeedsQueue*, G4bool = true) override
|
||||
{ return -1; }
|
||||
|
||||
void RegisterSubEventType(G4int ty, G4int maxEnt) override
|
||||
{
|
||||
eventManager->UseSubEventParallelism();
|
||||
eventManager->GetStackManager()->RegisterSubEventType(ty,maxEnt);
|
||||
}
|
||||
void RegisterSubEventType(G4int ty, G4int maxEnt) override;
|
||||
|
||||
void RegisterSubEvtWorker(G4WorkerSubEvtRunManager*,G4int);
|
||||
|
||||
// The following method should be invoked by G4WorkerSubEvtRunManager for each
|
||||
// sub-event. This method returns a sub-event. This sub-event object must not
|
||||
@@ -189,6 +190,7 @@ class G4SubEvtRunManager : public G4TaskRunManager
|
||||
|
||||
void SetUpSeedsForSubEvent(G4long& s1, G4long& s2, G4long& s3);
|
||||
|
||||
void MergeTrajectories(const G4SubEvent* se,const G4Event* evt) override;
|
||||
void UpdateScoringForSubEvent(const G4SubEvent* se,const G4Event* evt) override;
|
||||
|
||||
void CleanUpUnnecessaryEvents(G4int keepNEvents) override;
|
||||
@@ -196,6 +198,17 @@ class G4SubEvtRunManager : public G4TaskRunManager
|
||||
|
||||
protected:
|
||||
std::atomic<G4bool> runInProgress = false;
|
||||
|
||||
private:
|
||||
G4bool trajectoriesToBeMerged = false;
|
||||
std::map<G4int,G4int> fSubEvtTypeMap;
|
||||
std::map<G4WorkerSubEvtRunManager*,G4int> fWorkerMap;
|
||||
|
||||
G4bool CheckSubEvtTypes();
|
||||
|
||||
public:
|
||||
void TrajectoriesToBeMerged(G4bool val=true) override
|
||||
{ trajectoriesToBeMerged = val; }
|
||||
};
|
||||
|
||||
#endif // G4SubEvtRunManager_hh
|
||||
|
||||
@@ -79,7 +79,6 @@ class G4TaskRunManagerKernel : public G4RunManagerKernel
|
||||
static void TerminateWorkerRunEventLoop();
|
||||
static void TerminateWorker();
|
||||
static void TerminateWorkerRunEventLoop(G4WorkerTaskRunManager*);
|
||||
static void TerminateWorker(G4WorkerTaskRunManager*);
|
||||
|
||||
static std::vector<G4String>& InitCommandStack();
|
||||
|
||||
|
||||
@@ -33,19 +33,8 @@
|
||||
#ifndef G4UserSubEvtThreadInitialization_hh
|
||||
#define G4UserSubEvtThreadInitialization_hh
|
||||
|
||||
class G4VUserPrimaryGeneratorAction;
|
||||
class G4UserRunAction;
|
||||
class G4UserEventAction;
|
||||
class G4UserStackingAction;
|
||||
class G4UserTrackingAction;
|
||||
class G4UserSteppingAction;
|
||||
|
||||
class G4WorkerThread;
|
||||
class G4WorkerTaskRunManager;
|
||||
|
||||
#include "G4Threading.hh"
|
||||
#include "G4UserTaskThreadInitialization.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
class G4UserSubEvtThreadInitialization : public G4UserTaskThreadInitialization
|
||||
{
|
||||
@@ -56,7 +45,7 @@ class G4UserSubEvtThreadInitialization : public G4UserTaskThreadInitialization
|
||||
// Called by StartThread function to create a run-manager implementing worker
|
||||
// behvior. User should re-implemtn this function in derived class to
|
||||
// instantiate his/her user-defined WorkerRunManager. By default this method
|
||||
// instantiates G4WorkerTaskRunManager object.
|
||||
// instantiates G4WorkerSubEvtRunManager object.
|
||||
G4WorkerRunManager* CreateWorkerRunManager() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
#ifndef G4UserTaskThreadInitialization_hh
|
||||
#define G4UserTaskThreadInitialization_hh
|
||||
|
||||
class G4VUserPrimaryGeneratorAction;
|
||||
class G4UserRunAction;
|
||||
class G4UserEventAction;
|
||||
class G4UserStackingAction;
|
||||
class G4UserTrackingAction;
|
||||
class G4UserSteppingAction;
|
||||
//class G4VUserPrimaryGeneratorAction;
|
||||
//class G4UserRunAction;
|
||||
//class G4UserEventAction;
|
||||
//class G4UserStackingAction;
|
||||
//class G4UserTrackingAction;
|
||||
//class G4UserSteppingAction;
|
||||
|
||||
class G4WorkerThread;
|
||||
class G4WorkerTaskRunManager;
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
#ifndef G4UserWorkerThreadInitialization_hh
|
||||
#define G4UserWorkerThreadInitialization_hh 1
|
||||
|
||||
class G4VUserPrimaryGeneratorAction;
|
||||
class G4UserRunAction;
|
||||
class G4UserEventAction;
|
||||
class G4UserStackingAction;
|
||||
class G4UserTrackingAction;
|
||||
class G4UserSteppingAction;
|
||||
//class G4VUserPrimaryGeneratorAction;
|
||||
//class G4UserRunAction;
|
||||
//class G4UserEventAction;
|
||||
//class G4UserStackingAction;
|
||||
//class G4UserTrackingAction;
|
||||
//class G4UserSteppingAction;
|
||||
class G4WorkerThread;
|
||||
class G4WorkerRunManager;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class G4WorkerSubEvtRunManager : public G4WorkerTaskRunManager
|
||||
public:
|
||||
static G4WorkerSubEvtRunManager* GetWorkerRunManager();
|
||||
static G4WorkerSubEvtRunManagerKernel* GetWorkerRunManagerKernel();
|
||||
G4WorkerSubEvtRunManager(G4int subEventType = 1);
|
||||
G4WorkerSubEvtRunManager(G4int subEventType = 0);
|
||||
//G4WorkerSubEvtRunManager() = delete;
|
||||
|
||||
// Modified for worker behavior
|
||||
@@ -91,6 +91,7 @@ class G4WorkerSubEvtRunManager : public G4WorkerTaskRunManager
|
||||
public:
|
||||
G4int GetSubEventType() const override
|
||||
{ return fSubEventType; }
|
||||
void SetSubEventType(G4int) override;
|
||||
};
|
||||
|
||||
#endif // G4WorkerSubEvtRunManager_h
|
||||
|
||||
@@ -95,6 +95,7 @@ class G4RunMessenger : public G4UImessenger
|
||||
G4UIcmdWithoutParameter* physCmd = nullptr;
|
||||
G4UIcmdWithAnInteger* randEvtCmd = nullptr;
|
||||
G4UIcommand* procUICmds = nullptr;
|
||||
G4UIcmdWithABool* trajMergeCmd = nullptr;
|
||||
|
||||
G4UIdirectory* randomDirectory = nullptr;
|
||||
G4UIcmdWithAString* seedCmd = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user