Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4UserWorkerThreadInitialization Class Reference

#include <G4UserWorkerThreadInitialization.hh>

Inheritance diagram for G4UserWorkerThreadInitialization:
tbbUserWorkerInitialization

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 ( )

Definition at line 74 of file G4UserWorkerThreadInitialization.cc.

75 {;}
G4UserWorkerThreadInitialization::~G4UserWorkerThreadInitialization ( )
virtual

Definition at line 77 of file G4UserWorkerThreadInitialization.cc.

78 {;}

Member Function Documentation

G4Thread * G4UserWorkerThreadInitialization::CreateAndStartWorker ( G4WorkerThread workerThreadContext)
virtual

Reimplemented in tbbUserWorkerInitialization.

Definition at line 56 of file G4UserWorkerThreadInitialization.cc.

Referenced by G4MTRunManager::CreateAndStartWorkers().

57 {
58  return new G4Thread;
59 }
G4int G4Thread
Definition: G4Threading.hh:157
G4WorkerRunManager * G4UserWorkerThreadInitialization::CreateWorkerRunManager ( ) const
virtual

Reimplemented in tbbUserWorkerInitialization.

Definition at line 133 of file G4UserWorkerThreadInitialization.cc.

Referenced by tbbTask::execute(), and G4MTRunManagerKernel::StartThread().

134 {
135  return new G4WorkerRunManager();
136 }
void G4UserWorkerThreadInitialization::JoinWorker ( G4Thread aThread)
virtual

Reimplemented in tbbUserWorkerInitialization.

Definition at line 69 of file G4UserWorkerThreadInitialization.cc.

Referenced by G4MTRunManager::TerminateWorkers().

70 {
71 }
void G4UserWorkerThreadInitialization::SetupRNGEngine ( const CLHEP::HepRandomEngine aRNGEngine) const
virtual

Definition at line 86 of file G4UserWorkerThreadInitialization.cc.

References FatalException, G4endl, and G4Exception().

Referenced by tbbTask::execute(), and G4MTRunManagerKernel::StartThread().

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

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