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
UrbanMscModel93::currentKinEnergy
G4double currentKinEnergy
Definition: UrbanMscModel93.h:138
UrbanMscModel93::fParticleChange
G4ParticleChangeForMSC * fParticleChange
Definition: UrbanMscModel93.h:104
UrbanMscModel93::par1
G4double par1
Definition: UrbanMscModel93.h:134
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
UrbanMscModel93::SampleDisplacement
G4double SampleDisplacement()
Definition: UrbanMscModel93.cc:948
UrbanMscModel93::SimpleScattering
G4double SimpleScattering(G4double xmeanth, G4double x2meanth)
Definition: UrbanMscModel93.h:214
UrbanMscModel93::SetParticle
void SetParticle(const G4ParticleDefinition *)
Definition: UrbanMscModel93.h:165
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
UrbanMscModel93::Zold
G4double Zold
Definition: UrbanMscModel93.h:151
UrbanMscModel93::geomlimit
G4double geomlimit
Definition: UrbanMscModel93.h:124
UrbanMscModel93::tPathLength
G4double tPathLength
Definition: UrbanMscModel93.h:132
UrbanMscModel93::firstStep
G4bool firstStep
Definition: UrbanMscModel93.h:157
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
UrbanMscModel93::zPathLength
G4double zPathLength
Definition: UrbanMscModel93.h:133
UrbanMscModel93::particle
const G4ParticleDefinition * particle
Definition: UrbanMscModel93.h:103
UrbanMscModel93::coeffth2
G4double coeffth2
Definition: UrbanMscModel93.h:153
MeV
const double MeV
UrbanMscModel93::numlim
G4double numlim
Definition: UrbanMscModel93.h:143
UrbanMscModel93::coeffth1
G4double coeffth1
Definition: UrbanMscModel93.h:153
UrbanMscModel93::presafety
G4double presafety
Definition: UrbanMscModel93.h:128
UrbanMscModel93::currentMaterialIndex
G4int currentMaterialIndex
Definition: UrbanMscModel93.h:148
UrbanMscModel93::masslimite
G4double masslimite
Definition: UrbanMscModel93.h:111
UrbanMscModel93::xsi
G4double xsi
Definition: UrbanMscModel93.h:143
UrbanMscModel93
Definition: UrbanMscModel93.h:59
UrbanMscModel93::lambdalimit
G4double lambdalimit
Definition: UrbanMscModel93.h:111
UrbanMscModel93::scr1ini
G4double scr1ini
Definition: UrbanMscModel93.h:155
UrbanMscModel93::~UrbanMscModel93
~UrbanMscModel93() override
Definition: UrbanMscModel93.cc:105
UrbanMscModel93::ChargeSquare
G4double ChargeSquare
Definition: UrbanMscModel93.h:110
UrbanMscModel93::insideskin
G4bool insideskin
Definition: UrbanMscModel93.h:159
UrbanMscModel93::scr2
G4double scr2
Definition: UrbanMscModel93.h:155
UrbanMscModel93::theta0max
G4double theta0max
Definition: UrbanMscModel93.h:145
UrbanMscModel93::tlimitminfix
G4double tlimitminfix
Definition: UrbanMscModel93.h:119
UrbanMscModel93::LatCorrelation
G4double LatCorrelation()
Definition: UrbanMscModel93.cc:1001
UrbanMscModel93::charge
G4double charge
Definition: UrbanMscModel93.h:110
UrbanMscModel93::scr2ini
G4double scr2ini
Definition: UrbanMscModel93.h:155
UrbanMscModel93::Zeff
G4double Zeff
Definition: UrbanMscModel93.h:152
UrbanMscModel93::geommin
G4double geommin
Definition: UrbanMscModel93.h:123
UrbanMscModel93::rangeinit
G4double rangeinit
Definition: UrbanMscModel93.h:140
UrbanMscModel93::UpdateCache
void UpdateCache()
Definition: UrbanMscModel93.h:176
UrbanMscModel93::par2
G4double par2
Definition: UrbanMscModel93.h:134
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
UrbanMscModel93::par3
G4double par3
Definition: UrbanMscModel93.h:134
UrbanMscModel93::lambda0
G4double lambda0
Definition: UrbanMscModel93.h:130
UrbanMscModel93::currentRadLength
G4double currentRadLength
Definition: UrbanMscModel93.h:141
UrbanMscModel93::SampleCosineTheta
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy)
Definition: UrbanMscModel93.cc:763
UrbanMscModel93::stepmin
G4double stepmin
Definition: UrbanMscModel93.h:136
UrbanMscModel93::rellossmax
G4double rellossmax
Definition: UrbanMscModel93.h:145
UrbanMscModel93::eaa
G4double eaa
Definition: UrbanMscModel93.h:143
UrbanMscModel93::Z2
G4double Z2
Definition: UrbanMscModel93.h:152
UrbanMscModel93::Z23
G4double Z23
Definition: UrbanMscModel93.h:152
UrbanMscModel93::tlimit
G4double tlimit
Definition: UrbanMscModel93.h:117
UrbanMscModel93::mass
G4double mass
Definition: UrbanMscModel93.h:109
UrbanMscModel93::ComputeCrossSectionPerAtom
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *particle, G4double KineticEnergy, G4double AtomicNumber, G4double AtomicWeight=0., G4double cut=0., G4double emax=DBL_MAX) override
Definition: UrbanMscModel93.cc:125
UrbanMscModel93::inside
G4bool inside
Definition: UrbanMscModel93.h:158
UrbanMscModel93::currentRange
G4double currentRange
Definition: UrbanMscModel93.h:139
a
double a
Definition: hdecay.h:119
UrbanMscModel93::ea
G4double ea
Definition: UrbanMscModel93.h:143
UrbanMscModel93::SampleScattering
G4ThreeVector & SampleScattering(const G4ThreeVector &, G4double safety) override
Definition: UrbanMscModel93.cc:673
UrbanMscModel93::taubig
G4double taubig
Definition: UrbanMscModel93.h:113
UrbanMscModel93::operator=
UrbanMscModel93 & operator=(const UrbanMscModel93 &right)=delete
UrbanMscModel93::ComputeTrueStepLength
G4double ComputeTrueStepLength(G4double geomStepLength) override
Definition: UrbanMscModel93.cc:641
UrbanMscModel93::lambdaeff
G4double lambdaeff
Definition: UrbanMscModel93.h:131
UrbanMscModel93::scr1
G4double scr1
Definition: UrbanMscModel93.h:155
UrbanMscModel93::theManager
G4LossTableManager * theManager
Definition: UrbanMscModel93.h:107
UrbanMscModel93::currentTau
G4double currentTau
Definition: UrbanMscModel93.h:116
UrbanMscModel93::ComputeTheta0
G4double ComputeTheta0(G4double truePathLength, G4double KineticEnergy)
Definition: UrbanMscModel93.h:196
UrbanMscModel93::third
G4double third
Definition: UrbanMscModel93.h:146
UrbanMscModel93::Initialise
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
Definition: UrbanMscModel93.cc:109
UrbanMscModel93::smallstep
G4double smallstep
Definition: UrbanMscModel93.h:126
UrbanMscModel93::geombig
G4double geombig
Definition: UrbanMscModel93.h:122
UrbanMscModel93::taulim
G4double taulim
Definition: UrbanMscModel93.h:115
UrbanMscModel93::skindepth
G4double skindepth
Definition: UrbanMscModel93.h:125
UrbanMscModel93::coeffc1
G4double coeffc1
Definition: UrbanMscModel93.h:154
UrbanMscModel93::coeffc2
G4double coeffc2
Definition: UrbanMscModel93.h:154
UrbanMscModel93::y
G4double y
Definition: UrbanMscModel93.h:150
UrbanMscModel93::ComputeTruePathLengthLimit
G4double ComputeTruePathLengthLimit(const G4Track &track, G4double &currentMinimalStep) override
Definition: UrbanMscModel93.cc:349
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
UrbanMscModel93::StartTracking
void StartTracking(G4Track *) override
Definition: UrbanMscModel93.cc:337
UrbanMscModel93::UrbanMscModel93
UrbanMscModel93(const G4String &nam="UrbanMsc93")
Definition: UrbanMscModel93.cc:39
UrbanMscModel93::tausmall
G4double tausmall
Definition: UrbanMscModel93.h:114
UrbanMscModel93::ComputeGeomPathLength
G4double ComputeGeomPathLength(G4double truePathLength) override
Definition: UrbanMscModel93.cc:556
UrbanMscModel93::couple
const G4MaterialCutsCouple * couple
Definition: UrbanMscModel93.h:106
TtFullHadEvtBuilder_cfi.prob
prob
Definition: TtFullHadEvtBuilder_cfi.py:33
UrbanMscModel93::tgeom
G4double tgeom
Definition: UrbanMscModel93.h:120
UrbanMscModel93::lnZ
G4double lnZ
Definition: UrbanMscModel93.h:152
UrbanMscModel93::fr
G4double fr
Definition: UrbanMscModel93.h:111
UrbanMscModel93::tlimitmin
G4double tlimitmin
Definition: UrbanMscModel93.h:118