Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // =========================================================================== 28 // GEANT4 class header file 29 // 30 // Class: G4IonParametrisedLossModel 31 // 32 // Base class: G4VEmModel (utils) 33 // 34 // Author: Anton Lechner (Anton.Lechner@cern.ch) 35 // 36 // First implementation: 10. 11. 2008 37 // 38 // Modifications: 03. 02. 2009 - Bug fix iterators (AL) 39 // 11. 03. 2009 - Introduced new table handler(G4IonDEDXHandler) 40 // and modified method to add/remove tables 41 // (tables are now built in init. phase), 42 // Minor bug fix in ComputeDEDXPerVolume (AL) 43 // 12. 11. 2009 - Added function for switching off scaling 44 // of heavy ions from ICRU 73 data 45 // 20. 11. 2009 - Added set-method for energy loss limit (AL) 46 // 24. 11. 2009 - Bug fix: Range calculation corrected if same 47 // materials appears with different cuts in diff. 48 // regions (added UpdateRangeCache function and 49 // modified BuildRangeVector, ComputeLossForStep 50 // functions accordingly, added new cache param., 51 // changed typdef of IonMatCouple). 52 // - Removed GetRange function (AL) 53 // 54 // Class description: 55 // Model for computing the energy loss of ions by employing a 56 // parameterisation of dE/dx tables (default ICRU 73 tables). For 57 // ion-material combinations and/or projectile energies not covered 58 // by this model, the G4BraggIonModel and G4BetheBloch models are 59 // employed. 60 // 61 // Comments: 62 // 63 // =========================================================================== 64 65 66 #ifndef G4IONPARAMETRISEDLOSSMODEL_HH 67 #define G4IONPARAMETRISEDLOSSMODEL_HH 68 69 #include <iomanip> 70 #include <list> 71 #include <map> 72 #include <utility> 73 #include <CLHEP/Units/PhysicalConstants.h> 74 75 #include "G4VEmModel.hh" 76 #include "G4EmCorrections.hh" 77 #include "G4IonDEDXHandler.hh" 78 79 class G4BraggIonModel; 80 class G4BetheBlochModel; 81 class G4ParticleChangeForLoss; 82 class G4VIonDEDXTable; 83 class G4VIonDEDXScalingAlgorithm; 84 class G4PhysicsFreeVector; 85 class G4MaterialCutsCouple; 86 87 typedef std::list<G4IonDEDXHandler*> LossTableList; 88 typedef std::pair<const G4ParticleDefinition*, 89 const G4MaterialCutsCouple*> IonMatCouple; 90 91 class G4IonParametrisedLossModel : public G4VEmModel { 92 93 public: 94 explicit G4IonParametrisedLossModel(const G4ParticleDefinition* particle = nullptr, 95 const G4String& name = "ParamICRU73"); 96 97 virtual ~G4IonParametrisedLossModel(); 98 99 void Initialise( 100 const G4ParticleDefinition*, // Projectile 101 const G4DataVector&) override; // Cut energies 102 103 G4double MinEnergyCut( 104 const G4ParticleDefinition*, // Projectile 105 const G4MaterialCutsCouple*) override; 106 107 G4double ComputeCrossSectionPerAtom( 108 const G4ParticleDefinition*, // Projectile 109 G4double, // Kinetic energy of projectile 110 G4double, // Atomic number 111 G4double, // Mass number 112 G4double, // Energy cut for secondary prod. 113 G4double) override; // Maximum energy of secondaries 114 115 G4double CrossSectionPerVolume( 116 const G4Material*, // Target material 117 const G4ParticleDefinition*, // Projectile 118 G4double, // Kinetic energy 119 G4double, // Energy cut for secondary prod. 120 G4double) override; // Maximum energy of secondaries 121 122 G4double ComputeDEDXPerVolume( 123 const G4Material*, // Target material 124 const G4ParticleDefinition*, // Projectile 125 G4double, // Kinetic energy of projectile 126 G4double) override; // Energy cut for secondary prod. 127 128 // Function, which computes the continuous energy loss (due to electronic 129 // stopping) for a given pre-step energy and step length by using 130 // range vs energy (and energy vs range) tables 131 G4double ComputeLossForStep( 132 const G4MaterialCutsCouple*, // Mat-cuts couple 133 const G4ParticleDefinition*, // Projectile 134 G4double, // Kinetic energy of projectile 135 G4double); // Length of current step 136 137 // Function, which computes the mean energy transfer rate to delta rays 138 inline G4double DeltaRayMeanEnergyTransferRate( 139 const G4Material*, // Target Material 140 const G4ParticleDefinition*, // Projectile 141 G4double, // Kinetic energy of projectile 142 G4double); // Energy cut for secondary prod. 143 144 145 void SampleSecondaries(std::vector<G4DynamicParticle*>*, 146 const G4MaterialCutsCouple*, 147 const G4DynamicParticle*, 148 G4double, // Energy cut for secondary prod. 149 G4double) override; // Maximum energy of secondaries 150 151 G4double GetChargeSquareRatio( 152 const G4ParticleDefinition*, // Projectile 153 const G4Material*, // Target Material 154 G4double) override; // Kinetic energy of projectile 155 156 G4double GetParticleCharge( 157 const G4ParticleDefinition*, // Projectile 158 const G4Material*, // Target Material 159 G4double) override; // Kinetic energy of projectile 160 161 void CorrectionsAlongStep( 162 const G4MaterialCutsCouple*,// Mat.-Cut couple 163 const G4DynamicParticle*, // Dyn. particle 164 const G4double&, // Length of current step 165 G4double&) override; // Energy loss in current step 166 167 // Function which allows to add additional stopping power tables 168 // in combination with a scaling algorithm, which may depend on dynamic 169 // information like the current particle energy (the table and scaling 170 // algorithm are used via a handler class, which performs e.g.caching or 171 // which applies the scaling of energy and dE/dx values) 172 G4bool AddDEDXTable(const G4String& name, 173 G4VIonDEDXTable* table, 174 G4VIonDEDXScalingAlgorithm* algorithm = nullptr); 175 176 G4bool RemoveDEDXTable(const G4String& name); 177 178 // Function which allows to switch off scaling of stopping powers of heavy 179 // ions from existing ICRU 73 data 180 // void DeactivateICRU73Scaling(); 181 182 // Function checking the applicability of physics tables to ion-material 183 // combinations (Note: the energy range of tables is not checked) 184 inline LossTableList::iterator IsApplicable( 185 const G4ParticleDefinition*, // Projectile (ion) 186 const G4Material*); // Target material 187 188 // Function printing a dE/dx table for a given ion-material combination 189 // and a specified energy grid 190 void PrintDEDXTable( 191 const G4ParticleDefinition*, // Projectile (ion) 192 const G4Material*, // Absorber material 193 G4double, // Minimum energy per nucleon 194 G4double, // Maximum energy per nucleon 195 G4int, // Number of bins 196 G4bool); // Logarithmic scaling of energy 197 198 // Function printing a dE/dx table for a given ion-material combination 199 // and a specified energy grid 200 void PrintDEDXTableHandlers( 201 const G4ParticleDefinition*, // Projectile (ion) 202 const G4Material*, // Absorber material 203 G4double, // Minimum energy per nucleon 204 G4double, // Maximum energy per nucleon 205 G4int, // Number of bins 206 G4bool); // Logarithmic scaling of energy 207 208 // Function for setting energy loss limit for stopping power integration 209 inline void SetEnergyLossLimit(G4double ionEnergyLossLimit); 210 211 protected: 212 G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 213 G4double) override; // Kinetic energy of projectile 214 215 private: 216 // Function which updates parameters concerning the dE/dx calculation 217 // (the parameters are only updated if the particle, the material or 218 // the associated energy cut has changed) 219 void UpdateDEDXCache( 220 const G4ParticleDefinition*, // Projectile (ion) 221 const G4Material*, // Target material 222 G4double cutEnergy); // Energy cut 223 224 // Function which updates parameters concerning the range calculation 225 // (the parameters are only updated if the particle, the material or 226 // the associated energy cut has changed) 227 void UpdateRangeCache( 228 const G4ParticleDefinition*, // Projectile (ion) 229 const G4MaterialCutsCouple*); // Target material 230 231 // Function, which updates parameters concering particle properties 232 inline void UpdateCache( 233 const G4ParticleDefinition*); // Projectile (ion) 234 235 // Function, which builds range vs energy (and energy vs range) vectors 236 // for a given particle, material and energy cut 237 void BuildRangeVector( 238 const G4ParticleDefinition*, // Projectile (ion) 239 const G4MaterialCutsCouple*); // Material cuts couple 240 241 // Assignment operator and copy constructor are hidden: 242 G4IonParametrisedLossModel & operator=( 243 const G4IonParametrisedLossModel &right); 244 G4IonParametrisedLossModel(const G4IonParametrisedLossModel &); 245 246 // ###################################################################### 247 // # Models and dE/dx tables for computing the energy loss 248 // # 249 // ###################################################################### 250 251 // G4BraggIonModel and G4BetheBlochModel are used for ion-target 252 // combinations and/or projectile energies not covered by parametrisations 253 // adopted by this model: 254 G4BraggIonModel* braggIonModel; 255 G4BetheBlochModel* betheBlochModel; 256 257 // List of dE/dx tables plugged into the model 258 LossTableList lossTableList; 259 260 // ###################################################################### 261 // # Maps of Range vs Energy and Energy vs Range vectors 262 // # 263 // ###################################################################### 264 265 typedef std::map<IonMatCouple, G4PhysicsFreeVector*> RangeEnergyTable; 266 RangeEnergyTable r; 267 268 typedef std::map<IonMatCouple, G4PhysicsFreeVector*> EnergyRangeTable; 269 EnergyRangeTable E; 270 271 // ###################################################################### 272 // # Energy grid definitions (e.g. used for computing range-energy 273 // # tables) 274 // ###################################################################### 275 276 G4double lowerEnergyEdgeIntegr; 277 G4double upperEnergyEdgeIntegr; 278 279 size_t nmbBins; 280 size_t nmbSubBins; 281 282 // ###################################################################### 283 // # Particle change for loss 284 // # 285 // ###################################################################### 286 287 // Pointer to particle change object, which is used to set e.g. the 288 // energy loss and secondary delta-electron 289 // used indicating if model is initialized 290 G4ParticleChangeForLoss* particleChangeLoss; 291 292 // ###################################################################### 293 // # Corrections and energy loss limit 294 // # 295 // ###################################################################### 296 297 // Pointer to an G4EmCorrections object, which is used to compute the 298 // effective ion charge, and other corrections (like high order corrections 299 // to stopping powers) 300 G4EmCorrections* corrections; 301 302 // Corrections factor for effective charge, computed for each particle 303 // step 304 G4double corrFactor; 305 306 // Parameter indicating the maximal fraction of kinetic energy, which 307 // a particle may loose along a step, in order that the simple relation 308 // (dE/dx)*l can still be applied to compute the energy loss (l = step 309 // length) 310 G4double energyLossLimit; 311 312 // ###################################################################### 313 // # Cut energies and properties of generic ion 314 // # 315 // ###################################################################### 316 317 // Vector containing the current cut energies (the vector index matches 318 // the material-cuts couple index): 319 G4DataVector cutEnergies; 320 321 // Pointer to generic ion and mass of generic ion 322 const G4ParticleDefinition* genericIon; 323 G4double genericIonPDGMass; 324 325 // ###################################################################### 326 // # "Most-recently-used" cache parameters 327 // # 328 // ###################################################################### 329 330 // Cached key (particle) and value information for a faster 331 // access of particle-related information 332 const G4ParticleDefinition* cacheParticle; // Key: Current projectile 333 G4double cacheMass; // Projectile mass 334 G4double cacheElecMassRatio; // Electron-mass ratio 335 G4double cacheChargeSquare; // Charge squared 336 337 // Cached parameters needed during range computations: 338 const G4ParticleDefinition* rangeCacheParticle; // Key: 1) Current ion, 339 const G4MaterialCutsCouple* rangeCacheMatCutsCouple; // 2) Mat-cuts-couple 340 G4PhysicsVector* rangeCacheEnergyRange; // Energy vs range vector 341 G4PhysicsVector* rangeCacheRangeEnergy; // Range vs energy vector 342 343 // Cached parameters needed during dE/dx computations: 344 const G4ParticleDefinition* dedxCacheParticle; // Key: 1) Current ion, 345 const G4Material* dedxCacheMaterial; // 2) material and 346 G4double dedxCacheEnergyCut; // 3) cut energy 347 LossTableList::iterator dedxCacheIter; // Responsible dE/dx table 348 G4double dedxCacheTransitionEnergy; // Transition energy between 349 // parameterization and 350 // Bethe-Bloch model 351 G4double dedxCacheTransitionFactor; // Factor for smoothing the dE/dx 352 // values in the transition region 353 G4double dedxCacheGenIonMassRatio; // Ratio of generic ion mass 354 // and current particle mass 355 G4bool isInitialised; 356 }; 357 358 359 #include "G4IonParametrisedLossModel.icc" 360 361 #endif 362