Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BohrFluctuations Class Reference

#include <G4BohrFluctuations.hh>

+ Inheritance diagram for G4BohrFluctuations:

Public Member Functions

 G4BohrFluctuations (const G4String &nam="BohrFluc")
 
virtual ~G4BohrFluctuations ()
 
virtual G4double SampleFluctuations (const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double, G4double, G4double) override
 
virtual G4double Dispersion (const G4Material *, const G4DynamicParticle *, G4double, G4double) override
 
virtual void InitialiseMe (const G4ParticleDefinition *) override
 
- Public Member Functions inherited from G4VEmFluctuationModel
 G4VEmFluctuationModel (const G4String &nam)
 
virtual ~G4VEmFluctuationModel ()
 
virtual G4double SampleFluctuations (const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmax, G4double length, G4double meanLoss)=0
 
virtual G4double Dispersion (const G4Material *, const G4DynamicParticle *, G4double tmax, G4double length)=0
 
virtual void InitialiseMe (const G4ParticleDefinition *)
 
virtual void SetParticleAndCharge (const G4ParticleDefinition *, G4double q2)
 
const G4StringGetName () const
 
G4VEmFluctuationModeloperator= (const G4VEmFluctuationModel &right)=delete
 
 G4VEmFluctuationModel (const G4VEmFluctuationModel &)=delete
 

Detailed Description

Definition at line 57 of file G4BohrFluctuations.hh.

Constructor & Destructor Documentation

◆ G4BohrFluctuations()

G4BohrFluctuations::G4BohrFluctuations ( const G4String nam = "BohrFluc")
explicit

Definition at line 63 of file G4BohrFluctuations.cc.

65 particle(0),
66 minNumberInteractionsBohr(2.0),
67 minFraction(0.2),
68 xmin(0.2),
69 minLoss(0.001*eV)
70{
71 particleMass = proton_mass_c2;
72 chargeSquare = 1.0;
73 kineticEnergy = 0.0;
74 beta2 = 0.0;
75}

◆ ~G4BohrFluctuations()

G4BohrFluctuations::~G4BohrFluctuations ( )
virtual

Definition at line 79 of file G4BohrFluctuations.cc.

80{}

Member Function Documentation

◆ Dispersion()

G4double G4BohrFluctuations::Dispersion ( const G4Material material,
const G4DynamicParticle dp,
G4double  tmax,
G4double  length 
)
overridevirtual

Implements G4VEmFluctuationModel.

Definition at line 149 of file G4BohrFluctuations.cc.

153{
154 if(!particle) { InitialiseMe(dp->GetDefinition()); }
155
156 G4double electronDensity = material->GetElectronDensity();
157 kineticEnergy = dp->GetKineticEnergy();
158 G4double etot = kineticEnergy + particleMass;
159 beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
160 G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
161 * electronDensity * chargeSquare;
162
163 return siga;
164}
double G4double
Definition: G4Types.hh:83
virtual void InitialiseMe(const G4ParticleDefinition *) override
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetElectronDensity() const
Definition: G4Material.hh:215

Referenced by SampleFluctuations().

◆ InitialiseMe()

void G4BohrFluctuations::InitialiseMe ( const G4ParticleDefinition part)
overridevirtual

Reimplemented from G4VEmFluctuationModel.

Definition at line 84 of file G4BohrFluctuations.cc.

85{
86 particle = part;
87 particleMass = part->GetPDGMass();
88 G4double q = part->GetPDGCharge()/eplus;
89 chargeSquare = q*q;
90}
G4double GetPDGCharge() const

Referenced by Dispersion().

◆ SampleFluctuations()

G4double G4BohrFluctuations::SampleFluctuations ( const G4MaterialCutsCouple couple,
const G4DynamicParticle dp,
G4double  tmax,
G4double  length,
G4double  meanLoss 
)
overridevirtual

Implements G4VEmFluctuationModel.

Definition at line 95 of file G4BohrFluctuations.cc.

100{
101 if(meanLoss <= minLoss) { return meanLoss; }
102 const G4Material* material = couple->GetMaterial();
103 G4double siga = Dispersion(material,dp,tmax,length);
104 G4double loss = meanLoss;
105
106 G4double navr = meanLoss*meanLoss/siga;
107 //G4cout << "### meanLoss= " << meanLoss << " navr= " << navr << G4endl;
108 if (navr >= minNumberInteractionsBohr) {
109
110 // Increase fluctuations for big fractional energy loss
111 if ( meanLoss > minFraction*kineticEnergy ) {
112 G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
113 G4double b2 = 1.0 - 1.0/(gam*gam);
114 if(b2 < xmin*beta2) b2 = xmin*beta2;
115 G4double x = b2/beta2;
116 G4double x3 = 1.0/(x*x*x);
117 siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) );
118 }
119 siga = sqrt(siga);
120 G4double twomeanLoss = meanLoss + meanLoss;
121 //G4cout << "siga= " << siga << " 2edp= " << twomeanLoss <<G4endl;
122
123 if(twomeanLoss < siga) {
124 G4double x;
125 do {
126 loss = twomeanLoss*G4UniformRand();
127 x = (loss - meanLoss)/siga;
128 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
129 } while (1.0 - 0.5*x*x < G4UniformRand());
130 } else {
131 do {
132 loss = G4RandGauss::shoot(meanLoss,siga);
133 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
134 } while (0.0 > loss || loss > twomeanLoss);
135 }
136
137 // Poisson fluctuations
138 } else {
139 G4double n = (G4double)(G4Poisson(navr));
140 loss = meanLoss*n/navr;
141 }
142 //G4cout << "loss= " << loss << G4endl;
143
144 return loss;
145}
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:50
#define G4UniformRand()
Definition: Randomize.hh:52
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double, G4double) override
const G4Material * GetMaterial() const

The documentation for this class was generated from the following files: