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.22 2007/11/09 11:35:54 vnivanch Exp $ >> 27 // GEANT4 tag $Name: geant4-09-01-patch-03 $ 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) 54 // 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 // 55 // 58 // Class Description: 56 // Class Description: 59 // 57 // 60 // It is the unified energy loss process it ca 58 // It is the unified energy loss process it calculates the continuous 61 // energy loss for charged particles using a s 59 // energy loss for charged particles using a set of Energy Loss 62 // models valid for different energy regions. 60 // models valid for different energy regions. There are a possibility 63 // to create and access to dE/dx and range tab 61 // to create and access to dE/dx and range tables, or to calculate 64 // that information on fly. 62 // that information on fly. 65 63 66 // ------------------------------------------- 64 // ------------------------------------------------------------------- 67 // 65 // 68 66 >> 67 69 #ifndef G4EmModelManager_h 68 #ifndef G4EmModelManager_h 70 #define G4EmModelManager_h 1 69 #define G4EmModelManager_h 1 71 70 72 //....oooOO0OOooo........oooOO0OOooo........oo 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 73 72 74 #include "globals.hh" 73 #include "globals.hh" 75 #include "G4DataVector.hh" 74 #include "G4DataVector.hh" 76 #include "G4EmTableType.hh" 75 #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 76 85 class G4RegionModels 77 class G4RegionModels 86 { 78 { 87 79 88 friend class G4EmModelManager; 80 friend class G4EmModelManager; 89 81 >> 82 public: >> 83 90 private: 84 private: 91 85 92 G4RegionModels(G4int nMod, std::vector<G4int << 86 G4RegionModels(G4int nMod, std::vector<G4int>& list, G4DataVector& lowE); 93 G4DataVector& lowE, const G4R << 94 87 95 ~G4RegionModels(); 88 ~G4RegionModels(); 96 89 97 inline G4int SelectIndex(G4double e) const { << 90 G4int SelectIndex(G4double e) const { 98 G4int idx = 0; 91 G4int idx = 0; 99 if (nModelsForRegion>1) { 92 if (nModelsForRegion>1) { 100 idx = nModelsForRegion; 93 idx = nModelsForRegion; 101 // Loop checking, 03-Aug-2015, Vladimir << 94 do {idx--;} while (idx && e <= lowKineticEnergy[idx]); 102 do {--idx;} while (idx > 0 && e <= lowKi << 103 } 95 } 104 return theListOfModelIndexes[idx]; 96 return theListOfModelIndexes[idx]; 105 }; 97 }; 106 98 107 inline G4int ModelIndex(G4int n) const { << 99 G4int ModelIndex(G4int n) const { 108 return theListOfModelIndexes[n]; 100 return theListOfModelIndexes[n]; 109 }; 101 }; 110 102 111 inline G4int NumberOfModels() const { << 103 G4int NumberOfModels() const { 112 return nModelsForRegion; 104 return nModelsForRegion; 113 }; 105 }; 114 106 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; 107 G4int nModelsForRegion; 128 G4int* theListOfModelIndexes; 108 G4int* theListOfModelIndexes; 129 G4double* lowKineticEnergy; 109 G4double* lowKineticEnergy; 130 110 131 }; 111 }; 132 112 133 //....oooOO0OOooo........oooOO0OOooo........oo << 113 #include "G4VEmModel.hh" >> 114 #include "G4VEmFluctuationModel.hh" >> 115 #include "G4DynamicParticle.hh" 134 116 135 class G4Region; 117 class G4Region; 136 class G4ParticleDefinition; 118 class G4ParticleDefinition; >> 119 class G4DataVector; 137 class G4PhysicsVector; 120 class G4PhysicsVector; 138 class G4MaterialCutsCouple; 121 class G4MaterialCutsCouple; 139 122 140 //....oooOO0OOooo........oooOO0OOooo........oo 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 141 124 142 class G4EmModelManager 125 class G4EmModelManager 143 { 126 { 144 public: 127 public: 145 128 146 G4EmModelManager(); 129 G4EmModelManager(); 147 130 148 ~G4EmModelManager(); 131 ~G4EmModelManager(); 149 132 150 void Clear(); 133 void Clear(); 151 134 152 const G4DataVector* Initialise(const G4Parti << 135 const G4DataVector* Initialise(const G4ParticleDefinition*, 153 const G4Parti << 136 const G4ParticleDefinition*, 154 G4int verb); << 137 G4double, >> 138 G4int); >> 139 >> 140 const G4DataVector* Cuts() const; >> 141 >> 142 const G4DataVector* SubCutoff() const; 155 143 156 void FillDEDXVector(G4PhysicsVector*, const 144 void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*, 157 G4EmTableType t = fRestr << 145 G4EmTableType t = fRestricted); 158 146 159 void FillLambdaVector(G4PhysicsVector*, cons 147 void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*, 160 G4bool startFromNull = << 148 G4bool startFromNull = true, G4EmTableType t = fRestricted); 161 G4EmTableType t = fRes << 149 >> 150 G4VEmModel* SelectModel(G4double& energy, size_t& index); 162 151 163 void AddEmModel(G4int, G4VEmModel*, G4VEmFlu << 152 G4VEmModel* GetModel(G4int); 164 const G4Region* r); << 165 153 166 // Get model pointer from the model list << 154 G4int NumberOfModels() const; 167 G4VEmModel* GetModel(G4int idx, G4bool ver = << 168 155 169 // Get model pointer from the model list for << 156 void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*); 170 // no check on material cuts couple index << 157 171 G4VEmModel* GetRegionModel(G4int idx, std::s << 158 void UpdateEmModel(const G4String&, G4double, G4double); 172 159 173 // total number of models for material cut c << 160 private: 174 // no check on material cuts couple index << 175 G4int NumberOfRegionModels(std::size_t index << 176 161 177 // Automatic documentation << 162 // hide assignment operator 178 void DumpModelList(std::ostream& out, G4int << 179 163 180 // Select model for given material cuts coup << 164 G4EmModelManager(G4EmModelManager &); 181 inline G4VEmModel* SelectModel(G4double ener << 165 G4EmModelManager & operator=(const G4EmModelManager &right); 182 166 183 // Access to cuts << 167 // ===================================================================== 184 inline const G4DataVector* Cuts() const; << 185 168 186 // Set flag of fluorescence << 169 private: 187 inline void SetFluoFlag(G4bool val); << 188 170 189 // total number of models << 171 G4DataVector theCuts; 190 inline G4int NumberOfModels() const; << 172 G4DataVector theSubCuts; 191 173 192 // hide assignment operator << 174 std::vector<G4VEmModel*> models; 193 G4EmModelManager(G4EmModelManager &) = delet << 175 std::vector<G4VEmFluctuationModel*> flucModels; 194 G4EmModelManager & operator=(const G4EmModel << 176 std::vector<const G4Region*> regions; >> 177 std::vector<G4int> orderOfModels; >> 178 G4DataVector upperEkin; >> 179 >> 180 G4int nEmModels; >> 181 G4int nRegions; >> 182 G4int nCouples; >> 183 >> 184 G4int* idxOfRegionModels; >> 185 G4RegionModels** setOfRegionModels; >> 186 >> 187 G4double minSubRange; >> 188 G4double maxCutInRange; >> 189 G4double maxSubCutInRange; >> 190 >> 191 const G4ParticleDefinition* particle; >> 192 const G4ParticleDefinition* secondaryParticle; >> 193 const G4ParticleDefinition* theGamma; >> 194 const G4ParticleDefinition* thePositron; 195 195 196 private: << 196 G4int verboseLevel; 197 197 198 const G4ParticleDefinition* particle = nullp << 198 // cash 199 const G4DataVector* theCuts = nullpt << 199 G4int currentIdx; 200 G4DataVector* theCutsNew = nul << 201 << 202 // may be changed in run time << 203 G4RegionModels* currRegionModel << 204 G4VEmModel* currModel = null << 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 200 219 std::vector<G4int> idxOfRegionMod << 220 std::vector<G4RegionModels*> setOfRegionMod << 221 }; 201 }; 222 202 223 //....oooOO0OOooo........oooOO0OOooo........oo 203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 224 //....oooOO0OOooo........oooOO0OOooo........oo 204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 225 205 226 inline << 206 inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy, 227 G4VEmModel* G4EmModelManager::SelectModel(G4do << 207 size_t& index) 228 { 208 { 229 if(severalModels) { << 209 currentIdx = 230 if(nRegions > 1) { << 210 (setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy); 231 currRegionModel = setOfRegionModels[idxO << 211 return models[currentIdx]; 232 } << 233 currModel = models[currRegionModel->Select << 234 } << 235 return currModel; << 236 } 212 } 237 213 238 //....oooOO0OOooo........oooOO0OOooo........oo 214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 239 215 240 inline const G4DataVector* G4EmModelManager::C 216 inline const G4DataVector* G4EmModelManager::Cuts() const 241 { 217 { 242 return theCuts; << 218 return &theCuts; 243 } 219 } 244 220 245 //....oooOO0OOooo........oooOO0OOooo........oo 221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 246 222 247 inline void G4EmModelManager::SetFluoFlag(G4bo << 223 inline const G4DataVector* G4EmModelManager::SubCutoff() const 248 { 224 { 249 fluoFlag = val; << 225 return &theSubCuts; 250 } 226 } 251 227 252 //....oooOO0OOooo........oooOO0OOooo........oo 228 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 253 229 254 inline G4int G4EmModelManager::NumberOfModels( 230 inline G4int G4EmModelManager::NumberOfModels() const 255 { 231 { 256 return nEmModels; 232 return nEmModels; 257 } 233 } 258 234 259 //....oooOO0OOooo........oooOO0OOooo........oo 235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 260 236 261 #endif 237 #endif 262 238 263 239