CMS 3D CMS Logo

UrbanMscModel93.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------
2 //
3 //
4 // GEANT4 Class header file
5 //
6 //
7 // File name: UrbanMscModel93
8 //
9 // Original author: Laszlo Urban,
10 //
11 // V.Ivanchenko have copied from G4UrbanMscModel93 class
12 // of Geant4 global tag geant4-09-06-ref-07
13 // and have adopted to CMSSW
14 //
15 // Creation date: 21.08.2013
16 //
17 // Class Description:
18 //
19 // Implementation of the model of multiple scattering based on
20 // H.W.Lewis Phys Rev 78 (1950) 526
21 // L.Urban CERN-OPEN-2006-077, Dec. 2006
22 // V.N.Ivanchenko et al., J.Phys: Conf. Ser. 219 (2010) 032045
23 
24 // -------------------------------------------------------------------
25 // In its present form the model can be used for simulation
26 // of the e-/e+, muon and charged hadron multiple scattering
27 //
28 // This code was copied from Geant4 at the moment when it was removed
29 // from Geant4 completly (together with G4UrbanMscModel91, 95, 96).
30 // Since that time Geant4 supports the unique class G4UrbanMscModel.
31 // It was shown in Geant4 internal validations that this last class
32 // provides more accurate simulation for various thin target tests.
33 // This main Geant4 model does is not provide exactly the same results
34 // for CMS calorimeters run1 versus run2. To keep calorimeter response
35 // unchanged, CMS private version of the Urban model was created. It is
36 // basically the the same model used for run1 but it includes several
37 // technical fixed introduced after run1. There fixes do not change
38 // results but allow to avoid numerical problems for very small steps
39 // and to improve a bit of the CPU performance.
40 //
41 
42 #ifndef SimG4Core_PhysicsLists_UrbanMscModel93_h
43 #define SimG4Core_PhysicsLists_UrbanMscModel93_h 1
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
47 #include "G4VMscModel.hh"
48 #include "G4MscStepLimitType.hh"
49 #include "G4Log.hh"
50 #include "G4Exp.hh"
51 #include "CLHEP/Units/SystemOfUnits.h"
52 
53 class G4ParticleChangeForMSC;
54 class G4SafetyHelper;
55 class G4LossTableManager;
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 class UrbanMscModel93 : public G4VMscModel {
60 public:
61  UrbanMscModel93(const G4String& nam = "UrbanMsc93");
62 
63  ~UrbanMscModel93() override;
64 
65  void Initialise(const G4ParticleDefinition*, const G4DataVector&) override;
66 
67  void StartTracking(G4Track*) override;
68 
69  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
70  G4double KineticEnergy,
71  G4double AtomicNumber,
72  G4double AtomicWeight = 0.,
73  G4double cut = 0.,
74  G4double emax = DBL_MAX) override;
75 
76  G4ThreeVector& SampleScattering(const G4ThreeVector&, G4double safety) override;
77 
78  G4double ComputeTruePathLengthLimit(const G4Track& track, G4double& currentMinimalStep) override;
79 
80  G4double ComputeGeomPathLength(G4double truePathLength) override;
81 
82  G4double ComputeTrueStepLength(G4double geomStepLength) override;
83 
84  inline G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy);
85 
86 private:
87  G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
88 
89  G4double SampleDisplacement();
90 
91  G4double LatCorrelation();
92 
93  inline void SetParticle(const G4ParticleDefinition*);
94 
95  inline void UpdateCache();
96 
97  inline G4double SimpleScattering(G4double xmeanth, G4double x2meanth);
98 
99  // hide assignment operator
100  UrbanMscModel93& operator=(const UrbanMscModel93& right) = delete;
101  UrbanMscModel93(const UrbanMscModel93&) = delete;
102 
103  const G4ParticleDefinition* particle;
104  G4ParticleChangeForMSC* fParticleChange;
105 
106  const G4MaterialCutsCouple* couple;
107  G4LossTableManager* theManager;
108 
109  G4double mass;
110  G4double charge, ChargeSquare;
112 
113  G4double taubig;
114  G4double tausmall;
115  G4double taulim;
116  G4double currentTau;
117  G4double tlimit;
118  G4double tlimitmin;
119  G4double tlimitminfix;
120  G4double tgeom;
121 
122  G4double geombig;
123  G4double geommin;
124  G4double geomlimit;
125  G4double skindepth;
126  G4double smallstep;
127 
128  G4double presafety;
129 
130  G4double lambda0;
131  G4double lambdaeff;
132  G4double tPathLength;
133  G4double zPathLength;
134  G4double par1, par2, par3;
135 
136  G4double stepmin;
137 
139  G4double currentRange;
140  G4double rangeinit;
142 
143  G4double numlim, xsi, ea, eaa;
144 
146  G4double third;
147 
149 
150  G4double y;
151  G4double Zold;
152  G4double Zeff, Z2, Z23, lnZ;
153  G4double coeffth1, coeffth2;
154  G4double coeffc1, coeffc2;
155  G4double scr1ini, scr2ini, scr1, scr2;
156 
157  G4bool firstStep;
158  G4bool inside;
159  G4bool insideskin;
160 };
161 
162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
164 
165 inline void UrbanMscModel93::SetParticle(const G4ParticleDefinition* p) {
166  if (p != particle) {
167  particle = p;
168  mass = p->GetPDGMass();
169  charge = p->GetPDGCharge() / CLHEP::eplus;
171  }
172 }
173 
174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
175 
177  lnZ = G4Log(Zeff);
178  //new correction in theta0 formula
179  coeffth1 = (1. - 8.7780e-2 / Zeff) * (0.87 + 0.03 * lnZ);
180  coeffth2 = (4.0780e-2 + 1.7315e-4 * Zeff) * (0.87 + 0.03 * lnZ);
181  // tail parameters
182  G4double lnZ1 = G4Log(Zeff + 1.);
183  coeffc1 = 2.943 - 0.197 * lnZ1;
184  coeffc2 = 0.0987 - 0.0143 * lnZ1;
185  // for single scattering
186  Z2 = Zeff * Zeff;
187  Z23 = G4Exp(2. * lnZ / 3.);
188  scr1 = scr1ini * Z23;
189  scr2 = scr2ini * Z2 * ChargeSquare;
190 
191  Zold = Zeff;
192 }
193 
194 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
195 
196 inline G4double UrbanMscModel93::ComputeTheta0(G4double trueStepLength, G4double KineticEnergy) {
197  // for all particles take the width of the central part
198  // from a parametrization similar to the Highland formula
199  // ( Highland formula: Particle Physics Booklet, July 2002, eq. 26.10)
200  static const G4double c_highland = 13.6 * CLHEP::MeV;
201  G4double invbetacp =
202  sqrt((currentKinEnergy + mass) * (KineticEnergy + mass) /
203  (currentKinEnergy * (currentKinEnergy + 2. * mass) * KineticEnergy * (KineticEnergy + 2. * mass)));
204  y = trueStepLength / currentRadLength;
205  G4double theta0 = c_highland * std::abs(charge) * sqrt(y) * invbetacp;
206  // correction factor from e- scattering data
207  theta0 *= (coeffth1 + coeffth2 * G4Log(y));
208 
209  return theta0;
210 }
211 
212 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
213 
214 inline G4double UrbanMscModel93::SimpleScattering(G4double xmeanth, G4double x2meanth) {
215  // 'large angle scattering'
216  // 2 model functions with correct xmean and x2mean
217  G4double a = (2. * xmeanth + 9. * x2meanth - 3.) / (2. * xmeanth - 3. * x2meanth + 1.);
218  G4double prob = (a + 2.) * xmeanth / a;
219 
220  // sampling
221  G4double cth = 1.;
222  if (G4UniformRand() < prob) {
223  cth = -1. + 2. * G4Exp(G4Log(G4UniformRand()) / (a + 1.));
224  } else {
225  cth = -1. + 2. * G4UniformRand();
226  }
227  return cth;
228 }
229 
230 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
231 
232 #endif
const G4ParticleDefinition * particle
void StartTracking(G4Track *) override
const G4MaterialCutsCouple * couple
UrbanMscModel93 & operator=(const UrbanMscModel93 &right)=delete
G4ParticleChangeForMSC * fParticleChange
G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy)
G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety) override
G4double currentRadLength
void SetParticle(const G4ParticleDefinition *)
G4double ComputeGeomPathLength(G4double truePathLength) override
G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &currentMinimalStep) override
G4double LatCorrelation()
UrbanMscModel93(const G4String &nam="UrbanMsc93")
const double MeV
G4LossTableManager * theManager
T sqrt(T t)
Definition: SSEVec.h:18
G4double currentKinEnergy
G4double SimpleScattering(G4double xmeanth, G4double x2meanth)
G4double SampleDisplacement()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
~UrbanMscModel93() override
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *particle, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=0., G4double emax=DBL_MAX) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
G4double ComputeTrueStepLength(G4double geomStepLength) override
double a
Definition: hdecay.h:121
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy)