Geant4-11
G4UrbanMscModel.hh
Go to the documentation of this file.
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// -------------------------------------------------------------------
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 scattering based on
47// H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model
48
49// -------------------------------------------------------------------
50//
51
52#ifndef G4UrbanMscModel_h
53#define G4UrbanMscModel_h 1
54
55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
58
59#include "G4VMscModel.hh"
60#include "G4MscStepLimitType.hh"
61#include "G4Log.hh"
62#include "G4Exp.hh"
63
65class G4SafetyHelper;
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
71{
72
73public:
74
75 explicit G4UrbanMscModel(const G4String& nam = "UrbanMsc");
76
77 ~G4UrbanMscModel() override;
78
80 const G4DataVector&) override;
81
82 void StartTracking(G4Track*) override;
83
86 G4double KineticEnergy,
87 G4double AtomicNumber,
88 G4double AtomicWeight=0.,
89 G4double cut =0.,
90 G4double emax=DBL_MAX) override;
91
93 G4double safety) override;
94
96 G4double& currentMinimalStep) override;
97
98 G4double ComputeGeomPathLength(G4double truePathLength) override;
99
100 G4double ComputeTrueStepLength(G4double geomStepLength) override;
101
102 G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy);
103
104 // hide assignment operator
105 G4UrbanMscModel & operator=(const G4UrbanMscModel &right) = delete;
107
108private:
109
110 G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
111
112 void SampleDisplacement(G4double sinTheta, G4double phi);
113
114 void SampleDisplacementNew(G4double sinTheta, G4double phi);
115
117
118 inline void SetParticle(const G4ParticleDefinition*);
119
120 inline G4double Randomizetlimit();
121
122 inline G4double SimpleScattering(G4double xmeanth, G4double x2meanth);
123
124 inline G4double ComputeStepmin();
125
126 inline G4double ComputeTlimitmin();
127
129
133
136
140
149
155
157
163
165
171
174
178
179 struct mscData {
185 };
186 static std::vector<mscData*> msc;
187
188 // index of G4MaterialCutsCouple
190
193
197};
198
199//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
200//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
201
202inline
204{
205 if (p != particle) {
206 particle = p;
207 mass = p->GetPDGMass();
210 }
211}
212
213//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
214
216{
217 G4double res = tlimitmin;
218 if(tlimit > tlimitmin)
219 {
221 res = std::max(res, tlimitmin);
222 }
223 return res;
224}
225
226//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
227
228inline
230{
231 // 'large angle scattering'
232 // 2 model functions with correct xmean and x2mean
233 G4double a = (2.*xmeanth+9.*x2meanth-3.)/(2.*xmeanth-3.*x2meanth+1.);
234 G4double prob = (a+2.)*xmeanth/a;
235
236 // sampling
238 return (rndmarray[1] < prob) ?
239 -1.+2.*G4Exp(G4Log(rndmarray[0])/(a+1.)) : -1.+2.*rndmarray[0];
240}
241
243{
244 // define stepmin using estimation of the ratio
245 // of lambda_elastic/lambda_transport
247 return lambda0*1.e-3/(2.e-3+rat*(msc[idx]->stepmina+msc[idx]->stepminb*rat));
248}
249
251{
252 G4double x = (particle == positron) ?
253 0.7*msc[idx]->sqrtZ*stepmin : 0.87*msc[idx]->Z23*stepmin;
254 if(currentKinEnergy < tlow) { x *= 0.5*(1.+currentKinEnergy/tlow); }
255 return std::max(x, tlimitminfix);
256}
257
258//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
259
260#endif
261
static const G4double emax
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:179
G4double G4Log(G4double x)
Definition: G4Log.hh:226
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual void flatArray(const int size, double *vect)=0
G4double GetPDGCharge() const
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy)
void SampleDisplacementNew(G4double sinTheta, G4double phi)
G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety) override
G4double ComputeTrueStepLength(G4double geomStepLength) override
G4double currentKinEnergy
void SampleDisplacement(G4double sinTheta, G4double phi)
G4double rndmarray[2]
G4double Randomizetlimit()
const G4ParticleDefinition * positron
G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy)
void StartTracking(G4Track *) override
~G4UrbanMscModel() override
G4double currentRadLength
const G4MaterialCutsCouple * couple
G4UrbanMscModel(const G4String &nam="UrbanMsc")
G4double currentLogKinEnergy
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
G4double ComputeTlimitmin()
static std::vector< mscData * > msc
G4double ComputeGeomPathLength(G4double truePathLength) override
void SetParticle(const G4ParticleDefinition *)
G4double SimpleScattering(G4double xmeanth, G4double x2meanth)
G4ParticleChangeForMSC * fParticleChange
G4UrbanMscModel & operator=(const G4UrbanMscModel &right)=delete
const G4ParticleDefinition * particle
CLHEP::HepRandomEngine * rndmEngineMod
G4LossTableManager * theManager
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *particle, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=0., G4double emax=DBL_MAX) override
G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &currentMinimalStep) override
G4double ComputeStepmin()
G4UrbanMscModel(const G4UrbanMscModel &)=delete
static constexpr double eplus
ThreeVector shoot(const G4int Ap, const G4int Af)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
#define DBL_MAX
Definition: templates.hh:62