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: G4RegularXTRadiator.cc,v 1.9 2006/06/29 19:56:09 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-09-02 $ >> 29 // >> 30 >> 31 #include <complex> 26 32 27 #include "G4RegularXTRadiator.hh" 33 #include "G4RegularXTRadiator.hh" >> 34 #include "Randomize.hh" 28 35 29 #include "G4Gamma.hh" 36 #include "G4Gamma.hh" 30 #include "G4PhysicalConstants.hh" << 37 >> 38 using namespace std; 31 39 32 ////////////////////////////////////////////// 40 //////////////////////////////////////////////////////////////////////////// >> 41 // 33 // Constructor, destructor 42 // Constructor, destructor 34 G4RegularXTRadiator::G4RegularXTRadiator(G4Log << 43 35 G4Mat << 44 G4RegularXTRadiator::G4RegularXTRadiator(G4LogicalVolume *anEnvelope, 36 G4Mat << 45 G4Material* foilMat,G4Material* gasMat, 37 G4dou << 46 G4double a, G4double b, G4int n, 38 const << 47 const G4String& processName) : 39 : G4VXTRenergyLoss(anEnvelope, foilMat, gasM << 48 G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,n,processName) 40 { 49 { 41 G4cout << "Regular X-ray TR radiator EM proc << 50 G4cout<<"Regular X-ray TR radiator EM process is called"<<G4endl ; 42 51 43 // Build energy and angular integral spectra 52 // Build energy and angular integral spectra of X-ray TR photons from 44 // a radiator 53 // a radiator 45 54 46 fAlphaPlate = 10000; 55 fAlphaPlate = 10000; 47 fAlphaGas = 1000; 56 fAlphaGas = 1000; 48 G4cout << "fAlphaPlate = " << fAlphaPlate << << 57 G4cout<<"fAlphaPlate = "<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl ; 49 << G4endl; << 58 >> 59 // BuildTable() ; 50 } 60 } 51 61 52 ////////////////////////////////////////////// 62 /////////////////////////////////////////////////////////////////////////// 53 G4RegularXTRadiator::~G4RegularXTRadiator() = << 54 63 55 void G4RegularXTRadiator::ProcessDescription(s << 64 G4RegularXTRadiator::~G4RegularXTRadiator() 56 { 65 { 57 out << "Simulation of X-ray transition radia << 66 ; 58 "relativistic charged particles cross << 59 "two materials. Thicknesses of plates << 60 } 67 } 61 68 62 ////////////////////////////////////////////// << 63 G4double G4RegularXTRadiator::SpectralXTRdEdx( << 64 { << 65 G4double result, sum = 0., tmp, cof1, cof2, << 66 G4double aMa, bMb, sigma, dump; << 67 G4int k, kMax, kMin; << 68 << 69 aMa = fPlateThick * GetPlateLinearPhotoAbs << 70 bMb = fGasThick * GetGasLinearPhotoAbs(ene << 71 sigma = 0.5 * (aMa + bMb); << 72 dump = std::exp(-fPlateNumber * sigma); << 73 if(verboseLevel > 2) << 74 G4cout << " dump = " << dump << G4endl; << 75 cofPHC = 4 * pi * hbarc; << 76 tmp = (fSigma1 - fSigma2) / cofPHC / ener << 77 cof1 = fPlateThick * tmp; << 78 cof2 = fGasThick * tmp; << 79 << 80 cofMin = energy * (fPlateThick + fGasThick) << 81 cofMin += (fPlateThick * fSigma1 + fGasThick << 82 cofMin /= cofPHC; << 83 << 84 theta2 = cofPHC / (energy * (fPlateThick + f << 85 << 86 kMin = G4int(cofMin); << 87 if(cofMin > kMin) << 88 kMin++; << 89 << 90 kMax = kMin + 49; << 91 69 92 if(verboseLevel > 2) << 93 { << 94 G4cout << cof1 << " " << cof2 << " << 95 G4cout << "kMin = " << kMin << "; kMax << 96 } << 97 for(k = kMin; k <= kMax; ++k) << 98 { << 99 tmp = pi * fPlateThick * (k + cof2) / ( << 100 result = (k - cof1) * (k - cof1) * (k + co << 101 if(k == kMin && kMin == G4int(cofMin)) << 102 { << 103 sum += << 104 0.5 * std::sin(tmp) * std::sin(tmp) * << 105 } << 106 else << 107 { << 108 sum += std::sin(tmp) * std::sin(tmp) * s << 109 } << 110 theta2k = std::sqrt(theta2 * std::abs(k - << 111 << 112 if(verboseLevel > 2) << 113 { << 114 G4cout << k << " " << theta2k << " << 115 << std::sin(tmp) * std::sin(tmp) << 116 << " " << sum << G4endl; << 117 } << 118 } << 119 result = 2 * (cof1 + cof2) * (cof1 + cof2) * << 120 result *= (1 - dump + 2 * dump * fPlateNumbe << 121 << 122 return result; << 123 } << 124 70 125 ////////////////////////////////////////////// 71 /////////////////////////////////////////////////////////////////////////// >> 72 // 126 // Approximation for radiator interference fac 73 // Approximation for radiator interference factor for the case of 127 // fully Regular radiator. The plate and gas g << 74 // fully Regular radiator. The plate and gas gap thicknesses are fixed . 128 // The mean values of the plate and gas gap th << 75 // The mean values of the plate and gas gap thicknesses 129 // are supposed to be about XTR formation zone << 76 // are supposed to be about XTR formation zones but much less than 130 // mean absorption length of XTR photons in co << 77 // mean absorption length of XTR photons in coresponding material. 131 << 78 132 G4double G4RegularXTRadiator::GetStackFactor(G << 79 G4double 133 G << 80 G4RegularXTRadiator::GetStackFactor( G4double energy, >> 81 G4double gamma, G4double varAngle ) 134 { 82 { >> 83 135 // some gamma (10000/1000) like algorithm 84 // some gamma (10000/1000) like algorithm 136 85 137 G4double result, Za, Zb, Ma, Mb; 86 G4double result, Za, Zb, Ma, Mb; 138 << 87 139 Za = GetPlateFormationZone(energy, gamma, va << 88 Za = GetPlateFormationZone(energy,gamma,varAngle); 140 Zb = GetGasFormationZone(energy, gamma, varA << 89 Zb = GetGasFormationZone(energy,gamma,varAngle); 141 90 142 Ma = GetPlateLinearPhotoAbs(energy); 91 Ma = GetPlateLinearPhotoAbs(energy); 143 Mb = GetGasLinearPhotoAbs(energy); 92 Mb = GetGasLinearPhotoAbs(energy); 144 93 145 G4complex Ca(1.0 + 0.5 * fPlateThick * Ma / << 146 fPlateThick / Za / fAlphaPlate) << 147 G4complex Cb(1.0 + 0.5 * fGasThick * Mb / fA << 148 fGasThick / Zb / fAlphaGas); << 149 94 150 G4complex Ha = std::pow(Ca, -fAlphaPlate); << 95 G4complex Ca(1.0+0.5*fPlateThick*Ma/fAlphaPlate,fPlateThick/Za/fAlphaPlate); 151 G4complex Hb = std::pow(Cb, -fAlphaGas); << 96 G4complex Cb(1.0+0.5*fGasThick*Mb/fAlphaGas,fGasThick/Zb/fAlphaGas); 152 G4complex H = Ha * Hb; << 97 >> 98 G4complex Ha = pow(Ca,-fAlphaPlate); >> 99 G4complex Hb = pow(Cb,-fAlphaGas); >> 100 G4complex H = Ha*Hb; >> 101 >> 102 G4complex F1 = (1.0 - Ha)*(1.0 - Hb )/(1.0 - H) >> 103 * G4double(fPlateNumber); >> 104 >> 105 G4complex F2 = (1.0-Ha)*(1.0-Ha)*Hb/(1.0-H)/(1.0-H) >> 106 * (1.0 - pow(H,fPlateNumber)); >> 107 >> 108 G4complex R = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle); >> 109 >> 110 result = 2.0*real(R); >> 111 >> 112 return result; >> 113 >> 114 /* >> 115 // numerically stable but slow algorithm >> 116 >> 117 G4double result, Qa, Qb, Q, aZa, bZb, aMa, bMb; // , D; >> 118 >> 119 aZa = fPlateThick/GetPlateFormationZone(energy,gamma,varAngle); >> 120 bZb = fGasThick/GetGasFormationZone(energy,gamma,varAngle); >> 121 aMa = fPlateThick*GetPlateLinearPhotoAbs(energy); >> 122 bMb = fGasThick*GetGasLinearPhotoAbs(energy); >> 123 Qa = exp(-aMa); >> 124 Qb = exp(-bMb); >> 125 Q = Qa*Qb; >> 126 G4complex Ha( exp(-0.5*aMa)*cos(aZa), >> 127 -exp(-0.5*aMa)*sin(aZa) ); >> 128 G4complex Hb( exp(-0.5*bMb)*cos(bZb), >> 129 -exp(-0.5*bMb)*sin(bZb) ); >> 130 G4complex H = Ha*Hb; >> 131 >> 132 G4complex Hs = conj(H); >> 133 D = 1.0 /( (1 - sqrt(Q))*(1 - sqrt(Q)) + >> 134 4*sqrt(Q)*sin(0.5*(aZa+bZb))*sin(0.5*(aZa+bZb)) ); >> 135 G4complex F1 = (1.0 - Ha)*(1.0 - Hb)*(1.0 - Hs) >> 136 * G4double(fPlateNumber)*D; >> 137 G4complex F2 = (1.0-Ha)*(1.0-Ha)*Hb*(1.0-Hs)*(1.0-Hs) >> 138 * (1.0 - pow(H,fPlateNumber)) * D*D; >> 139 G4complex R = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle); >> 140 >> 141 >> 142 G4complex S(0.,0.), c(1.,0.); >> 143 G4int k; >> 144 for(k = 1; k < fPlateNumber; k++) >> 145 { >> 146 c *= H; >> 147 S += ( G4double(fPlateNumber) - G4double(k) )*c; >> 148 } >> 149 G4complex R = (2.- Ha - 1./Ha)*S + (1. - Ha)*G4double(fPlateNumber); >> 150 R *= OneInterfaceXTRdEdx(energy,gamma,varAngle); >> 151 result = 2.0*real(R); >> 152 return result; >> 153 */ >> 154 } >> 155 >> 156 >> 157 // >> 158 // >> 159 //////////////////////////////////////////////////////////////////////////// >> 160 >> 161 >> 162 153 163 154 G4complex F1 = (1.0 - Ha) * (1.0 - Hb) / (1. << 155 164 156 G4complex F2 = (1.0 - Ha) * (1.0 - Ha) * Hb << 157 (1.0 - std::pow(H, fPlateNumb << 158 165 159 G4complex R = (F1 + F2) * OneInterfaceXTRdEd << 160 166 161 result = 2.0 * std::real(R); << 162 167 163 return result; << 164 } << 165 168