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 // 26 // 27 // 27 // 28 // Author: Vladimir Grichine 28 // Author: Vladimir Grichine 29 // 29 // 30 // History: 30 // History: 31 // 31 // 32 // 14.10.12 V.Grichine, update of xsc and angu 32 // 14.10.12 V.Grichine, update of xsc and angular distribution 33 // 25.05.2011 first implementation 33 // 25.05.2011 first implementation 34 34 35 #include "G4XrayRayleighModel.hh" 35 #include "G4XrayRayleighModel.hh" 36 #include "G4PhysicalConstants.hh" 36 #include "G4PhysicalConstants.hh" 37 #include "G4SystemOfUnits.hh" 37 #include "G4SystemOfUnits.hh" 38 38 39 ////////////////////////////////////////////// << 39 //////////////////////////////////////////////////////////////////////////////////// >> 40 >> 41 using namespace std; 40 42 41 const G4double G4XrayRayleighModel::fCofA = 2. 43 const G4double G4XrayRayleighModel::fCofA = 2.*pi2*Bohr_radius*Bohr_radius; 42 44 43 const G4double G4XrayRayleighModel::fCofR = 8. 45 const G4double G4XrayRayleighModel::fCofR = 8.*pi*classic_electr_radius*classic_electr_radius/3.; 44 46 45 ////////////////////////////////////////////// << 47 //////////////////////////////////////////////////////////////////////////////////. 46 48 47 G4XrayRayleighModel::G4XrayRayleighModel(const 49 G4XrayRayleighModel::G4XrayRayleighModel(const G4ParticleDefinition*, 48 const G4String& nam) 50 const G4String& nam) 49 :G4VEmModel(nam),isInitialised(false) 51 :G4VEmModel(nam),isInitialised(false) 50 { 52 { 51 fParticleChange = nullptr; << 53 fParticleChange = 0; 52 lowEnergyLimit = 250*eV; 54 lowEnergyLimit = 250*eV; 53 highEnergyLimit = 10.*MeV; 55 highEnergyLimit = 10.*MeV; 54 fFormFactor = 0.0; 56 fFormFactor = 0.0; 55 57 56 // SetLowEnergyLimit(lowEnergyLimit); 58 // SetLowEnergyLimit(lowEnergyLimit); 57 SetHighEnergyLimit(highEnergyLimit); 59 SetHighEnergyLimit(highEnergyLimit); 58 // 60 // 59 verboseLevel= 0; 61 verboseLevel= 0; 60 // Verbosity scale: 62 // Verbosity scale: 61 // 0 = nothing 63 // 0 = nothing 62 // 1 = warning for energy non-conservation 64 // 1 = warning for energy non-conservation 63 // 2 = details of energy budget 65 // 2 = details of energy budget 64 // 3 = calculation of cross sections, file o 66 // 3 = calculation of cross sections, file openings, sampling of atoms 65 // 4 = entering in methods 67 // 4 = entering in methods 66 68 67 if(verboseLevel > 0) 69 if(verboseLevel > 0) 68 { 70 { 69 G4cout << "Xray Rayleigh is constructed " 71 G4cout << "Xray Rayleigh is constructed " << G4endl 70 << "Energy range: " 72 << "Energy range: " 71 << lowEnergyLimit / eV << " eV - " 73 << lowEnergyLimit / eV << " eV - " 72 << highEnergyLimit / MeV << " MeV" 74 << highEnergyLimit / MeV << " MeV" 73 << G4endl; 75 << G4endl; 74 } 76 } 75 } 77 } 76 78 77 ////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////// 78 80 79 G4XrayRayleighModel::~G4XrayRayleighModel() = << 81 G4XrayRayleighModel::~G4XrayRayleighModel() >> 82 { 80 83 81 ////////////////////////////////////////////// << 84 } >> 85 >> 86 ///////////////////////////////////////////////////////////////////////////////////// 82 87 83 void G4XrayRayleighModel::Initialise(const G4P 88 void G4XrayRayleighModel::Initialise(const G4ParticleDefinition* particle, 84 const G4DataVector& cuts) 89 const G4DataVector& cuts) 85 { 90 { 86 if (verboseLevel > 3) 91 if (verboseLevel > 3) 87 { 92 { 88 G4cout << "Calling G4XrayRayleighModel::In 93 G4cout << "Calling G4XrayRayleighModel::Initialise()" << G4endl; 89 } 94 } 90 95 91 InitialiseElementSelectors(particle,cuts); 96 InitialiseElementSelectors(particle,cuts); 92 97 93 98 94 if(isInitialised) return; 99 if(isInitialised) return; 95 fParticleChange = GetParticleChangeForGamma( 100 fParticleChange = GetParticleChangeForGamma(); 96 isInitialised = true; 101 isInitialised = true; 97 102 98 } 103 } 99 104 100 ////////////////////////////////////////////// << 105 ///////////////////////////////////////////////////////////////////////////////// 101 106 102 G4double G4XrayRayleighModel::ComputeCrossSect 107 G4double G4XrayRayleighModel::ComputeCrossSectionPerAtom( 103 const G 108 const G4ParticleDefinition*, 104 G 109 G4double gammaEnergy, 105 G 110 G4double Z, G4double, 106 G 111 G4double, G4double) 107 { 112 { 108 if (verboseLevel > 3) 113 if (verboseLevel > 3) 109 { 114 { 110 G4cout << "Calling CrossSectionPerAtom() o 115 G4cout << "Calling CrossSectionPerAtom() of G4XrayRayleighModel" << G4endl; 111 } 116 } 112 if (gammaEnergy < lowEnergyLimit || gammaEne 117 if (gammaEnergy < lowEnergyLimit || gammaEnergy > highEnergyLimit) 113 { 118 { 114 return 0.0; 119 return 0.0; 115 } 120 } 116 G4double k = gammaEnergy/hbarc; 121 G4double k = gammaEnergy/hbarc; 117 k *= Bohr_radius; 122 k *= Bohr_radius; 118 G4double p0 = 0.680654; 123 G4double p0 = 0.680654; 119 G4double p1 = -0.0224188; 124 G4double p1 = -0.0224188; 120 G4double lnZ = std::log(Z); 125 G4double lnZ = std::log(Z); 121 126 122 G4double lna = p0 + p1*lnZ; 127 G4double lna = p0 + p1*lnZ; 123 128 124 G4double alpha = std::exp(lna); 129 G4double alpha = std::exp(lna); 125 130 126 G4double fo = std::pow(k, alpha); 131 G4double fo = std::pow(k, alpha); 127 132 128 p0 = 3.68455; 133 p0 = 3.68455; 129 p1 = -0.464806; 134 p1 = -0.464806; 130 lna = p0 + p1*lnZ; 135 lna = p0 + p1*lnZ; 131 136 132 fo *= 0.01*std::exp(lna); 137 fo *= 0.01*std::exp(lna); 133 138 134 fFormFactor = fo; 139 fFormFactor = fo; 135 140 136 G4double b = 1. + 2.*fo; 141 G4double b = 1. + 2.*fo; 137 G4double b2 = b*b; 142 G4double b2 = b*b; 138 G4double b3 = b*b2; 143 G4double b3 = b*b2; 139 144 140 G4double xsc = fCofR*Z*Z/b3; 145 G4double xsc = fCofR*Z*Z/b3; 141 xsc *= fo*fo + (1. + fo)*(1. + fo); 146 xsc *= fo*fo + (1. + fo)*(1. + fo); 142 147 143 148 144 return xsc; 149 return xsc; 145 150 146 } 151 } 147 152 148 ////////////////////////////////////////////// << 153 /////////////////////////////////////////////////////////////////////////////////// 149 154 150 void G4XrayRayleighModel::SampleSecondaries(st 155 void G4XrayRayleighModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/, 151 co 156 const G4MaterialCutsCouple* couple, 152 co 157 const G4DynamicParticle* aDPGamma, 153 G4 158 G4double, 154 G4 159 G4double) 155 { 160 { 156 if ( verboseLevel > 3) 161 if ( verboseLevel > 3) 157 { 162 { 158 G4cout << "Calling SampleSecondaries() of 163 G4cout << "Calling SampleSecondaries() of G4XrayRayleighModel" << G4endl; 159 } 164 } 160 G4double photonEnergy0 = aDPGamma->GetKineti 165 G4double photonEnergy0 = aDPGamma->GetKineticEnergy(); 161 166 162 G4ParticleMomentum photonDirection0 = aDPGam 167 G4ParticleMomentum photonDirection0 = aDPGamma->GetMomentumDirection(); 163 168 164 169 165 // Sample the angle of the scattered photon 170 // Sample the angle of the scattered photon 166 // according to 1 + cosTheta*cosTheta distri 171 // according to 1 + cosTheta*cosTheta distribution 167 172 168 G4double cosDipole, cosTheta, sinTheta; 173 G4double cosDipole, cosTheta, sinTheta; 169 G4double c, delta, cofA, signc = 1., a, powe 174 G4double c, delta, cofA, signc = 1., a, power = 1./3.; 170 175 171 c = 4. - 8.*G4UniformRand(); 176 c = 4. - 8.*G4UniformRand(); 172 a = c; 177 a = c; 173 178 174 if( c < 0. ) 179 if( c < 0. ) 175 { 180 { 176 signc = -1.; 181 signc = -1.; 177 a = -c; 182 a = -c; 178 } 183 } 179 delta = std::sqrt(a*a+4.); 184 delta = std::sqrt(a*a+4.); 180 delta += a; 185 delta += a; 181 delta *= 0.5; 186 delta *= 0.5; 182 cofA = -signc*std::pow(delta, power); 187 cofA = -signc*std::pow(delta, power); 183 cosDipole = cofA - 1./cofA; 188 cosDipole = cofA - 1./cofA; 184 189 185 // select atom 190 // select atom 186 const G4Element* elm = SelectTargetAtom(coup 191 const G4Element* elm = SelectTargetAtom(couple, aDPGamma->GetParticleDefinition(), 187 phot 192 photonEnergy0,aDPGamma->GetLogKineticEnergy()); 188 G4double Z = elm->GetZ(); 193 G4double Z = elm->GetZ(); 189 194 190 G4double k = photonEnergy0/hbarc; 195 G4double k = photonEnergy0/hbarc; 191 k *= Bohr_radius; 196 k *= Bohr_radius; 192 G4double p0 = 0.680654; 197 G4double p0 = 0.680654; 193 G4double p1 = -0.0224188; 198 G4double p1 = -0.0224188; 194 G4double lnZ = std::log(Z); 199 G4double lnZ = std::log(Z); 195 200 196 G4double lna = p0 + p1*lnZ; 201 G4double lna = p0 + p1*lnZ; 197 202 198 G4double alpha = std::exp(lna); 203 G4double alpha = std::exp(lna); 199 204 200 G4double fo = std::pow(k, alpha); 205 G4double fo = std::pow(k, alpha); 201 206 202 p0 = 3.68455; 207 p0 = 3.68455; 203 p1 = -0.464806; 208 p1 = -0.464806; 204 lna = p0 + p1*lnZ; 209 lna = p0 + p1*lnZ; 205 210 206 fo *= 0.01*pi*std::exp(lna); 211 fo *= 0.01*pi*std::exp(lna); 207 212 208 213 209 G4double beta = fo/(1 + fo); 214 G4double beta = fo/(1 + fo); 210 215 211 cosTheta = (cosDipole + beta)/(1. + cosDipol 216 cosTheta = (cosDipole + beta)/(1. + cosDipole*beta); 212 217 213 218 214 if( cosTheta > 1.) cosTheta = 1.; 219 if( cosTheta > 1.) cosTheta = 1.; 215 if( cosTheta < -1.) cosTheta = -1.; 220 if( cosTheta < -1.) cosTheta = -1.; 216 221 217 sinTheta = std::sqrt( (1. - cosTheta)*(1. + 222 sinTheta = std::sqrt( (1. - cosTheta)*(1. + cosTheta) ); 218 223 219 // Scattered photon angles. ( Z - axis along 224 // Scattered photon angles. ( Z - axis along the parent photon) 220 225 221 G4double phi = twopi * G4UniformRand() ; 226 G4double phi = twopi * G4UniformRand() ; 222 G4double dirX = sinTheta*std::cos(phi); 227 G4double dirX = sinTheta*std::cos(phi); 223 G4double dirY = sinTheta*std::sin(phi); 228 G4double dirY = sinTheta*std::sin(phi); 224 G4double dirZ = cosTheta; 229 G4double dirZ = cosTheta; 225 230 226 // Update G4VParticleChange for the scattere 231 // Update G4VParticleChange for the scattered photon 227 232 228 G4ThreeVector photonDirection1(dirX, dirY, d 233 G4ThreeVector photonDirection1(dirX, dirY, dirZ); 229 photonDirection1.rotateUz(photonDirection0); 234 photonDirection1.rotateUz(photonDirection0); 230 fParticleChange->ProposeMomentumDirection(ph 235 fParticleChange->ProposeMomentumDirection(photonDirection1); 231 236 232 fParticleChange->SetProposedKineticEnergy(ph 237 fParticleChange->SetProposedKineticEnergy(photonEnergy0); 233 } 238 } 234 239 235 240 236 241