Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 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 // ------------------------------------------- 28 // 29 // GEANT4 Class header file 30 // 31 // File name: G4EmModelManager 32 // 33 // Author: Vladimir Ivanchenko 34 // 35 // Creation date: 07.05.2002 36 // 37 // Modifications: 38 // 39 // 03-12-02 V.Ivanchenko fix a bug in model se 40 // 20-01-03 Migrade to cut per region (V.Ivanc 41 // 27-01-03 Make models region aware (V.Ivanch 42 // 13-02-03 The set of models is defined for r 43 // 26-03-03 Add GetDEDXDispersion (V.Ivanchenk 44 // 13-04-03 Add startFromNull (V.Ivanchenko) 45 // 13-05-03 Add calculation of precise range ( 46 // 21-07-03 Add UpdateEmModel method (V.Ivanch 47 // 03-11-03 Substitute STL vector for G4Region 48 // 11-04-05 Remove access to fluctuation model 49 // 10-01-06 PreciseRange -> CSDARange (V.Ivant 50 // 20-01-06 Introduce G4EmTableType and reduci 51 // 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 // 58 // Class Description: 59 // 60 // It is the unified energy loss process it ca 61 // energy loss for charged particles using a s 62 // models valid for different energy regions. 63 // to create and access to dE/dx and range tab 64 // that information on fly. 65 66 // ------------------------------------------- 67 // 68 69 #ifndef G4EmModelManager_h 70 #define G4EmModelManager_h 1 71 72 //....oooOO0OOooo........oooOO0OOooo........oo 73 74 #include "globals.hh" 75 #include "G4DataVector.hh" 76 #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 85 class G4RegionModels 86 { 87 88 friend class G4EmModelManager; 89 90 private: 91 92 G4RegionModels(G4int nMod, std::vector<G4int 93 G4DataVector& lowE, const G4R 94 95 ~G4RegionModels(); 96 97 inline G4int SelectIndex(G4double e) const { 98 G4int idx = 0; 99 if (nModelsForRegion>1) { 100 idx = nModelsForRegion; 101 // Loop checking, 03-Aug-2015, Vladimir 102 do {--idx;} while (idx > 0 && e <= lowKi 103 } 104 return theListOfModelIndexes[idx]; 105 }; 106 107 inline G4int ModelIndex(G4int n) const { 108 return theListOfModelIndexes[n]; 109 }; 110 111 inline G4int NumberOfModels() const { 112 return nModelsForRegion; 113 }; 114 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; 128 G4int* theListOfModelIndexes; 129 G4double* lowKineticEnergy; 130 131 }; 132 133 //....oooOO0OOooo........oooOO0OOooo........oo 134 135 class G4Region; 136 class G4ParticleDefinition; 137 class G4PhysicsVector; 138 class G4MaterialCutsCouple; 139 140 //....oooOO0OOooo........oooOO0OOooo........oo 141 142 class G4EmModelManager 143 { 144 public: 145 146 G4EmModelManager(); 147 148 ~G4EmModelManager(); 149 150 void Clear(); 151 152 const G4DataVector* Initialise(const G4Parti 153 const G4Parti 154 G4int verb); 155 156 void FillDEDXVector(G4PhysicsVector*, const 157 G4EmTableType t = fRestr 158 159 void FillLambdaVector(G4PhysicsVector*, cons 160 G4bool startFromNull = 161 G4EmTableType t = fRes 162 163 void AddEmModel(G4int, G4VEmModel*, G4VEmFlu 164 const G4Region* r); 165 166 // Get model pointer from the model list 167 G4VEmModel* GetModel(G4int idx, G4bool ver = 168 169 // Get model pointer from the model list for 170 // no check on material cuts couple index 171 G4VEmModel* GetRegionModel(G4int idx, std::s 172 173 // total number of models for material cut c 174 // no check on material cuts couple index 175 G4int NumberOfRegionModels(std::size_t index 176 177 // Automatic documentation 178 void DumpModelList(std::ostream& out, G4int 179 180 // Select model for given material cuts coup 181 inline G4VEmModel* SelectModel(G4double ener 182 183 // Access to cuts 184 inline const G4DataVector* Cuts() const; 185 186 // Set flag of fluorescence 187 inline void SetFluoFlag(G4bool val); 188 189 // total number of models 190 inline G4int NumberOfModels() const; 191 192 // hide assignment operator 193 G4EmModelManager(G4EmModelManager &) = delet 194 G4EmModelManager & operator=(const G4EmModel 195 196 private: 197 198 const G4ParticleDefinition* particle = nullp 199 const G4DataVector* theCuts = nullpt 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 219 std::vector<G4int> idxOfRegionMod 220 std::vector<G4RegionModels*> setOfRegionMod 221 }; 222 223 //....oooOO0OOooo........oooOO0OOooo........oo 224 //....oooOO0OOooo........oooOO0OOooo........oo 225 226 inline 227 G4VEmModel* G4EmModelManager::SelectModel(G4do 228 { 229 if(severalModels) { 230 if(nRegions > 1) { 231 currRegionModel = setOfRegionModels[idxO 232 } 233 currModel = models[currRegionModel->Select 234 } 235 return currModel; 236 } 237 238 //....oooOO0OOooo........oooOO0OOooo........oo 239 240 inline const G4DataVector* G4EmModelManager::C 241 { 242 return theCuts; 243 } 244 245 //....oooOO0OOooo........oooOO0OOooo........oo 246 247 inline void G4EmModelManager::SetFluoFlag(G4bo 248 { 249 fluoFlag = val; 250 } 251 252 //....oooOO0OOooo........oooOO0OOooo........oo 253 254 inline G4int G4EmModelManager::NumberOfModels( 255 { 256 return nEmModels; 257 } 258 259 //....oooOO0OOooo........oooOO0OOooo........oo 260 261 #endif 262 263