Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UserWorkerThreadInitialization Class Reference

#include <G4UserWorkerThreadInitialization.hh>

+ Inheritance diagram for G4UserWorkerThreadInitialization:

Public Member Functions

 G4UserWorkerThreadInitialization ()
 
virtual ~G4UserWorkerThreadInitialization ()
 
virtual G4ThreadCreateAndStartWorker (G4WorkerThread *workerThreadContext)
 
virtual void SetupRNGEngine (const CLHEP::HepRandomEngine *aRNGEngine) const
 
virtual void JoinWorker (G4Thread *aThread)
 
virtual G4WorkerRunManagerCreateWorkerRunManager () const
 

Detailed Description

Definition at line 47 of file G4UserWorkerThreadInitialization.hh.

Constructor & Destructor Documentation

◆ G4UserWorkerThreadInitialization()

G4UserWorkerThreadInitialization::G4UserWorkerThreadInitialization ( )

Definition at line 70 of file G4UserWorkerThreadInitialization.cc.

70{ ; }

◆ ~G4UserWorkerThreadInitialization()

G4UserWorkerThreadInitialization::~G4UserWorkerThreadInitialization ( )
virtual

Definition at line 72 of file G4UserWorkerThreadInitialization.cc.

72{ ; }

Member Function Documentation

◆ CreateAndStartWorker()

G4Thread * G4UserWorkerThreadInitialization::CreateAndStartWorker ( G4WorkerThread workerThreadContext)
virtual

Reimplemented in G4UserTaskThreadInitialization.

Definition at line 53 of file G4UserWorkerThreadInitialization.cc.

55{
56 return new G4Thread;
57}
G4DummyThread G4Thread
Definition: G4Threading.hh:247

Referenced by G4MTRunManager::CreateAndStartWorkers().

◆ CreateWorkerRunManager()

G4WorkerRunManager * G4UserWorkerThreadInitialization::CreateWorkerRunManager ( ) const
virtual

◆ JoinWorker()

void G4UserWorkerThreadInitialization::JoinWorker ( G4Thread aThread)
virtual

Reimplemented in G4UserTaskThreadInitialization.

Definition at line 67 of file G4UserWorkerThreadInitialization.cc.

67{}

Referenced by G4MTRunManager::TerminateWorkers().

◆ SetupRNGEngine()

void G4UserWorkerThreadInitialization::SetupRNGEngine ( const CLHEP::HepRandomEngine aRNGEngine) const
virtual

Reimplemented in G4UserTaskThreadInitialization.

Definition at line 80 of file G4UserWorkerThreadInitialization.cc.

82{
83 G4AutoLock l(&rngCreateMutex);
84 // No default available, let's create the instance of random stuff
85 // A Call to this just forces the creation to defaults
86 G4Random::getTheEngine();
87 // Poor man's solution to check which RNG Engine is used in master thread
88 CLHEP::HepRandomEngine* retRNG = 0;
89
90 // Need to make these calls thread safe
91 if(dynamic_cast<const CLHEP::HepJamesRandom*>(aNewRNG))
92 {
93 retRNG = new CLHEP::HepJamesRandom;
94 }
95 if(dynamic_cast<const CLHEP::MixMaxRng*>(aNewRNG))
96 {
97 retRNG = new CLHEP::MixMaxRng;
98 }
99 if(dynamic_cast<const CLHEP::RanecuEngine*>(aNewRNG))
100 {
101 retRNG = new CLHEP::RanecuEngine;
102 }
103 if(dynamic_cast<const CLHEP::Ranlux64Engine*>(aNewRNG))
104 {
105 const CLHEP::Ranlux64Engine* theRNG =
106 dynamic_cast<const CLHEP::Ranlux64Engine*>(aNewRNG);
107 retRNG = new CLHEP::Ranlux64Engine(123, theRNG->getLuxury());
108 }
109 if(dynamic_cast<const CLHEP::MTwistEngine*>(aNewRNG))
110 {
111 retRNG = new CLHEP::MTwistEngine;
112 }
113 if(dynamic_cast<const CLHEP::DualRand*>(aNewRNG))
114 {
115 retRNG = new CLHEP::DualRand;
116 }
117 if(dynamic_cast<const CLHEP::RanluxEngine*>(aNewRNG))
118 {
119 const CLHEP::RanluxEngine* theRNG =
120 dynamic_cast<const CLHEP::RanluxEngine*>(aNewRNG);
121 retRNG = new CLHEP::RanluxEngine(123, theRNG->getLuxury());
122 }
123 if(dynamic_cast<const CLHEP::RanshiEngine*>(aNewRNG))
124 {
125 retRNG = new CLHEP::RanshiEngine;
126 }
127
128 if(retRNG != 0)
129 {
130 G4Random::setTheEngine(retRNG);
131 }
132 else
133 {
134 // Does a new method, such as aNewRng->newEngine() exist to clone it ?
136 msg << " Unknown type of RNG Engine - " << G4endl
137 << " Can cope only with HepJamesRandom, MixMaxRng, Ranecu, Ranlux64,"
138 << " MTwistEngine, DualRand, Ranlux or Ranshi." << G4endl
139 << " Cannot clone this type of RNG engine, as required for this thread"
140 << G4endl << " Aborting " << G4endl;
141 G4Exception("G4UserWorkerInitializition::SetupRNGEngine()", "Run0122",
142 FatalException, msg);
143 }
144}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4endl
Definition: G4ios.hh:57
int getLuxury() const
Definition: RanluxEngine.h:90

Referenced by G4TaskRunManagerKernel::InitializeWorker(), and G4MTRunManagerKernel::StartThread().


The documentation for this class was generated from the following files: