ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ErrorRunManagerHelper.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
27 // ------------------------------------------------------------
28 // GEANT 4 class implementation file
29 // ------------------------------------------------------------
30 //
31 
32 #include "G4Navigator.hh"
33 
34 #include "G4Timer.hh"
35 
37 
38 #include "G4RunManagerKernel.hh"
40 #include "G4ErrorPhysicsList.hh"
42 #include "G4RunManager.hh"
43 
44 //-----------------------------------------------------------------------
45 
48 
49 //-----------------------------------------------------------------------
51 { return fRunManagerKernel; }
52 
53 
54 //-----------------------------------------------------------------------
56 {
57  if(fRunManagerKernel) {
58  G4Exception("G4ErrorRunManagerHelper::G4ErrorRunManagerHelper()",
59  "InvalidSetup", FatalException,
60  "G4eRunManageKernel constructed twice.");
61  }
62  fRunManagerKernel = this;
63 
64  //----- Look if somebody has created a G4RunManagerKernel
66  if( theG4RunManagerKernel == 0 ) {
67  //--- if not create it
69  G4cout << " creating G4RunManagerKernel " << theG4RunManagerKernel << G4endl;
70  }
71 
74  theUserWorld = 0;
75 
76 }
77 
78 
79 //-----------------------------------------------------------------------
81 {
82 }
83 
84 
85 //-----------------------------------------------------------------------
87 {
88  theUserWorld = userInit->Construct();
89 }
90 
91 
92 //-----------------------------------------------------------------------
94 {
95  theUserWorld = userInit;
96 }
97 
98 
99 //-----------------------------------------------------------------------
101 {
102  theUserPhysicsList = userInit;
103 }
104 
105 
106 //-----------------------------------------------------------------------
108 {
109  //check if user world has been directly called or someone initialized the world volume already
110  //----- First option: geometry has been defined to GEANT4e
111  if( theUserWorld != 0 ) {
113 
114  //----- Second option: geometry has been defined to GEANT4, do nothing GEANT4 should take care
115  } else {
116  //--- Check that indeed geometry has been defined to GEANT4
118  ->GetNavigatorForTracking()->GetWorldVolume() == 0 ) {
119  G4Exception("G4ErrorRunManagerHelper::InitializeGeometry()",
120  "InvalisSetup", FatalException,
121  "No world defined in your geometry!" );
122  }
123 
124  }
125 }
126 
127 
128 //-----------------------------------------------------------------------
130 {
131 
132  G4cout << " G4ErrorRunManagerHelper::InitializePhysics " << G4endl;
133 
134  //----- First option: physics list has been defined to GEANT4e
135  if( theUserPhysicsList != 0 ) {
138  }else {
139  //----- Second option: physics list has been defined to GEANT4, do nothing GEANT4 should take care
141  //--- Physics should be G4ErrorPhysicsList, else send a warning
142  if( static_cast<const G4ErrorPhysicsList*>(G4RunManager::GetRunManager()->GetUserPhysicsList()) == 0 ) {
143  std::ostringstream message;
144  message << "Physics list is not G4ErrorPhysicsList. Are you sure?";
145  G4Exception("G4ErrorRunManagerHelper::InitializePhysics()",
146  "GEANT4e-Notification", JustWarning, message);
147  }
148  } else {
149  //----- Third option: no physics list has been defined, define a G4ErrorPhysicsList
151  // theG4RunManagerKernel->SetPhysics(new ExN02PhysicsList);
153  }
154  }
155 
156 }
157 
158 
159 //-----------------------------------------------------------------------
161 {
163 }
164 
165 
166 //-----------------------------------------------------------------------
168 {
169 
171 }
172 
173 
174 //-----------------------------------------------------------------------
176 {
178 }
179 
180 
181 //-----------------------------------------------------------------------
183 {
185 }
186