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