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