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 // $Id: G4EmModelManager.hh,v 1.19 2006/06/29 19:54:25 gunter Exp $ >> 27 // GEANT4 tag $Name: geant4-08-01 $ 26 // 28 // 27 // ------------------------------------------- 29 // ------------------------------------------------------------------- 28 // 30 // 29 // GEANT4 Class header file 31 // GEANT4 Class header file 30 // 32 // 31 // File name: G4EmModelManager 33 // File name: G4EmModelManager 32 // 34 // 33 // Author: Vladimir Ivanchenko 35 // Author: Vladimir Ivanchenko 34 // 36 // 35 // Creation date: 07.05.2002 37 // Creation date: 07.05.2002 36 // 38 // 37 // Modifications: 39 // Modifications: 38 // 40 // 39 // 03-12-02 V.Ivanchenko fix a bug in model se 41 // 03-12-02 V.Ivanchenko fix a bug in model selection 40 // 20-01-03 Migrade to cut per region (V.Ivanc 42 // 20-01-03 Migrade to cut per region (V.Ivanchenko) 41 // 27-01-03 Make models region aware (V.Ivanch 43 // 27-01-03 Make models region aware (V.Ivanchenko) 42 // 13-02-03 The set of models is defined for r 44 // 13-02-03 The set of models is defined for region (V.Ivanchenko) 43 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenk 45 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenko) 44 // 13-04-03 Add startFromNull (V.Ivanchenko) 46 // 13-04-03 Add startFromNull (V.Ivanchenko) 45 // 13-05-03 Add calculation of precise range ( 47 // 13-05-03 Add calculation of precise range (V.Ivanchenko) 46 // 21-07-03 Add UpdateEmModel method (V.Ivanch 48 // 21-07-03 Add UpdateEmModel method (V.Ivanchenko) 47 // 03-11-03 Substitute STL vector for G4Region 49 // 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko) 48 // 11-04-05 Remove access to fluctuation model 50 // 11-04-05 Remove access to fluctuation models (V.Ivanchenko) 49 // 10-01-06 PreciseRange -> CSDARange (V.Ivant 51 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko) 50 // 20-01-06 Introduce G4EmTableType and reduci 52 // 20-01-06 Introduce G4EmTableType and reducing number of methods (VI) 51 // 13-05-06 Add GetModel by index method (VI) 53 // 13-05-06 Add GetModel by index method (VI) 52 // 15-03-07 Add maxCutInRange (V.Ivanchenko) << 53 // 08-04-08 Simplify Select method for only on << 54 // 03-08-09 Removed unused members and simplif << 55 // model is used (VI) << 56 // 14-07-11 Use pointer to the vector of cuts << 57 // 54 // 58 // Class Description: 55 // Class Description: 59 // 56 // 60 // It is the unified energy loss process it ca 57 // It is the unified energy loss process it calculates the continuous 61 // energy loss for charged particles using a s 58 // energy loss for charged particles using a set of Energy Loss 62 // models valid for different energy regions. 59 // models valid for different energy regions. There are a possibility 63 // to create and access to dE/dx and range tab 60 // to create and access to dE/dx and range tables, or to calculate 64 // that information on fly. 61 // that information on fly. 65 62 66 // ------------------------------------------- 63 // ------------------------------------------------------------------- 67 // 64 // 68 65 >> 66 69 #ifndef G4EmModelManager_h 67 #ifndef G4EmModelManager_h 70 #define G4EmModelManager_h 1 68 #define G4EmModelManager_h 1 71 69 72 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 73 71 74 #include "globals.hh" 72 #include "globals.hh" 75 #include "G4DataVector.hh" 73 #include "G4DataVector.hh" 76 #include "G4EmTableType.hh" 74 #include "G4EmTableType.hh" 77 #include "G4EmProcessSubType.hh" << 78 #include "G4Region.hh" << 79 << 80 #include "G4VEmModel.hh" << 81 #include "G4VEmFluctuationModel.hh" << 82 #include "G4DynamicParticle.hh" << 83 #include <iostream> << 84 75 85 class G4RegionModels 76 class G4RegionModels 86 { 77 { 87 78 88 friend class G4EmModelManager; 79 friend class G4EmModelManager; 89 80 >> 81 public: >> 82 90 private: 83 private: 91 84 92 G4RegionModels(G4int nMod, std::vector<G4int << 85 G4RegionModels(G4int nMod, std::vector<G4int>& list, G4DataVector& lowE); 93 G4DataVector& lowE, const G4R << 94 86 95 ~G4RegionModels(); 87 ~G4RegionModels(); 96 88 97 inline G4int SelectIndex(G4double e) const { << 89 G4int SelectIndex(G4double e) const { 98 G4int idx = 0; 90 G4int idx = 0; 99 if (nModelsForRegion>1) { 91 if (nModelsForRegion>1) { 100 idx = nModelsForRegion; 92 idx = nModelsForRegion; 101 // Loop checking, 03-Aug-2015, Vladimir << 93 do {idx--;} while (idx && e <= lowKineticEnergy[idx]); 102 do {--idx;} while (idx > 0 && e <= lowKi << 103 } 94 } 104 return theListOfModelIndexes[idx]; 95 return theListOfModelIndexes[idx]; 105 }; 96 }; 106 97 107 inline G4int ModelIndex(G4int n) const { << 98 G4int ModelIndex(G4int n) const { 108 return theListOfModelIndexes[n]; 99 return theListOfModelIndexes[n]; 109 }; 100 }; 110 101 111 inline G4int NumberOfModels() const { << 102 G4int NumberOfModels() const { 112 return nModelsForRegion; 103 return nModelsForRegion; 113 }; 104 }; 114 105 115 inline G4double LowEdgeEnergy(G4int n) const << 116 return lowKineticEnergy[n]; << 117 }; << 118 << 119 inline const G4Region* Region() const { << 120 return theRegion; << 121 }; << 122 << 123 G4RegionModels(G4RegionModels &) = delete; << 124 G4RegionModels & operator=(const G4RegionMod << 125 << 126 const G4Region* theRegion; << 127 G4int nModelsForRegion; 106 G4int nModelsForRegion; 128 G4int* theListOfModelIndexes; 107 G4int* theListOfModelIndexes; 129 G4double* lowKineticEnergy; 108 G4double* lowKineticEnergy; 130 109 131 }; 110 }; 132 111 133 //....oooOO0OOooo........oooOO0OOooo........oo << 112 #include "G4VEmModel.hh" >> 113 #include "G4VEmFluctuationModel.hh" >> 114 #include "G4DynamicParticle.hh" 134 115 135 class G4Region; 116 class G4Region; 136 class G4ParticleDefinition; 117 class G4ParticleDefinition; >> 118 class G4DataVector; 137 class G4PhysicsVector; 119 class G4PhysicsVector; 138 class G4MaterialCutsCouple; 120 class G4MaterialCutsCouple; 139 121 140 //....oooOO0OOooo........oooOO0OOooo........oo 122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 141 123 142 class G4EmModelManager 124 class G4EmModelManager 143 { 125 { 144 public: 126 public: 145 127 146 G4EmModelManager(); 128 G4EmModelManager(); 147 129 148 ~G4EmModelManager(); 130 ~G4EmModelManager(); 149 131 150 void Clear(); 132 void Clear(); 151 133 152 const G4DataVector* Initialise(const G4Parti << 134 const G4DataVector* Initialise(const G4ParticleDefinition*, 153 const G4Parti << 135 const G4ParticleDefinition*, 154 G4int verb); << 136 G4double, >> 137 G4int); >> 138 >> 139 const G4DataVector* Cuts() const; >> 140 >> 141 const G4DataVector* SubCutoff() const; 155 142 156 void FillDEDXVector(G4PhysicsVector*, const 143 void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*, 157 G4EmTableType t = fRestr << 144 G4EmTableType t = fRestricted); 158 145 159 void FillLambdaVector(G4PhysicsVector*, cons 146 void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*, 160 G4bool startFromNull = << 147 G4bool startFromNull = true, G4EmTableType t = fRestricted); 161 G4EmTableType t = fRes << 162 148 163 void AddEmModel(G4int, G4VEmModel*, G4VEmFlu << 149 G4VEmModel* SelectModel(G4double& energy, size_t& index); 164 const G4Region* r); << 165 150 166 // Get model pointer from the model list << 151 G4VEmModel* GetModel(G4int); 167 G4VEmModel* GetModel(G4int idx, G4bool ver = << 168 152 169 // Get model pointer from the model list for << 153 G4int NumberOfModels() const; 170 // no check on material cuts couple index << 171 G4VEmModel* GetRegionModel(G4int idx, std::s << 172 154 173 // total number of models for material cut c << 155 void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*); 174 // no check on material cuts couple index << 156 175 G4int NumberOfRegionModels(std::size_t index << 157 void UpdateEmModel(const G4String&, G4double, G4double); 176 158 177 // Automatic documentation << 159 private: 178 void DumpModelList(std::ostream& out, G4int << 179 160 180 // Select model for given material cuts coup << 161 // hide assignment operator 181 inline G4VEmModel* SelectModel(G4double ener << 182 162 183 // Access to cuts << 163 G4EmModelManager(G4EmModelManager &); 184 inline const G4DataVector* Cuts() const; << 164 G4EmModelManager & operator=(const G4EmModelManager &right); 185 165 186 // Set flag of fluorescence << 166 // ===================================================================== 187 inline void SetFluoFlag(G4bool val); << 188 167 189 // total number of models << 168 private: 190 inline G4int NumberOfModels() const; << 191 169 192 // hide assignment operator << 170 G4DataVector theCuts; 193 G4EmModelManager(G4EmModelManager &) = delet << 171 G4DataVector theSubCuts; 194 G4EmModelManager & operator=(const G4EmModel << 195 172 196 private: << 173 std::vector<G4VEmModel*> models; >> 174 std::vector<G4VEmFluctuationModel*> flucModels; >> 175 std::vector<const G4Region*> regions; >> 176 std::vector<G4int> orderOfModels; >> 177 G4DataVector upperEkin; >> 178 >> 179 G4int nEmModels; >> 180 G4int nRegions; >> 181 G4int nCouples; >> 182 >> 183 G4int* idxOfRegionModels; >> 184 G4RegionModels** setOfRegionModels; >> 185 >> 186 G4double minSubRange; 197 187 198 const G4ParticleDefinition* particle = nullp << 188 const G4ParticleDefinition* particle; 199 const G4DataVector* theCuts = nullpt << 189 const G4ParticleDefinition* secondaryParticle; 200 G4DataVector* theCutsNew = nul << 190 201 << 191 G4int verboseLevel; 202 // may be changed in run time << 192 203 G4RegionModels* currRegionModel << 193 // cash 204 G4VEmModel* currModel = null << 194 G4int currentIdx; 205 << 206 G4int nEmModels = 0; << 207 G4int nRegions = 0; << 208 << 209 G4int verboseLevel = 0 << 210 G4bool severalModels = << 211 G4bool fluoFlag = false << 212 << 213 std::vector<G4VEmModel*> models; << 214 std::vector<G4VEmFluctuationModel*> flucMod << 215 std::vector<const G4Region*> regions << 216 std::vector<G4int> orderOf << 217 std::vector<G4int> isUsed; << 218 195 219 std::vector<G4int> idxOfRegionMod << 220 std::vector<G4RegionModels*> setOfRegionMod << 221 }; 196 }; 222 197 223 //....oooOO0OOooo........oooOO0OOooo........oo 198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 224 //....oooOO0OOooo........oooOO0OOooo........oo 199 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 225 200 226 inline << 201 inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy, 227 G4VEmModel* G4EmModelManager::SelectModel(G4do << 202 size_t& index) 228 { 203 { 229 if(severalModels) { << 204 currentIdx = 230 if(nRegions > 1) { << 205 (setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy); 231 currRegionModel = setOfRegionModels[idxO << 206 return models[currentIdx]; 232 } << 233 currModel = models[currRegionModel->Select << 234 } << 235 return currModel; << 236 } 207 } 237 208 238 //....oooOO0OOooo........oooOO0OOooo........oo 209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 239 210 240 inline const G4DataVector* G4EmModelManager::C 211 inline const G4DataVector* G4EmModelManager::Cuts() const 241 { 212 { 242 return theCuts; << 213 return &theCuts; 243 } 214 } 244 215 245 //....oooOO0OOooo........oooOO0OOooo........oo 216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 246 217 247 inline void G4EmModelManager::SetFluoFlag(G4bo << 218 inline const G4DataVector* G4EmModelManager::SubCutoff() const 248 { 219 { 249 fluoFlag = val; << 220 return &theSubCuts; 250 } 221 } 251 222 252 //....oooOO0OOooo........oooOO0OOooo........oo 223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 253 224 254 inline G4int G4EmModelManager::NumberOfModels( 225 inline G4int G4EmModelManager::NumberOfModels() const 255 { 226 { 256 return nEmModels; 227 return nEmModels; 257 } 228 } 258 229 259 //....oooOO0OOooo........oooOO0OOooo........oo 230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 260 231 261 #endif 232 #endif 262 233 263 234