Import Geant4 10.3.0.beta source tree
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "G4RNGHelper.hh"
|
||||
#include "G4MTBarrier.hh"
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
@@ -100,6 +101,8 @@ public:
|
||||
//This method is invoked just before spawning the threads to
|
||||
//collect from UI managere the list of commands that threads
|
||||
//will execute.
|
||||
size_t GetNumberActiveThreads() const { return threads.size(); }
|
||||
//Returns number of currently active threads
|
||||
private:
|
||||
// Number of worker threads. To be set by SetNumberOfThreads() method.
|
||||
G4int nworkers;
|
||||
@@ -189,12 +192,18 @@ public:
|
||||
|
||||
public:
|
||||
//Handling of more than one run per thread
|
||||
enum WorkerActionRequest {
|
||||
enum class WorkerActionRequest {
|
||||
UNDEFINED ,
|
||||
NEXTITERATION , // There is another set of UI commands to be executed
|
||||
PROCESSUI, // Process UI commands w/o a /run/beamOn
|
||||
ENDWORKER // Terminate thread, work finished
|
||||
};
|
||||
|
||||
virtual void RequestWorkersProcessCommandsStack();
|
||||
//Called to force workers to request and process the UI commands stack
|
||||
//This will block untill all workers have processed UI commands
|
||||
virtual void ThisWorkerProcessCommandsStackDone();
|
||||
//Called by workers to signal to master it has completed processing of
|
||||
//UI commands
|
||||
virtual WorkerActionRequest ThisWorkerWaitForNextAction();
|
||||
//Worker thread barrier
|
||||
//This method should be used by workers' run manager to wait,
|
||||
@@ -243,6 +252,12 @@ protected:
|
||||
public:
|
||||
static G4int SeedOncePerCommunication() { return seedOncePerCommunication; }
|
||||
static void SetSeedOncePerCommunication(G4int val) { seedOncePerCommunication = val; }
|
||||
protected:
|
||||
//Barriers: synch points between master and workers
|
||||
G4MTBarrier beginOfEventLoopBarrier;
|
||||
G4MTBarrier endOfEventLoopBarrier;
|
||||
G4MTBarrier nextActionRequestBarrier;
|
||||
G4MTBarrier processUIBarrier;
|
||||
};
|
||||
|
||||
#endif //G4MTRunManager_h
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiRunAction.hh 90212 2016-01-27 18:33:12Z adotti $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4MultiRunAction.hh
|
||||
//
|
||||
// Created on: Jan 17, 2016
|
||||
// Author: adotti
|
||||
//
|
||||
//
|
||||
// class description:
|
||||
// This class extends G4UserRunAction and allows multiple
|
||||
// user-defined tracking actions to be used in the same job.
|
||||
// The class is a vector of user-defined tracking actions.
|
||||
// This class owns and manages the dependent user-actions.
|
||||
// Usage:
|
||||
// There is no need to explicitly use this class as long as the
|
||||
// user actions are set via G4UserActionInitialization::SetUserAction
|
||||
// that can be called several times. Explicitly this is what is happening:
|
||||
// In user-defined action initialization:
|
||||
// G4MultiRunAction* action = new G4MultiRunAction;
|
||||
// action->push_back( G4UserRunActionUPtr( new MyUserRunAction );
|
||||
// [... add as many as needed ...]
|
||||
// SetUserAction( action );
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
|
||||
#ifndef G4MULTIRUNACTION_HH_
|
||||
#define G4MULTIRUNACTION_HH_
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
using G4UserRunActionUPtr=std::unique_ptr<G4UserRunAction>;
|
||||
using G4UserRunActionVector=std::vector<G4UserRunActionUPtr>;
|
||||
|
||||
|
||||
class G4MultiRunAction : public G4UserRunAction , public G4UserRunActionVector
|
||||
{
|
||||
public:
|
||||
G4MultiRunAction() = default;
|
||||
virtual ~G4MultiRunAction() = default;
|
||||
virtual G4Run* GenerateRun() override;
|
||||
virtual void BeginOfRunAction(const G4Run* aRun) override;
|
||||
virtual void EndOfRunAction(const G4Run* aRun) override;
|
||||
virtual void SetMaster(G4bool val=true) override;
|
||||
|
||||
};
|
||||
|
||||
#endif /* SOURCE_RUN_INCLUDE_G4MULTIRUNACTION_HH_ */
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
G4ExceptionDescription msg;
|
||||
msg << "No seed number "<<seedId<<"("<<seeds.size()<<" available)\n"
|
||||
<< " Original seed number "<<sdId<<" filled so far "<<offset;
|
||||
G4Exception("G4RNGHelper::GetSeed","Run0035", FatalException,msg);
|
||||
G4Exception("G4RNGHelper::GetSeed","Run0115", FatalException,msg);
|
||||
return T();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManager.hh 94222 2015-11-09 08:28:49Z gcosmo $
|
||||
// $Id: G4RunManager.hh 95232 2016-02-01 14:31:22Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -332,6 +332,17 @@ public: // with description
|
||||
virtual void RestoreRandomNumberStatus(const G4String& fileN);
|
||||
|
||||
public: // with description
|
||||
//The following set user-actions and user-initialization to the kernel
|
||||
//In MT mode, actions are shared among all threads, and should be set
|
||||
//in the master thread, while user-actions are thread-private and each `
|
||||
//thread has private instances. Master thread does not have user-actions
|
||||
//except for the (optional) run-action.
|
||||
//User should instantiate the user-actions in the action-initialization
|
||||
//and use that class set method to set user-actions and not directly
|
||||
//the methods provided here.
|
||||
//Multiple Run,Event,Tracking, and Stepping actions are allowed, set
|
||||
//multiple instances and these will be appended to the current configuration
|
||||
//Multiple Stacking and PrimaryGeneration are not allowed
|
||||
virtual void SetUserInitialization(G4VUserDetectorConstruction* userInit);
|
||||
virtual void SetUserInitialization(G4VUserPhysicsList* userInit);
|
||||
virtual void SetUserInitialization(G4VUserActionInitialization* userInit);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunMessenger.hh 94222 2015-11-09 08:28:49Z gcosmo $
|
||||
// $Id: G4RunMessenger.hh 95634 2016-02-17 08:05:21Z gcosmo $
|
||||
//
|
||||
//
|
||||
// GEANT 4 class header file
|
||||
@@ -101,6 +101,7 @@ class G4RunMessenger: public G4UImessenger
|
||||
G4UIcmdWithABool* geomRebCmd;
|
||||
G4UIcmdWithoutParameter * physCmd;
|
||||
G4UIcmdWithAnInteger * randEvtCmd;
|
||||
G4UIcommand * procUICmds;
|
||||
|
||||
G4UIdirectory * randomDirectory;
|
||||
G4UIcmdWithAString * seedCmd;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserRunAction.hh 68845 2013-04-08 07:22:19Z gcosmo $
|
||||
// $Id: G4UserRunAction.hh 95232 2016-02-01 14:31:22Z gcosmo $
|
||||
//
|
||||
|
||||
#ifndef G4UserRunAction_h
|
||||
@@ -64,7 +64,7 @@ class G4UserRunAction
|
||||
G4bool isMaster;
|
||||
|
||||
public:
|
||||
inline void SetMaster(G4bool val=true)
|
||||
inline virtual void SetMaster(G4bool val=true)
|
||||
{ isMaster = val; }
|
||||
inline G4bool IsMaster() const
|
||||
{ return isMaster; }
|
||||
|
||||
Reference in New Issue
Block a user