Public Member Functions | Private Attributes | List of all members
EDepSim::UserRunAction Class Reference

#include <EDepSimUserRunAction.hh>

Inheritance diagram for EDepSim::UserRunAction:

Public Member Functions

 UserRunAction ()
 
virtual ~UserRunAction ()
 
void BeginOfRunAction (const G4Run *)
 
void EndOfRunAction (const G4Run *)
 
const G4Timer * GetRunTimer (void) const
 
void SetSeed (long)
 
long GetSeed (void) const
 Get the seed that started the low level random generator. More...
 
void SetTimeSeed ()
 Build a seed for the generator based on the system time. More...
 
void SetDetSimRunId (int v)
 
void SetDetSimSubrunId (int v)
 
int GetDetSimSubrunId () const
 Get the subrun id value. More...
 

Private Attributes

EDepSim::UserRunActionMessengerfMessenger
 The messenger for this action. More...
 
G4String fStartTime
 The time that the run was started. More...
 
G4String fStopTime
 The time that the run was stopped. More...
 
G4Timer * fTimer
 The running time for the run. More...
 
int fSubrunId
 The cached value of the subrun id. More...
 

Detailed Description

Definition at line 16 of file EDepSimUserRunAction.hh.

Constructor & Destructor Documentation

EDepSim::UserRunAction::UserRunAction ( )

Definition at line 21 of file EDepSimUserRunAction.cc.

22  : fStartTime("invalid"), fStopTime("invalid"), fSubrunId(-1) {
23  fTimer = new G4Timer;
25 }
EDepSim::UserRunActionMessenger * fMessenger
The messenger for this action.
G4Timer * fTimer
The running time for the run.
G4String fStopTime
The time that the run was stopped.
int fSubrunId
The cached value of the subrun id.
G4String fStartTime
The time that the run was started.
EDepSim::UserRunAction::~UserRunAction ( )
virtual

Definition at line 27 of file EDepSimUserRunAction.cc.

27  {
28  delete fTimer;
29  delete fMessenger;
30 }
EDepSim::UserRunActionMessenger * fMessenger
The messenger for this action.
G4Timer * fTimer
The running time for the run.

Member Function Documentation

void EDepSim::UserRunAction::BeginOfRunAction ( const G4Run *  aRun)

Definition at line 32 of file EDepSimUserRunAction.cc.

32  {
33  // Initialize the run header
34  time_t ltime = time(NULL);
35  fStartTime = ctime(&ltime);
36  fTimer->Start();
37 
38 #ifdef UPDATE_VISUALIZATION
39  if (G4VVisManager::GetConcreteInstance()) {
40  G4UImanager* UI = G4UImanager::GetUIpointer();
41  UI->ApplyCommand("/vis/scene/notifyHandlers");
42  }
43 #endif
44 
45  EDepSimLog("### Run " << aRun->GetRunID() << " starting.");
46 
47 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
G4Timer * fTimer
The running time for the run.
G4String fStartTime
The time that the run was started.
void EDepSim::UserRunAction::EndOfRunAction ( const G4Run *  aRun)

Definition at line 49 of file EDepSimUserRunAction.cc.

49  {
50  fTimer->Stop();
51  time_t ltime = time(NULL);
52  fStopTime = ctime(&ltime);
53 
54  EDepSimLog("### Run " << aRun->GetRunID() << " ending.");
55  EDepSimLog("Number of events = " << aRun->GetNumberOfEvent());
57 
58 
59 #ifdef UPDATE_VISUALIZATION
60  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
61 
62  if( pVVisManager ) {
63  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
64  }
65 #endif
66 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
G4Timer * fTimer
The running time for the run.
G4String fStopTime
The time that the run was stopped.
int EDepSim::UserRunAction::GetDetSimSubrunId ( ) const

Get the subrun id value.

Definition at line 111 of file EDepSimUserRunAction.cc.

111  {
112  return fSubrunId;
113 }
int fSubrunId
The cached value of the subrun id.
const G4Timer* EDepSim::UserRunAction::GetRunTimer ( void  ) const
inline

Definition at line 24 of file EDepSimUserRunAction.hh.

24 {return fTimer;};
G4Timer * fTimer
The running time for the run.
long EDepSim::UserRunAction::GetSeed ( void  ) const

Get the seed that started the low level random generator.

Definition at line 75 of file EDepSimUserRunAction.cc.

75  {
76  return G4Random::getTheSeed();
77 }
void EDepSim::UserRunAction::SetDetSimRunId ( int  v)

Set the DetSim Run Id to a specific value. This is the first run id that will be used by GEANT. GEANT will automatically increment the run id everytime it starts a new internal run. The run id should be accessed through G4RunInfo (see G4RunManager).

Definition at line 102 of file EDepSimUserRunAction.cc.

102  {
103  G4RunManager* manager = G4RunManager::GetRunManager();
104  manager->SetRunIDCounter(v);
105 }
void EDepSim::UserRunAction::SetDetSimSubrunId ( int  v)

Set the DetSim Subrun Id to a specific value. This has no internal meaning and is just copied to the output event.

Definition at line 107 of file EDepSimUserRunAction.cc.

107  {
108  fSubrunId = v;
109 }
int fSubrunId
The cached value of the subrun id.
void EDepSim::UserRunAction::SetSeed ( long  seed)

Set the seed to a new value. This takes a long since the low-level random generate expects a long seed.

Definition at line 68 of file EDepSimUserRunAction.cc.

68  {
69  if (seed<0) seed = -seed;
70  EDepSimLog("### Random seed number set to: " << seed);
71  G4Random::setTheSeed(seed);
72 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
void EDepSim::UserRunAction::SetTimeSeed ( )

Build a seed for the generator based on the system time.

Definition at line 79 of file EDepSimUserRunAction.cc.

79  {
80  long seed = 0;
81 #ifdef __USE_POSIX
82  struct timeval buffer;
83  gettimeofday(&buffer,NULL);
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);
87 #else
88 #warning Using seconds since epoch to seed the random generator.
89  seed = time(NULL);
90 #endif
91  // Make sure the seed is positive;
92  if (seed<0) seed = -seed;
93  // Make sure the seed isn't too large.
94  seed = seed % (2l<<(8*sizeof(long)-4));
95  // Make sure the seed is odd and not zero.
96  seed += (seed % 2) + 1;
97  SetSeed(long(seed));
98  // Condition the seed.
99  for (int i=0; i<10000000; ++i) G4UniformRand();
100 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
static QStrList * l
Definition: config.cpp:1044
int gettimeofday(struct timeval *, struct timezone *)

Member Data Documentation

EDepSim::UserRunActionMessenger* EDepSim::UserRunAction::fMessenger
private

The messenger for this action.

Definition at line 51 of file EDepSimUserRunAction.hh.

G4String EDepSim::UserRunAction::fStartTime
private

The time that the run was started.

Definition at line 54 of file EDepSimUserRunAction.hh.

G4String EDepSim::UserRunAction::fStopTime
private

The time that the run was stopped.

Definition at line 57 of file EDepSimUserRunAction.hh.

int EDepSim::UserRunAction::fSubrunId
private

The cached value of the subrun id.

Definition at line 63 of file EDepSimUserRunAction.hh.

G4Timer* EDepSim::UserRunAction::fTimer
private

The running time for the run.

Definition at line 60 of file EDepSimUserRunAction.hh.


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