Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
+104 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.219 2005/12/05 12:13:07 vnivanch Exp $
$Id: History,v 1.253 2006/06/07 17:09:59 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,109 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
07 June 06: V.Ivant (emutils-V08-00-20)
- G4VEnergyLossProcess - Do not change particle momentum AlongStep
02 June 06: V.Ivant (emutils-V08-00-19)
- G4EmCorrections - fix compilation warnings at SUN
22 May 06: V.Ivant (emutils-V08-00-18)
- G4EmProcessOptions, G4LossTableManager - add Get/SetBremsstrahlungTh
method requested by CMS
- G4ionEffectiveCharge make upper limit of the model proportional to Z
14 May 06: V.Ivant (emutils-V08-00-17)
- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering - add
NumberOfModels method
- G4VEnergyLossProces - add random step sampling and minor fix subcut
13 May 06: V.Ivant (emutils-V08-00-16)
- G4EmCalculator and G4EmCorrections - add correction from user data
on stopping power
- G4VEnergyLossProcess, G4VEmProcess, G4VMultipleScattering - add
GetModelByIndex method
10 May 06: V.Ivant (emutils-V08-00-15)
- G4LossTableMessenger - add command MscStepLimitation
- G4LOssTableManager - add methods SetMscStepLimitation, FacRange,
and MscFlag
04 May 06: V.Ivant (emutils-V08-00-14)
- G4EmCorrections - fix compilation warning at SUN
28 April 06: V.Ivant (emutils-V08-00-13)
- G4EmCalculator - remove debug output
- G4EmCorrections - add finite size correction, cleanup other
- G4ionEffectiveCharge - extend upper limit to 50 MeV
18 April 06: V.Ivant (emutils-V08-00-12)
- G4EmCalculator - fix GetCrossSectionPerVolume problem for gamma
10 April 06: V.Ivant (emutils-V08-00-11)
- Add flag of LPM effect to G4LossTableMessenger, G4LossTableManager and
G4EmProcessOptions
- fix problem of activate/desactvate in G4LossTableManager
29 March 06: V.Ivant (emutils-V08-00-10)
- G4LossTableBuilder fix compilation warning at g++3.4.4
28 March 06: V.Ivant (emutils-V08-00-09)
- G4VEnergyLossProcess - add store energy loss tables for bremsstrahlung
- G4LossTableBuilder & G4LossTableManager - fix logic to ensure rebuild PhysicsTable
in the regime activate/desactivate processes
- G4VEmProcess - fix printout
23 March 06: V.Ivant (emutils-V08-00-08)
- G4VEnergyLossProcess add SetDynamicMassCharge (used by ionIonisation)
use flag isIonisation AlongStep, PrintInfo, and StoreTables
- G4LossTableManager set flag isIonisation for processes
- G4EmCalculator add public methods ComputeTotalDEDX, ComputeElectronicDEDX
update GetDEDX for ions
14 March 06 (mma) (emutils-V08-00-07)
- corrections in G4EmCalculator::GetCrossSectionPerVolume,
GetCrossSectionPerAtom, ComputeCrossSectionPerAtom
07 March 06: V.Ivant (emutils-V08-00-06)
- Complete design iteration for msc (V.Ivanchenko)
- Add G4DummyModel (V.Ivanchenko)
07 March 06: V.Ivant (emutils-V08-00-05)
- Optimize interfaces to Msc model (G4VEmModel and G4VMultipleScattering)
17 February 06: V.Ivant (emutils-V08-00-04)
- G4VmultipleScattering - Lambda table keep cross section not mfp
- remove obsolete interface G4VSCProcessor.hh
06 February 06 mma (emutils-V08-00-03)
- Added function G4VEmModel::ComputeMeanFreePath() (mma)
01 February 06
- G4VEmProcess::ComputeCrossSectionPerAtom(): put default value A=0,
G4VEmModel::ComputeCrossSectionPerAtom(): put default value A=0,
to keep compatibility with v5.2 (mma)
26 January 06: V.Ivant (emutils-V08-00-02)
- add method GetRangeFromRestricteDEDX for later replacement of GetRange(VI)
- G4VEnergyLossProcess - improve cout (VI)
- G4VEnergyLossProcess - Fix subcutoff simulation (VI)
20 January 06: V.Ivant (emutils-V08-00-01)
- Add G4EmTableType.hh enumerator (VI)
- Use G4EmTableType to reduce methods with practically identical code (VI)
- G4VEnergyLossProcess - recalculation of presafety for subcutoff
update energy constrain for subcutoff
add energy correction to subcutoff (VI)
11 January 06: V.Ivant (emutils-V08-00-00)
- G4VEnergyLossProcess - simplify subcutoff calculation (VI)
- G4EmCalculator - add GetCSDARange (VI)
- G4VEmProcess - remove dependence on G4NistManager (VI)
- Substitute PreciseRange -> CSDARange (VI)
- Substitute SetStepLimits -> SetStepFunction (VI)
- G4VEnergyLossProcess - remove minStepLimit member and use finalRange (VI)
- G4VEnergyLossProcess - reset currentCouple when StepFunction is changed (VI)
05 December 05: V.Ivant (emutils-V07-01-13)
- G4EmProcessOptions - fix verbosity definition for energy loss processes
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DummyModel.hh,v 1.2 2006/06/29 19:54:19 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4DummyModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.03.2006
//
// Modifications:
//
// Class Description:
//
// EM model doing nothing
// -------------------------------------------------------------------
//
#ifndef G4DummyModel_h
#define G4DummyModel_h 1
#include "globals.hh"
#include "G4VEmModel.hh"
class G4DummyModel : public G4VEmModel
{
public:
G4DummyModel(const G4String& nam = "DummyModel");
virtual ~G4DummyModel();
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
private:
// hide assignment operator
G4DummyModel & operator=(const G4DummyModel &right);
G4DummyModel(const G4DummyModel&);
};
#endif
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.hh,v 1.9 2005/02/26 22:01:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmCalculator.hh,v 1.16 2006/06/29 19:54:21 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// -------------------------------------------------------------------
@@ -37,7 +40,9 @@
//
// Modifications:
// 17.11.2004 Change signature of methods, add new methods (V.Ivanchenko)
//
// 11.01.2006 Add GetCSDARange (V.Ivanchenko)
// 26.01.2006 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 22.03.2006 Add ComputeElectronicDEDX and ComputeTotalDEDX (V.Ivanchenko)
//
// Class Description:
//
@@ -82,10 +87,26 @@ public:
G4double GetDEDX(G4double kinEnergy, const G4String& part, const G4String& mat,
const G4String& s = "world");
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition*, const G4Material*,
const G4Region* r = 0);
G4double GetRange(G4double kinEnergy, const G4String& part, const G4String& mat,
const G4String& s = "world");
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*,
const G4Region* r = 0);
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat,
const G4String& s = "world");
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*,
const G4Region* r = 0);
G4double GetCSDARange(G4double kinEnergy, const G4String& part,
const G4String& mat,
const G4String& s = "world");
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*,
const G4Region* r = 0);
G4double GetRange(G4double kinEnergy, const G4String& part,
const G4String& mat,
const G4String& s = "world");
G4double GetKinEnergy(G4double range, const G4ParticleDefinition*, const G4Material*,
const G4Region* r = 0);
@@ -99,13 +120,6 @@ public:
G4double GetCrossSectionPerVolume(
G4double kinEnergy, const G4String& part, const G4String& proc,
const G4String& mat, const G4String& s = "world");
G4double GetCrossSectionPerAtom(
G4double kinEnergy, const G4ParticleDefinition*,
const G4String& processName, const G4Material*,
const G4Region* r = 0);
G4double GetCrossSectionPerAtom(
G4double kinEnergy, const G4String& part, const G4String& proc,
const G4String& mat, const G4String& s = "world");
G4double GetMeanFreePath(G4double kinEnergy, const G4ParticleDefinition*,
const G4String& processName, const G4Material*,
@@ -128,9 +142,19 @@ public:
G4double ComputeDEDX(G4double kinEnergy, const G4String& part, const G4String& proc,
const G4String& mat, G4double cut = DBL_MAX);
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material* mat, G4double cut = DBL_MAX);
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut = DBL_MAX);
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4ParticleDefinition*, const G4Material*);
G4double ComputeNuclearDEDX(G4double kinEnergy, const G4String& part, const G4String& mat);
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*, G4double cut = DBL_MAX);
G4double ComputeTotalDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut = DBL_MAX);
G4double ComputeCrossSectionPerVolume(
G4double kinEnergy, const G4ParticleDefinition*,
const G4String& processName, const G4Material*,
@@ -178,7 +202,7 @@ private:
const G4String& processName,
G4double kinEnergy);
const G4VEnergyLossProcess* FindEnergyLossProcess(const G4ParticleDefinition*);
G4VEnergyLossProcess* FindEnergyLossProcess(const G4ParticleDefinition*);
G4EmCalculator & operator=(const G4EmCalculator &right);
G4EmCalculator(const G4EmCalculator&);
@@ -201,18 +225,22 @@ private:
const G4ParticleDefinition* baseParticle;
const G4PhysicsTable* currentLambda;
G4VEmModel* currentModel;
G4VEnergyLossProcess* currentProcess;
const G4ParticleDefinition* theGenericIon;
G4ionEffectiveCharge* ionEffCharge;
G4String currentName;
G4double currentCut;
G4double chargeSquare;
G4double massRatio;
G4double mass;
G4bool isIon;
G4bool isApplicable;
G4String currentParticleName;
G4String currentMaterialName;
G4String currentProcessName;
};
//....oooOO0OOooo.......oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.hh,v 1.3 2005/02/26 22:01:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmCorrections.hh,v 1.8 2006/06/29 19:54:23 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -35,11 +38,12 @@
// Creation date: 13.01.2005
//
// Modifications:
//
// 28.04.2006 General cleanup, add finite size corrections (V.Ivanchenko)
// 13.05.2006 Add corrections for ion stopping (V.Ivanhcenko)
//
// Class Description:
//
// This class provides calculation of EM corrections to ionisation
// This class provides calculation of EM corrections to ionisation
//
// -------------------------------------------------------------------
@@ -51,11 +55,14 @@
#include "globals.hh"
#include "G4AtomicShells.hh"
#include "G4ionEffectiveCharge.hh"
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
class G4Material;
class G4ParticleDefinition;
class G4NistManager;
class G4VEmModel;
class G4PhysicsVector;
class G4EmCorrections
class G4EmCorrections
{
public:
@@ -70,66 +77,87 @@ public:
G4double Bethe(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double SpinCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double KShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double LShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double ShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double ShellCorrectionSTD(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double DensityCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double BarkasCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double BlochCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double MottCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double kineticEnergy);
G4double FiniteSizeCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double NuclearDEDX(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy,
G4bool fluct = true);
G4double kineticEnergy,
G4bool fluct = true);
void AddStoppingData(G4int Z, G4int A, const G4String& materialName,
G4PhysicsVector& dVector);
G4double EffectiveChargeCorrection(const G4ParticleDefinition*,
const G4Material*,
G4double);
G4ionEffectiveCharge* GetIonEffectiveCharge(G4VEmModel* m = 0);
G4int GetNumberOfStoppingVectors();
private:
void Initialise();
G4double KShell(G4double theta, G4double eta);
G4PhysicsVector* InitialiseMaterial(const G4Material* mat);
G4double LShell(G4double theta, G4double eta);
void SetupKinematics(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4int Index(G4double x, G4double* y, G4int n);
G4double KShell(G4double theta, G4double eta);
G4double Value(G4double xv, G4double x1, G4double x2, G4double y1, G4double y2);
G4double LShell(G4double theta, G4double eta);
G4int Index(G4double x, G4double* y, G4int n);
G4double Value(G4double xv, G4double x1, G4double x2, G4double y1, G4double y2);
G4double Value2(G4double xv, G4double yv, G4double x1, G4double x2,
G4double y1, G4double y2,
G4double z11, G4double z21, G4double z12, G4double z22);
G4double z11, G4double z21, G4double z12, G4double z22);
G4double NuclearStoppingPower(G4double e, G4double z1, G4double z2,
G4double NuclearStoppingPower(G4double e, G4double z1, G4double z2,
G4double m1, G4double m2);
// hide assignment operator
@@ -138,12 +166,14 @@ private:
G4double engBarkas[47];
G4double corBarkas[47];
G4double e[104];
G4double ed[104];
G4double a[104];
G4double theZieglerFactor;
G4double alpha2;
G4bool lossFlucFlag;
G4int verbose;
G4int nK;
G4int nL;
G4int nEtaK;
@@ -174,32 +204,105 @@ private:
G4double MSH[93];
G4double TAU[93];
const G4ParticleDefinition* particle;
const G4ParticleDefinition* curParticle;
const G4Material* material;
const G4Material* curMaterial;
const G4ElementVector* theElementVector;
const G4double* atomDensity;
G4int numberOfElements;
G4double kinEnergy;
G4double mass;
G4double massFactor;
G4double tau;
G4double gamma;
G4double bg2;
G4double beta2;
G4double beta;
G4double ba2;
G4double tmax;
G4double tmax0;
G4double charge;
G4double q2;
G4AtomicShells shells;
G4ionEffectiveCharge effCharge;
G4ionEffectiveCharge effCharge;
G4NistManager* nist;
G4VEmModel* ionModel;
// Ion stopping data
G4int nIons;
G4int idx;
std::vector<G4int> Zion;
std::vector<G4int> Aion;
std::vector<G4String> materialName;
std::vector<const G4Material*> materialList;
std::vector<G4PhysicsVector*> stopData;
G4PhysicsVector* curVector;
};
inline G4int G4EmCorrections::Index(G4double x, G4double* y, G4int n)
inline G4int G4EmCorrections::Index(G4double x, G4double* y, G4int n)
{
G4int idx = n-1;
do {idx--;} while (idx>0 && x<y[idx]);
return idx;
G4int iddd = n-1;
do {iddd--;} while (iddd>0 && x<y[iddd]);
return iddd;
}
inline G4double G4EmCorrections::Value(G4double xv, G4double x1, G4double x2,
G4double y1, G4double y2)
inline G4double G4EmCorrections::Value(G4double xv, G4double x1, G4double x2,
G4double y1, G4double y2)
{
return y1 + (y2 - y1)*(xv - x1)/(x2 - x1);
}
inline G4double G4EmCorrections::Value2(G4double xv, G4double yv, G4double x1, G4double x2,
inline G4double G4EmCorrections::Value2(G4double xv, G4double yv,
G4double x1, G4double x2,
G4double y1, G4double y2,
G4double z11, G4double z21, G4double z12, G4double z22)
G4double z11, G4double z21,
G4double z12, G4double z22)
{
return (z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) +
0.5*(z12*((x2-xv)*(yv-y1)+(xv-x1)*(y2-yv))+z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv))))
return (z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) +
0.5*(z12*((x2-xv)*(yv-y1)+(xv-x1)*(y2-yv))+
z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv))))
/ ((x2-x1)*(y2-y1));
}
inline void G4EmCorrections::SetupKinematics(const G4ParticleDefinition* p,
const G4Material* mat,
G4double kineticEnergy)
{
if(kineticEnergy != kinEnergy || p != particle) {
particle = p;
kinEnergy = kineticEnergy;
mass = p->GetPDGMass();
tau = kineticEnergy / mass;
gamma = 1.0 + tau;
bg2 = tau * (tau+2.0);
beta2 = bg2/(gamma*gamma);
beta = std::sqrt(beta2);
ba2 = beta2/alpha2;
G4double ratio = electron_mass_c2/mass;
tmax = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio);
tmax0 = tmax;
charge = p->GetPDGCharge()/eplus;
if(charge < 1.5) q2 = charge*charge;
else {
q2 = effCharge.EffectiveChargeSquareRatio(p,mat,kinEnergy);
charge = std::sqrt(q2);
}
if(mass > 120.*MeV)
tmax = std::min(tmax,51200.*electron_mass_c2*std::pow(proton_mass_c2/mass,0.666667));
}
if(mat != material) {
material = mat;
theElementVector = material->GetElementVector();
atomDensity = material->GetAtomicNumDensityVector();
numberOfElements = material->GetNumberOfElements();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -1,33 +1,35 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.hh,v 1.14 2005/04/11 10:40:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmModelManager.hh,v 1.19 2006/06/29 19:54:25 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4EmModelManager
//
// Author: Vladimir Ivanchenko
@@ -46,6 +48,9 @@
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
// 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko)
// 11-04-05 Remove access to fluctuation models (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 13-05-06 Add GetModel by index method (VI)
//
// Class Description:
//
@@ -66,6 +71,7 @@
#include "globals.hh"
#include "G4DataVector.hh"
#include "G4EmTableType.hh"
class G4RegionModels
{
@@ -121,7 +127,7 @@ public:
G4EmModelManager();
~G4EmModelManager();
~G4EmModelManager();
void Clear();
@@ -134,18 +140,18 @@ public:
const G4DataVector* SubCutoff() const;
void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*);
void FillDEDXVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4EmTableType t = fRestricted);
void FillDEDXVectorForPreciseRange(G4PhysicsVector*, const G4MaterialCutsCouple*);
void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4bool startFromNull = true);
void FillSubLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4bool startFromNull = true);
void FillLambdaVector(G4PhysicsVector*, const G4MaterialCutsCouple*,
G4bool startFromNull = true, G4EmTableType t = fRestricted);
G4VEmModel* SelectModel(G4double& energy, size_t& index);
G4VEmModel* GetModel(G4int);
G4int NumberOfModels() const;
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*);
void UpdateEmModel(const G4String&, G4double, G4double);
@@ -192,9 +198,11 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy, size_t& index)
inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy,
size_t& index)
{
currentIdx = (setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy);
currentIdx =
(setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy);
return models[currentIdx];
}
@@ -214,5 +222,12 @@ inline const G4DataVector* G4EmModelManager::SubCutoff() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4EmModelManager::NumberOfModels() const
{
return nEmModels;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmMultiModel.hh,v 1.4 2005/04/15 11:40:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmMultiModel.hh,v 1.5 2006/06/29 19:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh,v 1.4 2005/10/27 14:04:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmProcessOptions.hh,v 1.9 2006/06/29 19:54:29 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// -------------------------------------------------------------------
@@ -36,6 +39,8 @@
// Creation date: 27.02.2004
//
// Modifications:
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 22-05-06 Add SetBremsstrahlungTh (V.Ivanchenko)
//
//
// Class Description:
@@ -75,23 +80,23 @@ public:
void SetMaxEnergy(G4double val);
void SetMaxEnergyForPreciseRange(G4double val);
void SetMaxEnergyForCSDARange(G4double val);
void SetMaxEnergyForMuons(G4double val);
void SetDEDXBinning(G4int val);
void SetDEDXBinningForPreciseRange(G4int val);
void SetDEDXBinningForCSDARange(G4int val);
void SetLambdaBinning(G4int val);
void SetStepLimits(G4double v1, G4double v2);
void SetStepFunction(G4double v1, G4double v2);
void SetRandomStep(G4bool val);
void SetApplyCuts(G4bool val);
void SetBuildPreciseRange(G4bool val);
void SetBuildCSDARange(G4bool val);
void SetVerbose(G4int val, const G4String& name = "all");
@@ -101,6 +106,10 @@ public:
void SetMscStepLimitation(G4bool algorithm, G4double factor = -1.);
void SetLPMFlag(G4bool val);
void SetBremsstrahlungTh(G4double val);
private:
G4EmProcessOptions & operator=(const G4EmProcessOptions &right);
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EmTableType.hh,v 1.2 2006/06/29 19:54:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//---------------------------------------------------------------
//
// G4EmTableType.hh
//
// Class Description:
// This is an enumerator to define type of dEdx and Rnge tables
//
// Author: Vladimir Ivanchenko
//
// Creation date: 19.01.2006
//
//---------------------------------------------------------------
#ifndef G4EmTableType_h
#define G4EmTableType_h 1
enum G4EmTableType
{
fTotal = 0,
fRestricted,
fSubRestricted
};
#endif
@@ -1,29 +1,49 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.8 2003/10/13 10:49:17 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EnergyLossMessenger.hh,v 1.13 2006/06/29 19:54:33 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EnergyLossMessenger
//
// Author: Michel Maire
//
// Creation date: 22-06-2000
//
// Modifications:
// 10-01-06 SetStepLimits -> SetStepFunction (V.Ivantchenko)
// 10-05-06 Add command MscStepLimit (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
//
// Class Description:
// This is a messenger class to interface to exchange information
@@ -59,26 +79,28 @@ class G4UIcmdWithADoubleAndUnit;
class G4EnergyLossMessenger: public G4UImessenger
{
public: // with description
public: // with description
G4EnergyLossMessenger();
virtual ~G4EnergyLossMessenger();
G4EnergyLossMessenger();
~G4EnergyLossMessenger();
void SetNewValue(G4UIcommand*, G4String);
void SetNewValue(G4UIcommand*, G4String);
private:
private:
G4UIdirectory* eLossDirectory;
G4UIcmdWithABool* RndmStepCmd;
G4UIcmdWithABool* EnlossFlucCmd;
G4UIcmdWithABool* SubSecCmd;
G4UIcmdWithADoubleAndUnit* MinSubSecCmd;
G4UIcommand* StepFuncCmd;
G4UIcmdWithADoubleAndUnit* MinEnCmd;
G4UIcmdWithADoubleAndUnit* MaxEnCmd;
G4UIcmdWithABool* IntegCmd;
G4UIcmdWithABool* rangeCmd;
G4UIcmdWithAnInteger* verCmd;
G4UIdirectory* eLossDirectory;
G4UIcmdWithABool* RndmStepCmd;
G4UIcmdWithABool* EnlossFlucCmd;
G4UIcmdWithABool* SubSecCmd;
G4UIcmdWithADoubleAndUnit* MinSubSecCmd;
G4UIcommand* StepFuncCmd;
G4UIcommand* mscCmd;
G4UIcmdWithADoubleAndUnit* MinEnCmd;
G4UIcmdWithADoubleAndUnit* MaxEnCmd;
G4UIcmdWithABool* IntegCmd;
G4UIcmdWithABool* rangeCmd;
G4UIcmdWithABool* lpmCmd;
G4UIcmdWithAnInteger* verCmd;
};
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.hh,v 1.18 2003/07/23 11:36:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EnergyLossTables.hh,v 1.19 2006/06/29 19:54:35 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// $Id:
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableBuilder.hh,v 1.4 2004/11/10 08:54:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LossTableBuilder.hh,v 1.7 2006/06/29 19:54:37 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// -------------------------------------------------------------------
@@ -59,16 +62,18 @@ class G4LossTableBuilder
public:
G4LossTableBuilder() {};
G4LossTableBuilder();
~G4LossTableBuilder() {};
virtual ~G4LossTableBuilder();
void BuildDEDXTable(G4PhysicsTable* dedxTable, const std::vector<G4PhysicsTable*>&);
void BuildRangeTable(const G4PhysicsTable* dedxTable, G4PhysicsTable* rangeTable);
void BuildRangeTable(const G4PhysicsTable* dedxTable, G4PhysicsTable* rangeTable,
G4bool isIonisation = false);
void BuildInverseRangeTable(const G4PhysicsTable* rangeTable,
G4PhysicsTable* invRangeTable);
G4PhysicsTable* invRangeTable,
G4bool isIonisation = false);
private:
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh,v 1.28 2005/10/27 14:04:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LossTableManager.hh,v 1.41 2006/06/29 19:54:39 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// -------------------------------------------------------------------
@@ -50,6 +53,11 @@
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 14-01-04 Activate precise range calculation (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce GetSubDEDX method (VI)
// 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
//
// Class Description:
//
@@ -70,7 +78,6 @@
#include <map>
#include <vector>
#include "globals.hh"
#include "G4LossTableBuilder.hh"
#include "G4VEnergyLossProcess.hh"
#include "G4EnergyLossTables.hh"
@@ -81,6 +88,7 @@ class G4ParticleDefinition;
class G4VMultipleScattering;
class G4VEmProcess;
class G4EmCorrections;
class G4LossTableBuilder;
class G4LossTableManager
{
@@ -99,12 +107,22 @@ public:
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetSubDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetRange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetTrancatedRange(
G4double GetCSDARange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
G4double GetRangeFromRestricteDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple);
@@ -132,13 +150,17 @@ public:
void DeRegister(G4VEmProcess* p);
void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle, G4VEnergyLossProcess* p);
void EnergyLossProcessIsInitialised(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p);
void RegisterIon(const G4ParticleDefinition* aParticle, G4VEnergyLossProcess* p);
void RegisterIon(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p);
void RegisterExtraParticle(const G4ParticleDefinition* aParticle, G4VEnergyLossProcess* p);
void RegisterExtraParticle(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p);
void BuildPhysicsTable(const G4ParticleDefinition* aParticle, G4VEnergyLossProcess* p);
void BuildPhysicsTable(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p);
void SetLossFluctuations(G4bool val);
@@ -154,25 +176,39 @@ public:
void SetMaxEnergy(G4double val);
void SetMaxEnergyForPreciseRange(G4double val);
void SetMaxEnergyForCSDARange(G4double val);
void SetMaxEnergyForMuons(G4double val);
void SetDEDXBinning(G4int val);
void SetDEDXBinningForPreciseRange(G4int val);
void SetDEDXBinningForCSDARange(G4int val);
void SetLambdaBinning(G4int val);
void SetStepLimits(G4double v1, G4double v2);
void SetStepFunction(G4double v1, G4double v2);
void SetBuildPreciseRange(G4bool val);
void SetBuildCSDARange(G4bool val);
void SetLPMFlag(G4bool val);
void SetBremsstrahlungTh(G4double val);
void SetVerbose(G4int val);
G4EnergyLossMessenger* GetMessenger();
G4bool BuildPreciseRange() const;
G4bool BuildCSDARange() const;
G4bool LPMFlag() const;
void SetMscStepLimitation(G4bool algorithm, G4double factor = -1.);
G4bool MscFlag() const;
G4double FacRange() const;
G4double BremsstrahlungTh() const;
const std::vector<G4VEnergyLossProcess*>& GetEnergyLossProcessVector();
@@ -188,7 +224,8 @@ private:
G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle);
void CopyTables(const G4ParticleDefinition* aParticle, G4VEnergyLossProcess*);
void CopyTables(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess*);
void ParticleHaveNoLoss(const G4ParticleDefinition* aParticle);
@@ -207,6 +244,7 @@ private:
std::vector<PD> part_vector;
std::vector<PD> base_part_vector;
std::vector<G4bool> tables_are_built;
std::vector<G4bool> isActive;
std::vector<G4PhysicsTable*> dedx_vector;
std::vector<G4PhysicsTable*> range_vector;
std::vector<G4PhysicsTable*> inv_range_vector;
@@ -214,9 +252,9 @@ private:
std::vector<G4VEmProcess*> emp_vector;
// cash
G4VEnergyLossProcess* currentLoss;
PD currentParticle;
PD theElectron;
G4VEnergyLossProcess* currentLoss;
PD currentParticle;
PD theElectron;
G4int n_loss;
@@ -228,11 +266,14 @@ private:
G4bool integral;
G4bool integralActive;
G4bool all_tables_are_stored;
G4bool buildPreciseRange;
G4bool buildCSDARange;
G4bool minEnergyActive;
G4bool maxEnergyActive;
G4bool maxEnergyForMuonsActive;
G4bool stepFunctionActive;
G4bool flagLPM;
G4bool flagMSC;
G4bool mscActive;
G4double minSubRange;
G4double maxRangeVariation;
@@ -240,6 +281,8 @@ private:
G4double minKinEnergy;
G4double maxKinEnergy;
G4double maxKinEnergyForMuons;
G4double facRange;
G4double bremsTh;
G4LossTableBuilder* tableBuilder;
G4EnergyLossMessenger* theMessenger;
@@ -269,13 +312,57 @@ inline G4double G4LossTableManager::GetDEDX(
}
G4double x;
if(currentLoss) x = currentLoss->GetDEDX(kineticEnergy, couple);
else x = G4EnergyLossTables::GetDEDX(currentParticle,kineticEnergy,couple,false);
else x = G4EnergyLossTables::GetDEDX(
currentParticle,kineticEnergy,couple,false);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline G4double G4LossTableManager::GetTrancatedRange(
inline G4double G4LossTableManager::GetSubDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) {
currentParticle = aParticle;
std::map<PD, G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos;
if ((pos = loss_map.find(aParticle)) != loss_map.end()) {
currentLoss = (*pos).second;
} else {
currentLoss = 0;
// ParticleHaveNoLoss(aParticle);
}
}
G4double x = 0.0;
if(currentLoss) x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline G4double G4LossTableManager::GetCSDARange(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple)
{
if(aParticle != currentParticle) {
currentParticle = aParticle;
std::map<PD, G4VEnergyLossProcess*, std::less<PD> >::const_iterator pos;
if ((pos = loss_map.find(currentParticle)) != loss_map.end()) {
currentLoss = (*pos).second;
} else {
currentLoss = 0;
}
}
G4double x = DBL_MAX;
if(currentLoss) x = currentLoss->GetCSDARange(kineticEnergy, couple);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
inline G4double G4LossTableManager::GetRangeFromRestricteDEDX(
const G4ParticleDefinition *aParticle,
G4double kineticEnergy,
const G4MaterialCutsCouple *couple)
@@ -344,8 +431,8 @@ inline G4double G4LossTableManager::GetEnergy(
}
G4double x;
if(currentLoss) x = currentLoss->GetKineticEnergy(range, couple);
else x = G4EnergyLossTables::GetPreciseEnergyFromRange(currentParticle,
range,couple,false);
else x = G4EnergyLossTables::GetPreciseEnergyFromRange(
currentParticle,range,couple,false);
return x;
}
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.hh,v 1.9 2005/07/25 18:13:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmFluctuationModel.hh,v 1.10 2006/06/29 19:54:41 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.hh,v 1.35 2005/07/25 18:13:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmModel.hh,v 1.42 2006/06/29 19:54:43 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -45,12 +48,16 @@
// 01-03-04 L.Urban signature changed in SampleCosineTheta
// 23-04-04 L.urban signature of SampleCosineTheta changed back
// 17-11-04 Add method CrossSectionPerAtom (V.Ivanchenko)
// 14-03-05 Reduce number of pure virtual methods and make inline part separate (V.Ivanchenko)
// 24-03-05 Remove IsInCharge and add G4VParticleChange in the constructor (V.Ivanchenko)
// 14-03-05 Reduce number of pure virtual methods and make inline part
// separate (V.Ivanchenko)
// 24-03-05 Remove IsInCharge and add G4VParticleChange in the constructor (VI)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 15-04-05 optimize internal interface for msc (V.Ivanchenko)
// 08-05-05 A -> N (V.Ivanchenko)
// 25-07-05 Move constructor and destructor to the body (V.Ivanchenko)
// 02-02-06 ComputeCrossSectionPerAtom: default value A=0. (mma)
// 06-02-06 add method ComputeMeanFreePath() (mma)
// 07-03-06 Optimize msc methods (V.Ivanchenko)
//
// Class Description:
//
@@ -76,6 +83,7 @@
class G4PhysicsTable;
class G4Region;
class G4VParticleChange;
class G4Track;
class G4VEmModel
{
@@ -118,36 +126,46 @@ public:
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeDEDXPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
virtual G4double CrossSectionPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
G4double A,
G4double A = 0.,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeMeanFreePath(
const G4ParticleDefinition*,
G4double kineticEnergy,
const G4Material*,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double CrossSectionPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// Methods for msc simulation
virtual G4double GeomPathLength(G4PhysicsTable* theLambdaTable,
const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double& kinEnergy,
G4double lambda,
G4double range,
G4double truePathLength);
virtual G4double TrueStepLength(G4double geomStepLength);
virtual G4double ComputeTruePathLengthLimit(
const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
virtual G4double ComputeGeomPathLength(G4double truePathLength);
virtual G4double ComputeTrueStepLength(G4double geomPathLength);
virtual void DefineForRegion(const G4Region*);
@@ -203,29 +221,37 @@ protected:
G4VParticleChange* pParticleChange;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::HighEnergyLimit()
{
return highLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::LowEnergyLimit()
{
return lowLimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetHighEnergyLimit(G4double val)
{
highLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetLowEnergyLimit(G4double val)
{
lowLimit = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,
G4VEmFluctuationModel* f = 0)
{
@@ -233,17 +259,24 @@ inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,
fluc = f;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
{
return fluc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*)
{
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeDEDXPerVolume(
const G4Material*,
const G4ParticleDefinition*,
@@ -253,6 +286,8 @@ inline G4double G4VEmModel::ComputeDEDXPerVolume(
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
@@ -261,34 +296,42 @@ inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy,
G4double maxEnergy)
{
return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double, G4double, G4double, G4double, G4double)
const G4ParticleDefinition*,
G4double, G4double, G4double,
G4double, G4double)
{
return 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4Element* G4VEmModel::SelectRandomAtom(
const G4Material* material,
const G4ParticleDefinition* pd,
G4double kinEnergy,
G4double tcut,
G4double tmax)
const G4Material* material,
const G4ParticleDefinition* pd,
G4double kinEnergy,
G4double tcut,
G4double tmax)
{
const G4ElementVector* theElementVector = material->GetElementVector();
const G4Element* elm = (*theElementVector)[0];
G4int nelm = material->GetNumberOfElements() - 1;
if(nelm > 0) {
G4double x = G4UniformRand()*CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
if (nelm > 0) {
G4double x = G4UniformRand()*
CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
G4int i = -1;
do {i++;} while (x > xsec[i] && i < nelm);
elm = (*theElementVector)[i];
@@ -296,43 +339,62 @@ inline const G4Element* G4VEmModel::SelectRandomAtom(
return elm;
}
inline G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::MaxSecondaryKinEnergy(
const G4DynamicParticle* dynParticle)
{
return MaxSecondaryEnergy(dynParticle->GetDefinition(), dynParticle->GetKineticEnergy());
return MaxSecondaryEnergy(dynParticle->GetDefinition(),
dynParticle->GetKineticEnergy());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy)
{
return kineticEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline const G4String& G4VEmModel::GetName() const
{
return name;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Methods for msc simulation
inline G4double G4VEmModel::GeomPathLength(G4PhysicsTable*,
const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double&,
G4double,
G4double,
G4double truePathLength)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeTruePathLengthLimit(
const G4Track&,
G4PhysicsTable*,
G4double)
{
return DBL_MAX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeGeomPathLength(G4double truePathLength)
{
return truePathLength;
}
inline G4double G4VEmModel::TrueStepLength(G4double geomStepLength)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4VEmModel::ComputeTrueStepLength(G4double geomPathLength)
{
return geomStepLength;
return geomPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4VEmModel::DefineForRegion(const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.29 2005/10/25 11:38:15 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmProcess.hh,v 1.33 2006/06/29 19:54:45 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -39,11 +42,14 @@
// 09-08-04 optimise integral option (V.Ivanchenko)
// 11-08-04 add protected methods to access cuts (V.Ivanchenko)
// 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko)
// 16-09-04 Add flag for LambdaTable and method RecalculateLambda (V.Ivanchneko)
// 16-09-04 Add flag for LambdaTable and method RecalculateLambda (VI)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivantchenko)
// 09-05-05 Fix problem in logic when path boundary between materials (V.Ivantchenko)
// 09-05-05 Fix problem in logic when path boundary between materials (VI)
// 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
// 01-02-06 put default value A=0. to keep compatibility with v5.2 (mma)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
//
// Class Description:
//
@@ -167,7 +173,8 @@ public:
const G4MaterialCutsCouple* couple);
// It returns the cross section of the process for energy/ material
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy, G4double Z);
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A=0.);
// It returns the cross section of the process per atom
G4double MeanFreePath( const G4Track& track,
@@ -179,12 +186,16 @@ public:
void ActivateDeexcitation(G4bool, const G4Region* r = 0);
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
G4VEmModel* SelectModelForMaterial(G4double kinEnergy,
size_t& idxRegion) const;
void SetIntegral(G4bool val);
G4bool IsIntegral() const;
void SetApplyCuts(G4bool val);
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0);
protected:
@@ -453,4 +464,11 @@ inline void G4VEmProcess::SetLambdaFactor(G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEmProcess::GetModelByIndex(G4int idx)
{
return modelManager->GetModel(idx);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VEnergyLoss.hh,v 1.17 2003/03/25 13:36:57 maire Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEnergyLoss.hh,v 1.18 2006/06/29 19:54:47 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// ------------------------------------------------------------
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh,v 1.43 2005/10/27 14:04:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEnergyLossProcess.hh,v 1.56 2006/06/29 19:54:49 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -52,13 +55,21 @@
// 10-03-04 Fix problem of step limit calculation (V.Ivanchenko)
// 30-06-04 make destructor virtual (V.Ivanchenko)
// 05-07-04 fix problem of GenericIons seen at small cuts (V.Ivanchenko)
// 03-08-04 Add DEDX table to all processes for control on integral range(V.Ivanchenko)
// 03-08-04 Add DEDX table to all processes for control on integral range(VI)
// 06-08-04 Clear up names of member functions (V.Ivanchenko)
// 27-08-04 Add NeedBuildTables method (V.Ivanchneko)
// 09-09-04 Bug fix for the integral mode with 2 peaks (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
// 11-04-05 Use MaxSecondaryEnergy from a model (V.Ivanchenko)
// 10-01-05 Remove SetStepLimits (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 13-01-06 Remove AddSubCutSecondaries and cleanup (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 26-01-06 Add public method GetCSDARange (V.Ivanchenko)
// 22-03-06 Add SetDynamicMassCharge (V.Ivanchenko)
// 23-03-06 Use isIonisation flag (V.Ivanchenko)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
//
// Class Description:
//
@@ -82,14 +93,15 @@
#include "G4EmModelManager.hh"
#include "G4UnitsTable.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4EmTableType.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
class G4Step;
class G4ParticleDefinition;
class G4VEmModel;
class G4VEmFluctuationModel;
class G4DataVector;
class G4PhysicsTable;
class G4PhysicsVector;
class G4Region;
class G4Navigator;
@@ -163,10 +175,9 @@ public:
G4double SampleRange();
G4PhysicsTable* BuildDEDXTable();
G4PhysicsTable* BuildDEDXTableForPreciseRange();
G4PhysicsTable* BuildLambdaTable();
G4PhysicsTable* BuildLambdaSubTable();
G4PhysicsTable* BuildDEDXTable(G4EmTableType tType = fRestricted);
G4PhysicsTable* BuildLambdaTable(G4EmTableType tType = fRestricted);
void SetBaseParticle(const G4ParticleDefinition* p);
@@ -176,12 +187,10 @@ public:
// Binning for dEdx, range, and inverse range tables
void SetDEDXBinning(G4int nbins);
void SetLambdaBinning(G4int nbins);
// Binning for dEdx, range, and inverse range tables
void SetDEDXBinningForPreciseRange(G4int nbins);
// Binning for lambda table
void SetLambdaBinning(G4int nbins);
void SetDEDXBinningForCSDARange(G4int nbins);
// Min kinetic energy for tables
void SetMinKinEnergy(G4double e);
@@ -192,7 +201,7 @@ public:
G4double MaxKinEnergy() const;
// Max kinetic energy for tables
void SetMaxKinEnergyForPreciseRange(G4double e);
void SetMaxKinEnergyForCSDARange(G4double e);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
@@ -225,11 +234,14 @@ public:
void SetDEDXTable(G4PhysicsTable* p);
G4PhysicsTable* DEDXTable() const;
void SetDEDXTableForSubsec(G4PhysicsTable* p);
G4PhysicsTable* DEDXTableForSubsec() const;
void SetDEDXunRestrictedTable(G4PhysicsTable* p);
G4PhysicsTable* DEDXunRestrictedTable() const;
void SetPreciseRangeTable(G4PhysicsTable* pRange);
G4PhysicsTable* PreciseRangeTable() const;
void SetCSDARangeTable(G4PhysicsTable* pRange);
G4PhysicsTable* CSDARangeTable() const;
void SetRangeTableForLoss(G4PhysicsTable* p);
G4PhysicsTable* RangeTableForLoss() const;
@@ -245,12 +257,14 @@ public:
void SetSubLambdaTable(G4PhysicsTable* p);
G4PhysicsTable* SubLambdaTable();
// Return values for particle
G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple* couple);
// Return values for given G4MaterialCutsCouple
G4double GetDEDX(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetDEDXForSubsec(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetRange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetCSDARange(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetRangeForLoss(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetKineticEnergy(G4double& range, const G4MaterialCutsCouple*);
G4double GetLambda(G4double& kineticEnergy, const G4MaterialCutsCouple*);
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple,
const G4DynamicParticle* dp,
@@ -270,7 +284,6 @@ public:
//
void SetLinearLossLimit(G4double val);
void SetMinSubRange(G4double val);
void SetStepLimits(G4double v1, G4double v2);
void SetStepFunction(G4double v1, G4double v2);
void SetLambdaFactor(G4double val);
@@ -293,17 +306,22 @@ public:
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
// Set/Get flag "isIonisation"
void SetIonisation(G4bool val);
G4bool IsIonisationProcess() const;
void AddCollaborativeProcess(G4VEnergyLossProcess*);
void AddSubCutoffSecondaries(std::vector<G4Track*>&, const G4Step&,
G4double& eloss, G4double& escaled);
void SampleSubCutSecondaries(std::vector<G4Track*>&, const G4Step&,
G4double& eloss, G4VEmModel* model);
G4double& cut, G4VEmModel* model);
// Set scaling parameters
void SetDynamicMassCharge(G4double massratio, G4double charge2ratio);
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0);
G4int NumberOfModels();
protected:
@@ -311,25 +329,10 @@ protected:
void SetSecondaryParticle(const G4ParticleDefinition* p);
G4PhysicsVector* DEDXPhysicsVector(const G4MaterialCutsCouple*);
G4PhysicsVector* DEDXPhysicsVectorForPreciseRange(const G4MaterialCutsCouple*);
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
G4PhysicsVector* SubLambdaPhysicsVector(const G4MaterialCutsCouple*);
G4VEmModel* SelectModel(G4double kinEnergy);
size_t CurrentMaterialCutsCoupleIndex() const;
// Set scaling parameters
//
void SetMassRatio(G4double val);
void SetReduceFactor(G4double val);
void SetChargeSquare(G4double val);
void SetChargeSquareRatio(G4double val);
G4double GetCurrentRange() const;
private:
@@ -338,10 +341,12 @@ private:
void Clear();
void DefineMaterial(const G4MaterialCutsCouple* couple);
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*, G4double cut);
// Returnd values for scaled energy and base particles mass
//
G4double GetDEDXForScaledEnergy(G4double scaledKinEnergy);
G4double GetSubDEDXForScaledEnergy(G4double scaledKinEnergy);
G4double GetScaledRangeForScaledEnergy(G4double scaledKinEnergy);
G4double GetLimitScaledRangeForScaledEnergy(G4double scaledKinEnergy);
G4double GetLambdaForScaledEnergy(G4double scaledKinEnergy);
@@ -371,9 +376,10 @@ private:
// tables and vectors
G4PhysicsTable* theDEDXTable;
G4PhysicsTable* theRangeTableForLoss;
G4PhysicsTable* theDEDXSubTable;
G4PhysicsTable* theDEDXunRestrictedTable;
G4PhysicsTable* thePreciseRangeTable;
G4PhysicsTable* theRangeTableForLoss;
G4PhysicsTable* theCSDARangeTable;
G4PhysicsTable* theSecondaryRangeTable;
G4PhysicsTable* theInverseRangeTable;
G4PhysicsTable* theLambdaTable;
@@ -393,21 +399,21 @@ private:
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* thePositron;
G4PhysicsVector* vstrag;
// cash
const G4Material* currentMaterial;
const G4MaterialCutsCouple* currentCouple;
size_t currentMaterialIndex;
G4double minStepLimit;
G4int nDEDXBins;
G4int nDEDXBinsForRange;
G4int nLambdaBins;
G4int nBins;
G4int nBinsCSDA;
G4int nWarnings;
G4double lowestKinEnergy;
G4double minKinEnergy;
G4double maxKinEnergy;
G4double maxKinEnergyForRange;
G4double maxKinEnergyCSDA;
G4double massRatio;
G4double reduceFactor;
@@ -440,14 +446,13 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
inline void G4VEnergyLossProcess::DefineMaterial(
const G4MaterialCutsCouple* couple)
{
if(couple != currentCouple) {
currentCouple = couple;
currentMaterial = couple->GetMaterial();
currentMaterialIndex = couple->GetIndex();
minStepLimit = std::min(finalRange,
currentCouple->GetProductionCuts()->GetProductionCut(idxG4ElectronCut));
if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
}
}
@@ -463,10 +468,31 @@ inline G4double G4VEnergyLossProcess::GetDEDX(G4double& kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetDEDXForSubsec(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return GetSubDEDXForScaledEnergy(kineticEnergy*massRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
{
G4bool b;
G4double x = ((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
G4double x =
((*theDEDXTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetSubDEDXForScaledEnergy(G4double e)
{
G4bool b;
G4double x =
((*theDEDXSubTable)[currentMaterialIndex]->GetValue(e, b))*chargeSqRatio;
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
return x;
}
@@ -476,42 +502,61 @@ inline G4double G4VEnergyLossProcess::GetDEDXForScaledEnergy(G4double e)
inline G4double G4VEnergyLossProcess::GetRange(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
if(thePreciseRangeTable)
x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio);
else if(theRangeTableForLoss)
x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio);
return x*reduceFactor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e)
{
G4bool b;
G4double x;
if (e < maxKinEnergyForRange) {
x = ((*thePreciseRangeTable)[currentMaterialIndex])->GetValue(e, b);
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
} else {
x = theRangeAtMaxEnergy[currentMaterialIndex] +
(e - maxKinEnergyForRange)/theDEDXAtMaxEnergy[currentMaterialIndex];
G4double x = fRange;
if(kineticEnergy != preStepKinEnergy || couple != currentCouple) {
DefineMaterial(couple);
if(theCSDARangeTable)
x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)
* reduceFactor;
else if(theRangeTableForLoss)
x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetRangeForLoss(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
inline G4double G4VEnergyLossProcess::GetCSDARange(
G4double& kineticEnergy, const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
if(theRangeTableForLoss) x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio);
return x*reduceFactor;
if(theCSDARangeTable)
x = GetLimitScaledRangeForScaledEnergy(kineticEnergy*massRatio)
* reduceFactor;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(
G4double e)
{
G4bool b;
G4double x;
if (e < maxKinEnergyCSDA) {
x = ((*theCSDARangeTable)[currentMaterialIndex])->GetValue(e, b);
if(e < minKinEnergy) x *= std::sqrt(e/minKinEnergy);
} else {
x = theRangeAtMaxEnergy[currentMaterialIndex] +
(e - maxKinEnergyCSDA)/theDEDXAtMaxEnergy[currentMaterialIndex];
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetRangeForLoss(
G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double x = DBL_MAX;
if(theRangeTableForLoss)
x = GetScaledRangeForScaledEnergy(kineticEnergy*massRatio)*reduceFactor;
// G4cout << "Range from " << GetProcessName() << " e= " << kineticEnergy << " r= " << x << G4endl;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -526,8 +571,9 @@ inline G4double G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetKineticEnergy(G4double& range,
const G4MaterialCutsCouple* couple)
inline G4double G4VEnergyLossProcess::GetKineticEnergy(
G4double& range,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
G4double r = range/reduceFactor;
@@ -586,7 +632,8 @@ inline G4double G4VEnergyLossProcess::GetLambda(G4double& kineticEnergy,
inline G4double G4VEnergyLossProcess::GetLambdaForScaledEnergy(G4double e)
{
G4bool b;
return chargeSqRatio*(((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
return
chargeSqRatio*(((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -616,44 +663,46 @@ inline void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition)
inline G4double G4VEnergyLossProcess::GetMeanFreePath(
const G4Track& track, G4double, G4ForceCondition* condition)
{
*condition = NotForced;
preStepKinEnergy = track.GetKineticEnergy();
preStepScaledEnergy = preStepKinEnergy*massRatio;
if(aboveCSmax && preStepScaledEnergy < mfpKinEnergy) ResetNumberOfInteractionLengthLeft();
if(aboveCSmax && preStepScaledEnergy < mfpKinEnergy)
ResetNumberOfInteractionLengthLeft();
DefineMaterial(track.GetMaterialCutsCouple());
if (meanFreePath) {
if (integral) ComputeLambdaForScaledEnergy(preStepScaledEnergy);
else preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy);
else preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy);
if(0.0 < preStepLambda) preStepMFP = 1.0/preStepLambda;
else preStepMFP = DBL_MAX;
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= " <<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl;
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<< " eCSmax= "
//<<mfpKinEnergy<< " mfp= "<<preStepMFP<<G4endl;
return preStepMFP;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(const G4Track&,
G4double, G4double currentMinStep, G4double&)
G4double, G4double currentMinStep, G4double&)
{
G4double x = DBL_MAX;
if(theRangeTableForLoss) {
if(isIonisation) {
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
x = fRange;
G4double y = x*dRoverRange;
if(x > minStepLimit && y < currentMinStep ) {
x = y + minStepLimit*(1.0 - dRoverRange)*(2.0 - minStepLimit/fRange);
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" range= "<<fRange
// <<" cMinSt="<<currentMinStep <<" minStepLimit= " << minStepLimit<< G4endl;
if(x > finalRange && y < currentMinStep ) {
x = y + finalRange*(1.0 - dRoverRange)*(2.0 - finalRange/fRange);
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" range= "<<fRange <<" cMinSt="<<currentMinStep<< G4endl;
} else if (rndmStepFlag) x = SampleRange();
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" stepLimit= "<<x<<G4endl;
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy
// <<" stepLimit= "<<x<<G4endl;
return x;
}
@@ -661,6 +710,11 @@ inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(const G4Track&,
inline G4double G4VEnergyLossProcess::SampleRange()
{
G4double e = amu_c2*preStepKinEnergy/particle->GetPDGMass();
G4bool b;
G4double s = fRange*std::pow(10.,vstrag->GetValue(e,b));
G4double x = fRange + G4RandGauss::shoot(0.0,s);
if(x > 0.0) fRange = x;
return fRange;
}
@@ -675,9 +729,8 @@ inline void G4VEnergyLossProcess::ResetNumberOfInteractionLengthLeft()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double cut)
inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(
const G4ParticleDefinition*, const G4Material*, G4double cut)
{
return cut;
}
@@ -692,7 +745,7 @@ inline G4VEmModel* G4VEnergyLossProcess::SelectModel(G4double kinEnergy)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel* G4VEnergyLossProcess::SelectModelForMaterial(
G4double kinEnergy, size_t& idx) const
G4double kinEnergy, size_t& idx) const
{
return modelManager->SelectModel(kinEnergy, idx);
}
@@ -713,7 +766,8 @@ inline const G4ParticleDefinition* G4VEnergyLossProcess::BaseParticle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() const
inline const G4ParticleDefinition*
G4VEnergyLossProcess::SecondaryParticle() const
{
return secondaryParticle;
}
@@ -736,6 +790,13 @@ inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::DEDXTableForSubsec() const
{
return theDEDXSubTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
{
return theDEDXunRestrictedTable;
@@ -743,9 +804,9 @@ inline G4PhysicsTable* G4VEnergyLossProcess::DEDXunRestrictedTable() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4PhysicsTable* G4VEnergyLossProcess::PreciseRangeTable() const
inline G4PhysicsTable* G4VEnergyLossProcess::CSDARangeTable() const
{
return thePreciseRangeTable;
return theCSDARangeTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -791,31 +852,14 @@ inline size_t G4VEnergyLossProcess::CurrentMaterialCutsCoupleIndex() const
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetMassRatio(G4double val)
{
massRatio = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetReduceFactor(G4double val)
inline void G4VEnergyLossProcess::SetDynamicMassCharge(G4double massratio,
G4double charge2ratio)
{
reduceFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetChargeSquare(G4double val)
{
chargeSquare = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::SetChargeSquareRatio(G4double val)
{
chargeSqRatio = val;
massRatio = massratio;
chargeSqRatio = charge2ratio;
chargeSquare = charge2ratio*eplus*eplus;
reduceFactor = 1.0/(chargeSqRatio*massRatio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -827,20 +871,25 @@ inline G4double G4VEnergyLossProcess::GetCurrentRange() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::AddCollaborativeProcess(G4VEnergyLossProcess* p)
inline void G4VEnergyLossProcess::AddCollaborativeProcess(
G4VEnergyLossProcess* p)
{
scProcesses.push_back(p);
useSubCutoff = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::AddSubCutoffSecondaries(std::vector<G4Track*>& tracks,
const G4Step& step, G4double& eloss, G4double& escaled)
inline G4VEmModel* G4VEnergyLossProcess::GetModelByIndex(G4int idx)
{
if(idxSCoffRegions[currentMaterialIndex])
SampleSubCutSecondaries(tracks, step, eloss, SelectModel(escaled));
}
return modelManager->GetModel(idx);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4int G4VEnergyLossProcess::NumberOfModels()
{
return modelManager->NumberOfModels();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh,v 1.29 2005/10/27 11:33:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VMultipleScattering.hh,v 1.39 2006/06/29 19:54:51 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -53,6 +56,11 @@
// 15-04-05 remove boundary flag (V.Ivanchenko)
// 07-10-05 error in a protection in GetContinuousStepLimit corrected (L.Urban)
// 27-10-05 introduce virtual function MscStepLimitation() (V.Ivanchenko)
// 26-01-06 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 17-02-06 Save table of transport cross sections not mfp (V.Ivanchenko)
// 07-03-06 Move step limit calculation to model (V.Ivanchenko)
// 13-05-06 Add method to access model by index (V.Ivanchenko)
//
// -------------------------------------------------------------------
//
@@ -94,10 +102,6 @@ public:
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
// True for all charged particles
virtual G4double TruePathLengthLimit(const G4Track& track,
G4double& lambda,
G4double currentMinimalStep) = 0;
virtual void PrintInfo() = 0;
protected:
@@ -123,9 +127,9 @@ public:
// Generic methods common to all models
//------------------------------------------------------------------------
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
@@ -172,7 +176,7 @@ public:
void AddEmModel(G4int, G4VEmModel*, const G4Region* region = 0);
// This method does not used for tracking, it is intended only for tests
G4double ContinuousStepLimit(const G4Track& track,
virtual G4double ContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
@@ -183,7 +187,7 @@ public:
void SetBuildLambdaTable(G4bool val);
const G4PhysicsTable* LambdaTable() const;
G4PhysicsTable* LambdaTable() const;
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
@@ -191,6 +195,9 @@ public:
const G4ParticleDefinition* Particle() const;
void SetParticle(const G4ParticleDefinition*);
// Access to models
G4VEmModel* GetModelByIndex(G4int idx = 0);
protected:
// This method is used for tracking, it returns mean free path value
@@ -201,24 +208,22 @@ protected:
G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
// This method is used for tracking, it returns step limit
G4double GetContinuousStepLimit(const G4Track& track,
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
void SelectModel(G4double& kinEnergy);
G4VEmModel* SelectModel(G4double kinEnergy);
// Select concrete model
size_t CurrentMaterialCutsCoupleIndex() const {return currentMaterialIndex;};
// Return current index
G4double CurrentRange() const {return currentRange;};
private:
const G4MaterialCutsCouple* CurrentMaterialCutsCouple() const;
// Return current G4MaterialCutsCouple
void DefineMaterial(const G4MaterialCutsCouple* couple);
// define current material
private:
// hide assignment operator
G4VMultipleScattering(G4VMultipleScattering &);
@@ -226,14 +231,18 @@ private:
// =====================================================================
protected:
G4GPILSelection valueGPILSelectionMSC;
G4ParticleChangeForMSC fParticleChange;
private:
G4EmModelManager* modelManager;
G4VEmModel* currentModel;
// tables and vectors
G4PhysicsTable* theLambdaTable;
// cash
// cache
const G4ParticleDefinition* firstParticle;
const G4ParticleDefinition* currentParticle;
const G4MaterialCutsCouple* currentCouple;
@@ -244,13 +253,6 @@ private:
G4double minKinEnergy;
G4double maxKinEnergy;
G4double trueStepLength;
G4double truePathLength;
G4double geomPathLength;
G4double lambda0;
G4double currentRange;
G4GPILSelection valueGPILSelectionMSC;
G4bool latDisplasment;
G4bool buildLambdaTable;
};
@@ -289,6 +291,7 @@ inline G4double G4VMultipleScattering::AlongStepGetPhysicalInteractionLength(
valueGPILSelectionMSC = NotCandidateForSelection;
G4double steplength = GetContinuousStepLimit(track,previousStepSize,
currentMinimalStep,currentSafety);
// G4cout << "StepLimit= " << steplength << G4endl;
// set return value for G4GPILSelection
*selection = valueGPILSelectionMSC;
return steplength;
@@ -303,27 +306,14 @@ inline G4double G4VMultipleScattering::GetContinuousStepLimit(
G4double&)
{
DefineMaterial(track.GetMaterialCutsCouple());
G4double e = track.GetKineticEnergy();
SelectModel(e);
const G4ParticleDefinition* p = track.GetDefinition();
lambda0 = GetLambda(p, e);
currentRange = G4LossTableManager::Instance()->GetTrancatedRange(p,e,currentCouple);
// the next line was in error
// if(currentRange < currentMinimalStep) currentRange = currentMinimalStep;
// the condition/protection correctly should be
if(currentRange < currentMinimalStep) currentMinimalStep = currentRange;
truePathLength = TruePathLengthLimit(track,lambda0,currentMinimalStep);
//G4cout << "StepLimit: tpl= " << truePathLength << " lambda0= "
// << lambda0 << " range= " << currentRange
// << " currentMinStep= " << currentMinimalStep << G4endl;
if (truePathLength < currentMinimalStep) valueGPILSelectionMSC = CandidateForSelection;
geomPathLength = currentModel->GeomPathLength(theLambdaTable,currentCouple,
p,e,lambda0,currentRange,truePathLength);
if(geomPathLength > lambda0) geomPathLength = lambda0;
return geomPathLength;
currentModel = SelectModel(track.GetKineticEnergy());
G4double tPathLength =
currentModel->ComputeTruePathLengthLimit(track, theLambdaTable, currentMinimalStep);
if (tPathLength < currentMinimalStep) valueGPILSelectionMSC = CandidateForSelection;
// G4cout << "tPathLength= " << tPathLength << " currentMinimalStep= " << currentMinimalStep<< G4endl;
return currentModel->ComputeGeomPathLength(tPathLength);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VMultipleScattering::ContinuousStepLimit(
@@ -344,10 +334,11 @@ inline G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p,
if(theLambdaTable) {
G4bool b;
x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
} else {
x = currentModel->CrossSection(currentCouple,p,e);
}
if(x > DBL_MIN) x = 1./x;
else x = DBL_MAX;
return x;
}
@@ -357,12 +348,8 @@ inline G4VParticleChange* G4VMultipleScattering::AlongStepDoIt(
const G4Track&,
const G4Step& step)
{
G4double geomStepLength = step.GetStepLength();
if((geomStepLength == geomPathLength) && (truePathLength <= currentRange))
trueStepLength = truePathLength;
else
trueStepLength = currentModel->TrueStepLength(geomStepLength);
fParticleChange.ProposeTrueStepLength(trueStepLength);
fParticleChange.ProposeTrueStepLength(
currentModel->ComputeTrueStepLength(step.GetStepLength()));
return &fParticleChange;
}
@@ -379,9 +366,9 @@ inline G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& tra
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SelectModel(G4double& kinEnergy)
inline G4VEmModel* G4VMultipleScattering::SelectModel(G4double kinEnergy)
{
currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
return modelManager->SelectModel(kinEnergy, currentMaterialIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -464,11 +451,22 @@ inline const G4ParticleDefinition* G4VMultipleScattering::Particle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
inline G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
{
return theLambdaTable;
}
inline
const G4MaterialCutsCouple* G4VMultipleScattering::CurrentMaterialCutsCouple() const
{
return currentCouple;
}
inline G4VEmModel* G4VMultipleScattering::GetModelByIndex(G4int idx)
{
return modelManager->GetModel(idx);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -1,103 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VSubCutoffProcessor.hh,v 1.6 2003/07/21 12:52:06 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4VSubCutoffProcessor
//
// Author: Vladimir Ivanchenko
//
// Creation date: 03.01.2002
//
// Modifications:
//
// 26-12-02 Secondary production moved to derived classes (V.Ivanchenko)
// 29-12-02 Change interface (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
//
// Class Description:
//
// Abstract class for interface to simualtion of subCutoff
// -------------------------------------------------------------------
//
#ifndef G4VSubCutoffProcessor_h
#define G4VSubCutoffProcessor_h 1
#include "globals.hh"
#include <vector>
class G4Step;
class G4Track;
class G4ParticleDefinition;
class G4VEmModel;
class G4DataVector;
class G4PhysicsTable;
class G4VSubCutoffProcessor
{
public:
G4VSubCutoffProcessor(const G4String& nam): name(nam) {};
virtual ~G4VSubCutoffProcessor() {};
virtual std::vector<G4Track*>* SampleSecondaries(const G4Step&,
G4double& tmax,
G4double& meanLoss,
G4VEmModel*) = 0;
virtual void Initialise(const G4ParticleDefinition*,
const G4ParticleDefinition*,
const G4DataVector*,
const G4DataVector*) = 0;
virtual void SetLambdaSubTable(G4PhysicsTable*) = 0;
virtual G4PhysicsTable* LambdaSubTable() = 0;
G4String GetName() const {return name;};
protected:
private:
// hide assignment operator
G4VSubCutoffProcessor & operator=(const G4VSubCutoffProcessor &right);
G4VSubCutoffProcessor(const G4VSubCutoffProcessor&);
const G4String name;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.hh,v 1.6 2005/02/26 22:01:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ionEffectiveCharge.hh,v 1.7 2006/06/29 19:54:53 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DummyModel.cc,v 1.2 2006/06/29 19:54:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4DummyModel
//
// Author: Vladimir Ivanchenko
//
// Creation date: 07.03.2006
//
// Modifications:
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4DummyModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DummyModel::G4DummyModel(const G4String& nam)
: G4VEmModel(nam)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DummyModel::~G4DummyModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DummyModel::Initialise(const G4ParticleDefinition*,
const G4DataVector&)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
std::vector<G4DynamicParticle*>* G4DummyModel::SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{
std::vector<G4DynamicParticle*>* vdp = 0;
return vdp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc,v 1.24 2005/11/26 15:33:08 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmCalculator.cc,v 1.33 2006/06/29 19:54:57 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -40,6 +43,13 @@
// 08.04.2005 Major optimisation of internal interfaces (V.Ivantchenko)
// 08.05.2005 Use updated interfaces (V.Ivantchenko)
// 23.10.2005 Fix computations for ions (V.Ivantchenko)
// 11.01.2006 Add GetCSDARange (V.Ivantchenko)
// 26.01.2006 Rename GetRange -> GetRangeFromRestricteDEDX (V.Ivanchenko)
// 14.03.2006 correction in GetCrossSectionPerVolume (mma)
// suppress GetCrossSectionPerAtom
// elm->GetA() in ComputeCrossSectionPerAtom
// 22.03.2006 Add ComputeElectronicDEDX and ComputeTotalDEDX (V.Ivanchenko)
// 13.05.2006 Add Corrections for ion stopping (V.Ivanchenko)
//
// Class Description:
//
@@ -84,6 +94,7 @@ G4EmCalculator::G4EmCalculator()
massRatio = 1.0;
currentParticleName= "";
currentMaterialName= "";
theGenericIon = G4GenericIon::GenericIon();
ionEffCharge = new G4ionEffectiveCharge();
isIon = false;
isApplicable = false;
@@ -125,13 +136,60 @@ G4double G4EmCalculator::GetDEDX(G4double kinEnergy, const G4ParticleDefinition*
G4double G4EmCalculator::GetDEDX(G4double kinEnergy, const G4String& particle,
const G4String& material, const G4String& reg)
{
return GetDEDX(kinEnergy,FindParticle(particle),FindMaterial(material),FindRegion(reg));
return GetDEDX(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy, const G4ParticleDefinition* p,
const G4Material* mat, const G4Region* region)
G4double G4EmCalculator::GetRangeFromRestricteDEDX(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
res = manager->GetRangeFromRestricteDEDX(p, kinEnergy, couple);
if(verbose>0) {
G4cout << "G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
<< " range(mm)= " << res/mm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
}
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetCSDARange(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
res = manager->GetCSDARange(p, kinEnergy, couple);
if(verbose>0) {
G4cout << "G4EmCalculator::GetRange: E(MeV)= " << kinEnergy/MeV
<< " range(mm)= " << res/mm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
}
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
@@ -150,16 +208,43 @@ G4double G4EmCalculator::GetRange(G4double kinEnergy, const G4ParticleDefinition
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy, const G4String& particle,
const G4String& material, const G4String& reg)
G4double G4EmCalculator::GetRangeFromRestricteDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& material,
const G4String& reg)
{
return GetRange(kinEnergy,FindParticle(particle),FindMaterial(material),FindRegion(reg));
return GetRangeFromRestricteDEDX(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetKinEnergy(G4double range, const G4ParticleDefinition* p,
const G4Material* mat, const G4Region* region)
G4double G4EmCalculator::GetCSDARange(G4double kinEnergy,
const G4String& particle,
const G4String& material,
const G4String& reg)
{
return GetCSDARange(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetRange(G4double kinEnergy,
const G4String& particle,
const G4String& material,
const G4String& reg)
{
return GetRange(kinEnergy,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetKinEnergy(G4double range,
const G4ParticleDefinition* p,
const G4Material* mat,
const G4Region* region)
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
@@ -181,7 +266,8 @@ G4double G4EmCalculator::GetKinEnergy(G4double range, const G4ParticleDefinition
G4double G4EmCalculator::GetKinEnergy(G4double range, const G4String& particle,
const G4String& material, const G4String& reg)
{
return GetKinEnergy(range,FindParticle(particle),FindMaterial(material),FindRegion(reg));
return GetKinEnergy(range,FindParticle(particle),
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -195,20 +281,22 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple) {
if(couple && UpdateParticle(p, kinEnergy)) {
G4int idx = couple->GetIndex();
FindLambdaTable(p, processName);
if(currentLambda && UpdateParticle(p, kinEnergy)) {
if(currentLambda) {
G4bool b;
G4double e = kinEnergy*massRatio;
res = (((*currentLambda)[idx])->GetValue(e,b))*chargeSquare;
res /= mat->GetTotNbOfAtomsPerVolume();
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(cm^2/g)= " << res*gram/cm2
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
<< " in " << mat->GetName();
if(verbose>1)
G4cout << " idx= " << idx << " e(MeV)= " << e
<< " q2= " << chargeSquare;
G4cout << G4endl;
}
}
}
@@ -229,31 +317,6 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetCrossSectionPerAtom(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4String& processName,
const G4Material* mat,
const G4Region* region)
{
G4double res = GetCrossSectionPerVolume(kinEnergy,p,processName,mat,region);
if(mat) res /= mat->GetTotNbOfAtomsPerVolume();
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetCrossSectionPerAtom( G4double kinEnergy,
const G4String& particle,
const G4String& processName,
const G4String& material,
const G4String& reg)
{
return GetCrossSectionPerAtom(kinEnergy,FindParticle(particle),processName,
FindMaterial(material),FindRegion(reg));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::GetMeanFreePath(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4String& processName,
@@ -308,7 +371,8 @@ void G4EmCalculator::PrintRangeTable(const G4ParticleDefinition* p)
void G4EmCalculator::PrintInverseRangeTable(const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = FindEnergyLossProcess(p);
G4cout << "### G4EmCalculator: Inverse Range Table for " << p->GetParticleName() << G4endl;
G4cout << "### G4EmCalculator: Inverse Range Table for "
<< p->GetParticleName() << G4endl;
if(elp) G4cout << *(elp->InverseRangeTable()) << G4endl;
}
@@ -326,32 +390,41 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
if(verbose > 1) {
G4cout << "### G4EmCalculator::ComputeDEDX: " << p->GetParticleName()
<< " in " << currentMaterialName
<< " e(MeV)= " << kinEnergy/MeV << " cut(MeV)= " << cut/MeV << G4endl;
<< " e(MeV)= " << kinEnergy/MeV << " cut(MeV)= " << cut/MeV
<< G4endl;
}
if(FindEmModel(p, processName, kinEnergy)) {
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
// G4cout << "currentModel= " << currentModel << G4endl;
if(UpdateParticle(p, kinEnergy)) {
G4double escaled = kinEnergy*massRatio;
if(baseParticle) {
res = currentModel->ComputeDEDXPerVolume(mat, baseParticle, escaled, cut)
* chargeSquare;
res = currentModel->ComputeDEDXPerVolume(
mat, baseParticle, escaled, cut) * chargeSquare;
if(verbose > 1)
G4cout << baseParticle->GetParticleName() << " Escaled(MeV)= " << escaled;
G4cout << baseParticle->GetParticleName()
<< " Escaled(MeV)= " << escaled;
} else {
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) G4cout << " no basePart E(MeV)= " << kinEnergy;
}
if(verbose > 1)
G4cout << " DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
if(isIon && currentModel->HighEnergyLimit() > 100.*MeV) {
res += corr->HighOrderCorrections(p,mat,kinEnergy);
if(isIon) {
if(currentModel->HighEnergyLimit() > 100.*MeV)
res += corr->HighOrderCorrections(p,mat,kinEnergy);
else
res *= corr->EffectiveChargeCorrection(p,mat,kinEnergy);
if(verbose > 1)
G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
/*
// emulate boundary region for different parameterisations
G4double eth = currentModel->LowEnergyLimit();
if(eth > 0.05*MeV && eth < 10.*MeV && escaled > eth) {
@@ -363,22 +436,25 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
res1 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
if(verbose > 1)
G4cout << "At boundary energy(MeV)= " << eth/MeV << " DEDX(MeV/mm)= " << res1*mm/MeV
G4cout << "At boundary energy(MeV)= " << eth/MeV
<< " DEDX(MeV/mm)= " << res1*mm/MeV
<< G4endl;
if(isIon) res1 += corr->HighOrderCorrections(p,mat,eth/massRatio);
G4double res0 = res1;
if(FindEmModel(p, processName, eth-1.0*keV)) {
if(baseParticle) {
res0 = currentModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut)
* chargeSquare;
res0 = currentModel->ComputeDEDXPerVolume(
mat, baseParticle, eth, cut) * chargeSquare;
} else {
res0 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
}
//G4cout << "eth= " << eth << " escaled= " << escaled << " res0= " << res0 << " res1= "
//G4cout << "eth= " << eth << " escaled= " << escaled
// << " res0= " << res0 << " res1= "
// << res1 << " q2= " << chargeSquare << G4endl;
res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
}
*/
if(verbose > 0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " DEDX(MeV/mm)= " << res*mm/MeV
@@ -396,6 +472,56 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeElectronicDEDX(G4double kinEnergy,
const G4ParticleDefinition* part,
const G4Material* mat,
G4double cut)
{
currentMaterial = mat;
currentMaterialName = mat->GetName();
G4double dedx = 0.0;
if(UpdateParticle(part, kinEnergy)) {
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
const G4ParticleDefinition* p = (vel[i])->Particle();
if((!isIon && p == part) || (isIon && p == theGenericIon))
dedx += ComputeDEDX(kinEnergy,part,(vel[i])->GetProcessName(),mat,cut);
}
}
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeElectronicDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut)
{
return ComputeElectronicDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition* part,
const G4Material* mat, G4double cut)
{
G4double dedx = ComputeElectronicDEDX(kinEnergy,part,mat,cut);
if(mass > 700.*MeV) dedx += ComputeNuclearDEDX(kinEnergy,part,mat);
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeTotalDEDX(G4double kinEnergy, const G4String& part,
const G4String& mat, G4double cut)
{
return ComputeTotalDEDX(kinEnergy,FindParticle(part),FindMaterial(mat),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& processName,
@@ -418,7 +544,8 @@ G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
if(verbose > 1) {
G4cout << p->GetParticleName() << " E(MeV)= " << kinEnergy/MeV
<< " NuclearDEDX(MeV/mm)= " << res*mm/MeV
<< " NuclearDEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< " NuclearDEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
return res;
@@ -430,7 +557,8 @@ G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& material)
{
return ComputeNuclearDEDX(kinEnergy,FindParticle(particle),FindMaterial(material));
return ComputeNuclearDEDX(kinEnergy,FindParticle(particle),
FindMaterial(material));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -445,21 +573,23 @@ G4double G4EmCalculator::ComputeCrossSectionPerVolume(
currentMaterial = mat;
currentMaterialName = mat->GetName();
G4double res = 0.0;
if(FindEmModel(p, processName, kinEnergy)) {
UpdateParticle(p, kinEnergy);
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->CrossSectionPerVolume(mat, baseParticle, e, cut, e)*chargeSquare;
} else {
res = currentModel->CrossSectionPerVolume(mat, p, e, cut, e);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(cm^2/g)= " << res*gram/cm2
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->CrossSectionPerVolume(
mat, baseParticle, e, cut, e) * chargeSquare;
} else {
res = currentModel->CrossSectionPerVolume(mat, p, e, cut, e);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName()
<< G4endl;
}
}
}
return res;
@@ -474,7 +604,8 @@ G4double G4EmCalculator::ComputeCrossSectionPerVolume(
const G4String& material,
G4double cut)
{
return ComputeCrossSectionPerVolume(kinEnergy,FindParticle(particle),processName,
return ComputeCrossSectionPerVolume(kinEnergy,FindParticle(particle),
processName,
FindMaterial(material),cut);
}
@@ -488,21 +619,23 @@ G4double G4EmCalculator::ComputeCrossSectionPerAtom(
G4double cut)
{
G4double res = 0.0;
if(FindEmModel(p, processName, kinEnergy)) {
UpdateParticle(p, kinEnergy);
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->ComputeCrossSectionPerAtom(baseParticle, e, Z, A, cut)*chargeSquare;
} else {
res = currentModel->ComputeCrossSectionPerAtom(p, e, Z, A, cut);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(barn)= " << res/barn
<< " " << p->GetParticleName()
<< " Z= " << Z << " A= " << A
<< G4endl;
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->ComputeCrossSectionPerAtom(
baseParticle, e, Z, A, cut) * chargeSquare;
} else {
res = currentModel->ComputeCrossSectionPerAtom(p, e, Z, A, cut);
}
if(verbose>0) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " cross(barn)= " << res/barn
<< " " << p->GetParticleName()
<< " Z= " << Z << " A= " << A/(g/mole) << " g/mole"
<< G4endl;
}
}
}
return res;
@@ -516,8 +649,9 @@ G4double G4EmCalculator::ComputeCrossSectionPerAtom(G4double kinEnergy,
const G4Element* elm,
G4double cut)
{
return ComputeCrossSectionPerAtom(kinEnergy,FindParticle(particle),processName,
elm->GetZ(),elm->GetN(),cut);
return ComputeCrossSectionPerAtom(kinEnergy,FindParticle(particle),
processName,
elm->GetZ(),elm->GetA(),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -555,40 +689,51 @@ G4double G4EmCalculator::ComputeMeanFreePath(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p, G4double kinEnergy)
G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p,
G4double kinEnergy)
{
if(p != currentParticle) {
currentParticle = p;
baseParticle = 0;
currentParticleName = p->GetParticleName();
massRatio = 1.0;
mass = p->GetPDGMass();
chargeSquare = 1.0;
currentProcess = FindEnergyLossProcess(p);
currentProcessName = "";
if(currentProcess) currentProcessName = currentProcess->GetProcessName();
if(p->GetParticleType() == "nucleus" &&
currentParticleName != "deuteron" && currentParticleName != "triton") {
baseParticle = G4GenericIon::GenericIon();
currentParticleName != "deuteron" && currentParticleName != "triton") {
baseParticle = theGenericIon;
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
isIon = true;
// G4cout << p->GetParticleName() << " in " << currentMaterial->GetName()
// G4cout << p->GetParticleName()
// << " in " << currentMaterial->GetName()
// << " e= " << kinEnergy << G4endl;
chargeSquare =
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
//G4cout << "q2= " << chargeSquare << G4endl;
} else {
isIon = false;
const G4VEnergyLossProcess* proc = FindEnergyLossProcess(p);
if(proc) {
baseParticle = proc->BaseParticle();
if(currentProcess) {
baseParticle = currentProcess->BaseParticle();
if(baseParticle) {
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
G4double q = p->GetPDGCharge()/baseParticle->GetPDGCharge();
chargeSquare *= q*q;
}
G4double q = baseParticle->GetPDGCharge()/eplus;
chargeSquare /= (q*q);
}
}
}
}
if(isIon) chargeSquare =
if(isIon) {
chargeSquare =
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
if(currentProcess)
currentProcess->SetDynamicMassCharge(massRatio,chargeSquare);
// G4cout << "massR= " << massRatio << " q2= " << chargeSquare << G4endl;
}
return true;
}
@@ -600,7 +745,8 @@ const G4ParticleDefinition* G4EmCalculator::FindParticle(const G4String& name)
if(name != currentParticleName) {
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(!p) {
G4cout << "### WARNING: G4EmCalculator::FindParticle fails to find " << name << G4endl;
G4cout << "### WARNING: G4EmCalculator::FindParticle fails to find "
<< name << G4endl;
}
} else {
p = currentParticle;
@@ -616,7 +762,8 @@ const G4Material* G4EmCalculator::FindMaterial(const G4String& name)
currentMaterial = G4Material::GetMaterial(name);
currentMaterialName = name;
if(!currentMaterial)
G4cout << "### WARNING: G4EmCalculator::FindMaterial fails to find " << name << G4endl;
G4cout << "### WARNING: G4EmCalculator::FindMaterial fails to find "
<< name << G4endl;
}
return currentMaterial;
}
@@ -630,8 +777,9 @@ const G4Region* G4EmCalculator::FindRegion(const G4String& reg)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4MaterialCutsCouple* G4EmCalculator::FindCouple(const G4Material* material,
const G4Region* region)
const G4MaterialCutsCouple* G4EmCalculator::FindCouple(
const G4Material* material,
const G4Region* region)
{
if(!material) return 0;
currentMaterial = material;
@@ -640,7 +788,8 @@ const G4MaterialCutsCouple* G4EmCalculator::FindCouple(const G4Material* materia
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
const G4Region* r = region;
if(!r) r = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
if(!r)
r = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
return theCoupleTable->GetMaterialCutsCouple(material,r->GetProductionCuts());
@@ -684,15 +833,16 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
if(p->GetParticleType() == "nucleus" && partname != "deuteron" && partname != "triton")
part = G4GenericIon::GenericIon();
if(isIon) part = theGenericIon;
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
if((vel[i])->GetProcessName() == currentName && (vel[i])->Particle() == part) {
if((vel[i])->GetProcessName() == currentName &&
(vel[i])->Particle() == part)
{
currentLambda = (vel[i])->LambdaTable();
isApplicable = true;
break;
@@ -702,7 +852,9 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
const std::vector<G4VEmProcess*> vem = lManager->GetEmProcessVector();
G4int n = vem.size();
for(G4int i=0; i<n; i++) {
if((vem[i])->GetProcessName() == currentName && (vem[i])->Particle() == part) {
if((vem[i])->GetProcessName() == currentName &&
(vem[i])->Particle() == part)
{
currentLambda = (vem[i])->LambdaTable();
isApplicable = true;
break;
@@ -710,10 +862,13 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
}
}
if(!currentLambda) {
const std::vector<G4VMultipleScattering*> vmsc = lManager->GetMultipleScatteringVector();
const std::vector<G4VMultipleScattering*> vmsc =
lManager->GetMultipleScatteringVector();
G4int n = vmsc.size();
for(G4int i=0; i<n; i++) {
if((vmsc[i])->GetProcessName() == currentName && (vmsc[i])->Particle() == part) {
if((vmsc[i])->GetProcessName() == currentName &&
(vmsc[i])->Particle() == part)
{
currentLambda = (vmsc[i])->LambdaTable();
isApplicable = true;
break;
@@ -727,25 +882,23 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
const G4String& processName,
G4double kineticEnergy)
G4double kinEnergy)
{
G4bool res = false;
if(!p) {
G4cout << "G4EmCalculator::FindEmModel WARNING: no particle defined" << G4endl;
G4cout << "G4EmCalculator::FindEmModel WARNING: no particle defined"
<< G4endl;
return res;
}
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
G4double kinEnergy = kineticEnergy;
if(p->GetParticleType() == "nucleus" && partname != "deuteron" && partname != "triton") {
part = G4GenericIon::GenericIon();
kinEnergy *= part->GetPDGMass()/p->GetPDGMass();
}
G4double scaledEnergy = kinEnergy*massRatio;
if(isIon) part = theGenericIon;
if(verbose > 1) {
G4cout << "G4EmCalculator::FindEmModel for " << partname
<< " (type= " << p->GetParticleType()
<< ") and " << processName << " at e(MeV)= " << kinEnergy;
<< ") and " << processName << " at e(MeV)= " << scaledEnergy;
if(p != part) G4cout << " GenericIon is the base particle";
G4cout << G4endl;
}
@@ -755,34 +908,40 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
currentModel = 0;
size_t idx = 0;
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
// G4cout << "i= " << i << " part= " << (vel[i])->Particle()->GetParticleName()
// G4cout << "i= " << i << " part= "
// << (vel[i])->Particle()->GetParticleName()
// << " proc= " << (vel[i])->GetProcessName() << G4endl;
if((vel[i])->GetProcessName() == currentName && (vel[i])->Particle() == part) {
if((vel[i])->GetProcessName() == currentName &&
(vel[i])->Particle() == part)
{
const G4ParticleDefinition* bp = (vel[i])->BaseParticle();
// G4cout << "i= " << i << " bp= " << bp << G4endl;
if(!bp) {
currentModel = (vel[i])->SelectModelForMaterial(kinEnergy, idx);
currentModel = (vel[i])->SelectModelForMaterial(scaledEnergy, idx);
isApplicable = true;
break;
} else {
G4double e = kinEnergy*bp->GetPDGMass()/p->GetPDGMass();
for(G4int j=0; j<n; j++) {
if((vel[j])->Particle() == bp) {
currentModel = (vel[j])->SelectModelForMaterial(e, idx);
currentModel = (vel[j])->SelectModelForMaterial(scaledEnergy, idx);
isApplicable = true;
break;
}
}
}
// G4cout << "model= " << currentModel << G4endl;
break;
}
}
if(!currentModel) {
const std::vector<G4VEmProcess*> vem = lManager->GetEmProcessVector();
G4int n = vem.size();
for(G4int i=0; i<n; i++) {
if((vem[i])->GetProcessName() == currentName && (vem[i])->Particle() == part) {
if((vem[i])->GetProcessName() == currentName &&
(vem[i])->Particle() == part)
{
currentModel = (vem[i])->SelectModelForMaterial(kinEnergy, idx);
isApplicable = true;
break;
@@ -790,10 +949,13 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
}
}
if(!currentModel) {
const std::vector<G4VMultipleScattering*> vmsc = lManager->GetMultipleScatteringVector();
const std::vector<G4VMultipleScattering*> vmsc =
lManager->GetMultipleScatteringVector();
G4int n = vmsc.size();
for(G4int i=0; i<n; i++) {
if((vmsc[i])->GetProcessName() == currentName && (vmsc[i])->Particle() == part) {
if((vmsc[i])->GetProcessName() == currentName &&
(vmsc[i])->Particle() == part)
{
currentModel = (vmsc[i])->SelectModelForMaterial(kinEnergy, idx);
isApplicable = true;
break;
@@ -806,17 +968,19 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = 0;
G4VEnergyLossProcess* elp = 0;
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
if(p->GetParticleType() == "nucleus" && partname != "deuteron" && partname != "triton")
part = G4GenericIon::GenericIon();
if(p->GetParticleType() == "nucleus" &&
partname != "deuteron" &&
partname != "triton") part = G4GenericIon::GenericIon();
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
if((vel[i])->Particle() == part) {
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.cc,v 1.13 2005/11/26 16:59:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmCorrections.cc,v 1.20 2006/06/29 19:54:59 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -36,38 +39,55 @@
// Modifications:
// 05.05.2005 V.Ivanchenko Fix misprint in Mott term
// 26.11.2005 V.Ivanchenko Fix effective charge for heavy ions using original paper
// 28.04.2006 V.Ivanchenko General cleanup, add finite size corrections
// 13.05.2006 V.Ivanchenko Add corrections for ion stopping
//
//
// Class Description:
//
// This class provides calculation of EM corrections to ionisation
// This class provides calculation of EM corrections to ionisation
//
// -------------------------------------------------------------------
//
#include "G4EmCorrections.hh"
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4NistManager.hh"
#include "G4VEmModel.hh"
#include "G4Proton.hh"
#include "G4LPhysicsFreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCorrections::G4EmCorrections()
{
Initialise();
particle = 0;
curParticle= 0;
material = 0;
curMaterial= 0;
curVector = 0;
kinEnergy = 0.0;
ionModel = 0;
nIons = 0;
verbose = 1;
massFactor = 1.0;
nist = G4NistManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCorrections::~G4EmCorrections()
{}
{
for(G4int i=0; i<nIons; i++) {delete stopData[i];}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::HighOrderCorrections(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
// J.C Ashley and R.H.Ritchie
@@ -76,131 +96,32 @@ G4double G4EmCorrections::HighOrderCorrections(const G4ParticleDefinition* p,
// valid for kineticEnergy < 0.5 MeV
// Other corrections from S.P.Ahlen Rev. Mod. Phys., Vol 52, No1, 1980
G4double tau = kineticEnergy / p->GetPDGMass();
SetupKinematics(p, mat, e);
if(tau <= 0.0) return 0.0;
G4double gamma = 1.0 + tau;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gamma*gamma);
G4double beta = std::sqrt(beta2);
G4double Barkas = BarkasCorrection (p, mat, e);
G4double Bloch = BlochCorrection (p, mat, e);
G4double Mott = MottCorrection (p, mat, e);
G4double FSize = FiniteSizeCorrection (p, mat, e);
G4double q = p->GetPDGCharge()/eplus;
if(q > 2.5) q *= (1.0 - std::exp(-130.0*beta/std::pow(q,0.66666667)));
else if(q > 1.5) q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double sum = (2.0*(Barkas + Bloch) + FSize + Mott);
G4double q2 = q*q;
G4double ba = beta2/alpha2;
G4double BarkasTerm = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
if(verbose > 1)
G4cout << "EmCorrections: E(MeV)= " << e/MeV << " Barkas= " << Barkas
<< " Bloch= " << Bloch << " Mott= " << Mott << " Fsize= " << FSize
<< " Sum= " << sum << G4endl;
G4double Zeff = 0.0;
G4double norm = 0.0;
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4int iz = G4int(Z);
G4double X = ba / Z;
// Variables to compute L_1
// G4double Eta0Chi = 0.8;
// G4double EtaChi = Eta0Chi * ( 1.0 + 6.02*std::pow( Z,-1.19 ) );
// G4double W = ( EtaChi * std::pow( Z,0.16666667 ) ) / std::sqrt(X);
G4double b = 1.3;
if(1 == iz) {
if(material->GetName() == "G4_lH2") b = 0.6;
else b = 1.8;
}
else if(2 == iz) b = 0.6;
else if(10 >= iz) b = 1.8;
else if(17 >= iz) b = 1.4;
else if(18 == iz) b = 1.8;
else if(25 >= iz) b = 1.4;
else if(50 >= iz) b = 1.35;
G4double W = b/std::sqrt(X);
G4double val;
if(W <= engBarkas[0]) val = corBarkas[0];
else if(W >= engBarkas[46]) val = corBarkas[46]*engBarkas[46]/W;
else {
G4int iw = Index(W, engBarkas, 47);
val = Value(W, engBarkas[iw], engBarkas[iw+1], corBarkas[iw], corBarkas[iw+1]);
}
BarkasTerm += 1.29*val*atomDensity[i] * std::sqrt(Z /X)/ X;
Zeff += Z*atomDensity[i];
norm += atomDensity[i];
}
Zeff /= norm;
BarkasTerm *= 2.0*q;
// L2 correction
G4double y2 = q2 / ba ;
G4double BlochTerm = 1.202;
if(y2 > 0.05) {
BlochTerm = 1.0 / (1.0 + y2) ;
G4double de = BlochTerm;
G4double i = 1.0;
do {
i += 1.0;
de = 1.0/( i * (i*i + y2));
BlochTerm += de;
} while (de > BlochTerm*0.01);
}
BlochTerm *= -2.0*y2;
// Estimation of mean square root of the ionisation potential
G4double ze = 2.0*Zeff;
G4double ze1 = std::log(ze);
G4double eexc= material->GetIonisation()->GetMeanExcitationEnergy()*ze1*ze1/ze;
G4double invbeta = 1.0/beta;
G4double invbeta2= invbeta*invbeta;
G4double za = q*fine_structure_const;
G4double za2 = za*za;
G4double za3 = za2*za;
G4double x = za*invbeta;
G4double cosx;
if(x < COSEB[13]) {
G4int i = Index(x,COSEB,14);
cosx = Value(x,COSEB[i], COSEB[i+1],COSXI[i],COSXI[i+1]);
} else {
cosx = COSXI[13]*COSEB[13]/x;
}
G4double mterm =
za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))))
+ za2*(3.246 - 0.451*beta2)
+ za3*(1.522*beta + 0.987*invbeta)
+ za2*za2*(4.569 - 0.494*beta2 - 2.696*invbeta2)
+ za3*za2*(1.254*beta + 0.222*invbeta - 1.17*invbeta*invbeta2);
G4double eloss = (BarkasTerm + (BlochTerm + mterm)*material->GetElectronDensity()) *
q2 * twopi_mc2_rcl2 *invbeta2;
return eloss;
sum *= material->GetElectronDensity() * q2 * twopi_mc2_rcl2 /beta2;
return sum;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::Bethe(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double mass = p->GetPDGMass();
G4double ratio = electron_mass_c2/mass;
G4double tau = kineticEnergy / mass;
G4double gamma = 1.0 + tau;
G4double bg2 = tau * (tau+2.0);
G4double beta2 = bg2/(gamma*gamma);
G4double tmax = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio);
SetupKinematics(p, mat, e);
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
G4double eexc2 = eexc*eexc;
G4double dedx = 0.5*std::log(2.0*electron_mass_c2*bg2*tmax/eexc2)-beta2;
@@ -210,35 +131,22 @@ G4double G4EmCorrections::Bethe(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::SpinCorrection(const G4ParticleDefinition* p,
const G4Material*,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double mass = p->GetPDGMass();
G4double ratio = electron_mass_c2/mass;
G4double tau = kineticEnergy / mass;
G4double gamma = 1.0 + tau;
G4double bg2 = tau * (tau+2.0);
G4double tmax = 2.0*electron_mass_c2*bg2 /(1. + 2.0*gamma*ratio + ratio*ratio);
G4double dedx = 0.5*tmax/(kineticEnergy + mass);
SetupKinematics(p, mat, e);
G4double dedx = 0.5*tmax/(kinEnergy + mass);
return 0.5*dedx*dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections:: KShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double term = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
@@ -261,19 +169,11 @@ G4double G4EmCorrections:: KShellCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections:: LShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double term = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
@@ -288,7 +188,8 @@ G4double G4EmCorrections:: LShellCorrection(const G4ParticleDefinition* p,
for(G4int j=1; j<nmax; j++) {
G4double ne = G4double(shells.GetNumberOfElectrons(iz,j));
G4double e1 = shells.GetBindingEnergy(iz,j);
// G4cout << "LShell: j= " << j << " ne= " << ne << " e(eV)= " << e/eV << " e0(eV)= " << e0/eV << G4endl;
// G4cout << "LShell: j= " << j << " ne= " << ne << " e(eV)= " << e/eV
// << " e0(eV)= " << e0/eV << G4endl;
term += f*ne*atomDensity[i]*LShell(e1/e0,ba2/Z2)/Z;
}
}
@@ -320,26 +221,29 @@ G4double G4EmCorrections::KShell(G4double tet, G4double eta)
G4int ieta = Index(y, Eta, nEtaK);
corr = Value2(x, y, TheK[itet], TheK[itet+1], Eta[ieta], Eta[ieta+1],
CK[itet][ieta], CK[itet+1][ieta], CK[itet][ieta+1], CK[itet+1][ieta+1]);
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheK[itet]<<" "<< TheK[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CK= " << CK[itet][ieta]<<" "<< CK[itet+1][ieta]<<" "<< CK[itet][ieta+1]<<" "<< CK[itet+1][ieta+1]<<G4endl;
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheK[itet]
//<<" "<< TheK[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CK= " << CK[itet][ieta]<<" "<< CK[itet+1][ieta]
//<<" "<< CK[itet][ieta+1]<<" "<< CK[itet+1][ieta+1]<<G4endl;
}
//G4cout << "Kshell: tet= " << tet << " eta= " << eta << " C= " << corr << " itet,ieta= " << itet <<G4endl;
//G4cout << "Kshell: tet= " << tet << " eta= " << eta << " C= " << corr
//<< " itet,ieta= " << itet <<G4endl;
return corr;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::LShell(G4double tet, G4double eta)
G4double G4EmCorrections::LShell(G4double tet, G4double eta)
{
G4double corr = 0.0;
G4double x = tet;
if(tet < TheL[0]) x = TheL[0];
if(tet < TheL[0]) x = TheL[0];
G4int itet = Index(x, TheL, nL);
// assimptotic case
if(eta >= Eta[nEtaL-1]) {
corr = (Value(x, TheL[itet], TheL[itet+1], UL[itet], UL[itet+1])
corr = (Value(x, TheL[itet], TheL[itet+1], UL[itet], UL[itet+1])
+ Value(x, TheL[itet], TheL[itet+1], VL[itet], VL[itet+1])/eta
)/eta;
} else {
@@ -348,8 +252,10 @@ G4double G4EmCorrections::LShell(G4double tet, G4double eta)
G4int ieta = Index(y, Eta, nEtaL);
corr = Value2(x, y, TheL[itet], TheL[itet+1], Eta[ieta], Eta[ieta+1],
CL[itet][ieta], CL[itet+1][ieta], CL[itet][ieta+1], CL[itet+1][ieta+1]);
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheL[itet]<<" "<< TheL[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CL= " << CL[itet][ieta]<<" "<< CL[itet+1][ieta]<<" "<< CL[itet][ieta+1]<<" "<< CL[itet+1][ieta+1]<<G4endl;
//G4cout << " x= " <<x<<" y= "<<y<<" tet= " <<TheL[itet]
//<<" "<< TheL[itet+1]<<" eta= "<< Eta[ieta]<<" "<< Eta[ieta+1]
// <<" CL= " << CL[itet][ieta]<<" "<< CL[itet+1][ieta]
//<<" "<< CL[itet][ieta+1]<<" "<< CL[itet+1][ieta+1]<<G4endl;
}
// G4cout << "Lshell: tet= " << tet << " eta= " << eta << " C= " << corr << " itet= " << itet <<G4endl;
return corr;
@@ -358,12 +264,11 @@ G4double G4EmCorrections::LShell(G4double tet, G4double eta)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::ShellCorrectionSTD(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double bg2 = tau * (tau+2.0);
G4double taulim= 8.0*MeV/p->GetPDGMass();
SetupKinematics(p, mat, e);
G4double taulim= 8.0*MeV/mass;
G4double bg2lim= taulim * (taulim+2.0);
G4double* shellCorrectionVector =
@@ -393,18 +298,12 @@ G4double G4EmCorrections::ShellCorrectionSTD(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double term = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
@@ -449,13 +348,13 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
if(28 >= iz) {
term += f*(Z - 10.)*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
} else if(32 >= iz) {
term += f*18.0*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
term += f*18.0*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
} else if(60 >= iz) {
term += f*18.0*atomDensity[i]*LShell(eshell,HM[iz-11]*eta)/Z;
term += f*(Z - 28.)*atomDensity[i]*LShell(eshell,HN[iz-33]*eta)/Z;
} else {
term += f*18.0*atomDensity[i]*LShell(eshell,HM[53]*eta)/Z;
term += f*32.0*atomDensity[i]*LShell(eshell,HN[30]*eta)/Z;
term += f*32.0*atomDensity[i]*LShell(eshell,HN[30]*eta)/Z;
term += f*(Z - 60.)*atomDensity[i]*LShell(eshell,150.*eta)/Z;
}
*/
@@ -471,11 +370,10 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::DensityCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double bg2 = tau * (tau+2.0);
SetupKinematics(p, mat, e);
G4double cden = material->GetIonisation()->GetCdensity();
G4double mden = material->GetIonisation()->GetMdensity();
@@ -499,25 +397,16 @@ G4double G4EmCorrections::DensityCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
// J.C Ashley and R.H.Ritchie
// Physical review B Vol.5 No.7 1 April 1972 pp. 2393-2397
// valid for kineticEnergy > 0.5 MeV
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
G4double q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double ba2 = beta2/alpha2;
SetupKinematics(p, mat, e);
G4double BarkasTerm = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* atomDensity = material->GetAtomicNumDensityVector();
G4int numberOfElements = material->GetNumberOfElements();
for (G4int i = 0; i<numberOfElements; i++) {
@@ -525,17 +414,11 @@ G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
G4int iz = G4int(Z);
G4double X = ba2 / Z;
// Variables to compute L_1
// G4double Eta0Chi = 0.8;
// G4double EtaChi = Eta0Chi * ( 1.0 + 6.02*std::pow( Z,-1.19 ) );
// G4double W = ( EtaChi * std::pow( Z,0.16666667 ) ) / std::sqrt(X);
G4double b = 1.3;
if(1 == iz) {
if(material->GetName() == "G4_lH2") b = 0.6;
else b = 1.8;
}
}
else if(2 == iz) b = 0.6;
else if(10 >= iz) b = 1.8;
else if(17 >= iz) b = 1.4;
@@ -552,28 +435,25 @@ G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
G4int iw = Index(W, engBarkas, 47);
val = Value(W, engBarkas[iw], engBarkas[iw+1], corBarkas[iw], corBarkas[iw+1]);
}
BarkasTerm += val*atomDensity[i] * std::sqrt(1.0/(Z*X))/ X;
// G4cout << "i= " << i << " b= " << b << " W= " << W
// << " Z= " << Z << " X= " << X << " val= " << val<< G4endl;
BarkasTerm += val*atomDensity[i] / (std::sqrt(Z*X)*X);
}
BarkasTerm *= q/material->GetTotNbOfAtomsPerVolume();
BarkasTerm *= 1.29*charge/material->GetTotNbOfAtomsPerVolume();
return BarkasTerm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::BlochCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double beta2 = tau*(tau + 2.0)/(gamma*gamma);
SetupKinematics(p, mat, e);
G4double q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double q2 = q*q;
G4double y2 = q2/ba2;
G4double y2 = q2*alpha2 / beta2;
G4double term = 1.0/(1.0 + y2);
G4double del;
G4double j = 1.0;
@@ -589,26 +469,31 @@ G4double G4EmCorrections::BlochCorrection(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::MottCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy)
const G4Material* mat,
G4double e)
{
G4double tau = kineticEnergy / p->GetPDGMass();
G4double gamma = 1.0 + tau;
G4double bg2 = tau*(tau + 2.0);
G4double beta2 = bg2/(gamma*gamma);
G4double q = effCharge.EffectiveCharge(p,material,kineticEnergy)/eplus;
G4double beta = std::sqrt(beta2);
G4double eexc = material->GetIonisation()->GetMeanExcitationEnergy();
G4double mterm = 0.0;
SetupKinematics(p, mat, e);
G4double mterm = pi*fine_structure_const*beta*charge;
/*
G4double mterm = 0.0;
if(beta > 0.0) {
// Estimation of mean square root of the ionisation potential
G4double Zeff = 0.0;
G4double norm = 0.0;
for (G4int i = 0; i<numberOfElements; i++) {
G4double Z = (*theElementVector)[i]->GetZ();
Zeff += Z*atomDensity[i];
norm += atomDensity[i];
}
Zeff *= (2.0/norm);
G4double ze1 = std::log(Zeff);
G4double eexc= material->GetIonisation()->GetMeanExcitationEnergy()*ze1*ze1/Zeff;
G4double invbeta = 1.0/beta;
G4double invbeta2= invbeta*invbeta;
G4double za = q*fine_structure_const;
G4double za = charge*fine_structure_const;
G4double za2 = za*za;
G4double za3 = za2*za;
G4double x = za*invbeta;
@@ -621,47 +506,96 @@ G4double G4EmCorrections::MottCorrection(const G4ParticleDefinition* p,
}
mterm =
za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))))
za*beta*(1.725 + pi*cosx*(0.52 - 2.0*std::sqrt(eexc/(2.0*electron_mass_c2*bg2))));
+ za2*(3.246 - 0.451*beta2)
+ za3*(1.522*beta + 0.987*invbeta)
+ za2*za2*(4.569 - 0.494*beta2 - 2.696*invbeta2)
+ za3*za2*(1.254*beta + 0.222*invbeta - 1.17*invbeta*invbeta2);
}
*/
return mterm;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::FiniteSizeCorrection(const G4ParticleDefinition* p,
const G4Material* mat,
G4double e)
// Finite size corrections are parameterized according to
// J.D.Jackson Phys. Rev. D59 (1998) 017301
{
SetupKinematics(p, mat, e);
G4double term = 0.0;
//Leptons
if(p->GetLeptonNumber() != 0) {
G4double x = tmax/(e + mass);
term = x*x;
// Pions and Kaons
} else if(p->GetPDGSpin() == 0.0 && q2 < 1.5) {
G4double xpi = 0.736*GeV;
G4double x = 2.0*electron_mass_c2*tmax0/(xpi*xpi);
term = -std::log(1.0 + x);
// Protons and baryons
} else if(q2 < 1.5) {
G4double xp = 0.8426*GeV;
G4double x = 2.0*electron_mass_c2*tmax0/(xp*xp);
G4double ksi2 = 2.79285*2.79285;
term = -x*(1.0 + 5.0*x/6.0)/((1.0 + x)*(1 + x)) - std::log(1.0 + x);
G4double b = xp*0.5/mass;
G4double c = xp*mass/(electron_mass_c2*(mass + e));
G4double lb = b*b;
G4double lb2= lb*lb;
G4double nu = 0.5*c*c;
G4double x1 = 1.0 + x;
G4double x2 = x1*x1;
G4double l1 = 1.0 - lb;
G4double l2 = l1*l1;
G4double lx = 1.0 + lb*x;
G4double ia = lb2*(lx*std::log(lx/x1)/x + l1 -
0.5*x*l2/(lb*x1) +
x*(3.0 + 2.0*x)*l2*l1/(6.0*x2*lb2))/(l2*l2);
G4double ib = x*x*(3.0 + x)/(6.0*x2*x1);
term += lb*((ksi2 - 1.0)*ia + nu*ksi2*ib);
// G4cout << "Proton F= " << term << " ia= " << ia << " ib= " << ib << " lb= " << lb<< G4endl;
//ions
} else {
G4double xp = 0.8426*GeV/std::pow(mass/proton_mass_c2,-0.33333333);
G4double x = 2.0*electron_mass_c2*tmax0/(xp*xp);
term = -std::log(1.0 + x);
//G4cout << "Ion F= " << term << G4endl;
}
return term;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::NuclearDEDX(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy,
G4bool fluct)
const G4Material* mat,
G4double e,
G4bool fluct)
{
G4double nloss = 0.0;
if(kineticEnergy <= 0.0) return nloss;
if(e <= 0.0) return nloss;
SetupKinematics(p, mat, e);
lossFlucFlag = fluct;
// Projectile nucleus
G4double z1 = std::abs((p->GetPDGCharge())/eplus) ;
G4double m1 = p->GetPDGMass()/amu_c2;
G4int NumberOfElements = material->GetNumberOfElements() ;
const G4ElementVector* theElementVector =
material->GetElementVector() ;
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector() ;
G4double z1 = std::abs(particle->GetPDGCharge()/eplus);
G4double m1 = mass/amu_c2;
// loop for the elements in the material
for (G4int iel=0; iel<NumberOfElements; iel++) {
for (G4int iel=0; iel<numberOfElements; iel++) {
const G4Element* element = (*theElementVector)[iel] ;
G4double z2 = element->GetZ();
G4double m2 = element->GetA()*mole/g ;
nloss += (NuclearStoppingPower(kineticEnergy, z1, z2, m1, m2))
* theAtomicNumDensityVector[iel] ;
nloss += (NuclearStoppingPower(kinEnergy, z1, z2, m1, m2))
* atomDensity[iel] ;
}
nloss *= theZieglerFactor;
return nloss;
@@ -669,8 +603,8 @@ G4double G4EmCorrections::NuclearDEDX(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double z1, G4double z2,
G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double z1, G4double z2,
G4double m1, G4double m2)
{
G4double energy = kineticEnergy/keV ; // energy in keV
@@ -678,14 +612,14 @@ G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
G4double rm;
if(z1 > 1.5) rm = (m1 + m2) * ( std::pow(z1, .23) + std::pow(z2, .23) ) ;
else rm = (m1 + m2) * std::pow(z2, 0.333333);
else rm = (m1 + m2) * std::pow(z2, 0.333333);
G4double er = 32.536 * m2 * energy / ( z1 * z2 * rm ) ; // reduced energy
for (G4int i=1; i<104; i++)
{
if (er > e[i]) {
nloss = (a[i] - a[i-1])*(er-e[i-1])/(e[i] - e[i-1]) + a[i-1];
if (er > ed[i]) {
nloss = (a[i] - a[i-1])*(er-ed[i-1])/(ed[i] - ed[i-1]) + a[i-1];
break;
}
}
@@ -696,17 +630,141 @@ G4double G4EmCorrections::NuclearStoppingPower(G4double kineticEnergy,
(4.0 + 0.197*std::pow(er,-1.6991)+6.584*std::pow(er,-1.0494))) ;
nloss *= G4RandGauss::shoot(1.0,sig) ;
}
}
nloss *= 8.462 * z1 * z2 * m1 / rm ; // Return to [ev/(10^15 atoms/cm^2]
if ( nloss < 0.0) nloss = 0.0 ;
return nloss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ionEffectiveCharge* G4EmCorrections::GetIonEffectiveCharge(G4VEmModel* m)
{
if(m) ionModel = m;
return &effCharge;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4EmCorrections::GetNumberOfStoppingVectors()
{
return nIons;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::EffectiveChargeCorrection(const G4ParticleDefinition* p,
const G4Material* mat,
G4double ekin)
{
G4double factor = 1.0;
if(p->GetPDGCharge() <= 2.5*eplus) return factor;
if(verbose > 1)
G4cout << "EffectiveChargeCorrection: " << p->GetParticleName() << " in " << mat->GetName()
<< " ekin(MeV)= " << ekin/MeV << G4endl;
if(p != curParticle || mat != curMaterial) {
curParticle = p;
curMaterial = 0;
curVector = 0;
G4int Z = p->GetAtomicNumber();
G4int A = p->GetAtomicMass();
if(verbose > 1) G4cout << "Zion= " << Z << " Aion= " << A << G4endl;
massFactor = proton_mass_c2/(nist->GetIsotopeMass(Z,A)*amu_c2);
idx = 0;
for(; idx<nIons; idx++) {
if(Z == Zion[idx] && A == Aion[idx]) {
if(materialList[idx] == mat) {
curMaterial = mat;
curVector = stopData[idx];
break;
} else if(materialList[idx] == 0) {
if(materialName[idx] == mat->GetName())
curVector = InitialiseMaterial(mat);
}
}
}
}
if(curVector) {
G4bool b;
factor = curVector->GetValue(ekin*massFactor,b);
}
if(verbose > 1) G4cout << " factor= " << factor << G4endl;
return factor;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCorrections::AddStoppingData(G4int Z, G4int A,
const G4String& mname,
G4PhysicsVector& dVector)
{
idx = 0;
for(; idx<nIons; idx++) {
if(Z == Zion[idx] && A == Aion[idx] && mname == materialName[idx])
break;
}
if(idx == nIons) {
Zion.push_back(Z);
Aion.push_back(A);
materialName.push_back(mname);
materialList.push_back(0);
stopData.push_back(0);
nIons++;
} else {
if(stopData[idx]) delete stopData[idx];
}
size_t nbins = dVector.GetVectorLength();
size_t n = 0;
for(; n<nbins; n++) {
if(dVector.GetLowEdgeEnergy(n) > 2.0*MeV) break;
}
if(n < nbins) nbins = n + 1;
G4LPhysicsFreeVector* v =
new G4LPhysicsFreeVector(nbins,
dVector.GetLowEdgeEnergy(0),
dVector.GetLowEdgeEnergy(nbins-1));
G4bool b;
for(size_t i=0; i<nbins; i++) {
G4double e = dVector.GetLowEdgeEnergy(i);
G4double dedx = dVector.GetValue(e, b);
v->PutValues(i, e, dedx);
}
// G4cout << *v << G4endl;
stopData[idx] = v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4EmCorrections::InitialiseMaterial(const G4Material* mat)
{
G4PhysicsVector* v = 0;
const G4Material* m = nist->FindOrBuildMaterial(materialName[idx],false);
if(m) {
materialList[idx] = m;
curMaterial = mat;
v = stopData[idx];
size_t nbins = v->GetVectorLength();
const G4ParticleDefinition* p = G4Proton::Proton();
if(verbose>1) G4cout << "G4ionIonisation::InitialiseMaterial Stooping data for "
<< materialName[idx] << G4endl;
G4bool b;
for(size_t i=0; i<nbins; i++) {
G4double e = v->GetLowEdgeEnergy(i);
G4double dedx = v->GetValue(e, b);
G4double dedx1= ionModel->ComputeDEDXPerVolume(mat, p, e, e)*
effCharge.EffectiveChargeSquareRatio(curParticle,mat,e/massFactor);
v->PutValue(i, dedx/dedx1);
if(verbose>1) G4cout << " E(meV)= " << e/MeV << " Correction= " << dedx/dedx1
<< " " << dedx << " " << dedx1 << G4endl;
}
}
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCorrections::Initialise()
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
@@ -887,7 +945,7 @@ void G4EmCorrections::Initialise()
};
for(i=0; i<104; i++) {
e[i] = nuca[i][0];
ed[i] = nuca[i][0];
a[i] = nuca[i][1];
}
@@ -1322,7 +1380,7 @@ void G4EmCorrections::Initialise()
};
const G4double tau[93] = {
const G4double ntau[93] = {
0.0,
-251.1, 512.8, 1724, 649, 658.8, 594.1, 946.6, 969.2, 1154, 997.8,
939.3, 775.5, 619.9, 848.3, 973.4, 1035, 1252, 698.8, 1043, 1080,
@@ -1338,7 +1396,7 @@ void G4EmCorrections::Initialise()
for(i=0; i<93; i++) {
MSH[i] = mm[i];
TAU[i] = tau[i];
TAU[i] = ntau[i];
}
const G4double coseb[14] = {0.0,0.05,0.1,0.15,0.2,0.3,0.4,0.5,0.6,0.8,
1.0,1.2,1.5,2.0};
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmModelManager.cc,v 1.31 2005/11/29 08:06:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmModelManager.cc,v 1.36 2006/06/29 19:55:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -53,6 +56,8 @@
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-08-05 Fix cut for e+e- pair production (V.Ivanchenko)
// 29-11-05 Add protection for arithmetic operations with cut=DBL_MAX (V.Ivanchenko)
// 20-01-06 Introduce G4EmTableType and reducing number of methods (VI)
// 13-05-06 Add GetModel by index method (VI)
//
// Class Description:
//
@@ -181,7 +186,8 @@ void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
G4VEmFluctuationModel* fm, const G4Region* r)
{
if(!p) {
G4cout << "G4EmModelManager::AddEmModel WARNING: no model defined." << G4endl;
G4cout << "G4EmModelManager::AddEmModel WARNING: no model defined."
<< G4endl;
return;
}
models.push_back(p);
@@ -209,7 +215,8 @@ void G4EmModelManager::AddEmModel(G4int num, G4VEmModel* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::UpdateEmModel(const G4String& nam, G4double emin, G4double emax)
void G4EmModelManager::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
if (nEmModels) {
for(G4int i=0; i<nEmModels; i++) {
@@ -227,6 +234,19 @@ void G4EmModelManager::UpdateEmModel(const G4String& nam, G4double emin, G4doubl
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4EmModelManager::GetModel(G4int i)
{
G4VEmModel* m = 0;
if(i >= 0 && i < nEmModels) m = models[i];
else if(verboseLevel > 0)
G4cout << "G4EmModelManager::GetModel WARNING: "
<< "index " << i << " is wrong Nmodels= "
<< nEmModels << G4endl;
return m;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
const G4ParticleDefinition* sp,
G4double theMinSubRange,
@@ -248,7 +268,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
Clear();
G4RegionStore* regionStore = G4RegionStore::GetInstance();
const G4Region* world = regionStore->GetRegion("DefaultRegionForTheWorld", false);
const G4Region* world =
regionStore->GetRegion("DefaultRegionForTheWorld", false);
// Identify the list of regions with different set of models
nRegions = 1;
@@ -308,7 +329,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
if (n>0) tmin = std::max(tmin, eHigh[n-1]);
if(1 < verboseLevel) {
G4cout << "Model #" << ii << " <" << model->GetName() << "> for region <";
G4cout << "Model #" << ii
<< " <" << model->GetName() << "> for region <";
if (region) G4cout << region->GetName();
G4cout << "> "
<< " tmin(MeV)= " << tmin/MeV
@@ -351,7 +373,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
for(G4int i=0; i<numOfCouples; i++) {
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
const G4ProductionCuts* pcuts = couple->GetProductionCuts();
@@ -374,7 +397,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
if( secondaryParticle == G4Gamma::Gamma() ) idx = 0;
cut = (*theCoupleTable->GetEnergyCutsVector(idx))[i];
if( secondaryParticle == G4Positron::Positron() && cut < DBL_MAX )
cut += (*theCoupleTable->GetEnergyCutsVector(2))[i] + 2.0*electron_mass_c2;
cut += (*theCoupleTable->GetEnergyCutsVector(2))[i] +
2.0*electron_mass_c2;
if( cut < DBL_MAX ) subcut = minSubRange*cut;
}
@@ -385,14 +409,15 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
G4double tcutmin = model->MinEnergyCut(particle, couple);
cut = std::max(cut, tcutmin);
subcut = std::max(subcut, tcutmin);
if(cut < tcutmin) cut = tcutmin;
if(subcut < tcutmin) subcut = tcutmin;
if(1 < verboseLevel) {
G4cout << "The model # " << j
<< "; tcutmin(MeV)= " << tcutmin/MeV
<< "; tcut(MeV)= " << cut/MeV
<< "; tsubcut(MeV)= " << subcut/MeV
<< G4endl;
<< " for " << particle->GetParticleName()
<< G4endl;
}
}
theCuts.push_back(cut);
@@ -417,7 +442,8 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple)
const G4MaterialCutsCouple* couple,
G4EmTableType tType)
{
// vectors to provide continues dE/dx
@@ -429,11 +455,18 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4double subcut = 0.0;
if(fTotal == tType) cut = DBL_MAX;
else if(fSubRestricted == tType) subcut = theSubCuts[i];
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVector() for "
<< couple->GetMaterial()->GetName()
<< " Ecut(MeV)= " << cut/MeV
<< " Ecut(MeV)= " << cut
<< " Esubcut(MeV)= " << subcut
<< " Type " << tType
<< " for " << particle->GetParticleName()
<< G4endl;
}
@@ -444,7 +477,6 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
dedxLow.resize(nmod);
dedxHigh.resize(nmod);
if(1 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName()
@@ -464,15 +496,27 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
e = upperEkin[regModels->ModelIndex(0)];
G4VEmModel* model = models[regModels->ModelIndex(0)];
dedxHigh[0] = 0.0;
if(model) dedxHigh[0] = model->ComputeDEDX(couple,particle,e,cut);
if(model && cut > subcut) {
dedxHigh[0] = model->ComputeDEDX(couple,particle,e,cut);
if(subcut > 0.0)
dedxHigh[0] -= model->ComputeDEDX(couple,particle,e,subcut);
}
if(nmod > 1) {
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,cut);
e = upperEkin[regModels->ModelIndex(j)];
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,cut);
G4int idx = regModels->ModelIndex(j);
dedxLow[j] = models[idx]->ComputeDEDX(couple,particle,e,cut);
if(subcut > 0.0)
dedxLow[j] -= models[idx]->ComputeDEDX(couple,particle,e,subcut);
if(subcut == cut) dedxLow[j] = 0.0;
e = upperEkin[idx];
dedxHigh[j] = models[idx]->ComputeDEDX(couple,particle,e,cut);
if(subcut > 0.0)
dedxHigh[j] -= models[idx]->ComputeDEDX(couple,particle,e,subcut);
if(subcut == cut) dedxHigh[j] = 0.0;
}
for(j=1; j<nmod; j++) {
@@ -502,115 +546,20 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
model = models[regModels->ModelIndex(k)];
G4double dedx = 0.0;
if(model) dedx = model->ComputeDEDX(couple,particle,e,cut)*fac;
if(dedx < 0.0) dedx = 0.0;
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
<< " E(MeV)= " << e/MeV
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
<< " fac= " << fac
<< G4endl;
}
aVector->PutValue(j, dedx);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillDEDXVectorForPreciseRange(
G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple)
{
// vectors to provide continues dE/dx
G4DataVector factor;
G4DataVector dedxLow;
G4DataVector dedxHigh;
G4double e;
size_t i = couple->GetIndex();
if(2 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVectorForPreciseRange() for "
<< couple->GetMaterial()->GetName()
<< G4endl;
}
G4int reg = idxOfRegionModels[i];
const G4RegionModels* regModels = setOfRegionModels[reg];
G4int nmod = regModels->NumberOfModels();
factor.resize(nmod);
dedxLow.resize(nmod);
dedxHigh.resize(nmod);
if(2 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName()
<< " at the region #" << reg
<< G4endl;
}
// calculate factors to provide continuity of energy loss
factor[0] = 1.0;
G4int j;
G4int totBinsLoss = aVector->GetVectorLength();
dedxLow[0] = 0.0;
e = upperEkin[regModels->ModelIndex(0)];
G4VEmModel* model = models[regModels->ModelIndex(0)];
dedxHigh[0] = 0.0;
if(model) dedxHigh[0] = model->ComputeDEDX(couple,particle,e,e);
if(nmod > 1) {
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
dedxLow[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,e);
e = upperEkin[regModels->ModelIndex(j)];
dedxHigh[j] = models[regModels->ModelIndex(j)]->ComputeDEDX(couple,particle,e,e);
}
for(j=1; j<nmod; j++) {
if(dedxLow[j] > 0.0) factor[j] = (dedxHigh[j-1]/dedxLow[j] - 1.0);
else factor[j] = 0.0;
}
if(2 < verboseLevel) {
G4cout << "Loop over " << totBinsLoss << " bins start " << G4endl;
}
}
// Calculate energy losses vector
for(j=0; j<totBinsLoss; j++) {
G4double e = aVector->GetLowEdgeEnergy(j);
G4double fac = 1.0;
// Choose a model of energy losses
G4int k = 0;
if (nmod > 1 && e > upperEkin[regModels->ModelIndex(0)]) {
do {
k++;
fac *= (1.0 + factor[k]*upperEkin[regModels->ModelIndex(k-1)]/e);
} while (k<nmod-1 && e > upperEkin[regModels->ModelIndex(k)] );
}
model = models[regModels->ModelIndex(k)];
G4double dedx = 0.0;
if(model) dedx = model->ComputeDEDX(couple,particle,e,e)*fac;
G4double dedx0 = 0.0;
if(model && cut > subcut) {
dedx = model->ComputeDEDX(couple,particle,e,cut);
dedx0 = dedx;
if(subcut > 0.0) dedx -= model->ComputeDEDX(couple,particle,e,subcut);
dedx *= fac;
}
if(dedx < 0.0) dedx = 0.0;
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
<< " E(MeV)= " << e/MeV
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
<< " dEdx0(MeV/mm)= " << dedx0*mm/MeV
<< " fac= " << fac
<< G4endl;
}
@@ -621,28 +570,35 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple,
G4bool startFromNull)
const G4MaterialCutsCouple* couple,
G4bool startFromNull,
G4EmTableType tType)
{
// vectors to provide continues dE/dx
// vectors to provide continues cross section
G4DataVector factor;
G4DataVector sigmaLow;
G4DataVector sigmaHigh;
G4double e;
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4double tmax = DBL_MAX;
if (fSubRestricted == tType) {
tmax = cut;
cut = theSubCuts[i];
}
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillLambdaVector() for particle "
<< particle->GetParticleName()
<< " in " << couple->GetMaterial()->GetName()
<< " Ecut(MeV)= " << cut
<< " Emax(MeV)= " << tmax
<< " Type " << tType
<< G4endl;
}
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4int reg = idxOfRegionModels[i];
const G4RegionModels* regModels = setOfRegionModels[reg];
G4int nmod = regModels->NumberOfModels();
@@ -665,7 +621,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
e = upperEkin[regModels->ModelIndex(0)];
G4VEmModel* model = models[regModels->ModelIndex(0)];
sigmaHigh[0] = 0.0;
if(model) sigmaHigh[0] = model->CrossSection(couple,particle,e,cut,e);
if(model) sigmaHigh[0] = model->CrossSection(couple,particle,e,cut,tmax);
if(2 < verboseLevel) {
G4cout << "### For material " << couple->GetMaterial()->GetName()
@@ -675,7 +631,8 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
<< " Emax(MeV)= " << e/MeV
<< " nbins= " << totBinsLambda
<< G4endl;
G4cout << " model #0 eUp= " << e << " sigmaUp= " << sigmaHigh[0] << G4endl;
G4cout << " model #0 eUp= " << e
<< " sigmaUp= " << sigmaHigh[0] << G4endl;
}
@@ -684,9 +641,11 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,e);
sigmaLow[j] =
models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,tmax);
e = upperEkin[regModels->ModelIndex(j)];
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,e);
sigmaHigh[j] =
models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,cut,tmax);
if(1 < verboseLevel) {
G4cout << " model #" << j << " eUp= " << e
<< " sigmaUp= " << sigmaHigh[j]
@@ -717,119 +676,15 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
model = models[regModels->ModelIndex(k)];
G4double cross = 0.0;
if(model) cross = model->CrossSection(couple,particle,e,cut,e)*fac;
if(model) cross = model->CrossSection(couple,particle,e,cut,tmax)*fac;
if(j==0 && startFromNull) cross = 0.0;
if(2 < verboseLevel) {
G4cout << "FillLambdaVector: " << j << ". e(MeV)= " << e/MeV
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac << " k= " << k << " model= " << regModels->ModelIndex(k)
<< G4endl;
}
if(cross < 0.0) cross = 0.0;
aVector->PutValue(j, cross);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple,
G4bool startFromNull)
{
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillSubLambdaTable() for particle "
<< particle->GetParticleName() << G4endl;
}
// vectors to provide continues dE/dx
G4DataVector factor;
G4DataVector sigmaLow;
G4DataVector sigmaHigh;
G4double e;
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
G4double subcut = theSubCuts[i];
G4int reg = idxOfRegionModels[i];
const G4RegionModels* regModels = setOfRegionModels[reg];
G4int nmod = regModels->NumberOfModels();
factor.resize(nmod);
sigmaLow.resize(nmod);
sigmaHigh.resize(nmod);
if(2 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName() << G4endl;
}
// calculate factors to provide continuity of energy loss
factor[0] = 1.0;
G4int j;
G4int totBinsLambda = aVector->GetVectorLength();
sigmaLow[0] = 0.0;
e = upperEkin[regModels->ModelIndex(0)];
if(2 < verboseLevel) {
G4cout << "### For material " << couple->GetMaterial()->GetName()
<< " are available " << nmod
<< " models"
<< " Ecut(MeV)= " << cut/MeV
<< " nbins= " << totBinsLambda
<< G4endl;
}
G4VEmModel* model = models[regModels->ModelIndex(0)];
sigmaHigh[0] = 0.0;
if(model) sigmaHigh[0] = model->CrossSection(couple,particle,e,subcut,cut);
if(nmod > 1) {
for(j=1; j<nmod; j++) {
e = upperEkin[regModels->ModelIndex(j-1)];
sigmaLow[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,subcut,cut);
e = upperEkin[regModels->ModelIndex(j)];
sigmaHigh[j] = models[regModels->ModelIndex(j)]->CrossSection(couple,particle,e,subcut,cut);
}
for(j=1; j<nmod; j++) {
if(sigmaLow[j] > 0.0) factor[j] = (sigmaHigh[j-1]/sigmaLow[j] - 1.0);
else factor[j] = 0.0;
}
}
// Calculate energy losses vector
for(j=0; j<totBinsLambda; j++) {
e = aVector->GetLowEdgeEnergy(j);
// Choose a model of energy losses
G4int k = 0;
G4double fac = 1.0;
if (nmod > 1 && e > upperEkin[regModels->ModelIndex(0)]) {
do {
k++;
fac *= (1.0 + factor[k]*upperEkin[regModels->ModelIndex(k-1)]/e);
} while (k<nmod-1 && e > upperEkin[regModels->ModelIndex(k)] );
}
model = models[regModels->ModelIndex(k)];
G4double cross = 0.0;
if(model) cross = model->CrossSection(couple,particle,e,subcut,cut)*fac;
if(j==0 && startFromNull) cross = 0.0;
if(2 < verboseLevel) {
G4cout << "BuildLambdaTable: e(MeV)= " << e/MeV
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac
<< G4endl;
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac << " k= " << k
<< " model= " << regModels->ModelIndex(k)
<< G4endl;
}
if(cross < 0.0) cross = 0.0;
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmMultiModel.cc,v 1.4 2005/04/15 11:40:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmMultiModel.cc,v 1.5 2006/06/29 19:55:03 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.cc,v 1.11 2005/12/05 12:13:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EmProcessOptions.cc,v 1.18 2006/06/29 19:55:05 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -37,6 +40,9 @@
// Modifications:
// 30-06-04 G4EmProcess is pure discrete (V.Ivanchenko)
// 24-03-05 Add ApplyCuts and RandomStep (V.Ivanchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 10-05-06 Add command MscStepLimit to G4LossTableManager (V.Ivantchenko)
// 22-05-06 Add SetBremsstrahlungTh (V.Ivanchenko)
//
// Class Description:
//
@@ -173,14 +179,14 @@ void G4EmProcessOptions::SetMaxEnergy(G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMaxEnergyForPreciseRange(G4double val)
void G4EmProcessOptions::SetMaxEnergyForCSDARange(G4double val)
{
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
for(itr = v.begin(); itr != v.end(); itr++) {
G4VEnergyLossProcess* p = *itr;
if(p) p->SetMaxKinEnergyForPreciseRange(val);
if(p) p->SetMaxKinEnergyForCSDARange(val);
}
}
@@ -238,14 +244,14 @@ void G4EmProcessOptions::SetDEDXBinning(G4int val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDEDXBinningForPreciseRange(G4int val)
void G4EmProcessOptions::SetDEDXBinningForCSDARange(G4int val)
{
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
std::vector<G4VEnergyLossProcess*>::const_iterator itr;
for(itr = v.begin(); itr != v.end(); itr++) {
G4VEnergyLossProcess* p = *itr;
if(p) p->SetDEDXBinningForPreciseRange(val);
if(p) p->SetDEDXBinningForCSDARange(val);
}
}
@@ -278,7 +284,7 @@ void G4EmProcessOptions::SetLambdaBinning(G4int val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetStepLimits(G4double v1, G4double v2)
void G4EmProcessOptions::SetStepFunction(G4double v1, G4double v2)
{
const std::vector<G4VEnergyLossProcess*>& v =
theManager->GetEnergyLossProcessVector();
@@ -317,9 +323,9 @@ void G4EmProcessOptions::SetApplyCuts(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBuildPreciseRange(G4bool val)
void G4EmProcessOptions::SetBuildCSDARange(G4bool val)
{
theManager->SetBuildPreciseRange(val);
theManager->SetBuildCSDARange(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -400,15 +406,24 @@ void G4EmProcessOptions::ActivateDeexcitation(G4bool val, const G4Region* r)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetMscStepLimitation(G4bool algorithm, G4double factor)
void G4EmProcessOptions::SetMscStepLimitation(G4bool algorithm,
G4double factor)
{
const std::vector<G4VMultipleScattering*>& u =
theManager->GetMultipleScatteringVector();
std::vector<G4VMultipleScattering*>::const_iterator itm;
for(itm = u.begin(); itm != u.end(); itm++) {
G4VMultipleScattering* s = *itm;
if(s) s->MscStepLimitation(algorithm, factor);
}
theManager->SetMscStepLimitation(algorithm, factor);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetLPMFlag(G4bool val)
{
theManager->SetLPMFlag(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBremsstrahlungTh(G4double val)
{
theManager->SetBremsstrahlungTh(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,29 +1,48 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EnergyLossMessenger.cc,v 1.12 2005/11/11 23:28:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EnergyLossMessenger.cc,v 1.20 2006/06/29 19:55:07 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
// File name: G4EnergyLossMessenger
//
// Author: Michel Maire
//
// Creation date: 22-06-2000
//
// Modifications:
// 10-01-06 SetStepLimits -> SetStepFunction (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 10-05-06 Add command MscStepLimit (V.Ivantchenko)
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -91,7 +110,8 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
G4UIparameter* unitPrm = new G4UIparameter("unit",'s',true);
unitPrm->SetGuidance("unit of finalRange");
unitPrm->SetDefaultValue("mm");
G4String unitCandidates = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
G4String unitCandidates =
G4UIcommand::UnitsList(G4UIcommand::CategoryOf("mm"));
unitPrm->SetParameterCandidates(unitCandidates);
StepFuncCmd->SetParameter(unitPrm);
@@ -115,17 +135,38 @@ G4EnergyLossMessenger::G4EnergyLossMessenger()
IntegCmd->SetDefaultValue(true);
IntegCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
rangeCmd = new G4UIcmdWithABool("/process/eLoss/preciseRange",this);
rangeCmd = new G4UIcmdWithABool("/process/eLoss/CSDARange",this);
rangeCmd->SetGuidance("Switch true/false the precise range calculation.");
rangeCmd->SetParameterName("range",true);
rangeCmd->SetDefaultValue(true);
rangeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
lpmCmd = new G4UIcmdWithABool("/process/eLoss/LPM",this);
lpmCmd->SetGuidance("Switch true/false the LPM effect calculation.");
lpmCmd->SetParameterName("lpm",true);
lpmCmd->SetDefaultValue(true);
lpmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
verCmd = new G4UIcmdWithAnInteger("/process/eLoss/verbose",this);
verCmd->SetGuidance("Set verbose level for EM physics.");
verCmd->SetParameterName("verb",true);
verCmd->SetDefaultValue(true);
verCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
mscCmd = new G4UIcommand("/process/eLoss/MscStepLimit",this);
mscCmd->SetGuidance("Set msc step limit flag and facRange value.");
G4UIparameter* facRange = new G4UIparameter("facRange",'d',false);
facRange->SetGuidance("msc parameter facRange");
facRange->SetParameterRange("facRange>0.");
mscCmd->SetParameter(facRange);
G4UIparameter* msc = new G4UIparameter("algMsc",'s',true);
msc->SetGuidance("msc step algorithm flag");
msc->SetDefaultValue("true");
mscCmd->SetParameter(msc);
mscCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -142,7 +183,9 @@ G4EnergyLossMessenger::~G4EnergyLossMessenger()
delete MaxEnCmd;
delete IntegCmd;
delete rangeCmd;
delete lpmCmd;
delete verCmd;
delete mscCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -166,7 +209,8 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
}
if (command == MinSubSecCmd)
{ G4VEnergyLoss::SetMinDeltaCutInRange(MinSubSecCmd->GetNewDoubleValue(newValue));
{ G4VEnergyLoss::SetMinDeltaCutInRange(
MinSubSecCmd->GetNewDoubleValue(newValue));
}
if (command == StepFuncCmd)
@@ -177,7 +221,18 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
is >> v1 >> v2 >> unt;
v2 *= G4UIcommand::ValueOf(unt);
G4VEnergyLoss::SetStepFunction(v1,v2);
lossTables->SetStepLimits(v1,v2);
lossTables->SetStepFunction(v1,v2);
}
if (command == mscCmd)
{
G4double f;
G4bool a = true;
G4String s;
std::istringstream is(newValue);
is >> f >> s;
if(s == "false" || s == "0" || s == "no") a = false;
lossTables->SetMscStepLimitation(a,f);
}
if (command == MinEnCmd) {
@@ -191,7 +246,10 @@ void G4EnergyLossMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
lossTables->SetIntegral(IntegCmd->GetNewBoolValue(newValue));
}
if (command == rangeCmd) {
lossTables->SetBuildPreciseRange(rangeCmd->GetNewBoolValue(newValue));
lossTables->SetBuildCSDARange(rangeCmd->GetNewBoolValue(newValue));
}
if (command == lpmCmd) {
lossTables->SetLPMFlag(lpmCmd->GetNewBoolValue(newValue));
}
if (command == verCmd) {
lossTables->SetVerbose(verCmd->GetNewIntValue(newValue));
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4EnergyLossTables.cc,v 1.32 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4EnergyLossTables.cc,v 1.33 2006/06/29 19:55:09 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableBuilder.cc,v 1.17 2005/04/12 18:13:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LossTableBuilder.cc,v 1.20 2006/06/29 19:55:11 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -40,6 +43,7 @@
// 21-07-04 V.Ivanchenko Fix problem of range for dedx=0
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 07-12-04 Fix of BuildDEDX table (V.Ivantchenko)
// 27-03-06 Add bool options isIonisation (V.Ivantchenko)
//
// Class Description:
//
@@ -55,6 +59,16 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LossTableBuilder::G4LossTableBuilder()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4LossTableBuilder::~G4LossTableBuilder()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
const std::vector<G4PhysicsTable*>& list)
{
@@ -86,7 +100,8 @@ void G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
G4PhysicsTable* rangeTable)
G4PhysicsTable* rangeTable,
G4bool isIonisation)
// Build range table from the energy loss table
{
size_t n_vectors = dedxTable->length();
@@ -98,7 +113,7 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
for (size_t i=0; i<n_vectors; i++) {
if (rangeTable->GetFlag(i)) {
if (rangeTable->GetFlag(i) || !isIonisation) {
G4PhysicsVector* pv = (*dedxTable)[i];
size_t nbins = pv->GetVectorLength();
size_t bin0 = 0;
@@ -156,7 +171,8 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable,
G4PhysicsTable* invRangeTable)
G4PhysicsTable* invRangeTable,
G4bool isIonisation)
// Build inverse range table from the energy loss table
{
size_t n_vectors = rangeTable->length();
@@ -165,7 +181,7 @@ void G4LossTableBuilder::BuildInverseRangeTable(const G4PhysicsTable* rangeTable
for (size_t i=0; i<n_vectors; i++) {
if (invRangeTable->GetFlag(i)) {
if (invRangeTable->GetFlag(i) || !isIonisation) {
G4PhysicsVector* pv = (*rangeTable)[i];
size_t nbins = pv->GetVectorLength();
G4double elow = pv->GetLowEdgeEnergy(0);
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.cc,v 1.61 2005/10/27 15:05:39 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LossTableManager.cc,v 1.72.2.1 2006/06/29 19:55:13 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -56,6 +59,11 @@
// 13-01-04 Fix problem which takes place for inactivate eIoni (V.Ivanchenko)
// 25-01-04 Fix initialisation problem for ions (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
// 20-01-06 Introduce G4EmTableType to remove repeating code (VI)
// 23-03-06 Set flag isIonisation (VI)
// 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
// 22-05-06 Add methods Set/Get bremsTh (VI)
//
// Class Description:
//
@@ -77,6 +85,8 @@
#include "G4ProductionCutsTable.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4EmCorrections.hh"
#include "G4EmTableType.hh"
#include "G4LossTableBuilder.hh"
G4LossTableManager* G4LossTableManager::theInstance = 0;
@@ -136,11 +146,16 @@ G4LossTableManager::G4LossTableManager()
emCorrections= new G4EmCorrections();
integral = true;
integralActive = false;
buildPreciseRange = false;
buildCSDARange = false;
minEnergyActive = false;
maxEnergyActive = false;
maxEnergyForMuonsActive = false;
stepFunctionActive = false;
flagLPM = true;
flagMSC = true;
facRange = 0.02;
bremsTh = DBL_MAX;
mscActive = false;
verbose = 1;
}
@@ -161,6 +176,7 @@ void G4LossTableManager::Clear()
part_vector.clear();
base_part_vector.clear();
tables_are_built.clear();
isActive.clear();
n_loss = 0;
}
}
@@ -177,6 +193,7 @@ void G4LossTableManager::Register(G4VEnergyLossProcess* p)
range_vector.push_back(0);
inv_range_vector.push_back(0);
tables_are_built.push_back(false);
isActive.push_back(true);
all_tables_are_built = false;
if(!lossFluctuationFlag) p->SetLossFluctuations(false);
if(subCutoffFlag) p->ActivateSubCutoff(true);
@@ -185,7 +202,8 @@ void G4LossTableManager::Register(G4VEnergyLossProcess* p)
if(minEnergyActive) p->SetMinKinEnergy(minKinEnergy);
if(maxEnergyActive) p->SetMaxKinEnergy(maxKinEnergy);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : " << p->GetProcessName() << G4endl;
G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : "
<< p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -202,8 +220,10 @@ void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
void G4LossTableManager::Register(G4VMultipleScattering* p)
{
msc_vector.push_back(p);
if(mscActive) p->MscStepLimitation(flagMSC, facRange);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VMultipleScattering : " << p->GetProcessName() << G4endl;
G4cout << "G4LossTableManager::Register G4VMultipleScattering : "
<< p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -222,7 +242,8 @@ void G4LossTableManager::Register(G4VEmProcess* p)
{
emp_vector.push_back(p);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VEmProcess : " << p->GetProcessName() << G4endl;
G4cout << "G4LossTableManager::Register G4VEmProcess : "
<< p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -237,15 +258,17 @@ void G4LossTableManager::DeRegister(G4VEmProcess* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion, G4VEnergyLossProcess* p)
void G4LossTableManager::RegisterIon(const G4ParticleDefinition* ion,
G4VEnergyLossProcess* p)
{
loss_map[ion] = p;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::RegisterExtraParticle(const G4ParticleDefinition* part,
G4VEnergyLossProcess* p)
void G4LossTableManager::RegisterExtraParticle(
const G4ParticleDefinition* part,
G4VEnergyLossProcess* p)
{
n_loss++;
loss_vector.push_back(p);
@@ -261,36 +284,45 @@ void G4LossTableManager::RegisterExtraParticle(const G4ParticleDefinition* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::EnergyLossProcessIsInitialised(
const G4ParticleDefinition* particle, G4VEnergyLossProcess* p)
const G4ParticleDefinition* particle,
G4VEnergyLossProcess* p)
{
if (first_entry || (particle == firstParticle && all_tables_are_built) ) {
all_tables_are_built = true;
if(1 < verbose)
G4cout << "### G4LossTableManager start initilisation of tables"
<< G4endl;
for (G4int i=0; i<n_loss; i++) {
G4VEnergyLossProcess* el = loss_vector[i];
if(el) {
const G4ProcessManager* pm = el->GetProcessManager();
if (pm->GetProcessActivation(el)) tables_are_built[i] = false;
else tables_are_built[i] = true;
if (!tables_are_built[i]) all_tables_are_built = false;
isActive[i] = pm->GetProcessActivation(el);
tables_are_built[i] = false;
all_tables_are_built = false;
if(1 < verbose) {
G4cout << i <<". "<< el->GetProcessName()
<< " for " << pm->GetParticleType()->GetParticleName()
<< " active= " << pm->GetProcessActivation(el)
<< " table= " << tables_are_built[i]
<< " isIonisation= " << el->IsIonisationProcess()
<< G4endl;
}
} else {
tables_are_built[i] = true;
part_vector[i] = 0;
}
}
if (first_entry) {
first_entry = false;
firstParticle = particle;
}
}
if(!all_tables_are_built) loss_map.clear();
currentParticle = 0;
SetParameters(p);
for (G4int j=0; j<n_loss; j++) {
if (p == loss_vector[j]) {
@@ -325,7 +357,8 @@ G4EnergyLossMessenger* G4LossTableManager::GetMessenger()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::ParticleHaveNoLoss(const G4ParticleDefinition* aParticle)
void G4LossTableManager::ParticleHaveNoLoss(
const G4ParticleDefinition* aParticle)
{
G4String s = "G4LossTableManager:: dE/dx table not found for "
+ aParticle->GetParticleName() + "!";
@@ -333,19 +366,19 @@ void G4LossTableManager::ParticleHaveNoLoss(const G4ParticleDefinition* aParticl
exit(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4LossTableManager::BuildPreciseRange() const
G4bool G4LossTableManager::BuildCSDARange() const
{
return buildPreciseRange;
return buildCSDARange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p)
void G4LossTableManager::BuildPhysicsTable(
const G4ParticleDefinition* aParticle,
G4VEnergyLossProcess* p)
{
if(1 < verbose) {
G4cout << "### G4LossTableManager::BuildDEDXTable() is requested for "
<< aParticle->GetParticleName()
@@ -356,12 +389,10 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
all_tables_are_built = true;
for(G4int i=0; i<n_loss; i++) {
if(!tables_are_built[i] && !base_part_vector[i]) {
const G4ParticleDefinition* curr_part = part_vector[i];
G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
CopyTables(curr_part, curr_proc);
if(curr_proc) CopyTables(curr_part, curr_proc);
}
}
@@ -382,7 +413,7 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
G4VEnergyLossProcess* base_proc)
@@ -390,17 +421,20 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
for (G4int j=0; j<n_loss; j++) {
G4VEnergyLossProcess* proc = loss_vector[j];
if(proc == base_proc || proc->Particle() == part) tables_are_built[j] = true;
if(proc == base_proc || proc->Particle() == part)
tables_are_built[j] = true;
if (!tables_are_built[j] && part == base_part_vector[j]) {
tables_are_built[j] = true;
proc->SetDEDXTable(base_proc->DEDXTable());
proc->SetDEDXTableForSubsec(base_proc->DEDXTableForSubsec());
proc->SetDEDXunRestrictedTable(base_proc->DEDXunRestrictedTable());
proc->SetPreciseRangeTable(base_proc->PreciseRangeTable());
proc->SetCSDARangeTable(base_proc->CSDARangeTable());
proc->SetRangeTableForLoss(base_proc->RangeTableForLoss());
proc->SetInverseRangeTable(base_proc->InverseRangeTable());
proc->SetLambdaTable(base_proc->LambdaTable());
proc->SetSubLambdaTable(base_proc->SubLambdaTable());
proc->SetIonisation(base_proc->IsIonisationProcess());
loss_map[part_vector[j]] = proc;
if (1 < verbose) {
G4cout << "For " << proc->GetProcessName()
@@ -416,47 +450,59 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition* aParticle)
G4VEnergyLossProcess* G4LossTableManager::BuildTables(
const G4ParticleDefinition* aParticle)
{
if(1 < verbose) {
G4cout << "G4LossTableManager::BuildTables() for "
<< aParticle->GetParticleName() << G4endl;
}
std::vector<G4PhysicsTable*> list;
list.clear();
std::vector<G4PhysicsTable*> list;
std::vector<G4VEnergyLossProcess*> loss_list;
loss_list.clear();
G4VEnergyLossProcess* em = 0;
G4VEnergyLossProcess* p = 0;
G4int iem = 0;
G4PhysicsTable* dedx = 0;
G4int i;
for (G4int i=0; i<n_loss; i++) {
if (aParticle == part_vector[i] && !tables_are_built[i] && loss_vector[i]) {
if (loss_vector[i]->IsIonisationProcess() || !em) {
em = loss_vector[i];
for (i=0; i<n_loss; i++) {
p = loss_vector[i];
if (p && aParticle == part_vector[i] && !tables_are_built[i]) {
if (p->IsIonisationProcess() && isActive[i] || !em || em && !isActive[iem] ) {
em = p;
iem= i;
}
list.push_back(loss_vector[i]->BuildDEDXTable());
loss_list.push_back(loss_vector[i]);
dedx = p->BuildDEDXTable(fRestricted);
p->SetDEDXTable(dedx);
list.push_back(dedx);
loss_list.push_back(p);
tables_are_built[i] = true;
}
}
G4int n_dedx = list.size();
if (!n_dedx) return 0;
if (!n_dedx) {
G4cout << "G4LossTableManager WARNING: no DEDX processes for "
<< aParticle->GetParticleName() << G4endl;
return 0;
}
G4int nSubRegions = em->NumberOfSubCutoffRegions();
if (1 < verbose) {
G4cout << "G4LossTableManager::BuildTables() start to build range tables"
<< " and the sum of " << n_dedx << " processes"
<< " iem= " << iem << " em= " << em
<< " iem= " << iem << " em= " << em->GetProcessName()
<< " buildCSDARange= " << buildCSDARange
<< " nSubRegions= " << nSubRegions
<< G4endl;
}
G4PhysicsTable* dedx = em->DEDXTable();
dedx = em->DEDXTable();
if (1 < n_dedx) tableBuilder->BuildDEDXTable(dedx, list);
dedx_vector[iem] = dedx;
G4PhysicsTable* range = em->RangeTableForLoss();
@@ -467,34 +513,54 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition
if(!invrange) invrange = G4PhysicsTableHelper::PreparePhysicsTable(invrange);
inv_range_vector[iem] = invrange;
tableBuilder->BuildRangeTable(dedx, range);
tableBuilder->BuildInverseRangeTable(range, invrange);
G4bool flag = em->IsIonisationProcess();
tableBuilder->BuildRangeTable(dedx, range, flag);
tableBuilder->BuildInverseRangeTable(range, invrange, flag);
if(buildPreciseRange) {
std::vector<G4PhysicsTable*> newlist;
newlist.clear();
G4PhysicsTable* dedxForRange = em->DEDXunRestrictedTable();
for (G4int i=0; i<n_dedx; i++) {
newlist.push_back(loss_list[i]->BuildDEDXTableForPreciseRange());
}
if (1 < n_dedx) tableBuilder->BuildDEDXTable(dedxForRange, newlist);
// if(1<verbose) G4cout << *dedx << G4endl;
em->SetDEDXunRestrictedTable(dedxForRange);
range = em->PreciseRangeTable();
if(!range) range = G4PhysicsTableHelper::PreparePhysicsTable(range);
tableBuilder->BuildRangeTable(dedxForRange, range);
em->SetPreciseRangeTable(range);
}
em->SetRangeTableForLoss(range);
em->SetInverseRangeTable(invrange);
loss_map[aParticle] = em;
for (G4int j=0; j<n_dedx; j++) {
G4VEnergyLossProcess* p = loss_list[j];
p->SetLambdaTable(p->BuildLambdaTable());
if(1<verbose) G4cout << *range << G4endl;
std::vector<G4PhysicsTable*> listSub;
std::vector<G4PhysicsTable*> listCSDA;
for (i=0; i<n_dedx; i++) {
p = loss_list[i];
p->SetIonisation(false);
p->SetLambdaTable(p->BuildLambdaTable(fRestricted));
if (0 < p->NumberOfSubCutoffRegions()) {
p->SetSubLambdaTable(p->BuildLambdaSubTable());
if( p != em) em->AddCollaborativeProcess(p);
dedx = p->BuildDEDXTable(fSubRestricted);
p->SetDEDXTableForSubsec(dedx);
listSub.push_back(dedx);
p->SetSubLambdaTable(p->BuildLambdaTable(fSubRestricted));
}
if(buildCSDARange) {
dedx = p->BuildDEDXTable(fTotal);
p->SetDEDXunRestrictedTable(dedx);
listCSDA.push_back(dedx);
}
}
if (0 < nSubRegions) {
G4PhysicsTable* dedxSub = em->DEDXTableForSubsec();
if (1 < listSub.size()) tableBuilder->BuildDEDXTable(dedxSub, listSub);
em->SetDEDXTableForSubsec(dedxSub);
}
if(buildCSDARange) {
G4PhysicsTable* dedxCSDA = em->DEDXunRestrictedTable();
if (1 < n_dedx) tableBuilder->BuildDEDXTable(dedxCSDA, listCSDA);
em->SetDEDXunRestrictedTable(dedxCSDA);
G4PhysicsTable* rCSDA = em->CSDARangeTable();
if(!rCSDA) range = G4PhysicsTableHelper::PreparePhysicsTable(rCSDA);
tableBuilder->BuildRangeTable(dedxCSDA, rCSDA, flag);
em->SetCSDARangeTable(rCSDA);
}
em->SetIonisation(true);
loss_map[aParticle] = em;
if (1 < verbose) {
G4cout << "G4LossTableManager::BuildTables: Tables are built for "
<< aParticle->GetParticleName()
@@ -504,7 +570,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition
return em;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetLossFluctuations(G4bool val)
{
@@ -514,7 +580,7 @@ void G4LossTableManager::SetLossFluctuations(G4bool val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetSubCutoff(G4bool val)
{
@@ -524,7 +590,7 @@ void G4LossTableManager::SetSubCutoff(G4bool val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetIntegral(G4bool val)
{
@@ -539,7 +605,7 @@ void G4LossTableManager::SetIntegral(G4bool val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMinSubRange(G4double val)
{
@@ -549,12 +615,12 @@ void G4LossTableManager::SetMinSubRange(G4double val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetRandomStep(G4bool)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMinEnergy(G4double val)
{
@@ -573,7 +639,7 @@ void G4LossTableManager::SetMinEnergy(G4double val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMaxEnergy(G4double val)
{
@@ -592,16 +658,16 @@ void G4LossTableManager::SetMaxEnergy(G4double val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMaxEnergyForPreciseRange(G4double val)
void G4LossTableManager::SetMaxEnergyForCSDARange(G4double val)
{
for(G4int i=0; i<n_loss; i++) {
if(loss_vector[i]) loss_vector[i]->SetMaxKinEnergyForPreciseRange(val);
if(loss_vector[i]) loss_vector[i]->SetMaxKinEnergyForCSDARange(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetMaxEnergyForMuons(G4double val)
{
@@ -609,7 +675,7 @@ void G4LossTableManager::SetMaxEnergyForMuons(G4double val)
maxKinEnergyForMuons = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetDEDXBinning(G4int val)
{
@@ -619,16 +685,16 @@ void G4LossTableManager::SetDEDXBinning(G4int val)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetDEDXBinningForPreciseRange(G4int val)
void G4LossTableManager::SetDEDXBinningForCSDARange(G4int val)
{
for(G4int i=0; i<n_loss; i++) {
if(loss_vector[i]) loss_vector[i]->SetDEDXBinningForPreciseRange(val);
if(loss_vector[i]) loss_vector[i]->SetDEDXBinningForCSDARange(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetLambdaBinning(G4int val)
{
@@ -645,7 +711,7 @@ void G4LossTableManager::SetLambdaBinning(G4int val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetVerbose(G4int val)
{
@@ -663,9 +729,9 @@ void G4LossTableManager::SetVerbose(G4int val)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetStepLimits(G4double v1, G4double v2)
void G4LossTableManager::SetStepFunction(G4double v1, G4double v2)
{
stepFunctionActive = true;
maxRangeVariation = v1;
@@ -675,14 +741,14 @@ void G4LossTableManager::SetStepLimits(G4double v1, G4double v2)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetBuildPreciseRange(G4bool val)
void G4LossTableManager::SetBuildCSDARange(G4bool val)
{
buildPreciseRange = val;
buildCSDARange = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetParameters(G4VEnergyLossProcess* p)
{
@@ -693,25 +759,82 @@ void G4LossTableManager::SetParameters(G4VEnergyLossProcess* p)
p->SetVerboseLevel(verbose);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const std::vector<G4VEnergyLossProcess*>& G4LossTableManager::GetEnergyLossProcessVector()
const std::vector<G4VEnergyLossProcess*>&
G4LossTableManager::GetEnergyLossProcessVector()
{
return loss_vector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const std::vector<G4VEmProcess*>& G4LossTableManager::GetEmProcessVector()
{
return emp_vector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const std::vector<G4VMultipleScattering*>& G4LossTableManager::GetMultipleScatteringVector()
const std::vector<G4VMultipleScattering*>&
G4LossTableManager::GetMultipleScatteringVector()
{
return msc_vector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void G4LossTableManager::SetLPMFlag(G4bool val)
{
flagLPM = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4LossTableManager::LPMFlag() const
{
return flagLPM;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::SetMscStepLimitation(G4bool val, G4double factor)
{
mscActive = true;
flagMSC = val;
facRange = factor;
size_t msc = msc_vector.size();
for (size_t j=0; j<msc; j++) {
if(msc_vector[j]) msc_vector[j]->MscStepLimitation(val, factor);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4LossTableManager::MscFlag() const
{
return flagMSC;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LossTableManager::FacRange() const
{
return facRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4LossTableManager::SetBremsstrahlungTh(G4double val)
{
bremsTh = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4LossTableManager::BremsstrahlungTh() const
{
return bremsTh;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.cc,v 1.1 2005/07/25 18:14:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmFluctuationModel.cc,v 1.2 2006/06/29 19:55:15 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc,v 1.3 2005/10/25 18:28:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmModel.cc,v 1.6 2006/06/29 19:55:17 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +39,7 @@
//
// Modifications:
// 25.10.2005 Set default highLimit=100.TeV (V.Ivanchenko)
// 06.02.2006 add method ComputeMeanFreePath() (mma)
//
//
// Class Description:
@@ -47,22 +51,25 @@
#include "G4VEmModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VEmModel::G4VEmModel(const G4String& nam):
lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VEmModel::~G4VEmModel()
{}
G4double G4VEmModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax)
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
@@ -71,12 +78,26 @@ G4double G4VEmModel::CrossSectionPerVolume(
for (size_t i=0; i<nelm; i++) {
const G4Element* elm = (*theElementVector)[i];
cross += theAtomNumDensityVector[i]*
ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
xsec[i] = cross;
}
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
G4double ekin,
const G4Material* material,
G4double emin,
G4double emax)
{
G4double mfp = DBL_MAX;
G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
if (cross >0.) mfp = 1./cross;
return mfp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc,v 1.32 2005/09/04 17:03:53 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEmProcess.cc,v 1.35 2006/06/29 19:55:19 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -38,12 +41,13 @@
// 30-06-04 make it to be pure discrete process (V.Ivanchenko)
// 30-09-08 optimise integral option (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (V.Ivanchenko)
// 11-03-05 Shift verbose level by 1, add applyCuts and killPrimary flags (VI)
// 14-03-05 Update logic PostStepDoIt (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivanchenko)
// 25-07-05 Add protection: integral mode only for charged particles (V.Ivanchenko)
// 25-07-05 Add protection: integral mode only for charged particles (VI)
// 04-09-05 default lambdaFactor 0.8 (V.Ivanchenko)
// 11-01-06 add A to parameters of ComputeCrossSectionPerAtom (VI)
//
//
// Class Description:
@@ -71,7 +75,6 @@
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -190,7 +193,7 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
void G4VEmProcess::BuildLambdaTable()
{
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossSTD::BuildLambdaTable() for process "
G4cout << "G4EmProcess::BuildLambdaTable() for process "
<< GetProcessName() << " and particle "
<< particle->GetParticleName()
<< G4endl;
@@ -238,7 +241,8 @@ void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, const G4Region* region)
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p,
const G4Region* region)
{
modelManager->AddEmModel(order, p, 0, region);
if(p) p->SetParticleChange(pParticleChange);
@@ -246,7 +250,8 @@ void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, const G4Region* region
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::UpdateEmModel(const G4String& nam, G4double emin, G4double emax)
void G4VEmProcess::UpdateEmModel(const G4String& nam,
G4double emin, G4double emax)
{
modelManager->UpdateEmModel(nam, emin, emax);
}
@@ -386,7 +391,8 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
} else {
G4VEmModel* model = SelectModel(kineticEnergy);
cross = model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
cross =
model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
}
return cross;
@@ -394,12 +400,11 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy, G4double Z)
G4double G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy,
G4double Z, G4double A)
{
G4VEmModel* model = SelectModel(kineticEnergy);
G4double A = G4NistManager::Instance()->FindOrBuildElement(G4int(Z), false)->GetN();
G4double cross = model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
return cross;
return model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -420,7 +425,8 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
G4bool yes = true;
if ( theLambdaTable && part == particle) {
const G4String name = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
const G4String name =
GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = theLambdaTable->StorePhysicsTable(name,ascii);
if ( yes ) {
@@ -429,7 +435,8 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
<< " in the directory <" << directory
<< "> " << G4endl;
} else {
G4cout << "Fail to store Physics Tables for " << particle->GetParticleName()
G4cout << "Fail to store Physics Tables for "
<< particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
@@ -438,7 +445,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
return yes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
@@ -457,7 +464,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
G4String filename;
filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,filename,ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,
filename,ascii);
if ( yes ) {
if (0 < verboseLevel) {
G4cout << "Lambda table for " << particleName << " is Retrieved from <"
@@ -480,7 +488,8 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
void G4VEmProcess::FindLambdaMax()
{
if(1 < verboseLevel) {
G4cout << "### G4VEmProcess::FindLambdaMax: " << particle->GetParticleName()
G4cout << "### G4VEmProcess::FindLambdaMax: "
<< particle->GetParticleName()
<< " and process " << GetProcessName() << G4endl;
}
size_t n = theLambdaTable->length();
@@ -590,7 +599,8 @@ G4bool G4VEmProcess::IsIntegral() const
G4PhysicsVector* G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
{
G4PhysicsVector* v = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
G4PhysicsVector* v =
new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
return v;
}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VEnergyLoss.cc,v 1.45 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VEnergyLoss.cc,v 1.46 2006/06/29 19:55:21 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// --------------------------------------------------------------
File diff suppressed because it is too large Load Diff
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.cc,v 1.37 2005/10/27 11:33:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VMultipleScattering.cc,v 1.39 2006/06/29 19:55:25 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -74,6 +77,7 @@
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4GenericIon.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -163,7 +167,10 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
{
if (!firstParticle) {
currentCouple = 0;
firstParticle = &part;
if(part.GetParticleType() == "nucleus" &&
part.GetParticleSubType() == "generic")
firstParticle = G4GenericIon::GenericIon();
else firstParticle = &part;
currentParticle = &part;
}
@@ -181,7 +188,8 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
InitialiseProcess(firstParticle);
if(buildLambdaTable)
theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
const G4DataVector* theCuts = modelManager->Initialise(firstParticle, 0, 10.0, verboseLevel);
const G4DataVector* theCuts =
modelManager->Initialise(firstParticle, 0, 10.0, verboseLevel);
if(2 < verboseLevel) G4cout << theCuts << G4endl;
@@ -1,27 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.cc,v 1.10 2005/02/27 18:07:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ionEffectiveCharge.cc,v 1.13 2006/06/29 19:55:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// -------------------------------------------------------------------
//
@@ -37,6 +40,8 @@
// Modifications:
// 12.09.2004 Set low energy limit to 1 keV (V.Ivanchenko)
// 25.01.2005 Add protection - min Charge 0.1 eplus (V.Ivanchenko)
// 28.04.2006 Set upper energy limit to 50 MeV (V.Ivanchenko)
// 23.05.2006 Set upper energy limit to Z*10 MeV (V.Ivanchenko)
//
// -------------------------------------------------------------------
@@ -84,7 +89,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// Vol.1, Pergamon Press, 1985
// Fast ions or hadrons
G4double reducedEnergy = kineticEnergy * proton_mass_c2/mass ;
if( reducedEnergy > energyHighLimit || Zi < 1.5 ) return charge;
if( reducedEnergy > Zi*energyHighLimit || Zi < 1.5 ) return charge;
static G4double vFermi[92] = {
1.0309, 0.15976, 0.59782, 1.0781, 1.0486, 1.0, 1.058, 0.93942, 0.74562, 0.3424,
@@ -168,14 +173,14 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// Heavy ion case
} else {
G4double z23 = std::pow(z, 0.666667);
G4double zi13 = std::pow(Zi, 0.33333);
G4double zi23 = zi13*zi13;
reducedEnergy = std::max(reducedEnergy,energyBohr/z23);
G4double e = std::max(reducedEnergy,energyBohr/z23);
// v1 is ion velocity in vF unit
G4double v1 = std::sqrt( reducedEnergy / energyBohr )/ vF ;
G4double v1 = std::sqrt( e / energyBohr )/ vF ;
G4double y ;
// Faster than Fermi velocity
@@ -191,10 +196,12 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
// G4cout << "y= " << y << " y3= " << y3 << " v1= " << v1 << " vF= " << vF << G4endl;
q = 1.0 - std::exp( 0.803*y3 - 1.3167*y3*y3 - 0.38157*y - 0.008983*y*y ) ;
// q = 1.0 - std::exp(-0.95*std::sqrt(reducedEnergy/energyBohr)/zi23);
G4double qmin = minCharge/Zi;
if(q < qmin) q = qmin;
G4double tq = 7.6 - std::log(reducedEnergy/keV);
G4double sq = 1.0 + ( 0.18 + 0.0015 * z ) * std::exp( -tq*tq )/ (Zi*Zi);
// G4cout << "sq= " << sq << G4endl;
@@ -205,6 +212,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
G4double lambda = 10.0 * vF * std::pow(1.0-q, 0.6667) / (zi13 * (6.0 + q)) ;
chargeCorrection = sq * (1.0 + (0.5/q - 0.5)*std::log(1.0 + lambda*lambda)/(vF*vF) );
}
// G4cout << "G4ionEffectiveCharge: charge= " << charge << " q= " << q
// << " chargeCor= " << chargeCorrection