Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4BohrFluctuations Class Reference

#include <G4BohrFluctuations.hh>

Inheritance diagram for G4BohrFluctuations:
Collaboration 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 void SetParticleAndCharge (const G4ParticleDefinition *, G4double q2)
 
const G4StringGetName () const
 

Detailed Description

Definition at line 58 of file G4BohrFluctuations.hh.

Constructor & Destructor Documentation

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

Definition at line 64 of file G4BohrFluctuations.cc.

66  particle(0),
67  minNumberInteractionsBohr(2.0),
68  minFraction(0.2),
69  xmin(0.2),
70  minLoss(0.001*eV)
71 {
72  particleMass = proton_mass_c2;
73  chargeSquare = 1.0;
74  kineticEnergy = 0.0;
75  beta2 = 0.0;
76 }
static constexpr double proton_mass_c2
static constexpr double eV
Definition: G4SIunits.hh:215
G4VEmFluctuationModel(const G4String &nam)
G4BohrFluctuations::~G4BohrFluctuations ( )
virtual

Definition at line 80 of file G4BohrFluctuations.cc.

81 {}

Member Function Documentation

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

Implements G4VEmFluctuationModel.

Definition at line 150 of file G4BohrFluctuations.cc.

154 {
155  if(!particle) { InitialiseMe(dp->GetDefinition()); }
156 
157  G4double electronDensity = material->GetElectronDensity();
158  kineticEnergy = dp->GetKineticEnergy();
159  G4double etot = kineticEnergy + particleMass;
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 }
G4double GetKineticEnergy() const
static constexpr double twopi_mc2_rcl2
G4ParticleDefinition * GetDefinition() const
virtual void InitialiseMe(const G4ParticleDefinition *) override
G4double GetElectronDensity() const
Definition: G4Material.hh:217
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void G4BohrFluctuations::InitialiseMe ( const G4ParticleDefinition part)
overridevirtual

Reimplemented from G4VEmFluctuationModel.

Definition at line 85 of file G4BohrFluctuations.cc.

86 {
87  particle = part;
88  particleMass = part->GetPDGMass();
89  G4double q = part->GetPDGCharge()/eplus;
90  chargeSquare = q*q;
91 }
static constexpr double eplus
Definition: G4SIunits.hh:199
G4double GetPDGMass() const
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements G4VEmFluctuationModel.

Definition at line 96 of file G4BohrFluctuations.cc.

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 }
ThreeVector shoot(const G4int Ap, const G4int Af)
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
#define G4UniformRand()
Definition: Randomize.hh:97
virtual G4double Dispersion(const G4Material *, const G4DynamicParticle *, G4double, G4double) override
double G4double
Definition: G4Types.hh:76
const G4Material * GetMaterial() const

Here is the call graph for this function:


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