G4IonFluctuations Class Reference

#include <G4IonFluctuations.hh>

Inheritance diagram for G4IonFluctuations:

G4VEmFluctuationModel

Public Member Functions

 G4IonFluctuations (const G4String &nam="IonFluc")
virtual ~G4IonFluctuations ()
G4double SampleFluctuations (const G4Material *, const G4DynamicParticle *, G4double &tmax, G4double &length, G4double &meanLoss)
G4double Dispersion (const G4Material *, const G4DynamicParticle *, G4double &tmax, G4double &length)
void InitialiseMe (const G4ParticleDefinition *)
void SetParticleAndCharge (const G4ParticleDefinition *, G4double q2)

Detailed Description

Definition at line 59 of file G4IonFluctuations.hh.


Constructor & Destructor Documentation

G4IonFluctuations::G4IonFluctuations ( const G4String nam = "IonFluc"  ) 

Definition at line 70 of file G4IonFluctuations.cc.

00071   : G4VEmFluctuationModel(nam),
00072     particle(0),
00073     particleMass(proton_mass_c2),
00074     charge(1.0),
00075     chargeSquare(1.0),
00076     effChargeSquare(1.0),
00077     parameter(10.0*CLHEP::MeV/CLHEP::proton_mass_c2),
00078     minNumberInteractionsBohr(0.0),
00079     theBohrBeta2(50.0*keV/CLHEP::proton_mass_c2),
00080     minFraction(0.2),
00081     xmin(0.2),
00082     minLoss(0.001*eV)
00083 {
00084   kineticEnergy = 0.0;
00085   beta2 = 0.0;
00086 }

G4IonFluctuations::~G4IonFluctuations (  )  [virtual]

Definition at line 90 of file G4IonFluctuations.cc.

00091 {}


Member Function Documentation

G4double G4IonFluctuations::Dispersion ( const G4Material ,
const G4DynamicParticle ,
G4double tmax,
G4double length 
) [virtual]

Implements G4VEmFluctuationModel.

Definition at line 170 of file G4IonFluctuations.cc.

References G4Material::GetElectronDensity(), G4DynamicParticle::GetKineticEnergy(), and G4Material::GetTotNbOfAtomsPerVolume().

Referenced by SampleFluctuations().

00174 {
00175   kineticEnergy = dp->GetKineticEnergy();
00176   G4double etot = kineticEnergy + particleMass;
00177   beta2 = kineticEnergy*(kineticEnergy + 2.*particleMass)/(etot*etot);
00178 
00179   G4double electronDensity = material->GetElectronDensity();
00180 
00181   /*
00182   G4cout << "e= " <<  kineticEnergy << " m= " << particleMass
00183          << " tmax= " << tmax << " l= " << length 
00184          << " q^2= " << effChargeSquare << " beta2=" << beta2<< G4endl;
00185   */
00186   G4double siga = (1. - beta2*0.5)*tmax*length*electronDensity*
00187     twopi_mc2_rcl2*chargeSquare/beta2;
00188 
00189   // Low velocity - additional ion charge fluctuations according to
00190   // Q.Yang et al., NIM B61(1991)149-155.
00191   //G4cout << "sigE= " << sqrt(siga) << " charge= " << charge <<G4endl;
00192 
00193   G4double Z = electronDensity/material->GetTotNbOfAtomsPerVolume();
00194  
00195   G4double fac = Factor(material, Z);
00196 
00197   // heavy ion correction
00198 //  G4double f1 = 1.065e-4*chargeSquare;
00199 //  if(beta2 > theBohrBeta2)  f1/= beta2;
00200 //  else                      f1/= theBohrBeta2;
00201 //  if(f1 > 2.5) f1 = 2.5;
00202 //  fac *= (1.0 + f1);
00203 
00204   // taking into account the cut
00205   G4double fac_cut = 1.0 + (fac - 1.0)*2.0*electron_mass_c2*beta2/(tmax*(1.0 - beta2));
00206   if(fac_cut > 0.01 && fac > 0.01) {
00207     siga *= fac_cut;
00208   }
00209 
00210   //G4cout << "siga(keV)= " << sqrt(siga)/keV << " fac= " << fac 
00211   //     << "  f1= " << f1 << G4endl;
00212 
00213   return siga;
00214 }

