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 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/standard/include/G4UrbanMscModel.hh (Version 11.3.0) and /processes/electromagnetic/standard/include/G4UrbanMscModel.hh (Version 11.0.p3,)


** Warning: Cannot open xref database.

  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 //                                                
 30 // GEANT4 Class header file                       
 31 //                                                
 32 //                                                
 33 // File name:     G4UrbanMscModel                 
 34 //                                                
 35 // Author:        Laszlo Urban                    
 36 //                                                
 37 // Creation date: 19.02.2013                      
 38 //                                                
 39 // Created from G4UrbanMscModel96                 
 40 //                                                
 41 // New parametrization for theta0                 
 42 // Correction for very small step length          
 43 //                                                
 44 // Class Description:                             
 45 //                                                
 46 // Implementation of the model of multiple sca    
 47 // H.W.Lewis Phys Rev 78 (1950) 526 and L.Urba    
 48                                                   
 49 // -------------------------------------------    
 50 //                                                
 51                                                   
 52 #ifndef G4UrbanMscModel_h                         
 53 #define G4UrbanMscModel_h 1                       
 54                                                   
 55 //....oooOO0OOooo........oooOO0OOooo........oo    
 56                                                   
 57 #include <CLHEP/Units/SystemOfUnits.h>            
 58                                                   
 59 #include "G4VMscModel.hh"                         
 60 #include "G4MscStepLimitType.hh"                  
 61 #include "G4Log.hh"                               
 62 #include "G4Exp.hh"                               
 63                                                   
 64 class G4ParticleChangeForMSC;                     
 65 class G4SafetyHelper;                             
 66                                                   
 67 //....oooOO0OOooo........oooOO0OOooo........oo    
 68                                                   
 69 class G4UrbanMscModel : public G4VMscModel        
 70 {                                                 
 71                                                   
 72 public:                                           
 73                                                   
 74   explicit G4UrbanMscModel(const G4String& nam    
 75                                                   
 76   ~G4UrbanMscModel() override;                    
 77                                                   
 78   void Initialise(const G4ParticleDefinition*,    
 79       const G4DataVector&) override;              
 80                                                   
 81   void StartTracking(G4Track*) override;          
 82                                                   
 83   G4double                                        
 84   ComputeCrossSectionPerAtom(const G4ParticleD    
 85            G4double KineticEnergy,                
 86            G4double AtomicNumber,                 
 87            G4double AtomicWeight=0.,              
 88            G4double cut =0.,                      
 89            G4double emax=DBL_MAX) override;       
 90                                                   
 91   G4ThreeVector& SampleScattering(const G4Thre    
 92           G4double safety) override;              
 93                                                   
 94   G4double ComputeTruePathLengthLimit(const G4    
 95                     G4double& currentMinimalSt    
 96                                                   
 97   G4double ComputeGeomPathLength(G4double true    
 98                                                   
 99   G4double ComputeTrueStepLength(G4double geom    
100                                                   
101   G4double ComputeTheta0(G4double truePathLeng    
102                                                   
103   inline void SetDisplacementAlgorithm96(const    
104                                                   
105   inline void SetPositronCorrection(const G4bo    
106                                                   
107   //  hide assignment operator                    
108   G4UrbanMscModel & operator=(const  G4UrbanMs    
109   G4UrbanMscModel(const  G4UrbanMscModel&) = d    
110                                                   
111 private:                                          
112                                                   
113   G4double SampleCosineTheta(G4double trueStep    
114                                                   
115   void SampleDisplacement(G4double sinTheta, G    
116                                                   
117   void SampleDisplacementNew(G4double sinTheta    
118                                                   
119   void InitialiseModelCache();                    
120                                                   
121   inline void SetParticle(const G4ParticleDefi    
122                                                   
123   inline G4double Randomizetlimit();              
124                                                   
125   inline G4double SimpleScattering();             
126                                                   
127   inline G4double ComputeStepmin();               
128                                                   
129   inline G4double ComputeTlimitmin();             
130                                                   
131   CLHEP::HepRandomEngine* rndmEngineMod;          
132                                                   
133   const G4ParticleDefinition* particle = nullp    
134   const G4ParticleDefinition* positron;           
135   G4ParticleChangeForMSC* fParticleChange = nu    
136   const G4MaterialCutsCouple* couple = nullptr    
137                                                   
138   G4double mass;                                  
139   G4double charge,chargeSquare;                   
140   G4double masslimite,fr;                         
141                                                   
142   G4double taubig;                                
143   G4double tausmall;                              
144   G4double taulim;                                
145   G4double currentTau;                            
146   G4double tlimit;                                
147   G4double tlimitmin;                             
148   G4double tlimitminfix,tlimitminfix2;            
149   G4double tgeom;                                 
150                                                   
151   G4double geombig;                               
152   G4double geommin;                               
153   G4double geomlimit;                             
154   G4double skindepth;                             
155   G4double smallstep;                             
156                                                   
157   G4double presafety;                             
158                                                   
159   G4double lambda0;                               
160   G4double lambdaeff;                             
161   G4double tPathLength;                           
162   G4double zPathLength;                           
163   G4double par1,par2,par3;                        
164                                                   
165   G4double stepmin;                               
166                                                   
167   G4double currentKinEnergy;                      
168   G4double currentLogKinEnergy;                   
169   G4double currentRange;                          
170   G4double rangeinit;                             
171   G4double currentRadLength;                      
172                                                   
173   G4double drr,finalr;                            
174                                                   
175   G4double tlow;                                  
176   G4double invmev;                                
177   G4double xmeanth = 0.0;                         
178   G4double x2meanth = 1./3.;                      
179   G4double rndmarray[2];                          
180                                                   
181   struct mscData {                                
182     G4double Z23, sqrtZ, factmin;                 
183     G4double coeffth1, coeffth2;                  
184     G4double coeffc1, coeffc2, coeffc3, coeffc    
185     G4double stepmina, stepminb;                  
186     G4double doverra, doverrb;                    
187     G4double posa, posb, posc, posd, pose;        
188   };                                              
189   static std::vector<mscData*> msc;               
190                                                   
191   // index of G4MaterialCutsCouple                
192   G4int idx = 0;                                  
193                                                   
194   G4bool firstStep = true;                        
195   G4bool insideskin = false;                      
196                                                   
197   G4bool latDisplasmentbackup = false;            
198   G4bool dispAlg96 = true;                        
199   G4bool fPosiCorrection = true;                  
200   G4bool isFirstInstance = false;                 
201 };                                                
202                                                   
203 //....oooOO0OOooo........oooOO0OOooo........oo    
204 //....oooOO0OOooo........oooOO0OOooo........oo    
205                                                   
206 inline                                            
207 void G4UrbanMscModel::SetParticle(const G4Part    
208 {                                                 
209   if (p != particle) {                            
210     particle = p;                                 
211     mass = p->GetPDGMass();                       
212     charge = p->GetPDGCharge()/CLHEP::eplus;      
213     chargeSquare = charge*charge;                 
214   }                                               
215 }                                                 
216                                                   
217 //....oooOO0OOooo........oooOO0OOooo........oo    
218                                                   
219 inline G4double G4UrbanMscModel::Randomizetlim    
220 {                                                 
221   G4double res = tlimitmin;                       
222   if(tlimit > tlimitmin)                          
223   {                                               
224     res = G4RandGauss::shoot(rndmEngineMod,tli    
225     res = std::max(res, tlimitmin);               
226   }                                               
227   return res;                                     
228 }                                                 
229                                                   
230 //....oooOO0OOooo........oooOO0OOooo........oo    
231                                                   
232 inline G4double G4UrbanMscModel::SimpleScatter    
233 {                                                 
234   // 'large angle scattering'                     
235   // 2 model functions with correct xmean and     
236   const G4double a = (2.*xmeanth+9.*x2meanth-3    
237   const G4double prob = (a+2.)*xmeanth/a;         
238                                                   
239   // sampling                                     
240   rndmEngineMod->flatArray(2, rndmarray);         
241   return (rndmarray[1] < prob) ?                  
242     -1.+2.*G4Exp(G4Log(rndmarray[0])/(a+1.)) :    
243 }                                                 
244                                                   
245 //....oooOO0OOooo........oooOO0OOooo........oo    
246                                                   
247 inline G4double G4UrbanMscModel::ComputeStepmi    
248 {                                                 
249   // define stepmin using estimation of the ra    
250   // of lambda_elastic/lambda_transport           
251   const G4double rat = currentKinEnergy*invmev    
252   return lambda0*msc[idx]->factmin/               
253     (0.002 + rat*(msc[idx]->stepmina + msc[idx    
254 }                                                 
255                                                   
256 //....oooOO0OOooo........oooOO0OOooo........oo    
257                                                   
258 inline G4double G4UrbanMscModel::ComputeTlimit    
259 {                                                 
260   G4double x = (particle == positron) ?           
261     0.7*msc[idx]->sqrtZ*stepmin : 0.87*msc[idx    
262   if(currentKinEnergy < tlow) { x *= 0.5*(1.+c    
263   return std::max(x, tlimitminfix);               
264 }                                                 
265                                                   
266 //....oooOO0OOooo........oooOO0OOooo........oo    
267                                                   
268 inline void G4UrbanMscModel::SetDisplacementAl    
269 {                                                 
270   dispAlg96 = val;                                
271 }                                                 
272                                                   
273 //....oooOO0OOooo........oooOO0OOooo........oo    
274                                                   
275 inline void G4UrbanMscModel::SetPositronCorrec    
276 {                                                 
277   fPosiCorrection = val;                          
278 }                                                 
279                                                   
280 //....oooOO0OOooo........oooOO0OOooo........oo    
281                                                   
282 #endif                                            
283                                                   
284