Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExG4RunAction01 Class Reference

#include <ExG4RunAction01.hh>

Inheritance diagram for ExG4RunAction01:
Collaboration diagram for ExG4RunAction01:

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

  • setting verbose level
  • option to save random number status at begin and end of run
  • option to read random number from a file at begin of run
  • option for automatic (time-based) random seeds for each run

Definition at line 49 of file ExG4RunAction01.hh.

Constructor & Destructor Documentation

ExG4RunAction01::ExG4RunAction01 ( )

Standard constructor

Definition at line 46 of file ExG4RunAction01.cc.

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

Destructor

Definition at line 60 of file ExG4RunAction01.cc.

61 {
63 }
ExG4RunAction01::ExG4RunAction01 ( )
ExG4RunAction01::~ExG4RunAction01 ( )
ExG4RunAction01::ExG4RunAction01 ( )
ExG4RunAction01::~ExG4RunAction01 ( )

Member Function Documentation

void ExG4RunAction01::BeginOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 67 of file ExG4RunAction01.cc.

68 {
69  if ( fVerboseLevel > 0 ) {
70  G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
71  }
72 
73  // read Rndm status
74  if ( fReadRndm ) {
75  G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
76  G4Random::restoreEngineStatus(fRndmFileName);
77  G4Random::showEngineStatus();
78  }
79 
80  // automatic (time-based) random seeds for each run
81  if ( fAutoSeed ) {
84 
85  G4cout << "*******************" << G4endl;
86  G4cout << "*** AUTOSEED ON ***" << G4endl;
87  G4cout << "*******************" << G4endl;
88 
89  long seeds[2];
90  time_t systime = time(NULL);
91  seeds[0] = (long) systime;
92  seeds[1] = (long) (systime*G4UniformRand());
93  G4Random::setTheSeeds(seeds);
94  G4Random::showEngineStatus();
95  }
96 
97  // save Rndm status
98  if ( fSaveRndm ) {
99  G4int runNumber = run->GetRunID();
100  std::ostringstream fileName;
101  fileName << "run" << runNumber << ".rndm";
102  G4Random::saveEngineStatus(fileName.str().c_str());
103  G4Random::showEngineStatus();
104  }
105 
107  G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
108  }
109 }
static G4VVisManager * GetConcreteInstance()
void SetRandomNumberStore(G4bool flag)
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
G4int GetRunID() const
Definition: G4Run.hh:76
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
#define G4endl
Definition: G4ios.hh:61
void SetRandomNumberStoreDir(const G4String &dir)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function:

virtual void ExG4RunAction01::BeginOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

virtual void ExG4RunAction01::BeginOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

void ExG4RunAction01::EndOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 113 of file ExG4RunAction01.cc.

114 {
115  // save Rndm status
116  if ( fSaveRndm ) {
117  G4int runNumber = run->GetRunID();
118  std::ostringstream fileName;
119  fileName << "run" << runNumber << "end.rndm";
120  G4Random::saveEngineStatus(fileName.str().c_str());
121  G4Random::showEngineStatus();
122  }
123 
125  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
126  }
127 }
static G4VVisManager * GetConcreteInstance()
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4int GetRunID() const
Definition: G4Run.hh:76
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function:

virtual void ExG4RunAction01::EndOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

virtual void ExG4RunAction01::EndOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

void ExG4RunAction01::SetAutoSeed ( G4bool  value)
void ExG4RunAction01::SetAutoSeed ( G4bool  value)
inline

Definition at line 97 of file ExG4RunAction01.hh.

97  {
98  fAutoSeed = value;
99 }
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:

void ExG4RunAction01::SetAutoSeed ( G4bool  value)
void ExG4RunAction01::SetReadRndm ( G4bool  value)
void ExG4RunAction01::SetReadRndm ( G4bool  value)
void ExG4RunAction01::SetReadRndm ( G4bool  value)
inline

Definition at line 93 of file ExG4RunAction01.hh.

93  {
94  fReadRndm = value;
95 }
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:

void ExG4RunAction01::SetRndmFileName ( const G4String fileName)
void ExG4RunAction01::SetRndmFileName ( const G4String fileName)
void ExG4RunAction01::SetRndmFileName ( const G4String fileName)
inline

Definition at line 85 of file ExG4RunAction01.hh.

85  {
86  fRndmFileName = fileName;
87 }

Here is the caller graph for this function:

void ExG4RunAction01::SetSaveRndm ( G4bool  value)
void ExG4RunAction01::SetSaveRndm ( G4bool  value)
inline

Definition at line 89 of file ExG4RunAction01.hh.

89  {
90  fSaveRndm = value;
91 }
const XML_Char int const XML_Char * value
Definition: expat.h:331

Here is the caller graph for this function:

void ExG4RunAction01::SetSaveRndm ( G4bool  value)
void ExG4RunAction01::SetVerboseLevel ( G4int  level)
void ExG4RunAction01::SetVerboseLevel ( G4int  level)
inline

Definition at line 81 of file ExG4RunAction01.hh.

81  {
82  fVerboseLevel = level;
83 }

Here is the caller graph for this function:

void ExG4RunAction01::SetVerboseLevel ( G4int  level)

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