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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 8.1.p1)


  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 // $Id: G4UrbanMscModel.hh,v 1.8 2006/06/29 19:51:46 gunter Exp $
                                                   >>  27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 //                                                 31 //
 30 // GEANT4 Class header file                        32 // GEANT4 Class header file
 31 //                                                 33 //
 32 //                                                 34 //
 33 // File name:     G4UrbanMscModel                  35 // File name:     G4UrbanMscModel
 34 //                                                 36 //
 35 // Author:        Laszlo Urban                     37 // Author:        Laszlo Urban
 36 //                                                 38 //
 37 // Creation date: 19.02.2013                   <<  39 // Creation date: 01.03.2001
 38 //                                                 40 //
 39 // Created from G4UrbanMscModel96              <<  41 // Modifications:
 40 //                                                 42 //
 41 // New parametrization for theta0              <<  43 // 27-03-03 Move model part from G4MultipleScattering (V.Ivanchenko)
 42 // Correction for very small step length       <<  44 // 27-03-03 Rename (V.Ivanchenko)
                                                   >>  45 //
                                                   >>  46 // 05-08-03 angle distribution has been modified (L.Urban)
                                                   >>  47 // 26-11-03 new data member currentRange (L.Urban)
                                                   >>  48 // 01-03-04 changes in data members + signature changed in SampleCosineTheta
                                                   >>  49 // 11-03-04 changes in data members (L.Urban)
                                                   >>  50 // 23-04-04 changes in data members and in signature of SampleCosineTheta
                                                   >>  51 //          (L.Urban)
                                                   >>  52 // 17-08-04 name of data member facxsi changed to factail (L.Urban)
                                                   >>  53 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
                                                   >>  54 // 15-04-05 optimize internal interface - add SampleSecondaries method (V.Ivanchenko)
                                                   >>  55 // 11-08-05 computation of lateral correlation added (L.Urban)
                                                   >>  56 // 02-10-05 nuclear size correction computation removed, the correction
                                                   >>  57 //          included in the (theoretical) tabulated values (L.Urban)
                                                   >>  58 // 16-02-06 data members b and xsi have been removed (L.Urban)
                                                   >>  59 // 17-02-06 Save table of transport cross sections not mfp (V.Ivanchenko)
                                                   >>  60 // 07-03-06 Create G4UrbanMscModel and move there step limit calculation (V.Ivanchenko)
                                                   >>  61 // 10-05-06 SetMscStepLimitation at initialisation (V.Ivantchenko)
                                                   >>  62 // 11-05-06 name of data member safety changed to presafety, some new data
                                                   >>  63 //          members added (frscaling1,frscaling2,tlimitminfix,nstepmax)
                                                   >>  64 //         (L.Urban)
                                                   >>  65 //
                                                   >>  66 
 43 //                                                 67 //
 44 // Class Description:                              68 // Class Description:
 45 //                                                 69 //
 46 // Implementation of the model of multiple sca     70 // Implementation of the model of multiple scattering based on
 47 // H.W.Lewis Phys Rev 78 (1950) 526 and L.Urba     71 // H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model
 48                                                    72 
 49 // -------------------------------------------     73 // -------------------------------------------------------------------
 50 //                                                 74 //
 51                                                    75 
 52 #ifndef G4UrbanMscModel_h                          76 #ifndef G4UrbanMscModel_h
 53 #define G4UrbanMscModel_h 1                        77 #define G4UrbanMscModel_h 1
 54                                                    78 
 55 //....oooOO0OOooo........oooOO0OOooo........oo     79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 56                                                    80 
 57 #include <CLHEP/Units/SystemOfUnits.h>         <<  81 #include "G4VEmModel.hh"
 58                                                <<  82 #include "G4PhysicsTable.hh"
 59 #include "G4VMscModel.hh"                      << 
 60 #include "G4MscStepLimitType.hh"               << 
 61 #include "G4Log.hh"                            << 
 62 #include "G4Exp.hh"                            << 
 63                                                    83 
 64 class G4ParticleChangeForMSC;                      84 class G4ParticleChangeForMSC;
 65 class G4SafetyHelper;                          <<  85 class G4Navigator;
                                                   >>  86 class G4LossTableManager;
 66                                                    87 
 67 //....oooOO0OOooo........oooOO0OOooo........oo     88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 68                                                    89 
 69 class G4UrbanMscModel : public G4VMscModel     <<  90 class G4UrbanMscModel : public G4VEmModel
 70 {                                                  91 {
 71                                                    92 
 72 public:                                            93 public:
 73                                                    94 
 74   explicit G4UrbanMscModel(const G4String& nam <<  95   G4UrbanMscModel(G4double facrange, G4double dtrl, G4double tkinlimit, 
 75                                                <<  96       G4double facgeom, G4double factail, 
 76   ~G4UrbanMscModel() override;                 <<  97       G4bool samplez, G4bool stepAlg, 
 77                                                <<  98       const G4String& nam = "UrbanMscUni");
 78   void Initialise(const G4ParticleDefinition*, << 
 79       const G4DataVector&) override;           << 
 80                                                    99 
 81   void StartTracking(G4Track*) override;       << 100   virtual ~G4UrbanMscModel();
 82                                                   101 
 83   G4double                                     << 102   virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
 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                                                   103 
 91   G4ThreeVector& SampleScattering(const G4Thre << 104   virtual G4double ComputeCrossSectionPerAtom( 
 92           G4double safety) override;           << 105                              const G4ParticleDefinition* particle,
                                                   >> 106                                    G4double KineticEnergy,
                                                   >> 107                                    G4double AtomicNumber,
                                                   >> 108                                    G4double AtomicWeight=0., 
                                                   >> 109            G4double cut =0.,
                                                   >> 110            G4double emax=DBL_MAX);
 93                                                   111 
 94   G4double ComputeTruePathLengthLimit(const G4 << 112   virtual std::vector<G4DynamicParticle*>* SampleSecondaries(
 95                     G4double& currentMinimalSt << 113                              const G4MaterialCutsCouple*,
                                                   >> 114                              const G4DynamicParticle*,
                                                   >> 115                                    G4double length,
                                                   >> 116                                    G4double safety);
 96                                                   117 
 97   G4double ComputeGeomPathLength(G4double true << 118   virtual G4double ComputeTruePathLengthLimit(
                                                   >> 119                              const G4Track& track,
                                                   >> 120                  G4PhysicsTable* theLambdaTable,
                                                   >> 121                  G4double currentMinimalStep);
 98                                                   122 
 99   G4double ComputeTrueStepLength(G4double geom << 123   virtual G4double ComputeGeomPathLength(G4double truePathLength);
100                                                   124 
101   G4double ComputeTheta0(G4double truePathLeng << 125   virtual G4double ComputeTrueStepLength(G4double geomStepLength);
102                                                   126 
103   inline void SetDisplacementAlgorithm96(const << 127   void SetLateralDisplasmentFlag(G4bool val);
104                                                   128 
105   inline void SetPositronCorrection(const G4bo << 129   void SetMscStepLimitation(G4bool, G4double);
106                                                << 
107   //  hide assignment operator                 << 
108   G4UrbanMscModel & operator=(const  G4UrbanMs << 
109   G4UrbanMscModel(const  G4UrbanMscModel&) = d << 
110                                                   130 
111 private:                                          131 private:
112                                                   132 
113   G4double SampleCosineTheta(G4double trueStep    133   G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
114                                                   134 
115   void SampleDisplacement(G4double sinTheta, G << 135   G4double SampleDisplacement();
116                                                << 
117   void SampleDisplacementNew(G4double sinTheta << 
118                                                   136 
119   void InitialiseModelCache();                 << 137   G4double LatCorrelation();
120                                                   138 
121   inline void SetParticle(const G4ParticleDefi << 139   G4double GetLambda(G4double kinEnergy);
122                                                   140 
123   inline G4double Randomizetlimit();           << 141   G4double GeomLimit(const G4Track& track);
124                                                << 
125   inline G4double SimpleScattering();          << 
126                                                   142 
127   inline G4double ComputeStepmin();            << 143   void SetParticle(const G4ParticleDefinition* p);
128                                                   144 
129   inline G4double ComputeTlimitmin();          << 145   //  hide assignment operator
130                                                << 146   G4UrbanMscModel & operator=(const  G4UrbanMscModel &right);
131   CLHEP::HepRandomEngine* rndmEngineMod;       << 147   G4UrbanMscModel(const  G4UrbanMscModel&);
132                                                   148 
133   const G4ParticleDefinition* particle = nullp << 149   const G4ParticleDefinition* particle;
134   const G4ParticleDefinition* positron;        << 150   G4ParticleChangeForMSC*     fParticleChange;
135   G4ParticleChangeForMSC* fParticleChange = nu << 151   G4Navigator*                navigator;
136   const G4MaterialCutsCouple* couple = nullptr << 152   G4PhysicsTable*             theLambdaTable;
                                                   >> 153   const G4MaterialCutsCouple* couple;
                                                   >> 154   G4LossTableManager*         theManager;
137                                                   155 
138   G4double mass;                                  156   G4double mass;
139   G4double charge,chargeSquare;                << 157   G4double charge;
140   G4double masslimite,fr;                      << 
141                                                   158 
142   G4double taubig;                                159   G4double taubig;
143   G4double tausmall;                              160   G4double tausmall;
144   G4double taulim;                                161   G4double taulim;
145   G4double currentTau;                            162   G4double currentTau;
                                                   >> 163   G4double dtrl;
                                                   >> 164   G4double factail ;
                                                   >> 165 
                                                   >> 166   G4double Tkinlimit;
                                                   >> 167   G4double Tlimit;
                                                   >> 168   G4double facrange;
                                                   >> 169   G4double frscaling1,frscaling2;
146   G4double tlimit;                                170   G4double tlimit;
147   G4double tlimitmin;                             171   G4double tlimitmin;
148   G4double tlimitminfix,tlimitminfix2;         << 172   G4double tlimitminfix;
149   G4double tgeom;                              << 173   G4double nstepmax;
150                                                << 
151   G4double geombig;                               174   G4double geombig;
152   G4double geommin;                               175   G4double geommin;
153   G4double geomlimit;                          << 176   G4double facgeom;
154   G4double skindepth;                          << 
155   G4double smallstep;                          << 
156                                                << 
157   G4double presafety;                             177   G4double presafety;
                                                   >> 178   G4double facsafety;
158                                                   179 
159   G4double lambda0;                               180   G4double lambda0;
160   G4double lambdaeff;                             181   G4double lambdaeff;
161   G4double tPathLength;                           182   G4double tPathLength;
162   G4double zPathLength;                           183   G4double zPathLength;
163   G4double par1,par2,par3;                     << 184   G4double geomLength;
                                                   >> 185   G4double par1,par2,par3 ;
164                                                   186 
165   G4double stepmin;                            << 187   G4double stepmin ;
166                                                   188 
167   G4double currentKinEnergy;                      189   G4double currentKinEnergy;
168   G4double currentLogKinEnergy;                << 
169   G4double currentRange;                          190   G4double currentRange; 
170   G4double rangeinit;                          << 
171   G4double currentRadLength;                      191   G4double currentRadLength;
172                                                   192 
173   G4double drr,finalr;                         << 193   G4int    currentMaterialIndex;
                                                   >> 194 
                                                   >> 195   G4bool   samplez;
                                                   >> 196   G4bool   latDisplasment;
                                                   >> 197   G4bool   steppingAlgorithm;
                                                   >> 198   G4bool   isInitialized;
174                                                   199 
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 };                                                200 };
202                                                   201 
203 //....oooOO0OOooo........oooOO0OOooo........oo    202 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204 //....oooOO0OOooo........oooOO0OOooo........oo    203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
205                                                   204 
206 inline                                            205 inline
207 void G4UrbanMscModel::SetParticle(const G4Part << 206 void G4UrbanMscModel::SetLateralDisplasmentFlag(G4bool val) 
208 {                                              << 207 { 
209   if (p != particle) {                         << 208   latDisplasment = val;
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 }                                                 209 }
244                                                   210 
245 //....oooOO0OOooo........oooOO0OOooo........oo    211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
246                                                   212 
247 inline G4double G4UrbanMscModel::ComputeStepmi << 213 inline
248 {                                              << 214 void G4UrbanMscModel::SetMscStepLimitation(G4bool alg, G4double factor)
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 {                                                 215 {
260   G4double x = (particle == positron) ?        << 216   steppingAlgorithm = alg;
261     0.7*msc[idx]->sqrtZ*stepmin : 0.87*msc[idx << 217   facrange = factor;
262   if(currentKinEnergy < tlow) { x *= 0.5*(1.+c << 
263   return std::max(x, tlimitminfix);            << 
264 }                                                 218 }
265                                                   219 
266 //....oooOO0OOooo........oooOO0OOooo........oo    220 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
267                                                   221 
268 inline void G4UrbanMscModel::SetDisplacementAl << 222 inline
                                                   >> 223 G4double G4UrbanMscModel::GetLambda(G4double e)
269 {                                                 224 {
270   dispAlg96 = val;                             << 225   G4double x;
                                                   >> 226   if(theLambdaTable) {
                                                   >> 227     G4bool b;
                                                   >> 228     x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
                                                   >> 229   } else {
                                                   >> 230     x = CrossSection(couple,particle,e);
                                                   >> 231   }
                                                   >> 232   if(x > DBL_MIN) x = 1./x;
                                                   >> 233   else            x = DBL_MAX;
                                                   >> 234   return x;
271 }                                                 235 }
272                                                   236 
273 //....oooOO0OOooo........oooOO0OOooo........oo    237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
274                                                   238 
275 inline void G4UrbanMscModel::SetPositronCorrec << 239 inline
                                                   >> 240 void G4UrbanMscModel::SetParticle(const G4ParticleDefinition* p)
276 {                                                 241 {
277   fPosiCorrection = val;                       << 242   if (p != particle) {
                                                   >> 243     particle = p;
                                                   >> 244     mass = p->GetPDGMass();
                                                   >> 245     charge = p->GetPDGCharge()/eplus;
                                                   >> 246     Tlimit = Tkinlimit*electron_mass_c2/mass;
                                                   >> 247   }
278 }                                                 248 }
279                                                   249 
280 //....oooOO0OOooo........oooOO0OOooo........oo    250 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
281                                                   251 
282 #endif                                            252 #endif
283                                                   253 
284                                                   254