Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
F04RunAction.cc
이 파일의 문서화 페이지로 가기
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: F04RunAction.cc 78002 2013-12-02 08:25:49Z gcosmo $
27 //
30 //
31 
32 #include "F04RunAction.hh"
33 #include "F04RunActionMessenger.hh"
34 
35 #include "G4Run.hh"
36 #include "G4RunManager.hh"
37 
38 #include "Randomize.hh"
39 
40 #include <ctime>
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45  : fSaveRndm(0), fAutoSeed(false)
46 {
48 }
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 {
54  delete fRunMessenger;
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 #include "G4Threading.hh"
59 
61 {
62  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
63 
66 
67  if (fAutoSeed) {
68  // automatic (time-based) random seeds for each run
69  G4cout << "*******************" << G4endl;
70  G4cout << "*** AUTOSEED ON ***" << G4endl;
71  G4cout << "*******************" << G4endl;
72  long seeds[2];
73  time_t systime = time(NULL);
74  seeds[0] = (long) systime;
75  seeds[1] = (long) (systime*G4UniformRand());
76  G4Random::setTheSeeds(seeds);
77  G4Random::showEngineStatus();
78  } else {
79  G4Random::showEngineStatus();
80  }
81 
82  if (fSaveRndm > 0)
83  {
84  std::ostringstream os;
85  os<<"beginOfRun_"<<G4Threading::G4GetThreadId()<<".rndm";
86  G4Random::saveEngineStatus(os.str().c_str());
87  }
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93 {
94  if (fSaveRndm == 1) {
95  G4Random::showEngineStatus();
96  std::ostringstream os;
97  os<<"endOfRun_"<<G4Threading::G4GetThreadId()<<".rndm";
98  G4Random::saveEngineStatus(os.str().c_str());
99  }
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
void SetRandomNumberStoreDir(const G4String &dir)
#define G4endl
Definition: G4ios.hh:61
virtual void EndOfRunAction(const G4Run *)
Definition: F04RunAction.cc:92
F04RunActionMessenger * fRunMessenger
Definition: F04RunAction.hh:61
G4int GetRunID() const
Definition: G4Run.hh:76
#define G4UniformRand()
Definition: Randomize.hh:53
G4bool fAutoSeed
Definition: F04RunAction.hh:64
virtual void BeginOfRunAction(const G4Run *)
Definition: F04RunAction.cc:60
Definition: G4Run.hh:46
void SetRandomNumberStore(G4bool flag)
G4GLOB_DLL std::ostream G4cout
Definition of the F04RunAction class.
virtual ~F04RunAction()
Definition: F04RunAction.cc:52
Definition of the F04RunActionMessenger class.
G4int G4GetThreadId()
Definition: G4Threading.cc:128