void G4IonFluctuations::InitialiseMe ( const G4ParticleDefinition  )  [virtual]

Reimplemented from G4VEmFluctuationModel.

Definition at line 95 of file G4IonFluctuations.cc.

References G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGMass(), and G4UniversalFluctuation::InitialiseMe().

00096 {
00097   particle       = part;
00098   particleMass   = part->GetPDGMass();
00099   charge         = part->GetPDGCharge()/eplus;
00100   chargeSquare   = charge*charge;
00101   effChargeSquare= chargeSquare;
00102   uniFluct.InitialiseMe(part);
00103 }

G4double G4IonFluctuations::SampleFluctuations ( const G4Material ,
const G4DynamicParticle ,
G4double tmax,
G4double length,
G4double meanLoss 
) [virtual]

Implements G4VEmFluctuationModel.

Definition at line 107 of file G4IonFluctuations.cc.

References Dispersion(), G4UniformRand, G4InuclParticleNames::gam, G4DynamicParticle::GetKineticEnergy(), and G4UniversalFluctuation::SampleFluctuations().

00112 {
00113   //  G4cout << "### meanLoss= " << meanLoss << G4endl;
00114   if(meanLoss <= minLoss) return meanLoss;
00115 
00116   //G4cout << "G4IonFluctuations::SampleFluctuations E(MeV)= " << dp->GetKineticEnergy()
00117   //     << "  Elim(MeV)= " << parameter*charge*particleMass << G4endl; 
00118 
00119   // Vavilov fluctuations
00120   if(dp->GetKineticEnergy() > parameter*charge*particleMass) {
00121     return uniFluct.SampleFluctuations(material,dp,tmax,length,meanLoss);
00122   }
00123 
00124   G4double siga = Dispersion(material,dp,tmax,length);
00125   G4double loss = meanLoss;
00126   
00127   //G4cout << "### siga= " << sqrt(siga) << "  navr= " << navr << G4endl;
00128 
00129   // Gaussian fluctuation
00130 
00131   // Increase fluctuations for big fractional energy loss
00132   //G4cout << "siga= " << siga << G4endl;
00133   if ( meanLoss > minFraction*kineticEnergy ) {
00134     G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
00135     G4double b2  = 1.0 - 1.0/(gam*gam);
00136     if(b2 < xmin*beta2) b2 = xmin*beta2;
00137     G4double x   = b2/beta2;
00138     G4double x3  = 1.0/(x*x*x);
00139     siga *= 0.25*(1.0 + x)*(x3 + (1.0/b2 - 0.5)/(1.0/beta2 - 0.5) );
00140   }
00141   siga = sqrt(siga);
00142   G4double sn = meanLoss/siga;
00143   G4double twomeanLoss = meanLoss + meanLoss;
00144   //  G4cout << "siga= " << siga << "  sn= " << sn << G4endl;
00145   
00146   // thick target case  
00147   if (sn >= 2.0) {
00148 
00149     do {
00150       loss = G4RandGauss::shoot(meanLoss,siga);
00151     } while (0.0 > loss || twomeanLoss < loss);
00152 
00153     // Gamma distribution
00154   } else if(sn > 0.1) {
00155 
00156     G4double neff = sn*sn;
00157     loss = meanLoss*CLHEP::RandGamma::shoot(neff,1.0)/neff;
00158 
00159     // uniform distribution for very small steps
00160   } else {
00161     loss = twomeanLoss*G4UniformRand();
00162   }
00163 
00164   //G4cout << "meanLoss= " << meanLoss << " loss= " << loss << G4endl;
00165   return loss;
00166 }

void G4IonFluctuations::SetParticleAndCharge ( const G4ParticleDefinition ,
G4double  q2 
) [virtual]

Reimplemented from G4VEmFluctuationModel.

Definition at line 431 of file G4IonFluctuations.cc.

References G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGMass(), and G4UniversalFluctuation::SetParticleAndCharge().

00433 {
00434   if(part != particle) {
00435     particle       = part;
00436     particleMass   = part->GetPDGMass();
00437     charge         = part->GetPDGCharge()/eplus;
00438     chargeSquare   = charge*charge;
00439   }
00440   effChargeSquare  = q2;
00441   uniFluct.SetParticleAndCharge(part, q2);
00442 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:17 2013 for Geant4 by  doxygen 1.4.7