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