|
Geant4 examples
|
Run action class. More...
#include <Doxymodules_common.h>
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) |
Private Attributes | |
| ExG4RunAction01Messenger | fMessenger |
| G4String | fRndmFileName |
| G4int | fVerboseLevel |
| G4bool | fSaveRndm |
| G4bool | fReadRndm |
| G4bool | fAutoSeed |
Static Private Attributes | |
| static const G4String | fgkDefaultRndmFileName = "run0.rndm" |
Run action class.
It provides:
Definition at line 65 of file Doxymodules_common.h.
| ExG4RunAction01::ExG4RunAction01 | ( | ) |
Standard constructor
Definition at line 45 of file ExG4RunAction01.cc.
: G4UserRunAction(), fMessenger(this), fRndmFileName(fgkDefaultRndmFileName), fVerboseLevel(1), fSaveRndm(false), fReadRndm(false), fAutoSeed(false) { }
| ExG4RunAction01::~ExG4RunAction01 | ( | ) |
Reimplemented from G4UserRunAction.
Definition at line 64 of file ExG4RunAction01.cc.
{
if ( fVerboseLevel > 0 ) {
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
}
// read Rndm status
if ( fReadRndm ) {
G4cout << "\n---> rndm status restored from file: " << fRndmFileName << G4endl;
CLHEP::HepRandom::restoreEngineStatus(fRndmFileName);
CLHEP::HepRandom::showEngineStatus();
}
// automatic (time-based) random seeds for each run
if ( fAutoSeed ) {
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
G4cout << "*******************" << G4endl;
G4cout << "*** AUTOSEED ON ***" << G4endl;
G4cout << "*******************" << G4endl;
long seeds[2];
time_t systime = time(NULL);
seeds[0] = (long) systime;
seeds[1] = (long) (systime*G4UniformRand());
CLHEP::HepRandom::setTheSeeds(seeds);
CLHEP::HepRandom::showEngineStatus();
}
// save Rndm status
if ( fSaveRndm ) {
G4int runNumber = run->GetRunID();
std::ostringstream fileName;
fileName << "run" << runNumber << ".rndm";
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
CLHEP::HepRandom::showEngineStatus();
}
if ( G4VVisManager::GetConcreteInstance() ) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
}
}
Reimplemented from G4UserRunAction.
Definition at line 109 of file ExG4RunAction01.cc.
{
// save Rndm status
if ( fSaveRndm ) {
G4int runNumber = run->GetRunID();
std::ostringstream fileName;
fileName << "run" << runNumber << "end.rndm";
CLHEP::HepRandom::saveEngineStatus(fileName.str().c_str());
CLHEP::HepRandom::showEngineStatus();
}
if ( G4VVisManager::GetConcreteInstance() ) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
}
Definition at line 85 of file ExG4RunAction01.hh.
{
fRndmFileName = fileName;
}
| void ExG4RunAction01::SetVerboseLevel | ( | G4int | level | ) | [inline] |
Definition at line 81 of file ExG4RunAction01.hh.
{
fVerboseLevel = level;
}
| void ExG4RunAction01::SetSaveRndm | ( | G4bool | value | ) | [inline] |
Definition at line 89 of file ExG4RunAction01.hh.
{
fSaveRndm = value;
}
| void ExG4RunAction01::SetReadRndm | ( | G4bool | value | ) | [inline] |
Definition at line 93 of file ExG4RunAction01.hh.
{
fReadRndm = value;
}
| void ExG4RunAction01::SetAutoSeed | ( | G4bool | value | ) | [inline] |
Definition at line 97 of file ExG4RunAction01.hh.
{
fAutoSeed = value;
}
const G4String ExG4RunAction01::fgkDefaultRndmFileName = "run0.rndm" [static, private] |
Definition at line 69 of file ExG4RunAction01.hh.
Definition at line 72 of file ExG4RunAction01.hh.
G4String ExG4RunAction01::fRndmFileName [private] |
Definition at line 73 of file ExG4RunAction01.hh.
G4int ExG4RunAction01::fVerboseLevel [private] |
Definition at line 74 of file ExG4RunAction01.hh.
G4bool ExG4RunAction01::fSaveRndm [private] |
Definition at line 75 of file ExG4RunAction01.hh.
G4bool ExG4RunAction01::fReadRndm [private] |
Definition at line 76 of file ExG4RunAction01.hh.
G4bool ExG4RunAction01::fAutoSeed [private] |
Definition at line 77 of file ExG4RunAction01.hh.
1.7.4