00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 //--------------------------------------------------------------- 00031 // 00032 // G4GlobalFastSimulationManager.hh 00033 // 00034 // Description: 00035 // A singleton class which manages the Fast Simulation managers 00036 // attached to envelopes. 00037 // 00038 // History: 00039 // June 98: Verderi && MoraDeFreitas - "G4ParallelWorld" becomes 00040 // "G4FlavoredParallelWorld"; some method name changes; 00041 // GetFlavoredWorldForThis now returns a 00042 // G4FlavoredParallelWorld pointer. 00043 // Feb 98: Verderi && MoraDeFreitas - First Implementation. 00044 // 00045 //--------------------------------------------------------------- 00046 00047 #ifndef G4GlobalFastSimulationManager_hh 00048 #define G4GlobalFastSimulationManager_hh 00049 00050 #include "globals.hh" 00051 #include "G4FastSimulationVector.hh" 00052 00053 #include "G4VGlobalFastSimulationManager.hh" 00054 #include "G4FastSimulationManager.hh" 00055 #include "G4FastSimulationManagerProcess.hh" 00056 00057 00058 class G4FastSimulationMessenger; 00059 00060 enum listType { 00061 NAMES_ONLY, 00062 MODELS, 00063 ISAPPLICABLE 00064 }; 00065 00066 00067 // Class Description: 00068 // This a singleton class which provides the management of the G4FastSimulationManager 00069 // objects and some ghost facilities. 00070 // 00071 // You can get access to it by: 00072 // 00073 // #include "G4GlobalFastSimulationManager.hh" 00074 // ... 00075 // ... 00076 // G4GlobalFastSimulationManager* globalFSM; 00077 // globalFSM = G4GlobalFastSimulationManager::getGlobalFastSimulationManager(); 00078 // ... 00079 // ... 00080 // 00081 // Presently, you will mainly need to use the GlobalFastSimulationManager if you use ghost 00082 // geometries. 00083 // 00084 00085 class G4GlobalFastSimulationManager 00086 { 00087 00088 public: // With description 00089 00090 static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager(); 00091 // Provides a global access to the GlobalFastSimulationManager 00092 static G4GlobalFastSimulationManager* GetInstance(); 00093 // Same as GetGlobalFastSimulationManager() 00094 00095 G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName, 00096 const G4VFastSimulationModel* previousFound = 0) const; 00097 // Iterative fetch of G4VFastSimulationModel objects by name: 00098 // o returns the G4VFastSimulationModel* of model with name modelName; 00099 // o returns 0 if no model found; 00100 // o usage: 00101 // myModel = gblManager->GetFastSimulationModel("MyModel"); 00102 // o note for the case of several models having the same name: 00103 // - to get the first "MyModel" model: 00104 // myModel1 = gblManager->GetFastSimulationModel("MyModel", 0); 00105 // - to get the next one: 00106 // myModel2 = gblManager->GetFastSimulationModel("MyModel", myModel1); 00107 // - and so on. 00108 // - When gblManager->GetFastSimulationModel("MyModel", myModel_n) 00109 // returns a null pointer, no extra model with name "MyModel" exist. 00110 00111 00112 public: // Without description 00113 00114 // Destructor 00115 ~G4GlobalFastSimulationManager(); 00116 00117 // 00118 // G4FastSimulationManager(Process)'s management, no intended for general use. 00119 // 00120 // Methods for a G4FastSimulationManager to register itself 00121 // 00122 void AddFastSimulationManager(G4FastSimulationManager*); 00123 void RemoveFastSimulationManager(G4FastSimulationManager*); 00124 // 00125 // G4FastSimulationManagerProcess bookeeping: 00126 // 00127 void AddFSMP(G4FastSimulationManagerProcess*); 00128 void RemoveFSMP(G4FastSimulationManagerProcess*); 00129 00130 00131 // Flag that the Parameterisation must be closed. 00132 void FastSimulationNeedsToBeClosed(); 00133 00134 00135 public: // With description 00136 void ShowSetup(); 00137 // Show the fast simulation setup : world(s), region(s), model(s) and links between them. 00138 // Requires the geometry to be closed. 00139 00140 00141 public: // Without description 00142 00143 void ListEnvelopes(const G4String& aName = "all", 00144 listType aListType = NAMES_ONLY); 00145 void ListEnvelopes(const G4ParticleDefinition* ); 00146 00147 void ActivateFastSimulationModel(const G4String&); 00148 void InActivateFastSimulationModel(const G4String&); 00149 00150 00151 00152 private: 00153 // Private construtor insures singleton class 00154 G4GlobalFastSimulationManager(); 00155 00156 // recursive display of regions, models, etc... 00157 void DisplayRegion(G4Region* motherRegion, G4int depth, std::vector<G4ParticleDefinition*>& particles) const; 00158 00159 // The single instance. 00160 static G4GlobalFastSimulationManager* fGlobalFastSimulationManager; 00161 G4FastSimulationMessenger* fTheFastSimulationMessenger; 00162 G4FastSimulationVector <G4FastSimulationManager> ManagedManagers; 00163 G4FastSimulationVector <G4FastSimulationManagerProcess> fFSMPVector; 00164 }; 00165 00166 #endif 00167 // end of #ifndef G4GlobalFastSimulationManager_hh