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: G4GlobalFastSimulationManager.hh,v 1.13 2007/05/11 13:50:20 mverderi Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | //--------------------------------------------------------------- |
---|
32 | // |
---|
33 | // G4GlobalFastSimulationManager.hh |
---|
34 | // |
---|
35 | // Description: |
---|
36 | // A singleton class which manages the Fast Simulation managers |
---|
37 | // attached to envelopes. |
---|
38 | // |
---|
39 | // History: |
---|
40 | // June 98: Verderi && MoraDeFreitas - "G4ParallelWorld" becomes |
---|
41 | // "G4FlavoredParallelWorld"; some method name changes; |
---|
42 | // GetFlavoredWorldForThis now returns a |
---|
43 | // G4FlavoredParallelWorld pointer. |
---|
44 | // Feb 98: Verderi && MoraDeFreitas - First Implementation. |
---|
45 | // |
---|
46 | //--------------------------------------------------------------- |
---|
47 | |
---|
48 | #ifndef G4GlobalFastSimulationManager_hh |
---|
49 | #define G4GlobalFastSimulationManager_hh |
---|
50 | |
---|
51 | #include "globals.hh" |
---|
52 | #include "G4FastSimulationVector.hh" |
---|
53 | |
---|
54 | #include "G4VGlobalFastSimulationManager.hh" |
---|
55 | #include "G4FastSimulationManager.hh" |
---|
56 | #include "G4FastSimulationManagerProcess.hh" |
---|
57 | |
---|
58 | |
---|
59 | class G4FastSimulationMessenger; |
---|
60 | |
---|
61 | enum listType { |
---|
62 | NAMES_ONLY, |
---|
63 | MODELS, |
---|
64 | ISAPPLICABLE |
---|
65 | }; |
---|
66 | |
---|
67 | |
---|
68 | // Class Description: |
---|
69 | // This a singleton class which provides the management of the G4FastSimulationManager |
---|
70 | // objects and some ghost facilities. |
---|
71 | // |
---|
72 | // You can get access to it by: |
---|
73 | // |
---|
74 | // #include "G4GlobalFastSimulationManager.hh" |
---|
75 | // ... |
---|
76 | // ... |
---|
77 | // G4GlobalFastSimulationManager* globalFSM; |
---|
78 | // globalFSM = G4GlobalFastSimulationManager::getGlobalFastSimulationManager(); |
---|
79 | // ... |
---|
80 | // ... |
---|
81 | // |
---|
82 | // Presently, you will mainly need to use the GlobalFastSimulationManager if you use ghost |
---|
83 | // geometries. |
---|
84 | // |
---|
85 | |
---|
86 | class G4GlobalFastSimulationManager |
---|
87 | { |
---|
88 | |
---|
89 | public: // With description |
---|
90 | |
---|
91 | static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager(); |
---|
92 | // Provides a global access to the GlobalFastSimulationManager |
---|
93 | static G4GlobalFastSimulationManager* GetInstance(); |
---|
94 | // Same as GetGlobalFastSimulationManager() |
---|
95 | |
---|
96 | G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName, |
---|
97 | const G4VFastSimulationModel* previousFound = 0) const; |
---|
98 | // Iterative fetch of G4VFastSimulationModel objects by name: |
---|
99 | // o returns the G4VFastSimulationModel* of model with name modelName; |
---|
100 | // o returns 0 if no model found; |
---|
101 | // o usage: |
---|
102 | // myModel = gblManager->GetFastSimulationModel("MyModel"); |
---|
103 | // o note for the case of several models having the same name: |
---|
104 | // - to get the first "MyModel" model: |
---|
105 | // myModel1 = gblManager->GetFastSimulationModel("MyModel", 0); |
---|
106 | // - to get the next one: |
---|
107 | // myModel2 = gblManager->GetFastSimulationModel("MyModel", myModel1); |
---|
108 | // - and so on. |
---|
109 | // - When gblManager->GetFastSimulationModel("MyModel", myModel_n) |
---|
110 | // returns a null pointer, no extra model with name "MyModel" exist. |
---|
111 | |
---|
112 | |
---|
113 | public: // Without description |
---|
114 | |
---|
115 | // Destructor |
---|
116 | ~G4GlobalFastSimulationManager(); |
---|
117 | |
---|
118 | // |
---|
119 | // G4FastSimulationManager(Process)'s management, no intended for general use. |
---|
120 | // |
---|
121 | // Methods for a G4FastSimulationManager to register itself |
---|
122 | // |
---|
123 | void AddFastSimulationManager(G4FastSimulationManager*); |
---|
124 | void RemoveFastSimulationManager(G4FastSimulationManager*); |
---|
125 | // |
---|
126 | // G4FastSimulationManagerProcess bookeeping: |
---|
127 | // |
---|
128 | void AddFSMP(G4FastSimulationManagerProcess*); |
---|
129 | void RemoveFSMP(G4FastSimulationManagerProcess*); |
---|
130 | |
---|
131 | |
---|
132 | // Flag that the Parameterisation must be closed. |
---|
133 | void FastSimulationNeedsToBeClosed(); |
---|
134 | |
---|
135 | |
---|
136 | public: // With description |
---|
137 | void ShowSetup(); |
---|
138 | // Show the fast simulation setup : world(s), region(s), model(s) and links between them. |
---|
139 | // Requires the geometry to be closed. |
---|
140 | |
---|
141 | |
---|
142 | public: // Without description |
---|
143 | |
---|
144 | void ListEnvelopes(const G4String& aName = "all", |
---|
145 | listType aListType = NAMES_ONLY); |
---|
146 | void ListEnvelopes(const G4ParticleDefinition* ); |
---|
147 | |
---|
148 | void ActivateFastSimulationModel(const G4String&); |
---|
149 | void InActivateFastSimulationModel(const G4String&); |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | private: |
---|
154 | // Private construtor insures singleton class |
---|
155 | G4GlobalFastSimulationManager(); |
---|
156 | |
---|
157 | // recursive display of regions, models, etc... |
---|
158 | void DisplayRegion(G4Region* motherRegion, G4int depth, std::vector<G4ParticleDefinition*>& particles) const; |
---|
159 | |
---|
160 | // The single instance. |
---|
161 | static G4GlobalFastSimulationManager* fGlobalFastSimulationManager; |
---|
162 | G4FastSimulationMessenger* fTheFastSimulationMessenger; |
---|
163 | G4FastSimulationVector <G4FastSimulationManager> ManagedManagers; |
---|
164 | G4FastSimulationVector <G4FastSimulationManagerProcess> fFSMPVector; |
---|
165 | }; |
---|
166 | |
---|
167 | #endif |
---|
168 | // end of #ifndef G4GlobalFastSimulationManager_hh |
---|