8 #include <Randomize.hh> 10 #include <G4RunManager.hh> 11 #include <G4UImanager.hh> 12 #include <G4VVisManager.hh> 22 : fStartTime(
"invalid"), fStopTime(
"invalid"), fSubrunId(-1) {
34 time_t ltime =
time(NULL);
38 #ifdef UPDATE_VISUALIZATION 39 if (G4VVisManager::GetConcreteInstance()) {
40 G4UImanager* UI = G4UImanager::GetUIpointer();
41 UI->ApplyCommand(
"/vis/scene/notifyHandlers");
45 EDepSimLog(
"### Run " << aRun->GetRunID() <<
" starting.");
51 time_t ltime =
time(NULL);
54 EDepSimLog(
"### Run " << aRun->GetRunID() <<
" ending.");
55 EDepSimLog(
"Number of events = " << aRun->GetNumberOfEvent());
59 #ifdef UPDATE_VISUALIZATION 60 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
63 G4UImanager::GetUIpointer()->ApplyCommand(
"/vis/viewer/update");
69 if (seed<0) seed = -seed;
70 EDepSimLog(
"### Random seed number set to: " << seed);
71 G4Random::setTheSeed(seed);
76 return G4Random::getTheSeed();
82 struct timeval buffer;
84 EDepSimLog(
"### Set seed from local time: " << ctime(&buffer.tv_sec));
85 EDepSimLog(
"### Micro-second offset: " << buffer.tv_usec);
86 seed = long(buffer.tv_sec + buffer.tv_usec);
88 #warning Using seconds since epoch to seed the random generator. 92 if (seed<0) seed = -seed;
94 seed = seed % (2
l<<(8*
sizeof(long)-4));
96 seed += (seed % 2) + 1;
99 for (
int i=0; i<10000000; ++i) G4UniformRand();
103 G4RunManager* manager = G4RunManager::GetRunManager();
104 manager->SetRunIDCounter(v);
#define EDepSimLog(outStream)
int GetDetSimSubrunId() const
Get the subrun id value.
EDepSim::UserRunActionMessenger * fMessenger
The messenger for this action.
void EndOfRunAction(const G4Run *)
G4Timer * fTimer
The running time for the run.
G4String fStopTime
The time that the run was stopped.
void SetTimeSeed()
Build a seed for the generator based on the system time.
int fSubrunId
The cached value of the subrun id.
void SetDetSimSubrunId(int v)
void BeginOfRunAction(const G4Run *)
void SetDetSimRunId(int v)
G4String fStartTime
The time that the run was started.
int gettimeofday(struct timeval *, struct timezone *)
long GetSeed(void) const
Get the seed that started the low level random generator.