1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4TransparentRegXTRadiator.cc,v 1.11 2007/09/29 17:49:34 vnivanch Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | |
---|
31 | #include <complex> |
---|
32 | |
---|
33 | #include "G4TransparentRegXTRadiator.hh" |
---|
34 | #include "Randomize.hh" |
---|
35 | #include "G4Integrator.hh" |
---|
36 | #include "G4Gamma.hh" |
---|
37 | |
---|
38 | using namespace std; |
---|
39 | |
---|
40 | //////////////////////////////////////////////////////////////////////////// |
---|
41 | // |
---|
42 | // Constructor, destructor |
---|
43 | |
---|
44 | G4TransparentRegXTRadiator::G4TransparentRegXTRadiator(G4LogicalVolume *anEnvelope, |
---|
45 | G4Material* foilMat,G4Material* gasMat, |
---|
46 | G4double a, G4double b, G4int n, |
---|
47 | const G4String& processName) : |
---|
48 | G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,n,processName) |
---|
49 | { |
---|
50 | if(verboseLevel > 0) |
---|
51 | G4cout<<"Regular transparent X-ray TR radiator EM process is called"<<G4endl; |
---|
52 | |
---|
53 | // Build energy and angular integral spectra of X-ray TR photons from |
---|
54 | // a radiator |
---|
55 | |
---|
56 | fAlphaPlate = 10000; |
---|
57 | fAlphaGas = 1000; |
---|
58 | |
---|
59 | // BuildTable(); |
---|
60 | } |
---|
61 | |
---|
62 | /////////////////////////////////////////////////////////////////////////// |
---|
63 | |
---|
64 | G4TransparentRegXTRadiator::~G4TransparentRegXTRadiator() |
---|
65 | { |
---|
66 | ; |
---|
67 | } |
---|
68 | |
---|
69 | /////////////////////////////////////////////////////////////////////////// |
---|
70 | // |
---|
71 | // |
---|
72 | |
---|
73 | G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy) |
---|
74 | { |
---|
75 | G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC,aMa, bMb, sigma; |
---|
76 | G4int k, kMax, kMin; |
---|
77 | |
---|
78 | aMa = fPlateThick*GetPlateLinearPhotoAbs(energy); |
---|
79 | bMb = fGasThick*GetGasLinearPhotoAbs(energy); |
---|
80 | sigma = aMa + bMb; |
---|
81 | |
---|
82 | cofPHC = 4*pi*hbarc; |
---|
83 | tmp = (fSigma1 - fSigma2)/cofPHC/energy; |
---|
84 | cof1 = fPlateThick*tmp; |
---|
85 | cof2 = fGasThick*tmp; |
---|
86 | |
---|
87 | cofMin = energy*(fPlateThick + fGasThick)/fGamma/fGamma; |
---|
88 | cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy; |
---|
89 | cofMin /= cofPHC; |
---|
90 | |
---|
91 | // if (fGamma < 1200) kMin = G4int(cofMin); // 1200 ? |
---|
92 | // else kMin = 1; |
---|
93 | |
---|
94 | |
---|
95 | kMin = G4int(cofMin); |
---|
96 | if (cofMin > kMin) kMin++; |
---|
97 | |
---|
98 | // tmp = (fPlateThick + fGasThick)*energy*fMaxThetaTR; |
---|
99 | // tmp /= cofPHC; |
---|
100 | // kMax = G4int(tmp); |
---|
101 | // if(kMax < 0) kMax = 0; |
---|
102 | // kMax += kMin; |
---|
103 | |
---|
104 | |
---|
105 | kMax = kMin + 19; // 9; // kMin + G4int(tmp); |
---|
106 | |
---|
107 | // tmp /= fGamma; |
---|
108 | // if( G4int(tmp) < kMin ) kMin = G4int(tmp); |
---|
109 | // G4cout<<"kMin = "<<kMin<<"; kMax = "<<kMax<<G4endl; |
---|
110 | |
---|
111 | for( k = kMin; k <= kMax; k++ ) |
---|
112 | { |
---|
113 | tmp = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick); |
---|
114 | result = (k - cof1)*(k - cof1)*(k + cof2)*(k + cof2); |
---|
115 | // tmp = sin(tmp)*sin(tmp)*abs(k-cofMin)/result; |
---|
116 | if( k == kMin && kMin == G4int(cofMin) ) |
---|
117 | { |
---|
118 | sum += 0.5*sin(tmp)*sin(tmp)*abs(k-cofMin)/result; |
---|
119 | } |
---|
120 | else |
---|
121 | { |
---|
122 | sum += sin(tmp)*sin(tmp)*abs(k-cofMin)/result; |
---|
123 | } |
---|
124 | if(verboseLevel > 2) |
---|
125 | { |
---|
126 | G4cout<<"k = "<<k<<"; tmp = "<<sin(tmp)*sin(tmp)*abs(k-cofMin)/result |
---|
127 | <<"; sum = "<<sum<<G4endl; |
---|
128 | } |
---|
129 | } |
---|
130 | result = 4*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy; |
---|
131 | // result *= ( 1 - exp(-0.5*fPlateNumber*sigma) )/( 1 - exp(-0.5*sigma) ); |
---|
132 | // fPlateNumber; |
---|
133 | result *= fPlateNumber; // *exp(-0.5*fPlateNumber*sigma); |
---|
134 | // +1-exp(-0.5*fPlateNumber*sigma); |
---|
135 | /* |
---|
136 | fEnergy = energy; |
---|
137 | // G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral; |
---|
138 | G4Integrator<G4TransparentRegXTRadiator,G4double(G4VXTRenergyLoss::*)(G4double)> integral; |
---|
139 | |
---|
140 | tmp = integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx, |
---|
141 | 0.0,0.3*fMaxThetaTR) + |
---|
142 | integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx, |
---|
143 | 0.3*fMaxThetaTR,0.6*fMaxThetaTR) + |
---|
144 | integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx, |
---|
145 | 0.6*fMaxThetaTR,fMaxThetaTR) ; |
---|
146 | result += tmp; |
---|
147 | */ |
---|
148 | return result; |
---|
149 | } |
---|
150 | |
---|
151 | |
---|
152 | /////////////////////////////////////////////////////////////////////////// |
---|
153 | // |
---|
154 | // Approximation for radiator interference factor for the case of |
---|
155 | // fully Regular radiator. The plate and gas gap thicknesses are fixed . |
---|
156 | // The mean values of the plate and gas gap thicknesses |
---|
157 | // are supposed to be about XTR formation zones but much less than |
---|
158 | // mean absorption length of XTR photons in coresponding material. |
---|
159 | |
---|
160 | G4double |
---|
161 | G4TransparentRegXTRadiator::GetStackFactor( G4double energy, |
---|
162 | G4double gamma, G4double varAngle ) |
---|
163 | { |
---|
164 | /* |
---|
165 | G4double result, Za, Zb, Ma, Mb, sigma; |
---|
166 | |
---|
167 | Za = GetPlateFormationZone(energy,gamma,varAngle); |
---|
168 | Zb = GetGasFormationZone(energy,gamma,varAngle); |
---|
169 | Ma = GetPlateLinearPhotoAbs(energy); |
---|
170 | Mb = GetGasLinearPhotoAbs(energy); |
---|
171 | sigma = Ma*fPlateThick + Mb*fGasThick; |
---|
172 | |
---|
173 | G4complex Ca(1.0+0.5*fPlateThick*Ma/fAlphaPlate,fPlateThick/Za/fAlphaPlate); |
---|
174 | G4complex Cb(1.0+0.5*fGasThick*Mb/fAlphaGas,fGasThick/Zb/fAlphaGas); |
---|
175 | |
---|
176 | G4complex Ha = pow(Ca,-fAlphaPlate); |
---|
177 | G4complex Hb = pow(Cb,-fAlphaGas); |
---|
178 | G4complex H = Ha*Hb; |
---|
179 | G4complex F1 = (1.0 - Ha)*(1.0 - Hb )/(1.0 - H) |
---|
180 | * G4double(fPlateNumber) ; |
---|
181 | G4complex F2 = (1.0-Ha)*(1.0-Ha)*Hb/(1.0-H)/(1.0-H) |
---|
182 | * (1.0 - exp(-0.5*fPlateNumber*sigma)) ; |
---|
183 | // *(1.0 - pow(H,fPlateNumber)) ; |
---|
184 | G4complex R = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle); |
---|
185 | // G4complex R = F2*OneInterfaceXTRdEdx(energy,gamma,varAngle); |
---|
186 | result = 2.0*real(R); |
---|
187 | return result; |
---|
188 | */ |
---|
189 | // numerically unstable result |
---|
190 | |
---|
191 | G4double result, Qa, Qb, Q, aZa, bZb, aMa, bMb, D, sigma; |
---|
192 | |
---|
193 | aZa = fPlateThick/GetPlateFormationZone(energy,gamma,varAngle); |
---|
194 | bZb = fGasThick/GetGasFormationZone(energy,gamma,varAngle); |
---|
195 | aMa = fPlateThick*GetPlateLinearPhotoAbs(energy); |
---|
196 | bMb = fGasThick*GetGasLinearPhotoAbs(energy); |
---|
197 | sigma = aMa*fPlateThick + bMb*fGasThick; |
---|
198 | Qa = exp(-0.5*aMa); |
---|
199 | Qb = exp(-0.5*bMb); |
---|
200 | Q = Qa*Qb; |
---|
201 | |
---|
202 | G4complex Ha( Qa*cos(aZa), -Qa*sin(aZa) ); |
---|
203 | G4complex Hb( Qb*cos(bZb), -Qb*sin(bZb) ); |
---|
204 | G4complex H = Ha*Hb; |
---|
205 | G4complex Hs = conj(H); |
---|
206 | D = 1.0 /( (1 - Q)*(1 - Q) + |
---|
207 | 4*Q*sin(0.5*(aZa + bZb))*sin(0.5*(aZa + bZb)) ); |
---|
208 | G4complex F1 = (1.0 - Ha)*(1.0 - Hb)*(1.0 - Hs) |
---|
209 | * G4double(fPlateNumber)*D; |
---|
210 | G4complex F2 = (1.0 - Ha)*(1.0 - Ha)*Hb*(1.0 - Hs)*(1.0 - Hs) |
---|
211 | // * (1.0 - pow(H,fPlateNumber)) * D*D; |
---|
212 | * (1.0 - exp(-0.5*fPlateNumber*sigma)) * D*D; |
---|
213 | G4complex R = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle); |
---|
214 | result = 2.0*real(R); |
---|
215 | return result; |
---|
216 | |
---|
217 | } |
---|
218 | |
---|
219 | |
---|
220 | // |
---|
221 | // |
---|
222 | //////////////////////////////////////////////////////////////////////////// |
---|
223 | |
---|
224 | |
---|
225 | |
---|
226 | |
---|
227 | |
---|
228 | |
---|
229 | |
---|
230 | |
---|