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: G4EmCorrections.hh 100363 2016-10-19 09:24:47Z gcosmo $ 26 // 27 // 27 // ------------------------------------------- 28 // ------------------------------------------------------------------- 28 // 29 // 29 // GEANT4 Class header file 30 // GEANT4 Class header file 30 // 31 // 31 // 32 // 32 // File name: G4EmCorrections 33 // File name: G4EmCorrections 33 // 34 // 34 // Author: Vladimir Ivanchenko 35 // Author: Vladimir Ivanchenko 35 // 36 // 36 // Creation date: 13.01.2005 37 // Creation date: 13.01.2005 37 // 38 // 38 // Modifications: 39 // Modifications: 39 // 28.04.2006 General cleanup, add finite size 40 // 28.04.2006 General cleanup, add finite size corrections (V.Ivanchenko) 40 // 13.05.2006 Add corrections for ion stopping 41 // 13.05.2006 Add corrections for ion stopping (V.Ivanhcenko) 41 // 20.05.2008 Removed Finite Size correction ( 42 // 20.05.2008 Removed Finite Size correction (V.Ivanchenko) 42 // 12.09.2008 Added inlined interfaces to effe 43 // 12.09.2008 Added inlined interfaces to effective charge (V.Ivanchenko) 43 // 19.04.2012 Fix reproducibility problem (A.R 44 // 19.04.2012 Fix reproducibility problem (A.Ribon) 44 // 45 // 45 // Class Description: 46 // Class Description: 46 // 47 // 47 // This class provides calculation of EM corre 48 // This class provides calculation of EM corrections to ionisation 48 // 49 // 49 50 50 // ------------------------------------------- 51 // ------------------------------------------------------------------- 51 // 52 // 52 53 53 #ifndef G4EmCorrections_h 54 #ifndef G4EmCorrections_h 54 #define G4EmCorrections_h 1 55 #define G4EmCorrections_h 1 55 56 >> 57 #include <CLHEP/Units/PhysicalConstants.h> >> 58 56 #include "globals.hh" 59 #include "globals.hh" 57 #include "G4ionEffectiveCharge.hh" 60 #include "G4ionEffectiveCharge.hh" 58 #include "G4Material.hh" 61 #include "G4Material.hh" 59 #include "G4ParticleDefinition.hh" 62 #include "G4ParticleDefinition.hh" 60 63 61 class G4VEmModel; 64 class G4VEmModel; 62 class G4PhysicsVector; 65 class G4PhysicsVector; 63 class G4IonTable; 66 class G4IonTable; 64 class G4MaterialCutsCouple; 67 class G4MaterialCutsCouple; 65 class G4PhysicsFreeVector; << 68 class G4LPhysicsFreeVector; 66 class G4Pow; 69 class G4Pow; 67 70 68 class G4EmCorrections 71 class G4EmCorrections 69 { 72 { 70 73 71 public: 74 public: 72 75 73 explicit G4EmCorrections(G4int verb); 76 explicit G4EmCorrections(G4int verb); 74 77 75 ~G4EmCorrections(); << 78 virtual ~G4EmCorrections(); 76 79 77 G4double HighOrderCorrections(const G4Partic 80 G4double HighOrderCorrections(const G4ParticleDefinition*, 78 const G4Materi 81 const G4Material*, 79 const G4double << 82 G4double kineticEnergy, 80 const G4double << 83 G4double cutEnergy); 81 84 82 G4double IonHighOrderCorrections(const G4Par 85 G4double IonHighOrderCorrections(const G4ParticleDefinition*, 83 const G4Mat 86 const G4MaterialCutsCouple*, 84 const G4dou << 87 G4double kineticEnergy); 85 88 86 G4double ComputeIonCorrections(const G4Parti 89 G4double ComputeIonCorrections(const G4ParticleDefinition*, 87 const G4Mater 90 const G4Material*, 88 const G4doubl << 91 G4double kineticEnergy); 89 92 90 G4double IonBarkasCorrection(const G4Particl 93 G4double IonBarkasCorrection(const G4ParticleDefinition*, 91 const G4Materia 94 const G4Material*, 92 const G4double << 95 G4double kineticEnergy); 93 96 94 G4double Bethe(const G4ParticleDefinition*, 97 G4double Bethe(const G4ParticleDefinition*, 95 const G4Material*, 98 const G4Material*, 96 const G4double kineticEnergy) << 99 G4double kineticEnergy); 97 100 98 G4double SpinCorrection(const G4ParticleDefi 101 G4double SpinCorrection(const G4ParticleDefinition*, 99 const G4Material*, 102 const G4Material*, 100 const G4double kinet << 103 G4double kineticEnergy); 101 104 102 G4double KShellCorrection(const G4ParticleDe 105 G4double KShellCorrection(const G4ParticleDefinition*, 103 const G4Material*, 106 const G4Material*, 104 const G4double kin << 107 G4double kineticEnergy); 105 108 106 G4double LShellCorrection(const G4ParticleDe 109 G4double LShellCorrection(const G4ParticleDefinition*, 107 const G4Material*, 110 const G4Material*, 108 const G4double kin << 111 G4double kineticEnergy); 109 112 110 G4double ShellCorrection(const G4ParticleDef 113 G4double ShellCorrection(const G4ParticleDefinition*, 111 const G4Material*, 114 const G4Material*, 112 const G4double kine << 115 G4double kineticEnergy); 113 116 114 G4double ShellCorrectionSTD(const G4Particle 117 G4double ShellCorrectionSTD(const G4ParticleDefinition*, 115 const G4Material 118 const G4Material*, 116 const G4double k << 119 G4double kineticEnergy); 117 120 118 G4double DensityCorrection(const G4ParticleD 121 G4double DensityCorrection(const G4ParticleDefinition*, 119 const G4Material* 122 const G4Material*, 120 const G4double ki << 123 G4double kineticEnergy); 121 124 122 G4double BarkasCorrection(const G4ParticleDe 125 G4double BarkasCorrection(const G4ParticleDefinition*, 123 const G4Material*, 126 const G4Material*, 124 const G4double kin << 127 G4double kineticEnergy); 125 const G4bool isIni << 126 128 127 G4double BlochCorrection(const G4ParticleDef 129 G4double BlochCorrection(const G4ParticleDefinition*, 128 const G4Material*, 130 const G4Material*, 129 const G4double kine << 131 G4double kineticEnergy); 130 const G4bool isInit << 131 132 132 G4double MottCorrection(const G4ParticleDefi 133 G4double MottCorrection(const G4ParticleDefinition*, 133 const G4Material*, 134 const G4Material*, 134 const G4double kinet << 135 G4double kineticEnergy); 135 const G4bool isIniti << 136 >> 137 G4double NuclearDEDX(const G4ParticleDefinition*, >> 138 const G4Material*, >> 139 G4double kineticEnergy, >> 140 G4bool fluct = true); 136 141 137 void AddStoppingData(const G4int Z, const G4 << 142 void AddStoppingData(G4int Z, G4int A, const G4String& materialName, 138 const G4String& materia << 139 G4PhysicsVector* dVecto 143 G4PhysicsVector* dVector); 140 144 141 void InitialiseForNewRun(); 145 void InitialiseForNewRun(); 142 146 143 // effective charge correction using stoppin 147 // effective charge correction using stopping power data 144 G4double EffectiveChargeCorrection(const G4P 148 G4double EffectiveChargeCorrection(const G4ParticleDefinition*, 145 const G4M 149 const G4Material*, 146 const G4d << 150 G4double kineticEnergy); 147 151 148 // effective charge of an ion 152 // effective charge of an ion 149 inline G4double GetParticleCharge(const G4Pa 153 inline G4double GetParticleCharge(const G4ParticleDefinition*, 150 const G4Ma 154 const G4Material*, 151 const G4do << 155 G4double kineticEnergy); 152 156 153 inline 157 inline 154 G4double EffectiveChargeSquareRatio(const G4 158 G4double EffectiveChargeSquareRatio(const G4ParticleDefinition*, 155 const G4 159 const G4Material*, 156 const G4 << 160 G4double kineticEnergy); 157 161 158 // ionisation models for ions 162 // ionisation models for ions 159 inline void SetIonisationModels(G4VEmModel* << 163 inline void SetIonisationModels(G4VEmModel* m1 = nullptr, 160 G4VEmModel* << 164 G4VEmModel* m2 = nullptr); 161 165 162 inline G4int GetNumberOfStoppingVectors() co 166 inline G4int GetNumberOfStoppingVectors() const; 163 167 164 inline void SetVerbose(G4int verb); 168 inline void SetVerbose(G4int verb); 165 169 166 // hide assignment operator << 167 G4EmCorrections & operator=(const G4EmCorrec << 168 G4EmCorrections(const G4EmCorrections&) = de << 169 << 170 private: 170 private: 171 171 172 void Initialise(); 172 void Initialise(); 173 173 174 void BuildCorrectionVector(); 174 void BuildCorrectionVector(); 175 175 176 void SetupKinematics(const G4ParticleDefinit 176 void SetupKinematics(const G4ParticleDefinition*, 177 const G4Material*, 177 const G4Material*, 178 const G4double kineticE << 178 G4double kineticEnergy); 179 << 180 G4double KShell(const G4double theta, const << 181 << 182 G4double LShell(const G4double theta, const << 183 179 184 G4int Index(const G4double x, const G4double << 180 G4double KShell(G4double theta, G4double eta); 185 181 186 G4double Value(const G4double xv, const G4do << 182 G4double LShell(G4double theta, G4double eta); 187 const G4double y1, const G4do << 188 183 189 G4double Value2(const G4double xv, const G4d << 184 G4int Index(G4double x, const G4double* y, G4int n) const; 190 const G4double x1, const G4d << 191 const G4double y1, const G4d << 192 const G4double z11, const G4 << 193 const G4double z12, const G4double z22) << 194 185 195 G4Pow* g4calc; << 186 G4double Value(G4double xv, G4double x1, G4double x2, 196 G4IonTable* ionTable; << 187 G4double y1, G4double y2) const; 197 188 198 const G4ParticleDefinition* particle = nullp << 189 G4double Value2(G4double xv, G4double yv, G4double x1, G4double x2, 199 const G4ParticleDefinition* curParticle = nu << 190 G4double y1, G4double y2, G4double z11, G4double z21, 200 const G4Material* material = nullptr; << 191 G4double z12, G4double z22) const; 201 const G4Material* curMaterial = nullptr; << 202 const G4ElementVector* theElementVector = nu << 203 const G4double* atomDensity = nullptr; << 204 << 205 G4PhysicsVector* curVector = nullptr; << 206 << 207 G4VEmModel* ionLEModel = nullptr; << 208 G4VEmModel* ionHEModel = nullptr; << 209 << 210 G4double kinEnergy = 0.0; << 211 G4double mass = 0.0; << 212 G4double massFactor = 1.0; << 213 G4double tau = 0.0; << 214 G4double gamma = 1.0; << 215 G4double bg2 = 0.0; << 216 G4double beta2 = 0.0; << 217 G4double beta = 0.0; << 218 G4double ba2 = 0.0; << 219 G4double tmax = 0.0; << 220 G4double charge = 0.0; << 221 G4double q2 = 0.0; << 222 G4double eth; << 223 G4double eCorrMin; << 224 G4double eCorrMax; << 225 << 226 std::size_t ncouples = 0; << 227 std::size_t idxBarkas = 0; << 228 G4int nK = 20; << 229 G4int nL = 26; << 230 G4int nEtaK = 29; << 231 G4int nEtaL = 28; << 232 G4int nbinCorr = 52; << 233 G4int numberOfElements = 0; << 234 192 235 // Ion stopping data << 193 G4double NuclearStoppingPower(G4double e, G4double z1, G4double z2, 236 G4int nIons = 0; << 194 G4double m1, G4double m2); 237 G4int idx = 0; << 238 G4int currentZ = 0; << 239 << 240 G4int verbose; << 241 G4bool isInitializer = false; << 242 << 243 std::vector<G4int> Zion; << 244 std::vector<G4int> Aion; << 245 std::vector<G4String> materialName; << 246 std::vector<const G4ParticleDefinition*> ion << 247 << 248 std::map< G4int, std::vector<G4double> > thc << 249 195 250 std::vector<const G4Material*> currmat; << 196 // hide assignment operator 251 std::vector<const G4Material*> materialList; << 197 G4EmCorrections & operator=(const G4EmCorrections &right) = delete; 252 std::vector<G4PhysicsVector*> stopData; << 198 G4EmCorrections(const G4EmCorrections&) = delete; 253 199 254 G4ionEffectiveCharge effCharge; << 200 G4Pow* g4calc; 255 201 >> 202 static const G4double inveplus; 256 static const G4double ZD[11]; 203 static const G4double ZD[11]; 257 static const G4double UK[20]; 204 static const G4double UK[20]; 258 static const G4double VK[20]; 205 static const G4double VK[20]; 259 static G4double ZK[20]; 206 static G4double ZK[20]; 260 static const G4double Eta[29]; 207 static const G4double Eta[29]; 261 static G4double CK[20][29]; 208 static G4double CK[20][29]; 262 static G4double CL[26][28]; 209 static G4double CL[26][28]; 263 static const G4double UL[26]; 210 static const G4double UL[26]; 264 static G4double VL[26]; 211 static G4double VL[26]; 265 212 266 static G4double sWmaxBarkas; << 213 static G4LPhysicsFreeVector* BarkasCorr; 267 static G4PhysicsFreeVector* sBarkasCorr; << 214 static G4LPhysicsFreeVector* ThetaK; 268 static G4PhysicsFreeVector* sThetaK; << 215 static G4LPhysicsFreeVector* ThetaL; 269 static G4PhysicsFreeVector* sThetaL; << 216 >> 217 G4double theZieglerFactor; >> 218 G4double alpha2; >> 219 G4bool lossFlucFlag; >> 220 >> 221 std::vector<const G4Material*> currmat; >> 222 std::map< G4int, std::vector<G4double> > thcorr; >> 223 size_t ncouples; >> 224 >> 225 const G4ParticleDefinition* particle; >> 226 const G4ParticleDefinition* curParticle; >> 227 const G4Material* material; >> 228 const G4Material* curMaterial; >> 229 const G4ElementVector* theElementVector; >> 230 const G4double* atomDensity; >> 231 >> 232 G4PhysicsVector* curVector; >> 233 >> 234 G4IonTable* ionTable; >> 235 G4VEmModel* ionLEModel; >> 236 G4VEmModel* ionHEModel; >> 237 >> 238 G4double kinEnergy; >> 239 G4double mass; >> 240 G4double massFactor; >> 241 G4double eth; >> 242 G4double tau; >> 243 G4double gamma; >> 244 G4double bg2; >> 245 G4double beta2; >> 246 G4double beta; >> 247 G4double ba2; >> 248 G4double tmax; >> 249 G4double charge; >> 250 G4double q2; >> 251 G4double eCorrMin; >> 252 G4double eCorrMax; >> 253 >> 254 G4int verbose; >> 255 >> 256 G4int nK; >> 257 G4int nL; >> 258 G4int nEtaK; >> 259 G4int nEtaL; >> 260 >> 261 G4int nbinCorr; >> 262 G4int numberOfElements; >> 263 >> 264 // Ion stopping data >> 265 G4int nIons; >> 266 G4int idx; >> 267 G4int currentZ; >> 268 std::vector<G4int> Zion; >> 269 std::vector<G4int> Aion; >> 270 std::vector<G4String> materialName; >> 271 >> 272 std::vector<const G4ParticleDefinition*> ionList; >> 273 >> 274 std::vector<const G4Material*> materialList; >> 275 std::vector<G4PhysicsVector*> stopData; >> 276 >> 277 G4bool isMaster; >> 278 G4ionEffectiveCharge effCharge; 270 }; 279 }; 271 280 272 inline G4int 281 inline G4int 273 G4EmCorrections::Index(const G4double x, const << 282 G4EmCorrections::Index(G4double x, const G4double* y, G4int n) const 274 { 283 { 275 G4int iddd = n-1; 284 G4int iddd = n-1; 276 // Loop checking, 03-Aug-2015, Vladimir Ivan 285 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko 277 do {--iddd;} while (iddd>0 && x<y[iddd]); 286 do {--iddd;} while (iddd>0 && x<y[iddd]); 278 return iddd; 287 return iddd; 279 } 288 } 280 289 281 inline G4double G4EmCorrections::Value(const G << 290 inline G4double G4EmCorrections::Value(G4double xv, G4double x1, G4double x2, 282 const G << 291 G4double y1, G4double y2) const 283 const G << 284 { 292 { 285 return y1 + (y2 - y1)*(xv - x1)/(x2 - x1); 293 return y1 + (y2 - y1)*(xv - x1)/(x2 - x1); 286 } 294 } 287 295 288 inline G4double G4EmCorrections::Value2(const << 296 inline G4double G4EmCorrections::Value2(G4double xv, G4double yv, 289 const << 297 G4double x1, G4double x2, 290 const << 298 G4double y1, G4double y2, 291 const << 299 G4double z11, G4double z21, 292 const << 300 G4double z12, G4double z22) const 293 { 301 { 294 return ( z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*( << 302 return (z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) + 295 z12*(x2-xv)*(yv-y1) + z21*(xv-x1)*(y2-yv) << 303 0.5*(z12*((x2-xv)*(yv-y1)+(xv-x1)*(y2-yv))+ >> 304 z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv)))) 296 / ((x2-x1)*(y2-y1)); 305 / ((x2-x1)*(y2-y1)); 297 } 306 } 298 307 299 inline void 308 inline void 300 G4EmCorrections::SetIonisationModels(G4VEmMode 309 G4EmCorrections::SetIonisationModels(G4VEmModel* mod1, G4VEmModel* mod2) 301 { 310 { 302 if(nullptr != mod1) { ionLEModel = mod1; } << 311 if(mod1) { ionLEModel = mod1; } 303 if(nullptr != mod2) { ionHEModel = mod2; } << 312 if(mod2) { ionHEModel = mod2; } 304 } 313 } 305 314 306 inline G4int G4EmCorrections::GetNumberOfStopp 315 inline G4int G4EmCorrections::GetNumberOfStoppingVectors() const 307 { 316 { 308 return nIons; 317 return nIons; 309 } 318 } 310 319 311 inline G4double 320 inline G4double 312 G4EmCorrections::GetParticleCharge(const G4Par 321 G4EmCorrections::GetParticleCharge(const G4ParticleDefinition* p, 313 const G4Mat 322 const G4Material* mat, 314 const G4dou << 323 G4double kineticEnergy) 315 { 324 { 316 return effCharge.EffectiveCharge(p,mat,kinet 325 return effCharge.EffectiveCharge(p,mat,kineticEnergy); 317 } 326 } 318 327 319 inline G4double 328 inline G4double 320 G4EmCorrections::EffectiveChargeSquareRatio(co 329 G4EmCorrections::EffectiveChargeSquareRatio(const G4ParticleDefinition* p, 321 co 330 const G4Material* mat, 322 co << 331 G4double kineticEnergy) 323 { 332 { 324 return effCharge.EffectiveChargeSquareRatio( 333 return effCharge.EffectiveChargeSquareRatio(p,mat,kineticEnergy); >> 334 } >> 335 >> 336 inline void G4EmCorrections::SetupKinematics(const G4ParticleDefinition* p, >> 337 const G4Material* mat, >> 338 G4double kineticEnergy) >> 339 { >> 340 if(kineticEnergy != kinEnergy || p != particle) { >> 341 particle = p; >> 342 kinEnergy = kineticEnergy; >> 343 mass = p->GetPDGMass(); >> 344 tau = kineticEnergy / mass; >> 345 gamma = 1.0 + tau; >> 346 bg2 = tau * (tau+2.0); >> 347 beta2 = bg2/(gamma*gamma); >> 348 beta = std::sqrt(beta2); >> 349 ba2 = beta2/alpha2; >> 350 G4double ratio = CLHEP::electron_mass_c2/mass; >> 351 tmax = 2.0*CLHEP::electron_mass_c2*bg2 >> 352 /(1. + 2.0*gamma*ratio + ratio*ratio); >> 353 charge = p->GetPDGCharge()*inveplus; >> 354 if(charge > 1.5) { charge = effCharge.EffectiveCharge(p,mat,kinEnergy); } >> 355 q2 = charge*charge; >> 356 } >> 357 if(mat != material) { >> 358 material = mat; >> 359 theElementVector = material->GetElementVector(); >> 360 atomDensity = material->GetAtomicNumDensityVector(); >> 361 numberOfElements = material->GetNumberOfElements(); >> 362 } 325 } 363 } 326 364 327 inline void G4EmCorrections::SetVerbose(G4int 365 inline void G4EmCorrections::SetVerbose(G4int verb) 328 { 366 { 329 verbose = verb; 367 verbose = verb; 330 } 368 } 331 369 332 //....oooOO0OOooo........oooOO0OOooo........oo 370 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 333 371 334 #endif 372 #endif 335 373