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