Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions
G4IonParametrisedLossModel Class Reference

#include <G4IonParametrisedLossModel.hh>

Inheritance diagram for G4IonParametrisedLossModel:
G4VEmModel

Public Member Functions

 G4IonParametrisedLossModel (const G4ParticleDefinition *particle=0, const G4String &name="ParamICRU73")
 
virtual ~G4IonParametrisedLossModel ()
 
virtual void Initialise (const G4ParticleDefinition *, const G4DataVector &)
 
virtual G4double MinEnergyCut (const G4ParticleDefinition *, const G4MaterialCutsCouple *)
 
virtual G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, G4double, G4double, G4double, G4double, G4double)
 
virtual G4double CrossSectionPerVolume (const G4Material *, const G4ParticleDefinition *, G4double, G4double, G4double)
 
virtual G4double ComputeDEDXPerVolume (const G4Material *, const G4ParticleDefinition *, G4double, G4double)
 
G4double ComputeLossForStep (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double, G4double)
 
G4double DeltaRayMeanEnergyTransferRate (const G4Material *, const G4ParticleDefinition *, G4double, G4double)
 
virtual void SampleSecondaries (std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double, G4double)
 
virtual G4double GetChargeSquareRatio (const G4ParticleDefinition *, const G4Material *, G4double)
 
virtual G4double GetParticleCharge (const G4ParticleDefinition *, const G4Material *, G4double)
 
virtual void CorrectionsAlongStep (const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &, G4double &, G4double)
 
G4bool AddDEDXTable (const G4String &name, G4VIonDEDXTable *table, G4VIonDEDXScalingAlgorithm *algorithm=0)
 
G4bool RemoveDEDXTable (const G4String &name)
 
void DeactivateICRU73Scaling ()
 
LossTableList::iterator IsApplicable (const G4ParticleDefinition *, const G4Material *)
 
void PrintDEDXTable (const G4ParticleDefinition *, const G4Material *, G4double, G4double, G4int, G4bool)
 
void PrintDEDXTableHandlers (const G4ParticleDefinition *, const G4Material *, G4double, G4double, G4int, G4bool)
 
void SetEnergyLossLimit (G4double ionEnergyLossLimit)
 
- Public Member Functions inherited from G4VEmModel
 G4VEmModel (const G4String &nam)
 
virtual ~G4VEmModel ()
 
virtual void InitialiseLocal (const G4ParticleDefinition *, G4VEmModel *masterModel)
 
virtual void InitialiseForMaterial (const G4ParticleDefinition *, const G4Material *)
 
virtual void InitialiseForElement (const G4ParticleDefinition *, G4int Z)
 
virtual G4double ChargeSquareRatio (const G4Track &)
 
virtual void StartTracking (G4Track *)
 
