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