Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // >> 27 // $Id: G4FastSimulationManager.hh,v 1.11 2006/06/29 21:09:04 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-08-01-patch-01 $ 27 // 29 // 28 // << 30 // 29 //-------------------------------------------- 31 //--------------------------------------------------------------- 30 // 32 // 31 // G4FastSimulationManager.hh 33 // G4FastSimulationManager.hh 32 // 34 // 33 // Description: 35 // Description: 34 // Manages the Fast Simulation models attac 36 // Manages the Fast Simulation models attached to a envelope. 35 // 37 // 36 // History: 38 // History: 37 // Oct 97: Verderi && MoraDeFreitas - First 39 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 38 // 40 // 39 //-------------------------------------------- 41 //--------------------------------------------------------------- 40 42 >> 43 41 #ifndef G4FastSimulationManager_h 44 #ifndef G4FastSimulationManager_h 42 #define G4FastSimulationManager_h 1 45 #define G4FastSimulationManager_h 1 43 46 44 #include "G4FastSimulationVector.hh" << 47 #include "globals.hh" 45 #include "G4FastStep.hh" << 48 46 #include "G4FastTrack.hh" << 47 #include "G4LogicalVolume.hh" 49 #include "G4LogicalVolume.hh" 48 #include "G4ParticleDefinition.hh" << 49 #include "G4ParticleTable.hh" << 50 #include "G4Region.hh" 50 #include "G4Region.hh" >> 51 #include "G4VPhysicalVolume.hh" >> 52 #include "G4ParticleTable.hh" >> 53 #include "G4ParticleDefinition.hh" >> 54 #include "G4VParticleChange.hh" >> 55 #include "G4FastTrack.hh" >> 56 #include "G4FastStep.hh" >> 57 #include "G4VFastSimulationModel.hh" 51 #include "G4RotationMatrix.hh" 58 #include "G4RotationMatrix.hh" 52 #include "G4ThreeVector.hh" 59 #include "G4ThreeVector.hh" 53 #include "G4Transform3D.hh" 60 #include "G4Transform3D.hh" 54 #include "G4VFastSimulationModel.hh" << 61 #include "G4FastSimulationVector.hh" 55 #include "G4VParticleChange.hh" << 62 56 #include "G4VPhysicalVolume.hh" << 57 #include "G4ios.hh" 63 #include "G4ios.hh" 58 #include "globals.hh" << 64 >> 65 //--------------------------- >> 66 // For possible future needs: >> 67 //--------------------------- >> 68 typedef G4Region G4Envelope; 59 69 60 //------------------------------------------- 70 //------------------------------------------- 61 // 71 // 62 // G4FastSimulationManager class 72 // G4FastSimulationManager class 63 // 73 // 64 //------------------------------------------- 74 //------------------------------------------- 65 75 66 // Class Description: 76 // Class Description: 67 // The G4VFastSimulationModel objects are att 77 // The G4VFastSimulationModel objects are attached to the envelope 68 // through a G4FastSimulationManager. 78 // through a G4FastSimulationManager. 69 // This object will manage the list of model 79 // This object will manage the list of models and will message them 70 // at tracking time. 80 // at tracking time. 71 // 81 // 72 82 >> 83 73 class G4FastSimulationManager 84 class G4FastSimulationManager 74 { 85 { 75 public: // with description << 86 public: // with description 76 //------------------------ << 87 //------------------------ 77 // Constructor/Destructor << 88 // Constructor/Destructor 78 //------------------------ << 89 //------------------------ 79 // Only one Constructor. By default the en << 90 // Only one Constructor. By default the envelope can 80 // be placed n-Times. << 91 // be placed n-Times. 81 // If the user is sure that it is placed j << 92 // If the user is sure that it'll be placed just one time, 82 // the IsUnique flag should be set TRUE to << 93 // the IsUnique flag should be set TRUE to avoid the 83 // G4AffineTransform re-calculations each << 94 // G4AffineTransform re-calculations each time we reach 84 // the envelope. << 95 // the envelope. 85 << 96 86 G4FastSimulationManager(G4Envelope* anEnve << 97 G4FastSimulationManager(G4Envelope *anEnvelope, 87 // This is the only constructor. In this c << 98 G4bool IsUnique=FALSE); 88 // the envelope by giving the G4Region (ty << 99 // This is the only constructor. In this constructor you specify 89 // pointer. The G4FastSimulationManager ob << 100 // the envelope by giving the G4Region (typedef-ed as G4Envelope) 90 // this envelope and will notify this G4Re << 101 // pointer. The G4FastSimulationManager object will bind itself to 91 // If you know that this region is used fo << 102 // this envelope and will notify this G4Region to become an envelope. 92 // you can turn the IsUnique boolean to "t << 103 // If you know that this region is used for only one logical volume, 93 // << 104 // you can turn the IsUnique boolean to "true" to allow some optimization. 94 // Note that if you choose to use the G4VF << 105 // 95 // G4Region*, G4bool) constructor for you << 106 // Note that if you choose to use the G4VFastSimulationModel(const G4String&, 96 // will be constructed using the given G4R << 107 // G4Region*, G4bool) constructor for you model, the G4FastSimulationManager 97 // model constructor. << 108 // will be constructed using the given G4Region* and G4bool values of the 98 // << 109 // model constructor. 99 << 110 // 100 // Destructor << 111 101 ~G4FastSimulationManager(); << 112 public: // without description 102 << 113 ~G4FastSimulationManager(); 103 // Add a model to the Model List. << 114 104 void AddFastSimulationModel(G4VFastSimulat << 115 105 << 116 public: // with description 106 // Remove a model from the Model List. << 117 // Methods to add/remove models to/from the Model 107 void RemoveFastSimulationModel(G4VFastSimu << 118 // List. 108 << 119 // 109 // Activate a model in the Model List. << 120 void AddFastSimulationModel(G4VFastSimulationModel*); 110 G4bool ActivateFastSimulationModel(const G << 121 // Add a model to the Model List. 111 << 122 112 // Inactivate a model in the Model List. << 123 void RemoveFastSimulationModel(G4VFastSimulationModel*); 113 G4bool InActivateFastSimulationModel(const << 124 // Remove a model from the Model List. 114 << 125 115 // Methods for print/control commands << 126 // Methods to activate/inactivate models from the Model 116 void ListTitle() const; << 127 // List. 117 void ListModels() const; << 128 118 void ListModels(const G4ParticleDefinition << 129 G4bool ActivateFastSimulationModel(const G4String&); 119 void ListModels(const G4String& aName) con << 130 // Activate a model in the Model List. 120 const G4Envelope* GetEnvelope() const; << 131 121 << 132 G4bool InActivateFastSimulationModel(const G4String&); 122 G4VFastSimulationModel* GetFastSimulationM << 133 // Inactivate a model in the Model List. 123 << 134 124 << 135 public: // without description 125 << 136 // Methods for print/control commands 126 const std::vector<G4VFastSimulationModel*> << 137 void ListTitle() const; 127 { << 138 void ListModels() const; 128 return ModelList; << 139 void ListModels(const G4ParticleDefinition*) const; 129 } << 140 void ListModels(const G4String& aName) const; 130 << 141 const G4Envelope* GetEnvelope() const; 131 void FlushModels(); << 142 132 << 143 G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName, 133 //---------------------------------------- << 144 const G4VFastSimulationModel* previousFound, 134 // Interface methods for the << 145 bool &foundPrevious) const; 135 // G4FastSimulationManagerProcess process. << 146 136 //---------------------------------------- << 147 137 // Trigger << 148 138 G4bool PostStepGetFastSimulationManagerTri << 149 139 // DoIt << 150 // ------------------------------------------------- 140 G4VParticleChange* InvokePostStepDoIt(); << 151 // Methods to add/remove GhostPlacements to/from the 141 << 152 // GhostPlacements List. 142 // AtRest methods: << 153 // ------------------------------------------------- 143 G4bool AtRestGetFastSimulationManagerTrigg << 154 // 144 G4VParticleChange* InvokeAtRestDoIt(); << 155 G4Transform3D* AddGhostPlacement(G4RotationMatrix*, 145 << 156 const G4ThreeVector&); 146 // For management << 157 // Flag that the envelope is a ghost volume giving its global 147 G4bool operator==(const G4FastSimulationMa << 158 // placement, where the rotation matrix and the translatation 148 << 159 // vector of 3D transformation describe the placement relative 149 private: << 160 // to the world coordinates. 150 // Private members : << 161 151 G4FastTrack fFastTrack; << 162 G4Transform3D* AddGhostPlacement(G4Transform3D*); 152 G4FastStep fFastStep; << 163 // The same but using a G4Transform3D. 153 G4VFastSimulationModel* fTriggedFastSimula << 164 154 G4FastSimulationVector<G4VFastSimulationMo << 165 G4bool RemoveGhostPlacement(const G4Transform3D*); 155 G4FastSimulationVector<G4VFastSimulationMo << 166 // Removes a Ghost placement. 156 << 167 // 157 G4ParticleDefinition* fLastCrossedParticle << 168 //---------------------------------------------- 158 G4FastSimulationVector<G4VFastSimulationMo << 169 // Interface methods for the G4GlobalFastSimulationManager >> 170 //---------------------------------------------- >> 171 // Parallel geometry placements >> 172 >> 173 G4bool InsertGhostHereIfNecessary(G4VPhysicalVolume* , >> 174 const G4ParticleDefinition&); >> 175 >> 176 // >> 177 //---------------------------------------------- >> 178 // Interface methods for the >> 179 // G4FastSimulationManagerProcess process. >> 180 //---------------------------------------------- >> 181 // Trigger >> 182 G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &, >> 183 const G4Navigator* a = 0); >> 184 // DoIt >> 185 G4VParticleChange* InvokePostStepDoIt(); >> 186 >> 187 // AtRest methods: >> 188 G4bool AtRestGetFastSimulationManagerTrigger(const G4Track &, >> 189 const G4Navigator* a = 0); >> 190 G4VParticleChange* InvokeAtRestDoIt(); >> 191 >> 192 // For management >> 193 G4bool operator == ( const G4FastSimulationManager&) const; >> 194 >> 195 private: >> 196 // Private members : >> 197 G4FastTrack fFastTrack; >> 198 G4FastStep fFastStep; >> 199 G4VFastSimulationModel* fTriggedFastSimulationModel; >> 200 G4FastSimulationVector <G4VFastSimulationModel> ModelList; >> 201 G4FastSimulationVector <G4VFastSimulationModel> fInactivatedModels; >> 202 G4FastSimulationVector <G4Transform3D> GhostPlacements; 159 203 160 // -- *** depracating, to be dropped @ nex << 204 G4ParticleDefinition* fLastCrossedParticle; 161 G4FastSimulationVector<G4Transform3D> Ghos << 205 G4FastSimulationVector <G4VFastSimulationModel> fApplicableModelList; 162 }; 206 }; 163 207 164 inline void G4FastSimulationManager::AddFastSi << 208 inline void >> 209 G4FastSimulationManager::AddFastSimulationModel(G4VFastSimulationModel* fsm) 165 { 210 { 166 ModelList.push_back(fsm); 211 ModelList.push_back(fsm); 167 // forces the fApplicableModelList to be reb 212 // forces the fApplicableModelList to be rebuild 168 fLastCrossedParticle = nullptr; << 213 fLastCrossedParticle = 0; 169 } 214 } 170 215 171 inline void G4FastSimulationManager::RemoveFas << 216 inline void >> 217 G4FastSimulationManager::RemoveFastSimulationModel(G4VFastSimulationModel* fsm) 172 { 218 { 173 if (ModelList.remove(fsm) == nullptr) fInact << 219 if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm); 174 // forces the fApplicableModelList to be reb 220 // forces the fApplicableModelList to be rebuild 175 fLastCrossedParticle = nullptr; << 221 fLastCrossedParticle = 0; 176 } 222 } 177 223 178 inline G4bool G4FastSimulationManager::operato << 224 inline G4bool >> 225 G4FastSimulationManager::operator == (const G4FastSimulationManager& fsm) const 179 { 226 { 180 return this == &fsm; << 227 return (this==&fsm) ? true : false; 181 } 228 } 182 229 183 inline const G4Envelope* G4FastSimulationManag << 230 inline const G4Envelope* >> 231 G4FastSimulationManager::GetEnvelope() const 184 { 232 { 185 return fFastTrack.GetEnvelope(); 233 return fFastTrack.GetEnvelope(); 186 } 234 } 187 235 188 #endif 236 #endif 189 237