[828] | 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 | // $Id: G4RunManagerKernel.hh,v 1.9 2007/05/30 00:42:09 asaim Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[828] | 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
| 32 | // class description: |
---|
| 33 | // |
---|
| 34 | // This is a class for mandatory control of GEANT4 kernel. |
---|
| 35 | // |
---|
| 36 | // This class is constructed by G4RunManager. If a user uses his/her own |
---|
| 37 | // class instead of G4RunManager, this class must be instantiated by |
---|
| 38 | // him/herself at the very beginning of the application and must be deleted |
---|
| 39 | // at the very end of the application. Also, following methods must be |
---|
| 40 | // invoked in the proper order. |
---|
| 41 | // DefineWorldVolume |
---|
| 42 | // InitializePhysics |
---|
| 43 | // RunInitialization |
---|
| 44 | // RunTermination |
---|
| 45 | // |
---|
| 46 | // User must provide his/her own classes derived from the following |
---|
| 47 | // abstract class and register it to the RunManagerKernel. |
---|
| 48 | // G4VUserPhysicsList - Particle types, Processes and Cuts |
---|
| 49 | // |
---|
| 50 | // G4RunManagerKernel does not have any eveny loop. Handling of events |
---|
| 51 | // is managed by G4RunManager. |
---|
| 52 | // |
---|
| 53 | |
---|
| 54 | #ifndef G4RunManagerKernel_h |
---|
| 55 | #define G4RunManagerKernel_h 1 |
---|
| 56 | |
---|
| 57 | class G4VUserPhysicsList; |
---|
| 58 | |
---|
| 59 | class G4VPhysicalVolume; |
---|
| 60 | class G4Region; |
---|
| 61 | class G4ExceptionHandler; |
---|
| 62 | class G4StackManager; |
---|
| 63 | class G4TrackingManager; |
---|
| 64 | class G4PrimaryTransformer; |
---|
| 65 | |
---|
| 66 | #include "globals.hh" |
---|
| 67 | #include "G4EventManager.hh" |
---|
| 68 | |
---|
| 69 | class G4RunManagerKernel |
---|
| 70 | { |
---|
| 71 | public: // with description |
---|
| 72 | static G4RunManagerKernel* GetRunManagerKernel(); |
---|
| 73 | // Static method which returns the singleton pointer of G4RunManagerKernel or |
---|
| 74 | // its derived class. |
---|
| 75 | |
---|
| 76 | private: |
---|
| 77 | static G4RunManagerKernel* fRunManagerKernel; |
---|
| 78 | |
---|
| 79 | public: // with description |
---|
| 80 | G4RunManagerKernel(); |
---|
| 81 | virtual ~G4RunManagerKernel(); |
---|
| 82 | // The constructor and the destructor. The user must construct this class |
---|
| 83 | // object at the beginning of his/her main() and must delete it at the |
---|
| 84 | // bottom of the main(), unless he/she used G4RunManager. |
---|
| 85 | |
---|
| 86 | public: // with description |
---|
| 87 | void DefineWorldVolume(G4VPhysicalVolume * worldVol, |
---|
| 88 | G4bool topologyIsChanged=true); |
---|
| 89 | // This method must be invoked if the geometry setup has been changed between |
---|
| 90 | // runs. The flag 'topologyIsChanged' will specify if the geometry topology is |
---|
| 91 | // different from the original one used in the previous run; if not, it must be |
---|
| 92 | // set to false, so that the original optimisation and navigation history is |
---|
| 93 | // preserved. This method is invoked also at initialisation. |
---|
| 94 | |
---|
| 95 | void SetPhysics(G4VUserPhysicsList* uPhys); |
---|
| 96 | // This method must be invoked at least once by the user with a valid |
---|
| 97 | // concrete implementation of user physics list. |
---|
| 98 | |
---|
| 99 | void InitializePhysics(); |
---|
| 100 | // This method must be invoked at least once by the user to build physics |
---|
| 101 | // processes. |
---|
| 102 | |
---|
| 103 | G4bool RunInitialization(); |
---|
| 104 | // Trigger geometry closing and physics table constructions. |
---|
| 105 | // It returns TRUE if all procedures went well. |
---|
| 106 | |
---|
| 107 | void RunTermination(); |
---|
| 108 | // Set the application state to G4State_Idle so that the user can modify |
---|
| 109 | // physics/geometry. |
---|
| 110 | |
---|
| 111 | private: |
---|
| 112 | void ResetNavigator(); |
---|
| 113 | void BuildPhysicsTables(); |
---|
| 114 | void CheckRegions(); |
---|
| 115 | |
---|
| 116 | public: // with description |
---|
| 117 | void UpdateRegion(); |
---|
| 118 | // Update region list. |
---|
| 119 | // This method is mandatory before invoking following two dump methods. |
---|
| 120 | // At RunInitialization(), this method is automatically invoked, and thus |
---|
| 121 | // the user needs not invoke. |
---|
| 122 | |
---|
| 123 | void DumpRegion(G4String rname) const; |
---|
| 124 | // Dump information of a region. |
---|
| 125 | |
---|
| 126 | void DumpRegion(G4Region* region=0) const; |
---|
| 127 | // Dump information of a region. |
---|
| 128 | // If the pointer is NULL, all regions are shown. |
---|
| 129 | |
---|
| 130 | private: |
---|
| 131 | G4VUserPhysicsList * physicsList; |
---|
| 132 | G4VPhysicalVolume* currentWorld; |
---|
| 133 | G4bool geometryInitialized; |
---|
| 134 | G4bool physicsInitialized; |
---|
| 135 | G4bool geometryNeedsToBeClosed; |
---|
| 136 | G4bool geometryToBeOptimized; |
---|
| 137 | G4bool physicsNeedsToBeReBuilt; |
---|
| 138 | G4int verboseLevel; |
---|
| 139 | G4int numberOfParallelWorld; |
---|
| 140 | |
---|
| 141 | G4EventManager * eventManager; |
---|
| 142 | G4ExceptionHandler* defaultExceptionHandler; |
---|
| 143 | G4Region* defaultRegion; |
---|
| 144 | G4String versionString; |
---|
| 145 | |
---|
| 146 | public: // with description |
---|
| 147 | inline void GeometryHasBeenModified() |
---|
| 148 | { geometryNeedsToBeClosed = true; } |
---|
| 149 | // This method must be invoked (or equivalent UI commands can be used) |
---|
| 150 | // in case the user changes his/her detector geometry. |
---|
| 151 | // This method is automatically invoked from DefineWorldVolume() method. |
---|
| 152 | |
---|
| 153 | inline void PhysicsHasBeenModified() |
---|
| 154 | { physicsNeedsToBeReBuilt = true; } |
---|
| 155 | // This method must be invoked in case the user changes his/her physics |
---|
| 156 | // process(es), e.g. (in)activate some processes. Once this method is |
---|
| 157 | // invoked, regardless of cuts are changed or not, BuildPhysicsTable() |
---|
| 158 | // of PhysicsList is invoked for refreshing all physics tables. |
---|
| 159 | |
---|
| 160 | public: |
---|
| 161 | inline G4EventManager* GetEventManager() const |
---|
| 162 | { return eventManager; } |
---|
| 163 | inline G4StackManager* GetStackManager() const |
---|
| 164 | { return eventManager->GetStackManager(); } |
---|
| 165 | inline G4TrackingManager* GetTrackingManager() const |
---|
| 166 | { return eventManager->GetTrackingManager(); } |
---|
| 167 | inline void SetPrimaryTransformer(G4PrimaryTransformer* pt) |
---|
| 168 | { eventManager->SetPrimaryTransformer(pt); } |
---|
| 169 | inline G4PrimaryTransformer* GetPrimaryTransformer() const |
---|
| 170 | { return eventManager->GetPrimaryTransformer(); } |
---|
| 171 | |
---|
| 172 | inline G4String GetVersionString() const |
---|
| 173 | { return versionString; } |
---|
| 174 | |
---|
| 175 | inline void SetVerboseLevel(G4int vl) |
---|
| 176 | { verboseLevel = vl; } |
---|
| 177 | |
---|
| 178 | inline void SetGeometryToBeOptimized(G4bool vl) |
---|
| 179 | { |
---|
| 180 | if(geometryToBeOptimized != vl) |
---|
| 181 | { |
---|
| 182 | geometryToBeOptimized = vl; |
---|
| 183 | geometryNeedsToBeClosed = true; |
---|
| 184 | } |
---|
| 185 | } |
---|
| 186 | |
---|
| 187 | inline G4int GetNumberOfParallelWorld() const |
---|
| 188 | { return numberOfParallelWorld; } |
---|
| 189 | inline void SetNumberOfParallelWorld(G4int i) |
---|
| 190 | { numberOfParallelWorld = i; } |
---|
| 191 | |
---|
| 192 | private: |
---|
| 193 | G4bool ConfirmCoupledTransportation(); |
---|
| 194 | }; |
---|
| 195 | |
---|
| 196 | #endif |
---|
| 197 | |
---|