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p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/lowenergy/src/G4RayleighAngularGenerator.cc (Version 11.3.0) and /processes/electromagnetic/lowenergy/src/G4RayleighAngularGenerator.cc (Version 9.5.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 // -------------------------------------------    
 28 //                                                
 29 // GEANT4 Class file                              
 30 //                                                
 31 // File name:     G4RayleighAngularGenerator      
 32 //                                                
 33 // Author:        V. Ivanchenko using design o    
 34 //                interface                       
 35 //                                                
 36 // Creation date: 31 May 2012                     
 37 //                                                
 38 // Modifications:                                 
 39 //                                                
 40 // Class Description: Class are tabulated data    
 41 //                    modified fit formulas fr    
 42 //                    Nucl. Instrum. Meth. Phy    
 43 //                                                
 44 //                                                
 45 // Class for Rayleigh scattering generation       
 46 //                                                
 47 // Class Description: End                         
 48 // -------------------------------------------    
 49 //                                                
 50 //                                                
 51                                                   
 52 #include "G4RayleighAngularGenerator.hh"          
 53 #include "G4PhysicalConstants.hh"                 
 54 #include "G4SystemOfUnits.hh"                     
 55 #include "Randomize.hh"                           
 56 #include "G4Log.hh"                               
 57 #include "G4Exp.hh"                               
 58                                                   
 59 using namespace std;                              
 60                                                   
 61 //....oooOO0OOooo........oooOO0OOooo........oo    
 62                                                   
 63 G4RayleighAngularGenerator::G4RayleighAngularG    
 64   : G4VEmAngularDistribution("CullenGenerator"    
 65 {                                                 
 66   G4double x = cm/(h_Planck*c_light);             
 67   fFactor = 0.5*x*x;                              
 68 }                                                 
 69                                                   
 70 //....oooOO0OOooo........oooOO0OOooo........oo    
 71                                                   
 72 G4RayleighAngularGenerator::~G4RayleighAngular    
 73 {}                                                
 74                                                   
 75 //....oooOO0OOooo........oooOO0OOooo........oo    
 76                                                   
 77 G4ThreeVector&                                    
 78 G4RayleighAngularGenerator::SampleDirection(co    
 79               G4double, G4int Z,                  
 80               const G4Material*)                  
 81 {                                                 
 82   G4double ekin = dp->GetKineticEnergy();         
 83   G4double xx = fFactor*ekin*ekin;                
 84                                                   
 85   G4double n0 = PP6[Z] - 1.0;                     
 86   G4double n1 = PP7[Z] - 1.0;                     
 87   G4double n2 = PP8[Z] - 1.0;                     
 88   G4double b0 = PP3[Z];                           
 89   G4double b1 = PP4[Z];                           
 90   G4double b2 = PP5[Z];                           
 91                                                   
 92   static const G4double numlim = 0.02;            
 93   G4double x  = 2.*xx*b0;                         
 94   G4double w0 = (x < numlim) ? n0*x*(1.0 - 0.5    
 95     : 1.0 - G4Exp(-n0*G4Log(1.0 + x));            
 96                                                   
 97   x  = 2.*xx*b1;                                  
 98   G4double w1 = (x < numlim) ? n1*x*(1.0 - 0.5    
 99     : 1.0 - G4Exp(-n1*G4Log(1.0 + x));            
100                                                   
101   x  = 2.*xx*b2;                                  
102   G4double w2 = (x < numlim) ? n2*x*(1.0 - 0.5    
103     : 1.0 - G4Exp(-n2*G4Log(1.0 + x));            
104                                                   
105   G4double x0= w0*PP0[Z]/(b0*n0);                 
106   G4double x1= w1*PP1[Z]/(b1*n1);                 
107   G4double x2= w2*PP2[Z]/(b2*n2);                 
108                                                   
109   G4double cost;                                  
110   do {                                            
111     G4double w = w0;                              
112     G4double n = n0;                              
113     G4double b = b0;                              
114                                                   
115     x = G4UniformRand()*(x0 + x1 + x2);           
116     if(x > x0) {                                  
117       x -= x0;                                    
118       if(x <= x1 ) {                              
119   w = w1;                                         
120   n = n1;                                         
121   b = b1;                                         
122       } else {                                    
123   w = w2;                                         
124   n = n2;                                         
125   b = b2;                                         
126       }                                           
127     }                                             
128     n = 1.0/n;                                    
129                                                   
130     // sampling of angle                          
131     G4double y = w*G4UniformRand();               
132     if(y < numlim) { x = y*n*( 1. + 0.5*(n + 1    
133     else           { x = G4Exp(-n*G4Log(1. - y    
134     cost = 1.0 - x/(b*xx);                        
135   } while (2*G4UniformRand() > 1.0 + cost*cost    
136                                                   
137   G4double phi  = twopi*G4UniformRand();          
138   G4double sint = sqrt((1. - cost)*(1.0 + cost    
139   fLocalDirection.set(sint*cos(phi),sint*sin(p    
140   fLocalDirection.rotateUz(dp->GetMomentumDire    
141                                                   
142   return fLocalDirection;                         
143 }                                                 
144                                                   
145 //....oooOO0OOooo........oooOO0OOooo........oo    
146 const G4double                                    
147   G4RayleighAngularGenerator::PP0[101] = {0,      
148   -2.477067493e-06, 3.308728278e+00, 5.2145900    
149   3.407539119e+00, 3.387258718e+00, 3.23054486    
150   3.731860000e+02, 4.201934230e+02, 4.61292033    
151   4.773566612e+02, 5.084376201e+02, 5.41367729    
152   2.972874756e+00, 2.740289935e+00, 2.50748731    
153   6.127527681e+01, 3.792700000e+00, 4.79811088    
154   1.194981340e+02, 2.167522747e+02, 3.36459000    
155   1.431016078e+02, 1.359161828e+02, 3.67045607    
156   3.340399767e+02, 3.011038509e+03, 3.48549794    
157   2.791527615e+00, 3.755804160e+03, 4.86370584    
158 };                                                
159                                                   
160 const G4double                                    
161   G4RayleighAngularGenerator::PP1[101] = {0,      
162   1.000002477e+00, 6.912717221e-01, 3.77240000    
163   5.759246095e+01, 6.861274506e+01, 8.37613986    
164   6.540840000e+01, 6.120116992e+01, 6.54048763    
165   4.800000000e+02, 5.120000000e+02, 5.44000000    
166   8.399999990e+02, 8.819999639e+02, 9.23999352    
167   1.300000000e+03, 1.352000000e+03, 1.40024221    
168   1.859999972e+03, 1.705247726e+03, 6.03151000    
169   2.519999640e+03, 2.591999669e+03, 2.31793557    
170   3.279999955e+03, 3.362000000e+03, 3.44399642    
171   4.139900637e+03, 4.761958553e+02, 3.83862968    
172 };                                                
173                                                   
174 const G4double                                    
175   G4RayleighAngularGenerator::PP2[101] = {0,      
176   0.000000000e+00, 0.000000000e+00, 1.30091000    
177   5.999999993e+01, 7.199999622e+01, 8.20080565    
178   2.405300000e+00, 2.605407111e+00, 2.30308987    
179   3.643338776e+00, 3.562379948e+00, 3.63227021    
180   8.380271263e+02, 8.792597462e+02, 9.22493160    
181   1.239724724e+03, 1.348210000e+03, 1.40395967    
182   1.741501894e+03, 1.922000000e+03, 1.25916000    
183   2.377898752e+03, 2.456084148e+03, 2.64401881    
184   2.946960068e+03, 3.509614912e+02, 3.09645378    
185   4.138307836e+03, 4.231999985e+03, 4.32399973    
186 };                                                
187                                                   
188 const G4double                                    
189   G4RayleighAngularGenerator::PP3[101] = {0,      
190   1.325913011e-16, 4.871957764e-16, 1.95042000    
191   8.030444002e-18, 6.678303405e-18, 5.35823468    
192   1.805410000e-15, 1.568852030e-15, 1.46426465    
193   2.121922892e-16, 2.064234936e-16, 1.99647988    
194   4.605105770e-19, 3.816125471e-19, 3.01753747    
195   9.418934098e-18, 6.540360000e-19, 6.72335260    
196   1.285032193e-17, 1.897941915e-17, 8.38225000    
197   1.351358940e-17, 1.262062535e-17, 2.23834297    
198   1.842791671e-17, 1.006061314e-16, 1.84533117    
199   1.861376691e-19, 8.994366946e-17, 2.16885552    
200 };                                                
201                                                   
202 const G4double                                    
203   G4RayleighAngularGenerator::PP4[101] = {0,      
204   1.105926652e-15, 2.260014406e-16, 1.56836000    
205   2.381852183e-15, 3.734413372e-15, 8.39186756    
206   1.379630000e-17, 9.139141296e-18, 1.87240878    
207   5.210034592e-16, 7.614492538e-16, 8.94817886    
208   6.465293663e-16, 3.854995461e-16, 4.89499585    
209   3.105865310e-16, 4.197600000e-16, 1.32632143    
210   7.097022036e-16, 1.115122840e-16, 4.61021000    
211   2.003109343e-16, 1.934498511e-16, 1.31900805    
212   1.158662950e-15, 1.374180788e-15, 8.56667776    
213   1.305399034e-16, 2.169990868e-17, 8.37279953    
214 };                                                
215                                                   
216 const G4double                                    
217   G4RayleighAngularGenerator::PP5[101] ={0,       
218  6.894128600e-17, 2.232031723e-17, 2.477820000    
219  5.490626359e-17, 6.721220587e-17, 2.797861959    
220  1.137340000e-18, 1.172666277e-18, 9.208052526    
221  1.000486545e-18, 8.890635605e-19, 8.866911360    
222  1.673069643e-16, 1.638573610e-16, 1.618391268    
223  1.080904532e-16, 1.490120000e-16, 2.463071192    
224  1.358154769e-16, 8.509795172e-16, 4.722000000    
225  1.325219469e-15, 1.361391001e-15, 1.166226381    
226  9.927188930e-17, 1.933919795e-17, 8.642866554    
227  4.609653396e-16, 1.503608663e-15, 9.130139990    
228 };                                                
229                                                   
230 const G4double                                    
231   G4RayleighAngularGenerator::PP6[101] = {0,      
232   5.245179284e+00, 3.941069622e+00, 7.59547000    
233   4.165369684e+00, 4.154784462e+00, 4.24310617    
234   1.570400000e+00, 1.595930653e+00, 1.59229579    
235   1.788357076e+00, 1.779735777e+00, 1.78269447    
236   4.992480078e+00, 5.353762609e+00, 5.98387288    
237   1.895332668e+00, 3.235160000e+00, 3.11741287    
238   1.735584396e+00, 1.700970330e+00, 1.49394000    
239   1.646594633e+00, 1.646361209e+00, 1.59689950    
240   1.539905529e+00, 2.445886590e+00, 1.52166658    
241   2.720221569e+00, 2.423181552e+00, 1.43380003    
242 };                                                
243                                                   
244 const G4double                                    
245   G4RayleighAngularGenerator::PP7[101] ={0,       
246  3.999571467e+00, 3.991128282e+00, 3.855930000    
247  1.860829199e+00, 1.805395915e+00, 5.601066041    
248  7.887250000e+00, 1.010638153e+01, 5.125426065    
249  4.487670198e+00, 3.377601937e+00, 3.060634263    
250  4.924387077e+00, 7.722486735e+00, 6.373463850    
251  8.586125523e+00, 6.676730000e+00, 1.759586815    
252  3.616573408e+00, 2.616627730e+00, 1.724970000    
253  1.632630475e+00, 1.635873458e+00, 1.825704957    
254  1.775440582e+00, 1.577663847e+00, 2.371177051    
255  1.455793655e+00, 1.441149845e+00, 2.479382371    
256 };                                                
257                                                   
258 const G4double                                    
259   G4RayleighAngularGenerator::PP8[101] = {0,      
260   3.999988492e+00, 3.007894874e+00, 5.94686000    
261   1.115856859e+01, 7.827803195e+00, 2.64112611    
262   5.878090000e+00, 5.532784283e+00, 5.96333790    
263   4.551995537e+00, 4.677756013e+00, 4.52827956    
264   1.727732750e+00, 1.724150271e+00, 1.70951822    
265   2.409664359e+00, 1.654010000e+00, 1.13468614    
266   2.057911711e+00, 2.980049185e+00, 1.08600000    
267   1.536232590e+00, 1.520253937e+00, 2.70110718    
268   2.454130254e+00, 1.522182263e+00, 2.58554126    
269   4.518186694e+00, 1.690796964e+00, 2.45897436    
270 };                                                
271 //....oooOO0OOooo........oooOO0OOooo........oo    
272