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