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

#include <ExG4RunAction01.hh>

Inheritance diagram for ExG4RunAction01:
G4UserRunAction

Public Member Functions

 ExG4RunAction01 ()
 
 ~ExG4RunAction01 ()
 
virtual void BeginOfRunAction (const G4Run *run)
 
virtual void EndOfRunAction (const G4Run *run)
 
void SetRndmFileName (const G4String &fileName)
 
void SetVerboseLevel (G4int level)
 
void SetSaveRndm (G4bool value)
 
void SetReadRndm (G4bool value)
 
void SetAutoSeed (G4bool value)
 
- 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

Run action class

It provides:

Definition at line 49 of file ExG4RunAction01.hh.

Constructor & Destructor Documentation

ExG4RunAction01::ExG4RunAction01 ( )

Standard constructor

Definition at line 45 of file ExG4RunAction01.cc.

46  : G4UserRunAction(),
47  fMessenger(this),
48  fRndmFileName(fgkDefaultRndmFileName),
49  fVerboseLevel(1),
50  fSaveRndm(false),
51  fReadRndm(false),
52  fAutoSeed(false)
53 {
54 /// Standard constructor
55 }
ExG4RunAction01::~ExG4RunAction01 ( )

Destructor

Definition at line 58 of file ExG4RunAction01.cc.

59 {
60 /// Destructor
61 }

Member Function Documentation

void ExG4RunAction01::BeginOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 64 of file ExG4RunAction01.cc.

References G4UImanager::ApplyCommand(), G4cout, G4endl, G4UniformRand, G4VVisManager::GetConcreteInstance(), G4Run::GetRunID(), G4RunManager::GetRunManager(), G4UImanager::GetUIpointer(), CLHEP::HepRandom::restoreEngineStatus(), CLHEP::HepRandom::saveEngineStatus(), G4RunManager::SetRandomNumberStore(), G4RunManager::SetRandomNumberStoreDir(), CLHEP::HepRandom::setTheSeeds(), and CLHEP::HepRandom::showEngineStatus().

65 {
66  if ( fVerboseLevel > 0 ) {
67  G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
68  }
69 
70  // read Rndm status
71  if ( fReadRndm ) {
72  G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
75  }
76 
77  // automatic (time-based) random seeds for each run
78  if ( fAutoSeed ) {
81 
82  G4cout << "*******************" << G4endl;
83  G4cout << "*** AUTOSEED ON ***" << G4endl;
84  G4cout << "*******************" << G4endl;
85 
86  long seeds[2];
87  time_t systime = time(NULL);
88  seeds[0] = (long) systime;
89  seeds[1] = (long) (systime*G4UniformRand());
92  }
93 
94  // save Rndm status
95  if ( fSaveRndm ) {
96  G4int runNumber = run->GetRunID();
97  std::ostringstream fileName;
98  fileName << "run" << runNumber << ".rndm";
99  CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
101  }
102 
104  G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
105  }
106 }
static void restoreEngineStatus(const char filename[]="Config.conf")
Definition: Random.cc:180
static G4VVisManager * GetConcreteInstance()
static void setTheSeeds(const long *seeds, int aux=-1)
Definition: Random.cc:141
void SetRandomNumberStore(G4bool flag)
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
G4int GetRunID() const
Definition: G4Run.hh:76
static void showEngineStatus()
Definition: Random.cc:203
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
static void saveEngineStatus(const char filename[]="Config.conf")
Definition: Random.cc:175
#define G4endl
Definition: G4ios.hh:61
void SetRandomNumberStoreDir(const G4String &dir)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
void ExG4RunAction01::EndOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 109 of file ExG4RunAction01.cc.

References G4UImanager::ApplyCommand(), G4VVisManager::GetConcreteInstance(), G4Run::GetRunID(), G4UImanager::GetUIpointer(), CLHEP::HepRandom::saveEngineStatus(), and CLHEP::HepRandom::showEngineStatus().

110 {
111  // save Rndm status
112  if ( fSaveRndm ) {
113  G4int runNumber = run->GetRunID();
114  std::ostringstream fileName;
115  fileName << "run" << runNumber << "end.rndm";
116  CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
118  }
119 
121  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
122  }
123 }
static G4VVisManager * GetConcreteInstance()
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4int GetRunID() const
Definition: G4Run.hh:76
static void showEngineStatus()
Definition: Random.cc:203
static void saveEngineStatus(const char filename[]="Config.conf")
Definition: Random.cc:175
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
void ExG4RunAction01::SetAutoSeed ( G4bool  value)
inline

Definition at line 97 of file ExG4RunAction01.hh.

Referenced by ExG4RunAction01Messenger::SetNewValue().

97  {
98  fAutoSeed = value;
99 }
const XML_Char int const XML_Char * value
void ExG4RunAction01::SetReadRndm ( G4bool  value)
inline

Definition at line 93 of file ExG4RunAction01.hh.

Referenced by ExG4RunAction01Messenger::SetNewValue().

93  {
94  fReadRndm = value;
95 }
const XML_Char int const XML_Char * value
void ExG4RunAction01::SetRndmFileName ( const G4String fileName)
inline

Definition at line 85 of file ExG4RunAction01.hh.

Referenced by ExG4RunAction01Messenger::SetNewValue().

85  {
86  fRndmFileName = fileName;
87 }
void ExG4RunAction01::SetSaveRndm ( G4bool  value)
inline

Definition at line 89 of file ExG4RunAction01.hh.

Referenced by ExG4RunAction01Messenger::SetNewValue().

89  {
90  fSaveRndm = value;
91 }
const XML_Char int const XML_Char * value
void ExG4RunAction01::SetVerboseLevel ( G4int  level)
inline

Definition at line 81 of file ExG4RunAction01.hh.

Referenced by ExG4RunAction01Messenger::SetNewValue().

81  {
82  fVerboseLevel = level;
83 }

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