#include <G4BohrFluctuations.hh>
Inheritance diagram for G4BohrFluctuations:
Public Member Functions | |
G4BohrFluctuations (const G4String &nam="BohrFluc") | |
virtual | ~G4BohrFluctuations () |
G4double | SampleFluctuations (const G4Material *, const G4DynamicParticle *, G4double &, G4double &, G4double &) |
G4double | Dispersion (const G4Material *, const G4DynamicParticle *, G4double &, G4double &) |
void | InitialiseMe (const G4ParticleDefinition *) |
Definition at line 58 of file G4BohrFluctuations.hh.
G4BohrFluctuations::G4BohrFluctuations | ( | const G4String & | nam = "BohrFluc" |
) |
Definition at line 63 of file G4BohrFluctuations.cc.
00064 :G4VEmFluctuationModel(nam), 00065 particle(0), 00066 minNumberInteractionsBohr(2.0), 00067 minFraction(0.2), 00068 xmin(0.2), 00069 minLoss(0.001*eV) 00070 { 00071 particleMass = proton_mass_c2; 00072 chargeSquare = 1.0; 00073 kineticEnergy = 0.0; 00074 beta2 = 0.0; 00075 }
G4BohrFluctuations::~G4BohrFluctuations | ( | ) | [virtual] |
G4double G4BohrFluctuations::Dispersion | ( | const G4Material * | , | |
const G4DynamicParticle * | , | |||
G4double & | , | |||
G4double & | ||||
) | [virtual] |
Implements G4VEmFluctuationModel.
Definition at line 145 of file G4BohrFluctuations.cc.
References G4DynamicParticle::GetDefinition(), G4Material::GetElectronDensity(), G4DynamicParticle::GetKineticEnergy(), and InitialiseMe().
Referenced by SampleFluctuations().
00149 { 00150 if(!particle) { InitialiseMe(dp->GetDefinition()); } 00151 00152 G4double electronDensity = material->GetElectronDensity(); 00153 kineticEnergy = dp->GetKineticEnergy(); 00154 G4double etot = kineticEnergy + particleMass; 00155 beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot); 00156 G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length 00157 * electronDensity * chargeSquare; 00158 00159 return siga; 00160 }
void G4BohrFluctuations::InitialiseMe | ( | const G4ParticleDefinition * | ) | [virtual] |
Reimplemented from G4VEmFluctuationModel.
Definition at line 84 of file G4BohrFluctuations.cc.
References G4ParticleDefinition::GetPDGCharge(), and G4ParticleDefinition::GetPDGMass().
Referenced by Dispersion().
00085 { 00086 particle = part; 00087 particleMass = part->GetPDGMass(); 00088 G4double q = part->GetPDGCharge()/eplus; 00089 chargeSquare = q*q; 00090 }
G4double G4BohrFluctuations::SampleFluctuations | ( | const G4Material * | , | |
const G4DynamicParticle * | , | |||
G4double & | , | |||
G4double & | , | |||
G4double & | ||||
) | [virtual] |
Implements G4VEmFluctuationModel.
Definition at line 94 of file G4BohrFluctuations.cc.
References Dispersion(), G4Poisson(), G4UniformRand, G4InuclParticleNames::gam, and CLHEP::detail::n.
00099 { 00100 if(meanLoss <= minLoss) { return meanLoss; } 00101 G4double siga = Dispersion(material,dp,tmax,length); 00102 G4double loss = meanLoss; 00103 00104 G4double navr = meanLoss*meanLoss/siga; 00105 //G4cout << "### meanLoss= " << meanLoss << " navr= " << navr << G4endl; 00106 if (navr >= minNumberInteractionsBohr) { 00107 00108 // Increase fluctuations for big fractional energy loss 00109 if ( meanLoss > minFraction*kineticEnergy ) { 00110 G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0; 00111 G4double b2 = 1.0 - 1.0/(gam*gam); 00112 if(b2 < xmin*beta2) b2 = xmin*beta2; 00113 G4double x = b2/beta2; 00114 G4double x3 = 1.0/(x*x*x); 00115 siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) ); 00116 } 00117 siga = sqrt(siga); 00118 G4double twomeanLoss = meanLoss + meanLoss; 00119 //G4cout << "siga= " << siga << " 2edp= " << twomeanLoss <<G4endl; 00120 00121 if(twomeanLoss < siga) { 00122 G4double x; 00123 do { 00124 loss = twomeanLoss*G4UniformRand(); 00125 x = (loss - meanLoss)/siga; 00126 } while (1.0 - 0.5*x*x < G4UniformRand()); 00127 } else { 00128 do { 00129 loss = G4RandGauss::shoot(meanLoss,siga); 00130 } while (0.0 > loss || loss > twomeanLoss); 00131 } 00132 00133 // Poisson fluctuations 00134 } else { 00135 G4double n = (G4double)(G4Poisson(navr)); 00136 loss = meanLoss*n/navr; 00137 } 00138 //G4cout << "loss= " << loss << G4endl; 00139 00140 return loss; 00141 }