virtual G4double Value (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
 
virtual G4double MinPrimaryEnergy (const G4Material *, const G4ParticleDefinition *, G4double cut=0.0)
 
virtual void SetupForMaterial (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void DefineForRegion (const G4Region *)
 
void InitialiseElementSelectors (const G4ParticleDefinition *, const G4DataVector &)
 
std::vector
< G4EmElementSelector * > * 
GetElementSelectors ()
 
void SetElementSelectors (std::vector< G4EmElementSelector * > *)
 
G4double ComputeDEDX (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
 
G4double CrossSection (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeMeanFreePath (const G4ParticleDefinition *, G4double kineticEnergy, const G4Material *, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, const G4Element *, G4double kinEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectIsotopeNumber (const G4Element *)
 
const G4ElementSelectRandomAtom (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectRandomAtom (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectRandomAtomNumber (const G4Material *)
 
void SetParticleChange (G4VParticleChange *, G4VEmFluctuationModel *f=0)
 
void SetCrossSectionTable (G4PhysicsTable *, G4bool isLocal)
 
G4ElementDataGetElementData ()
 
G4PhysicsTableGetCrossSectionTable ()
 
G4VEmFluctuationModelGetModelOfFluctuations ()
 
G4VEmAngularDistributionGetAngularDistribution ()
 
void SetAngularDistribution (G4VEmAngularDistribution *)
 
G4double HighEnergyLimit () const
 
G4double LowEnergyLimit () const
 
G4double HighEnergyActivationLimit () const
 
G4double LowEnergyActivationLimit () const
 
G4double PolarAngleLimit () const
 
G4double SecondaryThreshold () const
 
G4bool LPMFlag () const
 
G4bool DeexcitationFlag () const
 
G4bool ForceBuildTableFlag () const
 
G4bool UseAngularGeneratorFlag () const
 
void SetAngularGeneratorFlag (G4bool)
 
void SetHighEnergyLimit (G4double)
 
void SetLowEnergyLimit (G4double)
 
void SetActivationHighEnergyLimit (G4double)
 
void SetActivationLowEnergyLimit (G4double)
 
G4bool IsActive (G4double kinEnergy)
 
void SetPolarAngleLimit (G4double)
 
void SetSecondaryThreshold (G4double)
 
void SetLPMFlag (G4bool val)
 
void SetDeexcitationFlag (G4bool val)
 
void SetForceBuildTable (G4bool val)
 
void SetMasterThread (G4bool val)
 
G4bool IsMaster () const
 
G4double MaxSecondaryKinEnergy (const G4DynamicParticle *dynParticle)
 
const G4StringGetName () const
 
void SetCurrentCouple (const G4MaterialCutsCouple *)
 
const G4ElementGetCurrentElement () const
 

Protected Member Functions

virtual G4double MaxSecondaryEnergy (const G4ParticleDefinition *, G4double)
 
- Protected Member Functions inherited from G4VEmModel
G4ParticleChangeForLossGetParticleChangeForLoss ()
 
G4ParticleChangeForGammaGetParticleChangeForGamma ()
 
const G4MaterialCutsCoupleCurrentCouple () const
 
void SetCurrentElement (const G4Element *)
 

Additional Inherited Members

- Protected Attributes inherited from G4VEmModel
G4ElementDatafElementData
 
G4VParticleChangepParticleChange
 
G4PhysicsTablexSectionTable
 
const std::vector< G4double > * theDensityFactor
 
const std::vector< G4int > * theDensityIdx
 
size_t idxTable
 

Detailed Description

Definition at line 93 of file G4IonParametrisedLossModel.hh.

Constructor & Destructor Documentation

G4IonParametrisedLossModel::G4IonParametrisedLossModel ( const G4ParticleDefinition particle = 0,
const G4String name = "ParamICRU73" 
)

Definition at line 103 of file G4IonParametrisedLossModel.cc.

References AddDEDXTable(), G4GenericIon::Definition(), G4VEmModel::HighEnergyLimit(), G4LossTableManager::Instance(), python.hepunit::MeV, G4VEmModel::SetHighEnergyLimit(), and python.hepunit::TeV.

106  : G4VEmModel(nam),
107  braggIonModel(0),
108  betheBlochModel(0),
109  nmbBins(90),
110  nmbSubBins(100),
111  particleChangeLoss(0),
112  corrFactor(1.0),
113  energyLossLimit(0.01),
114  cutEnergies(0)
115 {
116  genericIon = G4GenericIon::Definition();
117  genericIonPDGMass = genericIon -> GetPDGMass();
118  corrections = G4LossTableManager::Instance() -> EmCorrections();
119 
120  // The upper limit of the current model is set to 100 TeV
121  SetHighEnergyLimit(100.0 * TeV);
122 
123  // The Bragg ion and Bethe Bloch models are instantiated
124  braggIonModel = new G4BraggIonModel();
125  betheBlochModel = new G4BetheBlochModel();
126 
127  // By default ICRU 73 stopping power tables are loaded:
128  AddDEDXTable("ICRU73",
129  new G4IonStoppingData("ion_stopping_data/icru73"),
130  new G4IonDEDXScalingICRU73());
131 
132  // The boundaries for the range tables are set
133  lowerEnergyEdgeIntegr = 0.025 * MeV;
134  upperEnergyEdgeIntegr = betheBlochModel -> HighEnergyLimit();
135 
136  // Cache parameters are set
137  cacheParticle = 0;
138  cacheMass = 0;
139  cacheElecMassRatio = 0;
140  cacheChargeSquare = 0;
141 
142  // Cache parameters are set
143  rangeCacheParticle = 0;
144  rangeCacheMatCutsCouple = 0;
145  rangeCacheEnergyRange = 0;
146  rangeCacheRangeEnergy = 0;
147 
148  // Cache parameters are set
149  dedxCacheParticle = 0;
150  dedxCacheMaterial = 0;
151  dedxCacheEnergyCut = 0;
152  dedxCacheIter = lossTableList.end();
153  dedxCacheTransitionEnergy = 0.0;
154  dedxCacheTransitionFactor = 0.0;
155  dedxCacheGenIonMassRatio = 0.0;
156 }
static G4LossTableManager * Instance()
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:592
static G4GenericIon * Definition()
Definition: G4GenericIon.cc:49
G4bool AddDEDXTable(const G4String &name, G4VIonDEDXTable *table, G4VIonDEDXScalingAlgorithm *algorithm=0)
G4VEmModel(const G4String &nam)
Definition: G4VEmModel.cc:65
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:683
G4IonParametrisedLossModel::~G4IonParametrisedLossModel ( )
virtual

Definition at line 160 of file G4IonParametrisedLossModel.cc.

160  {
161 
162  // dE/dx table objects are deleted and the container is cleared
163  LossTableList::iterator iterTables = lossTableList.begin();
164  LossTableList::iterator iterTables_end = lossTableList.end();
165 
166  for(;iterTables != iterTables_end; iterTables++) delete *iterTables;
167  lossTableList.clear();
168 }

Member Function Documentation

G4bool G4IonParametrisedLossModel::AddDEDXTable ( const G4String name,
G4VIonDEDXTable table,
G4VIonDEDXScalingAlgorithm algorithm = 0 
)

Definition at line 1226 of file G4IonParametrisedLossModel.cc.

References G4cerr, G4endl, and G4VEmModel::GetName().

Referenced by DeactivateICRU73Scaling(), and G4IonParametrisedLossModel().

1229  {
1230 
1231  if(table == 0) {
1232  G4cerr << "G4IonParametrisedLossModel::AddDEDXTable() Cannot "
1233  << " add table: Invalid pointer."
1234  << G4endl;
1235 
1236  return false;
1237  }
1238 
1239  // Checking uniqueness of name
1240  LossTableList::iterator iter = lossTableList.begin();
1241  LossTableList::iterator iter_end = lossTableList.end();
1242 
1243  for(;iter != iter_end; iter++) {
1244  G4String tableName = (*iter) -> GetName();
1245 
1246  if(tableName == nam) {
1247  G4cerr << "G4IonParametrisedLossModel::AddDEDXTable() Cannot "
1248  << " add table: Name already exists."
1249  << G4endl;
1250 
1251  return false;
1252  }
1253  }
1254 
1255  G4VIonDEDXScalingAlgorithm* scalingAlgorithm = algorithm;
1256  if(scalingAlgorithm == 0)
1257  scalingAlgorithm = new G4VIonDEDXScalingAlgorithm;
1258 
1259  G4IonDEDXHandler* handler =
1260  new G4IonDEDXHandler(table, scalingAlgorithm, nam);
1261 
1262  lossTableList.push_front(handler);
1263 
1264  return true;
1265 }
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4VEmModel.hh:753
G4GLOB_DLL std::ostream G4cerr
G4double G4IonParametrisedLossModel::ComputeCrossSectionPerAtom ( const G4ParticleDefinition particle,
G4double  kineticEnergy,
G4double  atomicNumber,
G4double  ,
G4double  cutEnergy,
G4double  maxKinEnergy 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 352 of file G4IonParametrisedLossModel.cc.

References energy(), G4cout, G4endl, MaxSecondaryEnergy(), python.hepunit::MeV, G4INCL::Math::min(), right, and python.hepunit::twopi_mc2_rcl2.

Referenced by CrossSectionPerVolume().

358  {
359 
360  // ############## Cross section per atom ################################
361  // Function computes ionization cross section per atom
362  //
363  // See Geant4 physics reference manual (version 9.1), section 9.1.3
364  //
365  // Ref.: W.M. Yao et al, Jour. of Phys. G 33 (2006) 1.
366  // B. Rossi, High energy particles, New York, NY: Prentice-Hall (1952).
367  //
368  // (Implementation adapted from G4BraggIonModel)
369 
370  G4double crosssection = 0.0;
371  G4double tmax = MaxSecondaryEnergy(particle, kineticEnergy);
372  G4double maxEnergy = std::min(tmax, maxKinEnergy);
373 
374  if(cutEnergy < tmax) {
375 
376  G4double energy = kineticEnergy + cacheMass;
377  G4double betaSquared = kineticEnergy *
378  (energy + cacheMass) / (energy * energy);
379 
380  crosssection = 1.0 / cutEnergy - 1.0 / maxEnergy -
381  betaSquared * std::log(maxEnergy / cutEnergy) / tmax;
382 
383  crosssection *= twopi_mc2_rcl2 * cacheChargeSquare / betaSquared;
384  }
385 
386 #ifdef PRINT_DEBUG_CS
387  G4cout << "########################################################"
388  << G4endl
389  << "# G4IonParametrisedLossModel::ComputeCrossSectionPerAtom"
390  << G4endl
391  << "# particle =" << particle -> GetParticleName()
392  << G4endl
393  << "# cut(MeV) = " << cutEnergy/MeV
394  << G4endl;
395 
396  G4cout << "#"
397  << std::setw(13) << std::right << "E(MeV)"
398  << std::setw(14) << "CS(um)"
399  << std::setw(14) << "E_max_sec(MeV)"
400  << G4endl
401  << "# ------------------------------------------------------"
402  << G4endl;
403 
404  G4cout << std::setw(14) << std::right << kineticEnergy / MeV
405  << std::setw(14) << crosssection / (um * um)
406  << std::setw(14) << tmax / MeV
407  << G4endl;
408 #endif
409 
410  crosssection *= atomicNumber;
411 
412  return crosssection;
413 }
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition *, G4double)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double G4IonParametrisedLossModel::ComputeDEDXPerVolume ( const G4Material material,
const G4ParticleDefinition particle,
G4double  kineticEnergy,
G4double  cutEnergy 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 436 of file G4IonParametrisedLossModel.cc.

References DeltaRayMeanEnergyTransferRate(), GetChargeSquareRatio(), and G4VEmModel::LowEnergyLimit().

Referenced by CorrectionsAlongStep(), and PrintDEDXTable().

440  {
441 
442  // ############## dE/dx ##################################################
443  // Function computes dE/dx values, where following rules are adopted:
444  // A. If the ion-material pair is covered by any native ion data
445  // parameterisation, then:
446  // * This parameterization is used for energies below a given energy
447  // limit,
448  // * whereas above the limit the Bethe-Bloch model is applied, in
449  // combination with an effective charge estimate and high order
450  // correction terms.
451  // A smoothing procedure is applied to dE/dx values computed with
452  // the second approach. The smoothing factor is based on the dE/dx
453  // values of both approaches at the transition energy (high order
454  // correction terms are included in the calculation of the transition
455  // factor).
456  // B. If the particle is a generic ion, the BraggIon and Bethe-Bloch
457  // models are used and a smoothing procedure is applied to values
458  // obtained with the second approach.
459  // C. If the ion-material is not covered by any ion data parameterization
460  // then:
461  // * The BraggIon model is used for energies below a given energy
462  // limit,
463  // * whereas above the limit the Bethe-Bloch model is applied, in
464  // combination with an effective charge estimate and high order
465  // correction terms.
466  // Also in this case, a smoothing procedure is applied to dE/dx values
467  // computed with the second model.
468 
469  G4double dEdx = 0.0;
470  UpdateDEDXCache(particle, material, cutEnergy);
471 
472  LossTableList::iterator iter = dedxCacheIter;
473 
474  if(iter != lossTableList.end()) {
475 
476  G4double transitionEnergy = dedxCacheTransitionEnergy;
477 
478  if(transitionEnergy > kineticEnergy) {
479 
480  dEdx = (*iter) -> GetDEDX(particle, material, kineticEnergy);
481 
482  G4double dEdxDeltaRays = DeltaRayMeanEnergyTransferRate(material,
483  particle,
484  kineticEnergy,
485  cutEnergy);
486  dEdx -= dEdxDeltaRays;
487  }
488  else {
489  G4double massRatio = dedxCacheGenIonMassRatio;
490 
491  G4double chargeSquare =
492  GetChargeSquareRatio(particle, material, kineticEnergy);
493 
494  G4double scaledKineticEnergy = kineticEnergy * massRatio;
495  G4double scaledTransitionEnergy = transitionEnergy * massRatio;
496 
497  G4double lowEnergyLimit = betheBlochModel -> LowEnergyLimit();
498 
499  if(scaledTransitionEnergy >= lowEnergyLimit) {
500 
501  dEdx = betheBlochModel -> ComputeDEDXPerVolume(
502  material, genericIon,
503  scaledKineticEnergy, cutEnergy);
504 
505  dEdx *= chargeSquare;
506 
507  dEdx += corrections -> ComputeIonCorrections(particle,
508  material, kineticEnergy);
509 
510  G4double factor = 1.0 + dedxCacheTransitionFactor /
511  kineticEnergy;
512 
513  dEdx *= factor;
514  }
515  }
516  }
517  else {
518  G4double massRatio = 1.0;
519  G4double chargeSquare = 1.0;
520 
521  if(particle != genericIon) {
522 
523  chargeSquare = GetChargeSquareRatio(particle, material, kineticEnergy);
524  massRatio = genericIonPDGMass / particle -> GetPDGMass();
525  }
526 
527  G4double scaledKineticEnergy = kineticEnergy * massRatio;
528 
529  G4double lowEnergyLimit = betheBlochModel -> LowEnergyLimit();
530  if(scaledKineticEnergy < lowEnergyLimit) {
531  dEdx = braggIonModel -> ComputeDEDXPerVolume(
532  material, genericIon,
533  scaledKineticEnergy, cutEnergy);
534 
535  dEdx *= chargeSquare;
536  }
537  else {
538  G4double dEdxLimitParam = braggIonModel -> ComputeDEDXPerVolume(
539  material, genericIon,
540  lowEnergyLimit, cutEnergy);
541 
542  G4double dEdxLimitBetheBloch = betheBlochModel -> ComputeDEDXPerVolume(
543  material, genericIon,
544  lowEnergyLimit, cutEnergy);
545 
546  if(particle != genericIon) {
547  G4double chargeSquareLowEnergyLimit =
548  GetChargeSquareRatio(particle, material,
549  lowEnergyLimit / massRatio);
550 
551  dEdxLimitParam *= chargeSquareLowEnergyLimit;
552  dEdxLimitBetheBloch *= chargeSquareLowEnergyLimit;
553 
554  dEdxLimitBetheBloch +=
555  corrections -> ComputeIonCorrections(particle,
556  material, lowEnergyLimit / massRatio);
557  }
558 
559  G4double factor = (1.0 + (dEdxLimitParam/dEdxLimitBetheBloch - 1.0)
560  * lowEnergyLimit / scaledKineticEnergy);
561 
562  dEdx = betheBlochModel -> ComputeDEDXPerVolume(
563  material, genericIon,
564  scaledKineticEnergy, cutEnergy);
565 
566  dEdx *= chargeSquare;
567 
568  if(particle != genericIon) {
569  dEdx += corrections -> ComputeIonCorrections(particle,
570  material, kineticEnergy);
571  }
572 
573  dEdx *= factor;
574  }
575 
576  }
577 
578  if (dEdx < 0.0) dEdx = 0.0;
579 
580  return dEdx;
581 }
virtual G4double GetChargeSquareRatio(const G4ParticleDefinition *, const G4Material *, G4double)
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:599
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double, G4double)
G4double DeltaRayMeanEnergyTransferRate(const G4Material *, const G4ParticleDefinition *, G4double, G4double)
double G4double
Definition: G4Types.hh:76
G4double G4IonParametrisedLossModel::ComputeLossForStep ( const G4MaterialCutsCouple matCutsCouple,
const G4ParticleDefinition particle,
G4double  kineticEnergy,
G4double  stepLength 
)

Definition at line 1167 of file G4IonParametrisedLossModel.cc.

References energy(), G4cout, G4endl, python.hepunit::mm, and G4VEmModel::Value().

Referenced by CorrectionsAlongStep().

1171  {
1172 
1173  G4double loss = 0.0;
1174 
1175  UpdateRangeCache(particle, matCutsCouple);
1176 
1177  G4PhysicsVector* energyRange = rangeCacheEnergyRange;
1178  G4PhysicsVector* rangeEnergy = rangeCacheRangeEnergy;
1179 
1180  if(energyRange != 0 && rangeEnergy != 0) {
1181 
1182  G4double lowerEnEdge = energyRange -> Energy( 0 );
1183  G4double lowerRangeEdge = rangeEnergy -> Energy( 0 );
1184 
1185  // Computing range for pre-step kinetic energy:
1186  G4double range = energyRange -> Value(kineticEnergy);
1187 
1188  // Energy below vector boundary:
1189  if(kineticEnergy < lowerEnEdge) {
1190 
1191  range = energyRange -> Value(lowerEnEdge);
1192  range *= std::sqrt(kineticEnergy / lowerEnEdge);
1193  }
1194 
1195 #ifdef PRINT_DEBUG
1196  G4cout << "G4IonParametrisedLossModel::ComputeLossForStep() range = "
1197  << range / mm << " mm, step = " << stepLength / mm << " mm"
1198  << G4endl;
1199 #endif
1200 
1201  // Remaining range:
1202  G4double remRange = range - stepLength;
1203 
1204  // If range is smaller than step length, the loss is set to kinetic
1205  // energy
1206  if(remRange < 0.0) loss = kineticEnergy;
1207  else if(remRange < lowerRangeEdge) {
1208 
1209  G4double ratio = remRange / lowerRangeEdge;
1210  loss = kineticEnergy - ratio * ratio * lowerEnEdge;
1211  }
1212  else {
1213 
1214  G4double energy = rangeEnergy -> Value(range - stepLength);
1215  loss = kineticEnergy - energy;
1216  }
1217  }
1218 
1219  if(loss < 0.0) loss = 0.0;
1220 
1221  return loss;
1222 }
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual G4double Value(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
Definition: G4VEmModel.cc:346
void G4IonParametrisedLossModel::CorrectionsAlongStep ( const G4MaterialCutsCouple couple,
const G4DynamicParticle dynamicParticle,
G4double eloss,
G4double ,
G4double  length 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 901 of file G4IonParametrisedLossModel.cc.

References ComputeDEDXPerVolume(), ComputeLossForStep(), DBL_MAX, energy(), G4cout, G4endl, G4VEmModel::GetModelOfFluctuations(), G4VEmModel::LowEnergyLimit(), python.hepunit::MeV, and right.

906  {
907 
908  // ############## Corrections for along step energy loss calculation ######
909  // The computed energy loss (due to electronic stopping) is overwritten
910  // by this function if an ion data parameterization is available for the
911  // current ion-material pair.
912  // No action on the energy loss (due to electronic stopping) is performed
913  // if no parameterization is available. In this case the original
914  // generic ion tables (in combination with the effective charge) are used
915  // in the along step DoIt function.
916  //
917  //
918  // (Implementation partly adapted from G4BraggIonModel/G4BetheBlochModel)
919 
920  const G4ParticleDefinition* particle = dynamicParticle -> GetDefinition();
921  const G4Material* material = couple -> GetMaterial();
922 
923  G4double kineticEnergy = dynamicParticle -> GetKineticEnergy();
924 
925  if(kineticEnergy == eloss) { return; }
926 
927  G4double cutEnergy = DBL_MAX;
928  size_t cutIndex = couple -> GetIndex();
929  cutEnergy = cutEnergies[cutIndex];
930 
931  UpdateDEDXCache(particle, material, cutEnergy);
932 
933  LossTableList::iterator iter = dedxCacheIter;
934 
935  // If parameterization for ions is available the electronic energy loss
936  // is overwritten
937  if(iter != lossTableList.end()) {
938 
939  // The energy loss is calculated using the ComputeDEDXPerVolume function
940  // and the step length (it is assumed that dE/dx does not change
941  // considerably along the step)
942  eloss =
943  length * ComputeDEDXPerVolume(material, particle,
944  kineticEnergy, cutEnergy);
945 
946 #ifdef PRINT_DEBUG
947  G4cout.precision(6);
948  G4cout << "########################################################"
949  << G4endl
950  << "# G4IonParametrisedLossModel::CorrectionsAlongStep"
951  << G4endl
952  << "# cut(MeV) = " << cutEnergy/MeV
953  << G4endl;
954 
955  G4cout << "#"
956  << std::setw(13) << std::right << "E(MeV)"
957  << std::setw(14) << "l(um)"
958  << std::setw(14) << "l*dE/dx(MeV)"
959  << std::setw(14) << "(l*dE/dx)/E"
960  << G4endl
961  << "# ------------------------------------------------------"
962  << G4endl;
963 
964  G4cout << std::setw(14) << std::right << kineticEnergy / MeV
965  << std::setw(14) << length / um
966  << std::setw(14) << eloss / MeV
967  << std::setw(14) << eloss / kineticEnergy * 100.0
968  << G4endl;
969 #endif
970 
971  // If the energy loss exceeds a certain fraction of the kinetic energy
972  // (the fraction is indicated by the parameter "energyLossLimit") then
973  // the range tables are used to derive a more accurate value of the
974  // energy loss
975  if(eloss > energyLossLimit * kineticEnergy) {
976 
977  eloss = ComputeLossForStep(couple, particle,
978  kineticEnergy,length);
979 
980 #ifdef PRINT_DEBUG
981  G4cout << "# Correction applied:"
982  << G4endl;
983 
984  G4cout << std::setw(14) << std::right << kineticEnergy / MeV
985  << std::setw(14) << length / um
986  << std::setw(14) << eloss / MeV
987  << std::setw(14) << eloss / kineticEnergy * 100.0
988  << G4endl;
989 #endif
990 
991  }
992  }
993 
994  // For all corrections below a kinetic energy between the Pre- and
995  // Post-step energy values is used
996  G4double energy = kineticEnergy - eloss * 0.5;
997  if(energy < 0.0) energy = kineticEnergy * 0.5;
998 
999  G4double chargeSquareRatio = corrections ->
1000  EffectiveChargeSquareRatio(particle,
1001  material,
1002  energy);
1003  GetModelOfFluctuations() -> SetParticleAndCharge(particle,
1004  chargeSquareRatio);
1005 
1006  // A correction is applied considering the change of the effective charge
1007  // along the step (the parameter "corrFactor" refers to the effective
1008  // charge at the beginning of the step). Note: the correction is not
1009  // applied for energy loss values deriving directly from parameterized
1010  // ion stopping power tables
1011  G4double transitionEnergy = dedxCacheTransitionEnergy;
1012 
1013  if(iter != lossTableList.end() && transitionEnergy < kineticEnergy) {
1014  chargeSquareRatio *= corrections -> EffectiveChargeCorrection(particle,
1015  material,
1016  energy);
1017 
1018  G4double chargeSquareRatioCorr = chargeSquareRatio/corrFactor;
1019  eloss *= chargeSquareRatioCorr;
1020  }
1021  else if (iter == lossTableList.end()) {
1022 
1023  chargeSquareRatio *= corrections -> EffectiveChargeCorrection(particle,
1024  material,
1025  energy);
1026 
1027  G4double chargeSquareRatioCorr = chargeSquareRatio/corrFactor;
1028  eloss *= chargeSquareRatioCorr;
1029  }
1030 
1031  // Ion high order corrections are applied if the current model does not
1032  // overwrite the energy loss (i.e. when the effective charge approach is
1033  // used)
1034  if(iter == lossTableList.end()) {
1035 
1036  G4double scaledKineticEnergy = kineticEnergy * dedxCacheGenIonMassRatio;
1037  G4double lowEnergyLimit = betheBlochModel -> LowEnergyLimit();
1038 
1039  // Corrections are only applied in the Bethe-Bloch energy region
1040  if(scaledKineticEnergy > lowEnergyLimit)
1041  eloss += length *
1042  corrections -> IonHighOrderCorrections(particle, couple, energy);
1043  }
1044 }
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:599
G4VEmFluctuationModel * GetModelOfFluctuations()
Definition: G4VEmModel.hh:571
string material
Definition: eplot.py:19
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double, G4double)
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double ComputeLossForStep(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double, G4double)
#define DBL_MAX
Definition: templates.hh:83
G4double G4IonParametrisedLossModel::CrossSectionPerVolume ( const G4Material material,
const G4ParticleDefinition particle,
G4double  kineticEnergy,
G4double  cutEnergy,
G4double  maxEnergy 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 417 of file G4IonParametrisedLossModel.cc.

References ComputeCrossSectionPerAtom().

422  {
423 
424  G4double nbElecPerVolume = material -> GetTotNbOfElectPerVolume();
425  G4double cross = ComputeCrossSectionPerAtom(particle,
426  kineticEnergy,
427  nbElecPerVolume, 0,
428  cutEnergy,
429  maxEnergy);
430 
431  return cross;
432 }
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double, G4double, G4double, G4double, G4double)
double G4double
Definition: G4Types.hh:76
void G4IonParametrisedLossModel::DeactivateICRU73Scaling ( )

Definition at line 1308 of file G4IonParametrisedLossModel.cc.

References AddDEDXTable(), and RemoveDEDXTable().

1308  {
1309 
1310  RemoveDEDXTable("ICRU73");
1311  AddDEDXTable("ICRU73", new G4IonStoppingData("ion_stopping_data/icru73"));
1312 }
G4bool AddDEDXTable(const G4String &name, G4VIonDEDXTable *table, G4VIonDEDXScalingAlgorithm *algorithm=0)
G4bool RemoveDEDXTable(const G4String &name)
G4double G4IonParametrisedLossModel::DeltaRayMeanEnergyTransferRate ( const G4Material ,
const G4ParticleDefinition ,
G4double  ,
G4double   
)
inline

Referenced by ComputeDEDXPerVolume().

G4double G4IonParametrisedLossModel::GetChargeSquareRatio ( const G4ParticleDefinition particle,
const G4Material material,
G4double  kineticEnergy 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 210 of file G4IonParametrisedLossModel.cc.

Referenced by ComputeDEDXPerVolume().

213  { // Kinetic energy
214 
215  G4double chargeSquareRatio = corrections ->
216  EffectiveChargeSquareRatio(particle,
217  material,
218  kineticEnergy);
219  corrFactor = chargeSquareRatio *
220  corrections -> EffectiveChargeCorrection(particle,
221  material,
222  kineticEnergy);
223  return corrFactor;
224 }
double G4double
Definition: G4Types.hh:76
G4double G4IonParametrisedLossModel::GetParticleCharge ( const G4ParticleDefinition particle,
const G4Material material,
G4double  kineticEnergy 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 228 of file G4IonParametrisedLossModel.cc.

231  { // Kinetic energy
232 
233  return corrections -> GetParticleCharge(particle, material, kineticEnergy);
234 }
virtual G4double GetParticleCharge(const G4ParticleDefinition *, const G4Material *, G4double)
void G4IonParametrisedLossModel::Initialise ( const G4ParticleDefinition particle,
const G4DataVector cuts 
)
virtual

Implements G4VEmModel.

Definition at line 238 of file G4IonParametrisedLossModel.cc.

References G4cout, G4endl, G4VEmModel::GetName(), G4VEmModel::GetParticleChangeForLoss(), G4ProductionCutsTable::GetProductionCutsTable(), eplot::material, python.hepunit::second, and G4VEmModel::SetParticleChange().

240  {
241 
242  // Cached parameters are reset
243  cacheParticle = 0;
244  cacheMass = 0;
245  cacheElecMassRatio = 0;
246  cacheChargeSquare = 0;
247 
248  // Cached parameters are reset
249  rangeCacheParticle = 0;
250  rangeCacheMatCutsCouple = 0;
251  rangeCacheEnergyRange = 0;
252  rangeCacheRangeEnergy = 0;
253 
254  // Cached parameters are reset
255  dedxCacheParticle = 0;
256  dedxCacheMaterial = 0;
257  dedxCacheEnergyCut = 0;
258  dedxCacheIter = lossTableList.end();
259  dedxCacheTransitionEnergy = 0.0;
260  dedxCacheTransitionFactor = 0.0;
261  dedxCacheGenIonMassRatio = 0.0;
262 
263  // The cache of loss tables is cleared
264  LossTableList::iterator iterTables = lossTableList.begin();
265  LossTableList::iterator iterTables_end = lossTableList.end();
266 
267  for(;iterTables != iterTables_end; iterTables++)
268  (*iterTables) -> ClearCache();
269 
270  // Range vs energy and energy vs range vectors from previous runs are
271  // cleared
272  RangeEnergyTable::iterator iterRange = r.begin();
273  RangeEnergyTable::iterator iterRange_end = r.end();
274 
275  for(;iterRange != iterRange_end; iterRange++) delete iterRange -> second;
276  r.clear();
277 
278  EnergyRangeTable::iterator iterEnergy = E.begin();
279  EnergyRangeTable::iterator iterEnergy_end = E.end();
280 
281  for(;iterEnergy != iterEnergy_end; iterEnergy++) delete iterEnergy -> second;
282  E.clear();
283 
284  // The cut energies are (re)loaded
285  size_t size = cuts.size();
286  cutEnergies.clear();
287  for(size_t i = 0; i < size; i++) cutEnergies.push_back(cuts[i]);
288 
289  // All dE/dx vectors are built
290  const G4ProductionCutsTable* coupleTable=
292  size_t nmbCouples = coupleTable -> GetTableSize();
293 
294 #ifdef PRINT_TABLE_BUILT
295  G4cout << "G4IonParametrisedLossModel::Initialise():"
296  << " Building dE/dx vectors:"
297  << G4endl;
298 #endif
299 
300  for (size_t i = 0; i < nmbCouples; i++) {
301 
302  const G4MaterialCutsCouple* couple =
303  coupleTable -> GetMaterialCutsCouple(i);
304 
305  const G4Material* material = couple -> GetMaterial();
306  // G4ProductionCuts* productionCuts = couple -> GetProductionCuts();
307 
308  for(G4int atomicNumberIon = 3; atomicNumberIon < 102; atomicNumberIon++) {
309 
310  LossTableList::iterator iter = lossTableList.begin();
311  LossTableList::iterator iter_end = lossTableList.end();
312 
313  for(;iter != iter_end; iter++) {
314 
315  if(*iter == 0) {
316  G4cout << "G4IonParametrisedLossModel::Initialise():"
317  << " Skipping illegal table."
318  << G4endl;
319  }
320 
321  G4bool isApplicable =
322  (*iter) -> BuildDEDXTable(atomicNumberIon, material);
323  if(isApplicable) {
324 
325 #ifdef PRINT_TABLE_BUILT
326  G4cout << " Atomic Number Ion = " << atomicNumberIon
327  << ", Material = " << material -> GetName()
328  << ", Table = " << (*iter) -> GetName()
329  << G4endl;
330 #endif
331  break;
332  }
333  }
334  }
335  }
336 
337  // The particle change object
338  if(! particleChangeLoss) {
339  particleChangeLoss = GetParticleChangeForLoss();
340  braggIonModel -> SetParticleChange(particleChangeLoss, 0);
341  betheBlochModel -> SetParticleChange(particleChangeLoss, 0);
342  }
343 
344  // The G4BraggIonModel and G4BetheBlochModel instances are initialised with
345  // the same settings as the current model:
346  braggIonModel -> Initialise(particle, cuts);
347  betheBlochModel -> Initialise(particle, cuts);
348 }
G4ParticleChangeForLoss * GetParticleChangeForLoss()
Definition: G4VEmModel.cc:107
int G4int
Definition: G4Types.hh:78
string material
Definition: eplot.py:19
G4GLOB_DLL std::ostream G4cout
void SetParticleChange(G4VParticleChange *, G4VEmFluctuationModel *f=0)
Definition: G4VEmModel.cc:387
bool G4bool
Definition: G4Types.hh:79
static G4ProductionCutsTable * GetProductionCutsTable()
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4VEmModel.hh:753
LossTableList::iterator G4IonParametrisedLossModel::IsApplicable ( const G4ParticleDefinition ,
const G4Material  
)
inline

Referenced by PrintDEDXTableHandlers().

G4double G4IonParametrisedLossModel::MaxSecondaryEnergy ( const G4ParticleDefinition particle,
G4double  kineticEnergy 
)
protectedvirtual

Reimplemented from G4VEmModel.

Definition at line 182 of file G4IonParametrisedLossModel.cc.

References python.hepunit::electron_mass_c2.

Referenced by ComputeCrossSectionPerAtom().

184  {
185 
186  // ############## Maximum energy of secondaries ##########################
187  // Function computes maximum energy of secondary electrons which are
188  // released by an ion
189  //
190  // See Geant4 physics reference manual (version 9.1), section 9.1.1
191  //
192  // Ref.: W.M. Yao et al, Jour. of Phys. G 33 (2006) 1.
193  // C.Caso et al. (Part. Data Group), Europ. Phys. Jour. C 3 1 (1998).
194  // B. Rossi, High energy particles, New York, NY: Prentice-Hall (1952).
195  //
196  // (Implementation adapted from G4BraggIonModel)
197 
198  if(particle != cacheParticle) UpdateCache(particle);
199 
200  G4double tau = kineticEnergy/cacheMass;
201  G4double tmax = 2.0 * electron_mass_c2 * tau * (tau + 2.) /
202  (1. + 2.0 * (tau + 1.) * cacheElecMassRatio +
203  cacheElecMassRatio * cacheElecMassRatio);
204 
205  return tmax;
206 }
float electron_mass_c2
Definition: hepunit.py:274
double G4double
Definition: G4Types.hh:76
G4double G4IonParametrisedLossModel::MinEnergyCut ( const G4ParticleDefinition ,
const G4MaterialCutsCouple couple 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 172 of file G4IonParametrisedLossModel.cc.

174  {
175 
176  return couple -> GetMaterial() -> GetIonisation() ->
177  GetMeanExcitationEnergy();
178 }
void G4IonParametrisedLossModel::PrintDEDXTable ( const G4ParticleDefinition particle,
const G4Material material,
G4double  lowerBoundary,
G4double  upperBoundary,
G4int  numBins,
G4bool  logScaleEnergy 
)

Definition at line 585 of file G4IonParametrisedLossModel.cc.

References python.hepunit::cm, python.hepunit::cm2, python.hepunit::cm3, ComputeDEDXPerVolume(), DBL_MAX, energy(), g(), G4cout, G4endl, G4VEmModel::GetName(), python.hepunit::MeV, and right.

Referenced by PrintDEDXTableHandlers().

591  { // Logarithmic scaling of energy
592 
593  G4double atomicMassNumber = particle -> GetAtomicMass();
594  G4double materialDensity = material -> GetDensity();
595 
596  G4cout << "# dE/dx table for " << particle -> GetParticleName()
597  << " in material " << material -> GetName()
598  << " of density " << materialDensity / g * cm3
599  << " g/cm3"
600  << G4endl
601  << "# Projectile mass number A1 = " << atomicMassNumber
602  << G4endl
603  << "# ------------------------------------------------------"
604  << G4endl;
605  G4cout << "#"
606  << std::setw(13) << std::right << "E"
607  << std::setw(14) << "E/A1"
608  << std::setw(14) << "dE/dx"
609  << std::setw(14) << "1/rho*dE/dx"
610  << G4endl;
611  G4cout << "#"
612  << std::setw(13) << std::right << "(MeV)"
613  << std::setw(14) << "(MeV)"
614  << std::setw(14) << "(MeV/cm)"
615  << std::setw(14) << "(MeV*cm2/mg)"
616  << G4endl
617  << "# ------------------------------------------------------"
618  << G4endl;
619 
620  G4double energyLowerBoundary = lowerBoundary * atomicMassNumber;
621  G4double energyUpperBoundary = upperBoundary * atomicMassNumber;
622 
623  if(logScaleEnergy) {
624 
625  energyLowerBoundary = std::log(energyLowerBoundary);
626  energyUpperBoundary = std::log(energyUpperBoundary);
627  }
628 
629  G4double deltaEnergy = (energyUpperBoundary - energyLowerBoundary) /
630  G4double(nmbBins);
631 
632  for(int i = 0; i < numBins + 1; i++) {
633 
634  G4double energy = energyLowerBoundary + i * deltaEnergy;
635  if(logScaleEnergy) energy = std::exp(energy);
636 
637  G4double dedx = ComputeDEDXPerVolume(material, particle, energy, DBL_MAX);
638  G4cout.precision(6);
639  G4cout << std::setw(14) << std::right << energy / MeV
640  << std::setw(14) << energy / atomicMassNumber / MeV
641  << std::setw(14) << dedx / MeV * cm
642  << std::setw(14) << dedx / materialDensity / (MeV*cm2/(0.001*g))
643  << G4endl;
644  }
645 }
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double, G4double)
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
Definition: G4VEmModel.hh:753
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
void G4IonParametrisedLossModel::PrintDEDXTableHandlers ( const G4ParticleDefinition particle,
const G4Material material,
G4double  lowerBoundary,
G4double  upperBoundary,
G4int  numBins,
G4bool  logScaleEnergy 
)

Definition at line 649 of file G4IonParametrisedLossModel.cc.

References IsApplicable(), and PrintDEDXTable().

655  { // Logarithmic scaling of energy
656 
657  LossTableList::iterator iter = lossTableList.begin();
658  LossTableList::iterator iter_end = lossTableList.end();
659 
660  for(;iter != iter_end; iter++) {
661  G4bool isApplicable = (*iter) -> IsApplicable(particle, material);
662  if(isApplicable) {
663  (*iter) -> PrintDEDXTable(particle, material,
664  lowerBoundary, upperBoundary,
665  numBins,logScaleEnergy);
666  break;
667  }
668  }
669 }
bool G4bool
Definition: G4Types.hh:79
LossTableList::iterator IsApplicable(const G4ParticleDefinition *, const G4Material *)
void PrintDEDXTable(const G4ParticleDefinition *, const G4Material *, G4double, G4double, G4int, G4bool)
G4bool G4IonParametrisedLossModel::RemoveDEDXTable ( const G4String name)

Definition at line 1269 of file G4IonParametrisedLossModel.cc.

References G4VEmModel::GetName(), and python.hepunit::second.

Referenced by DeactivateICRU73Scaling().

1270  {
1271 
1272  LossTableList::iterator iter = lossTableList.begin();
1273  LossTableList::iterator iter_end = lossTableList.end();
1274 
1275  for(;iter != iter_end; iter++) {
1276  G4String tableName = (*iter) -> GetName();
1277 
1278  if(tableName == nam) {
1279  delete (*iter);
1280 
1281  // Remove from table list
1282  lossTableList.erase(iter);
1283 
1284  // Range vs energy and energy vs range vectors are cleared
1285  RangeEnergyTable::iterator iterRange = r.begin();
1286  RangeEnergyTable::iterator iterRange_end = r.end();
1287 
1288  for(;iterRange != iterRange_end; iterRange++)
1289  delete iterRange -> second;
1290  r.clear();
1291 
1292  EnergyRangeTable::iterator iterEnergy = E.begin();
1293  EnergyRangeTable::iterator iterEnergy_end = E.end();
1294 
1295  for(;iterEnergy != iterEnergy_end; iterEnergy++)
1296  delete iterEnergy -> second;
1297  E.clear();
1298 
1299  return true;
1300  }
1301  }
1302 
1303  return false;
1304 }
const G4String & GetName() const
Definition: G4VEmModel.hh:753
void G4IonParametrisedLossModel::SampleSecondaries ( std::vector< G4DynamicParticle * > *  secondaries,
const G4MaterialCutsCouple ,
const G4DynamicParticle particle,
G4double  cutKinEnergySec,
G4double  userMaxKinEnergySec 
)
virtual

Implements G4VEmModel.

Definition at line 673 of file G4IonParametrisedLossModel.cc.

References G4Electron::Definition(), python.hepunit::electron_mass_c2, energy(), G4cout, G4endl, G4UniformRand, G4DynamicParticle::GetMomentumDirection(), G4VEmModel::MaxSecondaryKinEnergy(), G4INCL::Math::min(), CLHEP::Hep3Vector::rotateUz(), python.hepunit::twopi, and CLHEP::Hep3Vector::unit().

678  {
679 
680 
681  // ############## Sampling of secondaries #################################
682  // The probability density function (pdf) of the kinetic energy T of a
683  // secondary electron may be written as:
684  // pdf(T) = f(T) * g(T)
685  // where
686  // f(T) = (Tmax - Tcut) / (Tmax * Tcut) * (1 / T^2)
687  // g(T) = 1 - beta^2 * T / Tmax
688  // where Tmax is the maximum kinetic energy of the secondary, Tcut
689  // is the lower energy cut and beta is the kinetic energy of the
690  // projectile.
691  //
692  // Sampling of the kinetic energy of a secondary electron:
693  // 1) T0 is sampled from f(T) using the cumulated distribution function
694  // F(T) = int_Tcut^T f(T')dT'
695  // 2) T is accepted or rejected by evaluating the rejection function g(T)
696  // at the sampled energy T0 against a randomly sampled value
697  //
698  //
699  // See Geant4 physics reference manual (version 9.1), section 9.1.4
700  //
701  //
702  // Reference pdf: W.M. Yao et al, Jour. of Phys. G 33 (2006) 1.
703  //
704  // (Implementation adapted from G4BraggIonModel)
705 
706  G4double rossiMaxKinEnergySec = MaxSecondaryKinEnergy(particle);
707  G4double maxKinEnergySec =
708  std::min(rossiMaxKinEnergySec, userMaxKinEnergySec);
709 
710  if(cutKinEnergySec >= maxKinEnergySec) return;
711 
712  G4double kineticEnergy = particle -> GetKineticEnergy();
713  G4ThreeVector direction = particle ->GetMomentumDirection();
714 
715  G4double energy = kineticEnergy + cacheMass;
716  G4double betaSquared = kineticEnergy *
717  (energy + cacheMass) / (energy * energy);
718 
719  G4double kinEnergySec;
720  G4double grej;
721 
722  do {
723 
724  // Sampling kinetic energy from f(T) (using F(T)):
725  G4double xi = G4UniformRand();
726  kinEnergySec = cutKinEnergySec * maxKinEnergySec /
727  (maxKinEnergySec * (1.0 - xi) + cutKinEnergySec * xi);
728 
729  // Deriving the value of the rejection function at the obtained kinetic
730  // energy:
731  grej = 1.0 - betaSquared * kinEnergySec / rossiMaxKinEnergySec;
732 
733  if(grej > 1.0) {
734  G4cout << "G4IonParametrisedLossModel::SampleSecondary Warning: "
735  << "Majorant 1.0 < "
736  << grej << " for e= " << kinEnergySec
737  << G4endl;
738  }
739 
740  } while( G4UniformRand() >= grej );
741 
742  G4double momentumSec =
743  std::sqrt(kinEnergySec * (kinEnergySec + 2.0 * electron_mass_c2));
744 
745  G4double totMomentum = energy*std::sqrt(betaSquared);
746  G4double cost = kinEnergySec * (energy + electron_mass_c2) /
747  (momentumSec * totMomentum);
748  if(cost > 1.0) cost = 1.0;
749  G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
750 
751  G4double phi = twopi * G4UniformRand() ;
752 
753  G4ThreeVector directionSec(sint*std::cos(phi),sint*std::sin(phi), cost) ;
754  directionSec.rotateUz(direction);
755 
756  // create G4DynamicParticle object for delta ray
758  directionSec,
759  kinEnergySec);
760 
761  secondaries -> push_back(delta);
762 
763  // Change kinematics of primary particle
764  kineticEnergy -= kinEnergySec;
765  G4ThreeVector finalP = direction*totMomentum - directionSec*momentumSec;
766  finalP = finalP.unit();
767 
768  particleChangeLoss -> SetProposedKineticEnergy(kineticEnergy);
769  particleChangeLoss -> SetProposedMomentumDirection(finalP);
770 }
G4double MaxSecondaryKinEnergy(const G4DynamicParticle *dynParticle)
Definition: G4VEmModel.hh:448
static G4Electron * Definition()
Definition: G4Electron.cc:49
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
float electron_mass_c2
Definition: hepunit.py:274
Hep3Vector unit() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4IonParametrisedLossModel::SetEnergyLossLimit ( G4double  ionEnergyLossLimit)
inline

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