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$ 27 // 28 // 28 // << 29 // 29 //-------------------------------------------- 30 //--------------------------------------------------------------- 30 // 31 // 31 // G4FastSimulationManager.hh 32 // G4FastSimulationManager.hh 32 // 33 // 33 // Description: 34 // Description: 34 // Manages the Fast Simulation models attac 35 // Manages the Fast Simulation models attached to a envelope. 35 // 36 // 36 // History: 37 // History: 37 // Oct 97: Verderi && MoraDeFreitas - First 38 // Oct 97: Verderi && MoraDeFreitas - First Implementation. 38 // 39 // 39 //-------------------------------------------- 40 //--------------------------------------------------------------- 40 41 >> 42 41 #ifndef G4FastSimulationManager_h 43 #ifndef G4FastSimulationManager_h 42 #define G4FastSimulationManager_h 1 44 #define G4FastSimulationManager_h 1 43 45 44 #include "G4FastSimulationVector.hh" << 46 #include "globals.hh" 45 #include "G4FastStep.hh" << 47 46 #include "G4FastTrack.hh" << 47 #include "G4LogicalVolume.hh" 48 #include "G4LogicalVolume.hh" 48 #include "G4ParticleDefinition.hh" << 49 #include "G4ParticleTable.hh" << 50 #include "G4Region.hh" 49 #include "G4Region.hh" >> 50 #include "G4VPhysicalVolume.hh" >> 51 #include "G4ParticleTable.hh" >> 52 #include "G4ParticleDefinition.hh" >> 53 #include "G4VParticleChange.hh" >> 54 #include "G4FastTrack.hh" >> 55 #include "G4FastStep.hh" >> 56 #include "G4VFastSimulationModel.hh" 51 #include "G4RotationMatrix.hh" 57 #include "G4RotationMatrix.hh" 52 #include "G4ThreeVector.hh" 58 #include "G4ThreeVector.hh" 53 #include "G4Transform3D.hh" 59 #include "G4Transform3D.hh" 54 #include "G4VFastSimulationModel.hh" << 60 #include "G4FastSimulationVector.hh" 55 #include "G4VParticleChange.hh" << 61 56 #include "G4VPhysicalVolume.hh" << 57 #include "G4ios.hh" 62 #include "G4ios.hh" 58 #include "globals.hh" << 63 >> 64 //--------------------------- >> 65 // For possible future needs: >> 66 //--------------------------- >> 67 typedef G4Region G4Envelope; 59 68 60 //------------------------------------------- 69 //------------------------------------------- 61 // 70 // 62 // G4FastSimulationManager class 71 // G4FastSimulationManager class 63 // 72 // 64 //------------------------------------------- 73 //------------------------------------------- 65 74 66 // Class Description: 75 // Class Description: 67 // The G4VFastSimulationModel objects are att 76 // The G4VFastSimulationModel objects are attached to the envelope 68 // through a G4FastSimulationManager. 77 // through a G4FastSimulationManager. 69 // This object will manage the list of model 78 // This object will manage the list of models and will message them 70 // at tracking time. 79 // at tracking time. 71 // 80 // 72 81 >> 82 73 class G4FastSimulationManager 83 class G4FastSimulationManager 74 { 84 { 75 public: // with description << 85 public: // with description 76 //------------------------ << 86 //------------------------ 77 // Constructor/Destructor << 87 // Constructor/Destructor 78 //------------------------ << 88 //------------------------ 79 // Only one Constructor. By default the en << 89 // Only one Constructor. By default the envelope can 80 // be placed n-Times. << 90 // be placed n-Times. 81 // If the user is sure that it is placed j << 91 // If the user is sure that it is placed just one time, 82 // the IsUnique flag should be set TRUE to << 92 // the IsUnique flag should be set TRUE to avoid the 83 // G4AffineTransform re-calculations each << 93 // G4AffineTransform re-calculations each time we reach 84 // the envelope. << 94 // the envelope. 85 << 95 86 G4FastSimulationManager(G4Envelope* anEnve << 96 G4FastSimulationManager(G4Envelope *anEnvelope, 87 // This is the only constructor. In this c << 97 G4bool IsUnique = FALSE); 88 // the envelope by giving the G4Region (ty << 98 // This is the only constructor. In this constructor you specify 89 // pointer. The G4FastSimulationManager ob << 99 // the envelope by giving the G4Region (typedef-ed as G4Envelope) 90 // this envelope and will notify this G4Re << 100 // pointer. The G4FastSimulationManager object will bind itself to 91 // If you know that this region is used fo << 101 // this envelope and will notify this G4Region to become an envelope. 92 // you can turn the IsUnique boolean to "t << 102 // If you know that this region is used for only one logical volume, 93 // << 103 // you can turn the IsUnique boolean to "true" to allow some optimization. 94 // Note that if you choose to use the G4VF << 104 // 95 // G4Region*, G4bool) constructor for you << 105 // Note that if you choose to use the G4VFastSimulationModel(const G4String&, 96 // will be constructed using the given G4R << 106 // G4Region*, G4bool) constructor for you model, the G4FastSimulationManager 97 // model constructor. << 107 // will be constructed using the given G4Region* and G4bool values of the 98 // << 108 // model constructor. 99 << 109 // 100 // Destructor << 110 101 ~G4FastSimulationManager(); << 111 public: // without description 102 << 112 ~G4FastSimulationManager(); 103 // Add a model to the Model List. << 113 104 void AddFastSimulationModel(G4VFastSimulat << 114 105 << 115 public: // with description 106 // Remove a model from the Model List. << 116 // Methods to add/remove models to/from the Model 107 void RemoveFastSimulationModel(G4VFastSimu << 117 // List. 108 << 118 // 109 // Activate a model in the Model List. << 119 void AddFastSimulationModel(G4VFastSimulationModel*); 110 G4bool ActivateFastSimulationModel(const G << 120 // Add a model to the Model List. 111 << 121 112 // Inactivate a model in the Model List. << 122 void RemoveFastSimulationModel(G4VFastSimulationModel*); 113 G4bool InActivateFastSimulationModel(const << 123 // Remove a model from the Model List. 114 << 124 115 // Methods for print/control commands << 125 // Methods to activate/inactivate models from the Model 116 void ListTitle() const; << 126 // List. 117 void ListModels() const; << 127 118 void ListModels(const G4ParticleDefinition << 128 G4bool ActivateFastSimulationModel(const G4String&); 119 void ListModels(const G4String& aName) con << 129 // Activate a model in the Model List. 120 const G4Envelope* GetEnvelope() const; << 130 121 << 131 G4bool InActivateFastSimulationModel(const G4String&); 122 G4VFastSimulationModel* GetFastSimulationM << 132 // Inactivate a model in the Model List. 123 << 133 124 << 134 public: // without description 125 << 135 // Methods for print/control commands 126 const std::vector<G4VFastSimulationModel*> << 136 void ListTitle() const; 127 { << 137 void ListModels() const; 128 return ModelList; << 138 void ListModels(const G4ParticleDefinition*) const; 129 } << 139 void ListModels(const G4String& aName) const; 130 << 140 const G4Envelope* GetEnvelope() const; 131 void FlushModels(); << 141 132 << 142 G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName, 133 //---------------------------------------- << 143 const G4VFastSimulationModel* previousFound, 134 // Interface methods for the << 144 bool &foundPrevious) const; 135 // G4FastSimulationManagerProcess process. << 145 136 //---------------------------------------- << 146 const std::vector<G4VFastSimulationModel*>& GetFastSimulationModelList() const 137 // Trigger << 147 {return ModelList;} 138 G4bool PostStepGetFastSimulationManagerTri << 148 139 // DoIt << 149 140 G4VParticleChange* InvokePostStepDoIt(); << 150 //---------------------------------------------- 141 << 151 // Interface methods for the 142 // AtRest methods: << 152 // G4FastSimulationManagerProcess process. 143 G4bool AtRestGetFastSimulationManagerTrigg << 153 //---------------------------------------------- 144 G4VParticleChange* InvokeAtRestDoIt(); << 154 // Trigger 145 << 155 G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &, 146 // For management << 156 const G4Navigator* a = 0); 147 G4bool operator==(const G4FastSimulationMa << 157 // DoIt 148 << 158 G4VParticleChange* InvokePostStepDoIt(); 149 private: << 159 150 // Private members : << 160 // AtRest methods: 151 G4FastTrack fFastTrack; << 161 G4bool AtRestGetFastSimulationManagerTrigger(const G4Track &, 152 G4FastStep fFastStep; << 162 const G4Navigator* a = 0); 153 G4VFastSimulationModel* fTriggedFastSimula << 163 G4VParticleChange* InvokeAtRestDoIt(); 154 G4FastSimulationVector<G4VFastSimulationMo << 164 155 G4FastSimulationVector<G4VFastSimulationMo << 165 // For management >> 166 G4bool operator == ( const G4FastSimulationManager&) const; >> 167 >> 168 private: >> 169 // Private members : >> 170 G4FastTrack fFastTrack; >> 171 G4FastStep fFastStep; >> 172 G4VFastSimulationModel* fTriggedFastSimulationModel; >> 173 G4FastSimulationVector <G4VFastSimulationModel> ModelList; >> 174 G4FastSimulationVector <G4VFastSimulationModel> fInactivatedModels; 156 175 157 G4ParticleDefinition* fLastCrossedParticle << 176 G4ParticleDefinition* fLastCrossedParticle; 158 G4FastSimulationVector<G4VFastSimulationMo << 177 G4FastSimulationVector <G4VFastSimulationModel> fApplicableModelList; 159 178 160 // -- *** depracating, to be dropped @ nex << 179 // -- *** depracating, to be dropped @ next major release: 161 G4FastSimulationVector<G4Transform3D> Ghos << 180 G4FastSimulationVector <G4Transform3D> GhostPlacements; 162 }; 181 }; 163 182 164 inline void G4FastSimulationManager::AddFastSi << 183 inline void >> 184 G4FastSimulationManager::AddFastSimulationModel(G4VFastSimulationModel* fsm) 165 { 185 { 166 ModelList.push_back(fsm); 186 ModelList.push_back(fsm); 167 // forces the fApplicableModelList to be reb 187 // forces the fApplicableModelList to be rebuild 168 fLastCrossedParticle = nullptr; << 188 fLastCrossedParticle = 0; 169 } 189 } 170 190 171 inline void G4FastSimulationManager::RemoveFas << 191 inline void >> 192 G4FastSimulationManager::RemoveFastSimulationModel(G4VFastSimulationModel* fsm) 172 { 193 { 173 if (ModelList.remove(fsm) == nullptr) fInact << 194 if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm); 174 // forces the fApplicableModelList to be reb 195 // forces the fApplicableModelList to be rebuild 175 fLastCrossedParticle = nullptr; << 196 fLastCrossedParticle = 0; 176 } 197 } 177 198 178 inline G4bool G4FastSimulationManager::operato << 199 inline G4bool >> 200 G4FastSimulationManager::operator == (const G4FastSimulationManager& fsm) const 179 { 201 { 180 return this == &fsm; << 202 return (this==&fsm) ? true : false; 181 } 203 } 182 204 183 inline const G4Envelope* G4FastSimulationManag << 205 inline const G4Envelope* >> 206 G4FastSimulationManager::GetEnvelope() const 184 { 207 { 185 return fFastTrack.GetEnvelope(); 208 return fFastTrack.GetEnvelope(); 186 } 209 } 187 210 188 #endif 211 #endif 189 212