test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 UrbanMscModel93_h
43 #define 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 "G4SystemOfUnits.hh"
52 
53 class G4ParticleChangeForMSC;
54 class G4SafetyHelper;
55 class G4LossTableManager;
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 class UrbanMscModel93 : public G4VMscModel
60 {
61 
62 public:
63 
64  UrbanMscModel93(const G4String& nam = "UrbanMsc93");
65 
66  virtual ~UrbanMscModel93();
67 
68  void Initialise(const G4ParticleDefinition*, const G4DataVector&);
69 
70  void StartTracking(G4Track*);
71 
72  G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
73  G4double KineticEnergy,
74  G4double AtomicNumber,
75  G4double AtomicWeight=0.,
76  G4double cut =0.,
77  G4double emax=DBL_MAX);
78 
79  G4ThreeVector& SampleScattering(const G4ThreeVector&, G4double safety);
80 
81  G4double ComputeTruePathLengthLimit(const G4Track& track,
82  G4double& currentMinimalStep);
83 
84  G4double ComputeGeomPathLength(G4double truePathLength);
85 
86  G4double ComputeTrueStepLength(G4double geomStepLength);
87 
88  inline G4double ComputeTheta0(G4double truePathLength,
89  G4double KineticEnergy);
90 
91 private:
92 
93  G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
94 
95  G4double SampleDisplacement();
96 
97  G4double LatCorrelation();
98 
99  inline void SetParticle(const G4ParticleDefinition*);
100 
101  inline void UpdateCache();
102 
103  inline G4double SimpleScattering(G4double xmeanth, G4double x2meanth);
104 
105  // hide assignment operator
106  UrbanMscModel93 & operator=(const UrbanMscModel93 &right);
108 
109  const G4ParticleDefinition* particle;
110  G4ParticleChangeForMSC* fParticleChange;
111 
112  const G4MaterialCutsCouple* couple;
113  G4LossTableManager* theManager;
114 
115  G4double mass;
118 
119  G4double taubig;
120  G4double tausmall;
121  G4double taulim;
122  G4double currentTau;
123  G4double tlimit;
124  G4double tlimitmin;
125  G4double tlimitminfix;
126  G4double tgeom;
127 
128  G4double geombig;
129  G4double geommin;
130  G4double geomlimit;
131  G4double skindepth;
132  G4double smallstep;
133 
134  G4double presafety;
135 
136  G4double lambda0;
137  G4double lambdaeff;
138  G4double tPathLength;
139  G4double zPathLength;
140  G4double par1,par2,par3;
141 
142  G4double stepmin;
143 
145  G4double currentRange;
146  G4double rangeinit;
148 
149  G4double numlim, xsi, ea, eaa;
150 
152  G4double third;
153 
155 
156  G4double y;
157  G4double Zold;
158  G4double Zeff,Z2,Z23,lnZ;
159  G4double coeffth1,coeffth2;
160  G4double coeffc1,coeffc2;
162 
163  G4bool firstStep;
164  G4bool inside;
165  G4bool insideskin;
166 };
167 
168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
170 
171 inline
172 void UrbanMscModel93::SetParticle(const G4ParticleDefinition* p)
173 {
174  if (p != particle) {
175  particle = p;
176  mass = p->GetPDGMass();
177  charge = p->GetPDGCharge()/CLHEP::eplus;
179  }
180 }
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
183 
184 inline
186 {
187  lnZ = G4Log(Zeff);
188  //new correction in theta0 formula
189  coeffth1 = (1.-8.7780e-2/Zeff)*(0.87+0.03*lnZ);
190  coeffth2 = (4.0780e-2+1.7315e-4*Zeff)*(0.87+0.03*lnZ);
191  // tail parameters
192  G4double lnZ1 = G4Log(Zeff+1.);
193  coeffc1 = 2.943-0.197*lnZ1;
194  coeffc2 = 0.0987-0.0143*lnZ1;
195  // for single scattering
196  Z2 = Zeff*Zeff;
197  Z23 = G4Exp(2.*lnZ/3.);
198  scr1 = scr1ini*Z23;
200 
201  Zold = Zeff;
202 }
203 
204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
205 
206 inline
207 G4double UrbanMscModel93::ComputeTheta0(G4double trueStepLength,
208  G4double KineticEnergy)
209 {
210  // for all particles take the width of the central part
211  // from a parametrization similar to the Highland formula
212  // ( Highland formula: Particle Physics Booklet, July 2002, eq. 26.10)
213  static const G4double c_highland = 13.6*CLHEP::MeV;
214  G4double invbetacp = sqrt((currentKinEnergy+mass)*(KineticEnergy+mass)/
216  KineticEnergy*(KineticEnergy+2.*mass)));
217  y = trueStepLength/currentRadLength;
218  G4double theta0 = c_highland*std::abs(charge)*sqrt(y)*invbetacp;
219  // correction factor from e- scattering data
220  theta0 *= (coeffth1+coeffth2*G4Log(y));
221 
222  return theta0;
223 }
224 
225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
226 
227 inline
228 G4double UrbanMscModel93::SimpleScattering(G4double xmeanth, G4double x2meanth)
229 {
230  // 'large angle scattering'
231  // 2 model functions with correct xmean and x2mean
232  G4double a = (2.*xmeanth+9.*x2meanth-3.)/(2.*xmeanth-3.*x2meanth+1.);
233  G4double prob = (a+2.)*xmeanth/a;
234 
235  // sampling
236  G4double cth = 1.;
237  if(G4UniformRand() < prob) {
238  cth = -1.+2.*G4Exp(G4Log(G4UniformRand())/(a+1.));
239  } else {
240  cth = -1.+2.*G4UniformRand();
241  }
242  return cth;
243 }
244 
245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
246 
247 #endif
248 
const G4ParticleDefinition * particle
const G4MaterialCutsCouple * couple
G4ParticleChangeForMSC * fParticleChange
G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy)
void Initialise(const G4ParticleDefinition *, const G4DataVector &)
G4double ComputeGeomPathLength(G4double truePathLength)
G4double currentRadLength
void SetParticle(const G4ParticleDefinition *)
G4double LatCorrelation()
UrbanMscModel93(const G4String &nam="UrbanMsc93")
const double MeV
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *particle, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=0., G4double emax=DBL_MAX)
void StartTracking(G4Track *)
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
G4double ComputeTrueStepLength(G4double geomStepLength)
UrbanMscModel93 & operator=(const UrbanMscModel93 &right)
double a
Definition: hdecay.h:121
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy)
virtual ~UrbanMscModel93()
G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety)
G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &currentMinimalStep)