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