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

#include <F04RunAction.hh>

Inheritance diagram for F04RunAction:
G4UserRunAction

Public Member Functions

 F04RunAction ()
 
virtual ~F04RunAction ()
 
virtual void BeginOfRunAction (const G4Run *)
 
virtual void EndOfRunAction (const G4Run *)
 
void SetRndmFreq (G4int val)
 
G4int GetRndmFreq ()
 
void SetAutoSeed (const G4bool val)
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
virtual G4RunGenerateRun ()
 
void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

Definition at line 42 of file F04RunAction.hh.

Constructor & Destructor Documentation

F04RunAction::F04RunAction ( )

Definition at line 44 of file F04RunAction.cc.

45  : fSaveRndm(0), fAutoSeed(false)
46 {
47  fRunMessenger = new F04RunActionMessenger(this);
48 }
F04RunAction::~F04RunAction ( )
virtual

Definition at line 52 of file F04RunAction.cc.

53 {
54  delete fRunMessenger;
55 }

Member Function Documentation

void F04RunAction::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 60 of file F04RunAction.cc.

References G4cout, G4endl, G4Threading::G4GetThreadId(), G4UniformRand, G4Run::GetRunID(), G4RunManager::GetRunManager(), G4RunManager::SetRandomNumberStore(), and G4RunManager::SetRandomNumberStoreDir().

61 {
62  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
63 
66 
67  if (fAutoSeed) {
68  // automatic (time-based) random seeds for each run
69  G4cout << "*******************" << G4endl;
70  G4cout << "*** AUTOSEED ON ***" << G4endl;
71  G4cout << "*******************" << G4endl;
72  long seeds[2];
73  time_t systime = time(NULL);
74  seeds[0] = (long) systime;
75  seeds[1] = (long) (systime*G4UniformRand());
76  G4Random::setTheSeeds(seeds);
77  G4Random::showEngineStatus();
78  } else {
79  G4Random::showEngineStatus();
80  }
81 
82  if (fSaveRndm > 0)
83  {
84  std::ostringstream os;
85  os<<"beginOfRun_"<<G4Threading::G4GetThreadId()<<".rndm";
86  G4Random::saveEngineStatus(os.str().c_str());
87  }
88 }
void SetRandomNumberStore(G4bool flag)
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
G4int GetRunID() const
Definition: G4Run.hh:76
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
#define G4endl
Definition: G4ios.hh:61
void SetRandomNumberStoreDir(const G4String &dir)
G4int G4GetThreadId()
Definition: G4Threading.cc:103
void F04RunAction::EndOfRunAction ( const G4Run )
virtual

Reimplemented from G4UserRunAction.

Definition at line 92 of file F04RunAction.cc.

References G4Threading::G4GetThreadId().

93 {
94  if (fSaveRndm == 1) {
95  G4Random::showEngineStatus();
96  std::ostringstream os;
97  os<<"endOfRun_"<<G4Threading::G4GetThreadId()<<".rndm";
98  G4Random::saveEngineStatus(os.str().c_str());
99  }
100 }
G4int G4GetThreadId()
Definition: G4Threading.cc:103
G4int F04RunAction::GetRndmFreq ( )
inline

Definition at line 55 of file F04RunAction.hh.

Referenced by F04EventAction::EndOfEventAction().

55 {return fSaveRndm;}
void F04RunAction::SetAutoSeed ( const G4bool  val)
inline

Definition at line 57 of file F04RunAction.hh.

Referenced by F04RunActionMessenger::SetNewValue().

57 {fAutoSeed = val;}
void F04RunAction::SetRndmFreq ( G4int  val)
inline

Definition at line 54 of file F04RunAction.hh.

Referenced by F04RunActionMessenger::SetNewValue().

54 {fSaveRndm = val;}

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