Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4BohrFluctuations.cc
이 파일의 문서화 페이지로 가기
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 // $Id: G4BohrFluctuations.cc 91726 2015-08-03 15:41:36Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4BohrFluctuations
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 02.04.2003
38 //
39 // Modifications:
40 //
41 // 23-05-03 Add control on parthalogical cases (V.Ivanchenko)
42 // 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
43 //
44 // Class Description: Sampling of Gaussion fluctuations
45 //
46 // -------------------------------------------------------------------
47 //
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
52 #include "G4BohrFluctuations.hh"
53 #include "G4PhysicalConstants.hh"
54 #include "G4SystemOfUnits.hh"
55 #include "Randomize.hh"
56 #include "G4Poisson.hh"
57 #include "G4ParticleDefinition.hh"
58 #include "G4MaterialCutsCouple.hh"
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
61 
62 using namespace std;
63 
66  particle(0),
67  minNumberInteractionsBohr(2.0),
68  minFraction(0.2),
69  xmin(0.2),
70  minLoss(0.001*eV)
71 {
73  chargeSquare = 1.0;
74  kineticEnergy = 0.0;
75  beta2 = 0.0;
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
79 
81 {}
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84 
86 {
87  particle = part;
88  particleMass = part->GetPDGMass();
89  G4double q = part->GetPDGCharge()/eplus;
90  chargeSquare = q*q;
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
94 
95 G4double
97  const G4DynamicParticle* dp,
98  G4double tmax,
99  G4double length,
100  G4double meanLoss)
101 {
102  if(meanLoss <= minLoss) { return meanLoss; }
103  const G4Material* material = couple->GetMaterial();
104  G4double siga = Dispersion(material,dp,tmax,length);
105  G4double loss = meanLoss;
106 
107  G4double navr = meanLoss*meanLoss/siga;
108  //G4cout << "### meanLoss= " << meanLoss << " navr= " << navr << G4endl;
109  if (navr >= minNumberInteractionsBohr) {
110 
111  // Increase fluctuations for big fractional energy loss
112  if ( meanLoss > minFraction*kineticEnergy ) {
113  G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
114  G4double b2 = 1.0 - 1.0/(gam*gam);
115  if(b2 < xmin*beta2) b2 = xmin*beta2;
116  G4double x = b2/beta2;
117  G4double x3 = 1.0/(x*x*x);
118  siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) );
119  }
120  siga = sqrt(siga);
121  G4double twomeanLoss = meanLoss + meanLoss;
122  //G4cout << "siga= " << siga << " 2edp= " << twomeanLoss <<G4endl;
123 
124  if(twomeanLoss < siga) {
125  G4double x;
126  do {
127  loss = twomeanLoss*G4UniformRand();
128  x = (loss - meanLoss)/siga;
129  // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
130  } while (1.0 - 0.5*x*x < G4UniformRand());
131  } else {
132  do {
133  loss = G4RandGauss::shoot(meanLoss,siga);
134  // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
135  } while (0.0 > loss || loss > twomeanLoss);
136  }
137 
138  // Poisson fluctuations
139  } else {
140  G4double n = (G4double)(G4Poisson(navr));
141  loss = meanLoss*n/navr;
142  }
143  //G4cout << "loss= " << loss << G4endl;
144 
145  return loss;
146 }
147 
148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
149 
151  const G4DynamicParticle* dp,
152  G4double tmax,
153  G4double length)
154 {
155  if(!particle) { InitialiseMe(dp->GetDefinition()); }
156 
157  G4double electronDensity = material->GetElectronDensity();
160  beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
161  G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
162  * electronDensity * chargeSquare;
163 
164  return siga;
165 }
166 
167 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
168 
169 
Float_t x
Definition: compare.C:6
static constexpr double twopi_mc2_rcl2
G4double GetPDGCharge() const
const G4ParticleDefinition * particle
G4double GetPDGMass() const
static constexpr double proton_mass_c2
double G4double
Definition: G4Types.hh:76
TString part[npart]
Definition: Style.C:32
G4ParticleDefinition * GetDefinition() const
#define G4UniformRand()
Definition: Randomize.hh:53
static constexpr double eV
Definition: G4SIunits.hh:215
G4BohrFluctuations(const G4String &nam="BohrFluc")
virtual void InitialiseMe(const G4ParticleDefinition *) override
ThreeVector shoot(const G4int Ap, const G4int Af)
static constexpr double eplus
Definition: G4SIunits.hh:199
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double, G4double) override
G4double GetKineticEnergy() const
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
Char_t n[5]
const G4Material * GetMaterial() const
G4double GetElectronDensity() const
Definition: G4Material.hh:218
virtual G4double SampleFluctuations(const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double, G4double, G4double) override
G4double minNumberInteractionsBohr