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 // >> 27 // $Id: G4TransparentRegXTRadiator.cc,v 1.11 2007/09/29 17:49:34 vnivanch Exp $ >> 28 // GEANT4 tag $Name: geant4-09-01-patch-01 $ >> 29 // >> 30 >> 31 #include <complex> 26 32 27 #include "G4TransparentRegXTRadiator.hh" 33 #include "G4TransparentRegXTRadiator.hh" >> 34 #include "Randomize.hh" >> 35 #include "G4Integrator.hh" >> 36 #include "G4Gamma.hh" 28 37 29 #include "G4PhysicalConstants.hh" << 38 using namespace std; 30 39 31 ////////////////////////////////////////////// 40 //////////////////////////////////////////////////////////////////////////// >> 41 // 32 // Constructor, destructor 42 // Constructor, destructor 33 G4TransparentRegXTRadiator::G4TransparentRegXT << 43 34 G4LogicalVolume* anEnvelope, G4Material* foi << 44 G4TransparentRegXTRadiator::G4TransparentRegXTRadiator(G4LogicalVolume *anEnvelope, 35 G4double a, G4double b, G4int n, const G4Str << 45 G4Material* foilMat,G4Material* gasMat, 36 : G4VXTRenergyLoss(anEnvelope, foilMat, gasM << 46 G4double a, G4double b, G4int n, >> 47 const G4String& processName) : >> 48 G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,n,processName) 37 { 49 { 38 if(verboseLevel > 0) 50 if(verboseLevel > 0) 39 G4cout << "Regular transparent X-ray TR r << 51 G4cout<<"Regular transparent X-ray TR radiator EM process is called"<<G4endl; 40 << G4endl; << 41 52 42 // Build energy and angular integral spectra 53 // Build energy and angular integral spectra of X-ray TR photons from 43 // a radiator 54 // a radiator 44 55 45 fAlphaPlate = 10000; 56 fAlphaPlate = 10000; 46 fAlphaGas = 1000; 57 fAlphaGas = 1000; >> 58 >> 59 // BuildTable(); 47 } 60 } 48 61 49 ////////////////////////////////////////////// 62 /////////////////////////////////////////////////////////////////////////// 50 G4TransparentRegXTRadiator::~G4TransparentRegX << 51 63 52 ////////////////////////////////////////////// << 64 G4TransparentRegXTRadiator::~G4TransparentRegXTRadiator() 53 void G4TransparentRegXTRadiator::ProcessDescri << 54 { 65 { 55 out << "Simulation of forward X-ray transiti << 66 ; 56 "relativistic charged particles cross << 57 "two materials.\n"; << 58 } 67 } 59 68 60 ////////////////////////////////////////////// 69 /////////////////////////////////////////////////////////////////////////// >> 70 // >> 71 // >> 72 61 G4double G4TransparentRegXTRadiator::SpectralX 73 G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy) 62 { 74 { 63 G4double result, sum = 0., tmp, cof1, cof2, << 75 G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC,aMa, bMb, sigma; 64 G4int k, kMax, kMin; 76 G4int k, kMax, kMin; 65 77 66 cofPHC = 4. * pi * hbarc; << 78 aMa = fPlateThick*GetPlateLinearPhotoAbs(energy); 67 tmp = (fSigma1 - fSigma2) / cofPHC / ener << 79 bMb = fGasThick*GetGasLinearPhotoAbs(energy); 68 cof1 = fPlateThick * tmp; << 80 sigma = aMa + bMb; 69 cof2 = fGasThick * tmp; << 81 >> 82 cofPHC = 4*pi*hbarc; >> 83 tmp = (fSigma1 - fSigma2)/cofPHC/energy; >> 84 cof1 = fPlateThick*tmp; >> 85 cof2 = fGasThick*tmp; 70 86 71 cofMin = energy * (fPlateThick + fGasThick) << 87 cofMin = energy*(fPlateThick + fGasThick)/fGamma/fGamma; 72 cofMin += (fPlateThick * fSigma1 + fGasThick << 88 cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy; 73 cofMin /= cofPHC; 89 cofMin /= cofPHC; 74 90 75 theta2 = cofPHC / (energy * (fPlateThick + f << 91 // if (fGamma < 1200) kMin = G4int(cofMin); // 1200 ? >> 92 // else kMin = 1; >> 93 76 94 77 kMin = G4int(cofMin); 95 kMin = G4int(cofMin); 78 if(cofMin > kMin) << 96 if (cofMin > kMin) kMin++; 79 kMin++; << 80 97 81 kMax = kMin + 49; << 98 // tmp = (fPlateThick + fGasThick)*energy*fMaxThetaTR; >> 99 // tmp /= cofPHC; >> 100 // kMax = G4int(tmp); >> 101 // if(kMax < 0) kMax = 0; >> 102 // kMax += kMin; >> 103 >> 104 >> 105 kMax = kMin + 19; // 9; // kMin + G4int(tmp); >> 106 >> 107 // tmp /= fGamma; >> 108 // if( G4int(tmp) < kMin ) kMin = G4int(tmp); >> 109 // G4cout<<"kMin = "<<kMin<<"; kMax = "<<kMax<<G4endl; 82 110 83 if(verboseLevel > 2) << 111 for( k = kMin; k <= kMax; k++ ) 84 { 112 { 85 G4cout << cof1 << " " << cof2 << " << 113 tmp = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick); 86 G4cout << "kMin = " << kMin << "; kMax << 114 result = (k - cof1)*(k - cof1)*(k + cof2)*(k + cof2); 87 } << 115 // tmp = sin(tmp)*sin(tmp)*abs(k-cofMin)/result; 88 for(k = kMin; k <= kMax; ++k) << 116 if( k == kMin && kMin == G4int(cofMin) ) 89 { << 90 tmp = pi * fPlateThick * (k + cof2) / ( << 91 result = (k - cof1) * (k - cof1) * (k + co << 92 if(k == kMin && kMin == G4int(cofMin)) << 93 { 117 { 94 sum += << 118 sum += 0.5*sin(tmp)*sin(tmp)*abs(k-cofMin)/result; 95 0.5 * std::sin(tmp) * std::sin(tmp) * << 96 } 119 } 97 else 120 else 98 { 121 { 99 sum += std::sin(tmp) * std::sin(tmp) * s << 122 sum += sin(tmp)*sin(tmp)*abs(k-cofMin)/result; 100 } 123 } 101 theta2k = std::sqrt(theta2 * std::abs(k - << 102 << 103 if(verboseLevel > 2) 124 if(verboseLevel > 2) 104 { << 125 { 105 G4cout << k << " " << theta2k << " << 126 G4cout<<"k = "<<k<<"; tmp = "<<sin(tmp)*sin(tmp)*abs(k-cofMin)/result 106 << std::sin(tmp) * std::sin(tmp) << 127 <<"; sum = "<<sum<<G4endl; 107 << " " << sum << G4endl; << 128 } 108 } << 109 } 129 } 110 result = 4. * (cof1 + cof2) * (cof1 + cof2) << 130 result = 4*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy; 111 result *= fPlateNumber; << 131 // result *= ( 1 - exp(-0.5*fPlateNumber*sigma) )/( 1 - exp(-0.5*sigma) ); 112 << 132 // fPlateNumber; >> 133 result *= fPlateNumber; // *exp(-0.5*fPlateNumber*sigma); >> 134 // +1-exp(-0.5*fPlateNumber*sigma); >> 135 /* >> 136 fEnergy = energy; >> 137 // G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral; >> 138 G4Integrator<G4TransparentRegXTRadiator,G4double(G4VXTRenergyLoss::*)(G4double)> integral; >> 139 >> 140 tmp = integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx, >> 141 0.0,0.3*fMaxThetaTR) + >> 142 integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx, >> 143 0.3*fMaxThetaTR,0.6*fMaxThetaTR) + >> 144 integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx, >> 145 0.6*fMaxThetaTR,fMaxThetaTR) ; >> 146 result += tmp; >> 147 */ 113 return result; 148 return result; 114 } 149 } 115 150 >> 151 116 ////////////////////////////////////////////// 152 /////////////////////////////////////////////////////////////////////////// >> 153 // 117 // Approximation for radiator interference fac 154 // Approximation for radiator interference factor for the case of 118 // fully Regular radiator. The plate and gas g << 155 // fully Regular radiator. The plate and gas gap thicknesses are fixed . 119 // The mean values of the plate and gas gap th << 156 // The mean values of the plate and gas gap thicknesses 120 // are supposed to be about XTR formation zone << 157 // are supposed to be about XTR formation zones but much less than 121 // mean absorption length of XTR photons in co << 158 // mean absorption length of XTR photons in coresponding material. 122 G4double G4TransparentRegXTRadiator::GetStackF << 159 123 << 160 G4double 124 << 161 G4TransparentRegXTRadiator::GetStackFactor( G4double energy, >> 162 G4double gamma, G4double varAngle ) 125 { 163 { 126 G4double result, Qa, Qb, Q, aZa, bZb, aMa, b << 164 /* 127 << 165 G4double result, Za, Zb, Ma, Mb, sigma; 128 aZa = fPlateThick / GetPlateFormationZone( << 166 129 bZb = fGasThick / GetGasFormationZone(ener << 167 Za = GetPlateFormationZone(energy,gamma,varAngle); 130 aMa = fPlateThick * GetPlateLinearPhotoAbs << 168 Zb = GetGasFormationZone(energy,gamma,varAngle); 131 bMb = fGasThick * GetGasLinearPhotoAbs(ene << 169 Ma = GetPlateLinearPhotoAbs(energy); 132 sigma = aMa * fPlateThick + bMb * fGasThick; << 170 Mb = GetGasLinearPhotoAbs(energy); 133 Qa = std::exp(-0.5 * aMa); << 171 sigma = Ma*fPlateThick + Mb*fGasThick; 134 Qb = std::exp(-0.5 * bMb); << 172 135 Q = Qa * Qb; << 173 G4complex Ca(1.0+0.5*fPlateThick*Ma/fAlphaPlate,fPlateThick/Za/fAlphaPlate); 136 << 174 G4complex Cb(1.0+0.5*fGasThick*Mb/fAlphaGas,fGasThick/Zb/fAlphaGas); 137 G4complex Ha(Qa * std::cos(aZa), -Qa * std:: << 175 138 G4complex Hb(Qb * std::cos(bZb), -Qb * std:: << 176 G4complex Ha = pow(Ca,-fAlphaPlate); 139 G4complex H = Ha * Hb; << 177 G4complex Hb = pow(Cb,-fAlphaGas); >> 178 G4complex H = Ha*Hb; >> 179 G4complex F1 = (1.0 - Ha)*(1.0 - Hb )/(1.0 - H) >> 180 * G4double(fPlateNumber) ; >> 181 G4complex F2 = (1.0-Ha)*(1.0-Ha)*Hb/(1.0-H)/(1.0-H) >> 182 * (1.0 - exp(-0.5*fPlateNumber*sigma)) ; >> 183 // *(1.0 - pow(H,fPlateNumber)) ; >> 184 G4complex R = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle); >> 185 // G4complex R = F2*OneInterfaceXTRdEdx(energy,gamma,varAngle); >> 186 result = 2.0*real(R); >> 187 return result; >> 188 */ >> 189 // numerically unstable result >> 190 >> 191 G4double result, Qa, Qb, Q, aZa, bZb, aMa, bMb, D, sigma; >> 192 >> 193 aZa = fPlateThick/GetPlateFormationZone(energy,gamma,varAngle); >> 194 bZb = fGasThick/GetGasFormationZone(energy,gamma,varAngle); >> 195 aMa = fPlateThick*GetPlateLinearPhotoAbs(energy); >> 196 bMb = fGasThick*GetGasLinearPhotoAbs(energy); >> 197 sigma = aMa*fPlateThick + bMb*fGasThick; >> 198 Qa = exp(-0.5*aMa); >> 199 Qb = exp(-0.5*bMb); >> 200 Q = Qa*Qb; >> 201 >> 202 G4complex Ha( Qa*cos(aZa), -Qa*sin(aZa) ); >> 203 G4complex Hb( Qb*cos(bZb), -Qb*sin(bZb) ); >> 204 G4complex H = Ha*Hb; 140 G4complex Hs = conj(H); 205 G4complex Hs = conj(H); 141 D = 1.0 / ((1 - Q) * (1 - Q) + << 206 D = 1.0 /( (1 - Q)*(1 - Q) + 142 4 * Q * std::sin(0.5 * (aZa + bZb << 207 4*Q*sin(0.5*(aZa + bZb))*sin(0.5*(aZa + bZb)) ); 143 G4complex F1 = << 208 G4complex F1 = (1.0 - Ha)*(1.0 - Hb)*(1.0 - Hs) 144 (1.0 - Ha) * (1.0 - Hb) * (1.0 - Hs) * G4d << 209 * G4double(fPlateNumber)*D; 145 G4complex F2 = (1.0 - Ha) * (1.0 - Ha) * Hb << 210 G4complex F2 = (1.0 - Ha)*(1.0 - Ha)*Hb*(1.0 - Hs)*(1.0 - Hs) 146 (1.0 - std::exp(-0.5 * fPlate << 211 // * (1.0 - pow(H,fPlateNumber)) * D*D; 147 G4complex R = (F1 + F2) * OneInterfaceXTRdEd << 212 * (1.0 - exp(-0.5*fPlateNumber*sigma)) * D*D; 148 result = 2.0 * std::real(R); << 213 G4complex R = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle); 149 return result; << 214 result = 2.0*real(R); >> 215 return result; >> 216 150 } 217 } >> 218 >> 219 >> 220 // >> 221 // >> 222 //////////////////////////////////////////////////////////////////////////// >> 223 >> 224 >> 225 >> 226 >> 227 >> 228 >> 229 >> 230 151 231