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.8 2002/11/02 00:10:34 mverderi Exp $ >> 25 // GEANT4 tag $Name: geant4-05-02 $ 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" << 47 #include "G4VPhysicalVolume.hh" 49 #include "G4ParticleTable.hh" 48 #include "G4ParticleTable.hh" 50 #include "G4Region.hh" << 49 #include "G4ParticleDefinition.hh" >> 50 #include "G4VParticleChange.hh" >> 51 #include "G4FastTrack.hh" >> 52 #include "G4FastStep.hh" >> 53 #include "G4VFastSimulationModel.hh" 51 #include "G4RotationMatrix.hh" 54 #include "G4RotationMatrix.hh" 52 #include "G4ThreeVector.hh" 55 #include "G4ThreeVector.hh" 53 #include "G4Transform3D.hh" 56 #include "G4Transform3D.hh" 54 #include "G4VFastSimulationModel.hh" << 57 #include "G4FastSimulationVector.hh" 55 #include "G4VParticleChange.hh" << 58 56 #include "G4VPhysicalVolume.hh" << 57 #include "G4ios.hh" 59 #include "G4ios.hh" 58 #include "globals.hh" << 60 >> 61 //--------------------------- >> 62 // For possible future needs: >> 63 //--------------------------- >> 64 typedef G4LogicalVolume G4Envelope; 59 65 60 //------------------------------------------- 66 //------------------------------------------- 61 // 67 // 62 // G4FastSimulationManager class 68 // G4FastSimulationManager class 63 // 69 // 64 //------------------------------------------- 70 //------------------------------------------- 65 71 66 // Class Description: 72 // Class Description: 67 // The G4VFastSimulationModel objects are att << 73 // The G4VFastSimulationModel objects are attached to the envelope through a G4FastSimulationManager. 68 // through a G4FastSimulationManager. << 74 // 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 // 75 // 72 76 >> 77 73 class G4FastSimulationManager 78 class G4FastSimulationManager 74 { 79 { 75 public: // with description << 80 public: // with description 76 //------------------------ << 81 //------------------------ 77 // Constructor/Destructor << 82 // Constructor/Destructor 78 //------------------------ << 83 //------------------------ 79 // Only one Constructor. By default the en << 84 // Only one Constructor. By default the envelope can 80 // be placed n-Times. << 85 // be placed n-Times. 81 // If the user is sure that it is placed j << 86 // If the user is sure that it'll be placed just one time, 82 // the IsUnique flag should be set TRUE to << 87 // the IsUnique flag should be set TRUE to avoid the 83 // G4AffineTransform re-calculations each << 88 // G4AffineTransform re-calculations each time we reach 84 // the envelope. << 89 // the envelope. 85 << 90 86 G4FastSimulationManager(G4Envelope* anEnve << 91 G4FastSimulationManager(G4Envelope *anEnvelope, 87 // This is the only constructor. In this c << 92 G4bool IsUnique=FALSE); 88 // the envelope by giving the G4Region (ty << 93 // This is the only constructor. In this constructor you specify the envelope by giving the 89 // pointer. The G4FastSimulationManager ob << 94 // G4LogicalVolume pointer. The G4FastSimulationManager object will bind itself to this envelope 90 // this envelope and will notify this G4Re << 95 // 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 << 96 // placed only once, you can turn the IsUnique boolean to "true" to allow some optimization. 92 // you can turn the IsUnique boolean to "t << 97 // 93 // << 98 // Note that if you choose to use the G4VFastSimulationModel(const G4String&, G4LogicalVolume*, 94 // Note that if you choose to use the G4VF << 99 // G4bool) constructor for you model, the G4FastSimulationManager will be constructed using the 95 // G4Region*, G4bool) constructor for you << 100 // given G4LogicalVolume* and G4bool values of the model constructor. 96 // will be constructed using the given G4R << 101 // 97 // model constructor. << 102 98 // << 103 public: // without description 99 << 104 ~G4FastSimulationManager(); 100 // Destructor << 105 101 ~G4FastSimulationManager(); << 106 102 << 107 public: // with description 103 // Add a model to the Model List. << 108 // Methods to add/remove models to/from the Model 104 void AddFastSimulationModel(G4VFastSimulat << 109 // List. 105 << 110 // 106 // Remove a model from the Model List. << 111 void AddFastSimulationModel(G4VFastSimulationModel*); 107 void RemoveFastSimulationModel(G4VFastSimu << 112 // Add a model to the Model List. 108 << 113 109 // Activate a model in the Model List. << 114 void RemoveFastSimulationModel(G4VFastSimulationModel*); 110 G4bool ActivateFastSimulationModel(const G << 115 // Remove a model from the Model List. 111 << 116 112 // Inactivate a model in the Model List. << 117 // Methods to activate/inactivate models from the Model 113 G4bool InActivateFastSimulationModel(const << 118 // List. 114 << 119 115 // Methods for print/control commands << 120 G4bool ActivateFastSimulationModel(const G4String&); 116 void ListTitle() const; << 121 // Activate a model in the Model List. 117 void ListModels() const; << 122 118 void ListModels(const G4ParticleDefinition << 123 G4bool InActivateFastSimulationModel(const G4String&); 119 void ListModels(const G4String& aName) con << 124 // Inactivate a model in the Model List. 120 const G4Envelope* GetEnvelope() const; << 125 121 << 126 // Methods to add/remove GhostPlacements to/from the 122 G4VFastSimulationModel* GetFastSimulationM << 127 // GhostPlacements List. 123 << 128 // 124 << 129 G4Transform3D* AddGhostPlacement(G4RotationMatrix*, 125 << 130 const G4ThreeVector&); 126 const std::vector<G4VFastSimulationModel*> << 131 // Flag that the envelope is a ghost volume giving its global placement, where the rotation matrix 127 { << 132 // and the translatation vector of 3D transformation describe the placement relative to the world 128 return ModelList; << 133 // coordinates. 129 } << 134 130 << 135 G4Transform3D* AddGhostPlacement(G4Transform3D*); 131 void FlushModels(); << 136 // The same but using a G4Transform3D. 132 << 137 133 //---------------------------------------- << 138 G4bool RemoveGhostPlacement(const G4Transform3D*); 134 // Interface methods for the << 139 // Removes a Ghost placement. 135 // G4FastSimulationManagerProcess process. << 140 136 //---------------------------------------- << 141 public: // without description 137 // Trigger << 142 // Methods for print/control commands 138 G4bool PostStepGetFastSimulationManagerTri << 143 void ListTitle() const; 139 // DoIt << 144 void ListModels() const; 140 G4VParticleChange* InvokePostStepDoIt(); << 145 void ListModels(const G4ParticleDefinition*) const; 141 << 146 void ListModels(const G4String& aName) const; 142 // AtRest methods: << 147 const G4Envelope* GetEnvelope() const; 143 G4bool AtRestGetFastSimulationManagerTrigg << 148 144 G4VParticleChange* InvokeAtRestDoIt(); << 149 G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName, 145 << 150 const G4VFastSimulationModel* previousFound, 146 // For management << 151 bool &foundPrevious) const; 147 G4bool operator==(const G4FastSimulationMa << 152 148 << 153 149 private: << 154 150 // Private members : << 155 151 G4FastTrack fFastTrack; << 156 // 152 G4FastStep fFastStep; << 157 //---------------------------------------------- 153 G4VFastSimulationModel* fTriggedFastSimula << 158 // Interface methods for the G4GlobalFastSimulationManager 154 G4FastSimulationVector<G4VFastSimulationMo << 159 //---------------------------------------------- 155 G4FastSimulationVector<G4VFastSimulationMo << 160 // Parallel geometry placements 156 << 161 157 G4ParticleDefinition* fLastCrossedParticle << 162 G4bool InsertGhostHereIfNecessary(G4VPhysicalVolume* , 158 G4FastSimulationVector<G4VFastSimulationMo << 163 const G4ParticleDefinition&); >> 164 >> 165 // >> 166 //---------------------------------------------- >> 167 // Interface methods for the >> 168 // G4FastSimulationManagerProcess process. >> 169 //---------------------------------------------- >> 170 // Trigger >> 171 G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &, >> 172 const G4Navigator* a = 0); >> 173 // DoIt >> 174 G4VParticleChange* InvokePostStepDoIt(); >> 175 >> 176 // AtRest methods: >> 177 G4bool AtRestGetFastSimulationManagerTrigger(const G4Track &, >> 178 const G4Navigator* a = 0); >> 179 G4VParticleChange* InvokeAtRestDoIt(); >> 180 >> 181 // For management >> 182 G4bool operator == ( const G4FastSimulationManager&) const; >> 183 >> 184 private: >> 185 // Private members : >> 186 G4FastTrack fFastTrack; >> 187 G4FastStep fFastStep; >> 188 G4VFastSimulationModel* fTriggedFastSimulationModel; >> 189 G4FastSimulationVector <G4VFastSimulationModel> ModelList; >> 190 G4FastSimulationVector <G4VFastSimulationModel> fInactivatedModels; >> 191 G4FastSimulationVector <G4Transform3D> GhostPlacements; 159 192 160 // -- *** depracating, to be dropped @ nex << 193 G4ParticleDefinition* fLastCrossedParticle; 161 G4FastSimulationVector<G4Transform3D> Ghos << 194 G4FastSimulationVector <G4VFastSimulationModel> fApplicableModelList; 162 }; 195 }; 163 196 164 inline void G4FastSimulationManager::AddFastSi << 197 inline void >> 198 G4FastSimulationManager::AddFastSimulationModel(G4VFastSimulationModel* fsm) 165 { 199 { 166 ModelList.push_back(fsm); 200 ModelList.push_back(fsm); 167 // forces the fApplicableModelList to be reb 201 // forces the fApplicableModelList to be rebuild 168 fLastCrossedParticle = nullptr; << 202 fLastCrossedParticle = 0; 169 } 203 } 170 204 171 inline void G4FastSimulationManager::RemoveFas << 205 inline void >> 206 G4FastSimulationManager::RemoveFastSimulationModel(G4VFastSimulationModel* fsm) 172 { 207 { 173 if (ModelList.remove(fsm) == nullptr) fInact << 208 if(!ModelList.remove(fsm)) fInactivatedModels.remove(fsm); 174 // forces the fApplicableModelList to be reb 209 // forces the fApplicableModelList to be rebuild 175 fLastCrossedParticle = nullptr; << 210 fLastCrossedParticle = 0; 176 } 211 } 177 212 178 inline G4bool G4FastSimulationManager::operato << 213 inline G4bool >> 214 G4FastSimulationManager::operator == (const G4FastSimulationManager& fsm) const 179 { 215 { 180 return this == &fsm; << 216 return (this==&fsm) ? true : false; 181 } 217 } 182 218 183 inline const G4Envelope* G4FastSimulationManag << 219 inline const G4Envelope* >> 220 G4FastSimulationManager::GetEnvelope() const 184 { 221 { 185 return fFastTrack.GetEnvelope(); 222 return fFastTrack.GetEnvelope(); 186 } 223 } 187 224 188 #endif 225 #endif 189 226