Geant4  10.02.p02
WLSRunAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: WLSRunAction.cc 70603 2013-06-03 11:23:16Z gcosmo $
27 //
30 //
31 //
32 #include "WLSRunAction.hh"
33 #include "WLSRunActionMessenger.hh"
34 
35 #include "G4Run.hh"
36 #include "G4RunManager.hh"
37 
38 #include "Randomize.hh"
39 
41 #include "WLSSteppingAction.hh"
42 
43 #include <ctime>
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  : fSaveRndm(0), fAutoSeed(false)
49 {
51 }
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 {
57  delete fRunMessenger;
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 {
64  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
65 
68 
69  if (fAutoSeed) {
70  // automatic (time-based) random seeds for each run
71  G4cout << "*******************" << G4endl;
72  G4cout << "*** AUTOSEED ON ***" << G4endl;
73  G4cout << "*******************" << G4endl;
74  long seeds[2];
75  time_t systime = time(NULL);
76  seeds[0] = (long) systime;
77  seeds[1] = (long) (systime*G4UniformRand());
78  G4Random::setTheSeeds(seeds);
79  G4Random::showEngineStatus();
80  } else {
81  G4Random::showEngineStatus();
82  }
83 
84  if (fSaveRndm > 0) G4Random::saveEngineStatus("BeginOfRun.rndm");
85 
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  if (fSaveRndm == 1)
93  {
94  G4Random::showEngineStatus();
95  G4Random::saveEngineStatus("endOfRun.rndm");
96  }
97 }
void SetRandomNumberStore(G4bool flag)
Definition of the WLSDetectorConstruction class.
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
WLSRunActionMessenger * fRunMessenger
Definition: WLSRunAction.hh:65
Definition of the WLSRunAction class.
G4bool fAutoSeed
Definition: WLSRunAction.hh:68
G4int GetRunID() const
Definition: G4Run.hh:76
Definition: G4Run.hh:46
virtual ~WLSRunAction()
Definition: WLSRunAction.cc:55
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
#define G4endl
Definition: G4ios.hh:61
Definition of the WLSSteppingAction class.
virtual void BeginOfRunAction(const G4Run *)
Definition: WLSRunAction.cc:62
void SetRandomNumberStoreDir(const G4String &dir)
virtual void EndOfRunAction(const G4Run *)
Definition: WLSRunAction.cc:90
Definition of the WLSRunActionMessenger class.