Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ErrorRunManagerHelper.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: G4ErrorRunManagerHelper.cc 78318 2013-12-11 15:02:40Z gcosmo $
27 //
28 // ------------------------------------------------------------
29 // GEANT 4 class implementation file
30 // ------------------------------------------------------------
31 //
32 
33 #include "G4Navigator.hh"
34 
35 #include "G4Timer.hh"
36 
38 
39 #include "G4RunManagerKernel.hh"
41 #include "G4ErrorPhysicsList.hh"
43 #include "G4RunManager.hh"
44 
45 //-----------------------------------------------------------------------
46 
49 
50 //-----------------------------------------------------------------------
52 { return fRunManagerKernel; }
53 
54 
55 //-----------------------------------------------------------------------
57 {
58  if(fRunManagerKernel) {
59  G4Exception("G4ErrorRunManagerHelper::G4ErrorRunManagerHelper()",
60  "InvalidSetup", FatalException,
61  "G4eRunManageKernel constructed twice.");
62  }
63  fRunManagerKernel = this;
64 
65  //----- Look if somebody has created a G4RunManagerKernel
67  if( theG4RunManagerKernel == 0 ) {
68  //--- if not create it
70  G4cout << " creating G4RunManagerKernel " << theG4RunManagerKernel << G4endl;
71  }
72 
75  theUserWorld = 0;
76 
77 }
78 
79 
80 //-----------------------------------------------------------------------
82 {
83 }
84 
85 
86 //-----------------------------------------------------------------------
88 {
89  theUserWorld = userInit->Construct();
90 }
91 
92 
93 //-----------------------------------------------------------------------
95 {
96  theUserWorld = userInit;
97 }
98 
99 
100 //-----------------------------------------------------------------------
102 {
103  theUserPhysicsList = userInit;
104 }
105 
106 
107 //-----------------------------------------------------------------------
109 {
110  //check if user world has been directly called or someone initialized the world volume already
111  //----- First option: geometry has been defined to GEANT4e
112  if( theUserWorld != 0 ) {
114 
115  //----- Second option: geometry has been defined to GEANT4, do nothing GEANT4 should take care
116  } else {
117  //--- Check that indeed geometry has been defined to GEANT4
119  ->GetNavigatorForTracking()->GetWorldVolume() == 0 ) {
120  G4Exception("G4ErrorRunManagerHelper::InitializeGeometry()",
121  "InvalisSetup", FatalException,
122  "No world defined in your geometry!" );
123  }
124 
125  }
126 }
127 
128 
129 //-----------------------------------------------------------------------
131 {
132 
133  G4cout << " G4ErrorRunManagerHelper::InitializePhysics " << G4endl;
134 
135  //----- First option: physics list has been defined to GEANT4e
136  if( theUserPhysicsList != 0 ) {
139  }else {
140  //----- Second option: physics list has been defined to GEANT4, do nothing GEANT4 should take care
142  //--- Physics should be G4ErrorPhysicsList, else send a warning
143  if( static_cast<const G4ErrorPhysicsList*>(G4RunManager::GetRunManager()->GetUserPhysicsList()) == 0 ) {
144  std::ostringstream message;
145  message << "Physics list is not G4ErrorPhysicsList. Are you sure?";
146  G4Exception("G4ErrorRunManagerHelper::InitializePhysics()",
147  "GEANT4e-Notification", JustWarning, message);
148  }
149  } else {
150  //----- Third option: no physics list has been defined, define a G4ErrorPhysicsList
152  // theG4RunManagerKernel->SetPhysics(new ExN02PhysicsList);
154  }
155  }
156 
157 }
158 
159 
160 //-----------------------------------------------------------------------
162 {
164 }
165 
166 
167 //-----------------------------------------------------------------------
169 {
170 
172 }
173 
174 
175 //-----------------------------------------------------------------------
177 {
179 }
180 
181 
182 //-----------------------------------------------------------------------
184 {
186 }
187 
G4bool RunInitialization(G4bool fakeRun=false)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4VUserPhysicsList * theUserPhysicsList
#define G4endl
Definition: G4ios.hh:61
void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void message(RunManager *runmanager)
Definition: ts_scorers.cc:72
#define G4ThreadLocal
Definition: tls.hh:69
void SetUserAction(G4UserEventAction *userAction)
static G4RunManagerKernel * GetRunManagerKernel()
void SetPhysics(G4VUserPhysicsList *uPhys)
G4VPhysicalVolume * theUserWorld
void SetUserAction(G4UserTrackingAction *userAction)
static G4EventManager * GetEventManager()
static G4ThreadLocal G4ErrorRunManagerHelper * fRunManagerKernel
static G4ErrorRunManagerHelper * GetRunManagerKernel()
void SetVerboseLevel(G4int vl)
G4VUserPhysicsList * GetUserPhysicsList() const
static G4TransportationManager * GetTransportationManager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
virtual G4VPhysicalVolume * Construct()=0
G4GLOB_DLL std::ostream G4cout
G4RunManagerKernel * theG4RunManagerKernel
void SetUserInitialization(G4VUserDetectorConstruction *userInit)