Import Geant4 7.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 12:11:21 +02:00
parent 516dbf1a58
commit d93e1e39a9
5384 changed files with 125662 additions and 82444 deletions
+54 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.185 2004/12/09 10:38:02 vnivanch Exp $
$Id: History,v 1.201 2005/05/30 08:55:51 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,59 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
27 May 05: V.Ivant (utils-V07-00-13)
- Fix problem observed for second run after adding/removal materials
- Fix compilation warning at SUN in G4EmCalculator and G4EmCorrections;
18 May 05: V.Ivant (utils-V07-00-12)
- fix calculation of CrossSection without /run/initialise
12 May 05: V.Ivant (utils-V07-00-11)
- fix calculation of MFP in G4Emcalculator
- cleanup
09 May 05: V.Ivant (utils-V07-00-10)
- Bux fixes in G4VEmProcess, G4VEmModel, G4EmCorrections
03 May 05: V.Ivant (utils-V07-00-09)
- fabs -> std::abs
29 April 05: V.Ivant (utils-V07-00-08)
- Fix compilation warning at gcc.3.4
26 April 05: V.Ivant (utils-V07-00-07)
- Fix compilation warning at Windaows
19 April 05: V.Ivant (utils-V07-00-06)
- Add method SelectRandomAtom to G4VEmModel
18 April 05: V.Ivant (utils-V07-00-05)
- G4VEmProcess migrate to G4ParticleChangeForGamma
- G4VMultipleScattering and G4VEmModel - optimise internal interfaces
13 April 05: V.Ivant (utils-V07-00-04)
- Optimization of internal interfaces G4VEmModel, G4VEmFluctuationModel,
G4VEmProcess, G4VEmEnergyLossProcess
- Fix range calculation for dedx=0 in G4LossTableBuilder
- Add Mott correction to G4EmCorrection
18 March 05: V.Ivant (utils-V07-00-03)
- Optimization of G4VEmProcess interface for gamma processes
- Put default inline implementation for virtual method of G4VEmModel
11 March 05: V.Ivant (utils-V07-00-02)
- Shift verbose level, set default value 1
- Add flags "ApplyCuts" and "KillPrimary" to G4VEmProcess
- Add G4EmCorrection class
07 March 05: V.Ivant (utils-V07-00-01)
- Fix bug in initialisation of G4VEmProcess
13 Jan 05: V.Ivant (utils-V07-00-00)
- Fix bug which takes place when inactivate eIoni
- Fix problem of effective charge for very slow ions - add protections
- Fix problem of initialisation for ion beam examples
09 Dec 04: V.Ivant (utils-V06-02-22)
- Fix bug related to hadron tests
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmCalculator.hh,v 1.8 2004/11/17 10:04:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmCalculator.hh,v 1.9 2005/02/26 22:01:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// -------------------------------------------------------------------
@@ -63,6 +63,7 @@ class G4VEnergyLossProcess;
class G4ionEffectiveCharge;
class G4Region;
class G4Element;
class G4EmCorrections;
class G4EmCalculator
{
@@ -127,6 +128,9 @@ public:
G4double ComputeDEDX(G4double kinEnergy, const G4String& part, const G4String& proc,
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 ComputeCrossSectionPerVolume(
G4double kinEnergy, const G4ParticleDefinition*,
const G4String& processName, const G4Material*,
@@ -183,6 +187,7 @@ private:
std::vector<const G4MaterialCutsCouple*> localCouples;
G4LossTableManager* manager;
G4EmCorrections* corr;
G4DataVector localCuts;
G4int nLocalMaterials;
@@ -0,0 +1,205 @@
//
// ********************************************************************
// * 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: G4EmCorrections.hh,v 1.3 2005/02/26 22:01:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4EmCorrections
//
// Author: Vladimir Ivanchenko
//
// Creation date: 13.01.2005
//
// Modifications:
//
//
// Class Description:
//
// This class provides calculation of EM corrections to ionisation
//
// -------------------------------------------------------------------
//
#ifndef G4EmCorrections_h
#define G4EmCorrections_h 1
#include "globals.hh"
#include "G4AtomicShells.hh"
#include "G4ionEffectiveCharge.hh"
class G4Material;
class G4ParticleDefinition;
class G4EmCorrections
{
public:
G4EmCorrections();
virtual ~G4EmCorrections();
G4double HighOrderCorrections(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double Bethe(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double SpinCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double KShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double LShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double ShellCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double ShellCorrectionSTD(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double DensityCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double BarkasCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double BlochCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double MottCorrection(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy);
G4double NuclearDEDX(const G4ParticleDefinition* p,
const G4Material* material,
G4double kineticEnergy,
G4bool fluct = true);
private:
void Initialise();
G4double KShell(G4double theta, G4double eta);
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 NuclearStoppingPower(G4double e, G4double z1, G4double z2,
G4double m1, G4double m2);
// hide assignment operator
G4EmCorrections & operator=(const G4EmCorrections &right);
G4EmCorrections(const G4EmCorrections&);
G4double engBarkas[47];
G4double corBarkas[47];
G4double e[104];
G4double a[104];
G4double theZieglerFactor;
G4double alpha2;
G4bool lossFlucFlag;
G4int nK;
G4int nL;
G4int nEtaK;
G4int nEtaL;
G4double COSEB[14];
G4double COSXI[14];
G4double ZD[11];
G4double TheK[20];
G4double SK[20];
G4double TK[20];
G4double UK[20];
G4double VK[20];
G4double ZK[20];
G4double TheL[26];
G4double SL[26];
G4double TL[26];
G4double UL[26];
G4double VL[26];
G4double Eta[29];
G4double CK[20][29];
G4double CL[26][28];
G4double HM[53];
G4double HN[31];
G4double MSH[93];
G4double TAU[93];
G4AtomicShells shells;
G4ionEffectiveCharge effCharge;
};
inline G4int G4EmCorrections::Index(G4double x, G4double* y, G4int n)
{
G4int idx = n-1;
do {idx--;} while (idx>0 && x<y[idx]);
return idx;
}
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,
G4double y1, G4double y2,
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))))
/ ((x2-x1)*(y2-y1));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmModelManager.hh,v 1.13 2003/11/03 19:37:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmModelManager.hh,v 1.14 2005/04/11 10:40:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -45,6 +45,7 @@
// 13-05-03 Add calculation of precise range (V.Ivanchenko)
// 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)
//
// Class Description:
//
@@ -145,20 +146,6 @@ public:
G4VEmModel* SelectModel(G4double& energy, size_t& index);
G4double SampleFluctuations(const G4Material* material,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length,
G4double& eloss,
G4double& preStepKinEnergy,
size_t& index);
G4double GetDEDXDispersion( const G4Material* material,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length,
size_t& index);
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel*, const G4Region*);
void UpdateEmModel(const G4String&, G4double, G4double);
@@ -211,43 +198,6 @@ inline G4VEmModel* G4EmModelManager::SelectModel(G4double& kinEnergy, size_t& in
return models[currentIdx];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EmModelManager::SampleFluctuations(
const G4Material* material,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length,
G4double& eloss,
G4double& kinEnergy,
size_t& index)
{
currentIdx = (setOfRegionModels[idxOfRegionModels[index]])->SelectIndex(kinEnergy);
G4VEmFluctuationModel* fm = flucModels[currentIdx];
G4double x = eloss;
if(fm) x = fm->SampleFluctuations(material,dp,tmax,length,eloss);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EmModelManager::GetDEDXDispersion(
const G4Material* material,
const G4DynamicParticle* dp,
G4double& tmax,
G4double& length,
size_t& index)
{
currentIdx = (setOfRegionModels[idxOfRegionModels[index]])
->SelectIndex(dp->GetKineticEnergy());
G4VEmFluctuationModel* fm = flucModels[currentIdx];
G4double x = 0.0;
if(fm) x = fm->Dispersion(material,dp,tmax,length);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4DataVector* G4EmModelManager::Cuts() const
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmMultiModel.hh,v 1.2 2004/10/25 13:34:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmMultiModel.hh,v 1.4 2005/04/15 11:40:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -35,8 +35,7 @@
// Creation date: 03.05.2004
//
// Modifications:
//
//
// 15-04-05 optimize internal interface (V.Ivanchenko)
//
// Class Description:
//
@@ -67,35 +66,20 @@ public:
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
G4double HighEnergyLimit(const G4ParticleDefinition*) {return highKinEnergy;};
G4double LowEnergyLimit(const G4ParticleDefinition*) {return lowKinEnergy;};
void SetHighEnergyLimit(G4double e) {highKinEnergy = e;};
void SetLowEnergyLimit(G4double e) {lowKinEnergy = e;};
G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
G4bool IsInCharge(const G4ParticleDefinition*);
G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy);
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy);
G4double CrossSection(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
G4DynamicParticle* SampleSecondary(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax);
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
@@ -103,12 +87,8 @@ public:
G4double tmin,
G4double tmax);
G4double MaxSecondaryEnergy(const G4DynamicParticle* dynParticle);
void DefineForRegion(const G4Region*);
void SetDynamicParticle(const G4DynamicParticle*);
void AddModel(G4VEmModel*, G4double tmin, G4double tmax);
protected:
@@ -127,9 +107,6 @@ private:
G4DataVector tsecmin;
G4DataVector cross_section;
G4double highKinEnergy;
G4double lowKinEnergy;
};
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.hh,v 1.2 2004/05/17 09:46:55 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmProcessOptions.hh,v 1.3 2005/03/28 23:08:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// -------------------------------------------------------------------
@@ -87,15 +87,17 @@ public:
void SetStepLimits(G4double v1, G4double v2);
void SetRandomStep(G4bool val);
void SetApplyCuts(G4bool val);
void SetBuildPreciseRange(G4bool val);
void SetVerbose(G4int val, const G4String& name = "all");
void SetLambdaFactor(G4double val);
void ActivateFluorescence(G4bool val, const G4Region* r = 0);
void ActivateAugerElectronProduction(G4bool val, const G4Region* r = 0);
void ActivateDeexcitation(G4bool val, const G4Region* r = 0);
private:
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnergyLossMessenger.hh,v 1.8 2003/10/13 10:49:17 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// Class Description:
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnergyLossTables.hh,v 1.18 2003/07/23 11:36:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// $Id:
//
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4LossTableBuilder.hh,v 1.4 2004/11/10 08:54:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// -------------------------------------------------------------------
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4LossTableManager.hh,v 1.26 2004/11/10 08:54:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4LossTableManager.hh,v 1.27 2005/02/15 19:35:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// -------------------------------------------------------------------
@@ -80,6 +80,7 @@ class G4EnergyLossMessenger;
class G4ParticleDefinition;
class G4VMultipleScattering;
class G4VEmProcess;
class G4EmCorrections;
class G4LossTableManager
{
@@ -179,6 +180,8 @@ public:
const std::vector<G4VMultipleScattering*>& GetMultipleScatteringVector();
G4EmCorrections* EmCorrections() {return emCorrections;};
private:
G4LossTableManager();
@@ -241,6 +244,7 @@ private:
//G4VEnergyLossProcess* eIonisation;
G4LossTableBuilder* tableBuilder;
G4EnergyLossMessenger* theMessenger;
G4EmCorrections* emCorrections;
const G4ParticleDefinition* firstParticle;
G4int verbose;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEmFluctuationModel.hh,v 1.7 2003/10/16 13:06:40 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4VEmFluctuationModel.hh,v 1.8 2005/04/12 11:21:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -40,6 +40,7 @@
// 07-02-03 change signature (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
//
// Class Description:
@@ -64,26 +65,36 @@ class G4VEmFluctuationModel
public:
G4VEmFluctuationModel(const G4String& nam): name(nam) {};
G4VEmFluctuationModel(const G4String& nam);
virtual ~G4VEmFluctuationModel() {};
virtual ~G4VEmFluctuationModel();
//------------------------------------------------------------------------
// Virtual methods to be implemented for the concrete model
//------------------------------------------------------------------------
virtual G4double SampleFluctuations(const G4Material*,
const G4DynamicParticle*,
G4double& tmax,
G4double& length,
G4double& meanLoss) = 0;
const G4DynamicParticle*,
G4double& tmax,
G4double& length,
G4double& meanLoss) = 0;
virtual G4double Dispersion(const G4Material*,
const G4DynamicParticle*,
G4double& tmax,
G4double& length) = 0;
G4double& tmax,
G4double& length) = 0;
virtual void InitialiseMe(const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
G4String GetName() const {return name;};
virtual void InitialiseMe(const G4ParticleDefinition*);
protected:
//------------------------------------------------------------------------
// Generic methods common to all models
//------------------------------------------------------------------------
G4String GetName() const;
private:
@@ -95,6 +106,23 @@ private:
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmFluctuationModel::G4VEmFluctuationModel(const G4String& nam)
: name(nam)
{}
inline G4VEmFluctuationModel::~G4VEmFluctuationModel()
{}
inline void G4VEmFluctuationModel::InitialiseMe(const G4ParticleDefinition*)
{}
inline G4String G4VEmFluctuationModel::GetName() const
{
return name;
}
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEmModel.hh,v 1.22 2004/11/17 10:11:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4VEmModel.hh,v 1.34 2005/05/11 08:06:19 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -45,7 +45,11 @@
// 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)
// 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)
//
// Class Description:
//
@@ -62,94 +66,122 @@
#include "G4ParticleDefinition.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4DataVector.hh"
#include "G4VEmFluctuationModel.hh"
#include "Randomize.hh"
class G4PhysicsTable;
class G4Region;
class G4VParticleChange;
class G4VEmModel
{
public:
G4VEmModel(const G4String& nam): name(nam) {};
G4VEmModel(const G4String& nam);
virtual ~G4VEmModel() {};
virtual ~G4VEmModel();
//------------------------------------------------------------------------
// Virtual methods to be implemented for the concrete model
//------------------------------------------------------------------------
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&) = 0;
virtual G4double HighEnergyLimit(const G4ParticleDefinition*) = 0;
virtual G4double LowEnergyLimit(const G4ParticleDefinition*) = 0;
virtual void SetHighEnergyLimit(G4double) = 0;
virtual void SetLowEnergyLimit(G4double) = 0;
virtual G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*) = 0;
virtual G4bool IsInCharge(const G4ParticleDefinition*) = 0;
virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy) = 0;
virtual G4double CrossSection(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy) = 0;
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double&, G4double&, G4double&, G4double)
{return 0.0;};
virtual G4DynamicParticle* SampleSecondary(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax) = 0;
virtual std::vector<G4DynamicParticle*>* SampleSecondaries(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double tmax) = 0;
G4double tmin = 0.0,
G4double tmax = DBL_MAX) = 0;
virtual G4double MaxSecondaryEnergy(
const G4DynamicParticle* dynParticle) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
const G4String& GetName() const {return name;};
virtual G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
virtual G4double ComputeDEDX(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = DBL_MAX);
virtual G4double CrossSection(const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
virtual G4double ComputeDEDXPerVolume(
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 cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
// Methods for msc simulation
virtual G4double GeomPathLength(G4PhysicsTable*,
virtual G4double GeomPathLength(G4PhysicsTable* theLambdaTable,
const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double&,
G4double,
G4double,
G4double truePathLength) {return truePathLength;};
// G4double parameters: kinEnergy, lambda, range,
// G4PhysicsTable: theLambdaTable
G4double& kinEnergy,
G4double lambda,
G4double range,
G4double truePathLength);
virtual G4double TrueStepLength(G4double geomStepLength) {return geomStepLength;};
virtual G4double TrueStepLength(G4double geomStepLength);
virtual G4double SampleCosineTheta(G4double,G4double ) {return 1.0;};
// trueStepLength + Tkin
virtual G4double SampleDisplacement() {return 0.0;};
virtual void DefineForRegion(const G4Region*) {};
virtual void SetDynamicParticle(const G4DynamicParticle*) {};
virtual void DefineForRegion(const G4Region*);
protected:
virtual G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy) = 0;
G4double kineticEnergy);
//------------------------------------------------------------------------
// Generic methods common to all models
//------------------------------------------------------------------------
public:
void SetParticleChange(G4VParticleChange*, G4VEmFluctuationModel*);
G4VEmFluctuationModel* GetModelOfFluctuations();
G4double HighEnergyLimit();
G4double LowEnergyLimit();
void SetHighEnergyLimit(G4double);
void SetLowEnergyLimit(G4double);
G4double MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle);
const G4Element* SelectRandomAtom(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy = 0.0,
G4double maxEnergy = DBL_MAX);
const G4String& GetName() const;
private:
@@ -157,8 +189,176 @@ private:
G4VEmModel & operator=(const G4VEmModel &right);
G4VEmModel(const G4VEmModel&);
G4double lowLimit;
G4double highLimit;
G4double xsec[40];
G4VEmFluctuationModel* fluc;
const G4String name;
protected:
G4VParticleChange* pParticleChange;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VEmModel::G4VEmModel(const G4String& nam):
lowLimit(0.0), highLimit(0.0), fluc(0), name(nam), pParticleChange(0)
{}
inline G4VEmModel::~G4VEmModel()
{}
inline G4double G4VEmModel::HighEnergyLimit()
{
return highLimit;
}
inline G4double G4VEmModel::LowEnergyLimit()
{
return lowLimit;
}
inline void G4VEmModel::SetHighEnergyLimit(G4double val)
{
highLimit = val;
}
inline void G4VEmModel::SetLowEnergyLimit(G4double val)
{
lowLimit = val;
}
inline void G4VEmModel::SetParticleChange(G4VParticleChange* p,
G4VEmFluctuationModel* f = 0)
{
if(p && pParticleChange != p) pParticleChange = p;
fluc = f;
}
inline G4VEmFluctuationModel* G4VEmModel::GetModelOfFluctuations()
{
return fluc;
}
inline G4double G4VEmModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*)
{
return 0.0;
}
inline G4double G4VEmModel::ComputeDEDXPerVolume(
const G4Material*,
const G4ParticleDefinition*,
G4double,
G4double)
{
return 0.0;
}
inline G4double G4VEmModel::ComputeDEDX(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy)
{
return ComputeDEDXPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy);
}
inline G4double G4VEmModel::CrossSection(const G4MaterialCutsCouple* c,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double cutEnergy,
G4double maxEnergy)
{
return CrossSectionPerVolume(c->GetMaterial(),p,kinEnergy,cutEnergy,maxEnergy);
}
inline G4double G4VEmModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax)
{
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
size_t nelm = material->GetNumberOfElements();
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);
xsec[i] = cross;
}
return cross;
}
inline G4double G4VEmModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double, G4double, G4double, G4double, G4double)
{
return 0.0;
}
inline const G4Element* G4VEmModel::SelectRandomAtom(
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);
G4int i = -1;
do {i++;} while (x > xsec[i] && i < nelm);
elm = (*theElementVector)[i];
}
return elm;
}
inline G4double G4VEmModel::MaxSecondaryKinEnergy(const G4DynamicParticle* dynParticle)
{
return MaxSecondaryEnergy(dynParticle->GetDefinition(), dynParticle->GetKineticEnergy());
}
inline G4double G4VEmModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy)
{
return kineticEnergy;
}
inline const G4String& G4VEmModel::GetName() const
{
return name;
}
// Methods for msc simulation
inline G4double G4VEmModel::GeomPathLength(G4PhysicsTable*,
const G4MaterialCutsCouple*,
const G4ParticleDefinition*,
G4double&,
G4double,
G4double,
G4double truePathLength)
{
return truePathLength;
}
inline G4double G4VEmModel::TrueStepLength(G4double geomStepLength)
{
return geomStepLength;
}
inline void G4VEmModel::DefineForRegion(const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEmProcess.hh,v 1.15 2004/11/10 08:54:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4VEmProcess.hh,v 1.28 2005/05/12 11:06:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -41,6 +41,9 @@
// 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)
// 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)
//
// Class Description:
//
@@ -60,7 +63,7 @@
#include "G4EmModelManager.hh"
#include "G4UnitsTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleChangeForLoss.hh"
#include "G4ParticleChangeForGamma.hh"
class G4Step;
class G4VEmModel;
@@ -80,25 +83,46 @@ public:
virtual ~G4VEmProcess();
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual std::vector<G4DynamicParticle*>* SecondariesPostStep(
G4VEmModel*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*) = 0;
//------------------------------------------------------------------------
// Virtual methods to be implemented in concrete processes
//------------------------------------------------------------------------
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
// True for all charged particles
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
virtual void PrintInfo() = 0;
protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
virtual std::vector<G4DynamicParticle*>* SecondariesPostStep(
G4VEmModel*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
virtual G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
//------------------------------------------------------------------------
// Generic methods common to all processes
//------------------------------------------------------------------------
public:
void PrintInfoDefinition();
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
void PreparePhysicsTable(const G4ParticleDefinition&);
// Initialise for build of tables
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void PrintInfoDefinition();
// Print out of the class parameters
void SetLambdaBinning(G4int nbins);
G4int LambdaBinning() const;
// Binning for lambda table
@@ -111,6 +135,8 @@ public:
G4double MaxKinEnergy() const;
// Max kinetic energy for tables
void SetLambdaFactor(G4double val);
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
@@ -132,8 +158,6 @@ public:
void UpdateEmModel(const G4String&, G4double, G4double);
// Define new energy range for the model identified by the name
virtual G4double RecalculateLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double& kinEnergy, const G4MaterialCutsCouple* couple);
// It returns the Lambda of the process
@@ -143,6 +167,9 @@ public:
const G4MaterialCutsCouple* couple);
// It returns the cross section of the process for energy/ material
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy, G4double Z);
// It returns the cross section of the process per atom
G4double MeanFreePath( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
@@ -150,27 +177,26 @@ public:
const G4ParticleDefinition* Particle() const;
const G4ParticleDefinition* SecondaryParticle() const;
virtual void ActivateFluorescence(G4bool, const G4Region* r = 0);
virtual void ActivateAugerElectronProduction(G4bool, const G4Region* r = 0);
void ActivateDeexcitation(G4bool, const G4Region* r = 0);
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
void SetIntegral(G4bool val);
G4bool IsIntegral() const;
void SetApplyCuts(G4bool val);
protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
void SetParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*) = 0;
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
G4VEmModel* SelectModel(G4double& kinEnergy);
@@ -183,15 +209,21 @@ protected:
void SetBuildTableFlag(G4bool val);
void SetStartFromNullFlag(G4bool val);
private:
void Clear();
void DefineMaterial(const G4MaterialCutsCouple* couple);
G4double GetLambda(G4double kinEnergy);
void ComputeIntegralLambda(G4double kinEnergy);
void ComputeLambda(G4double kinEnergy);
G4double GetLambdaFromTable(G4double kinEnergy);
G4double GetCurrentLambda(G4double kinEnergy);
G4double ComputeCurrentLambda(G4double kinEnergy);
void BuildLambdaTable();
@@ -206,7 +238,7 @@ private:
protected:
G4ParticleChangeForLoss fParticleChange;
G4ParticleChangeForGamma fParticleChange;
private:
@@ -219,6 +251,9 @@ private:
const G4ParticleDefinition* particle;
const G4ParticleDefinition* secondaryParticle;
const G4ParticleDefinition* theGamma;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
const std::vector<G4double>* theCutsGamma;
const std::vector<G4double>* theCutsElectron;
@@ -244,6 +279,13 @@ private:
G4bool meanFreePath;
G4bool aboveCSmax;
G4bool buildLambdaTable;
G4bool applyCuts;
G4bool startFromNull;
G4int nRegions;
std::vector<G4Region*> regions;
std::vector<G4bool> flagsDeexcitation;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -265,23 +307,38 @@ inline G4double G4VEmProcess::GetLambda(G4double& kineticEnergy,
const G4MaterialCutsCouple* couple)
{
DefineMaterial(couple);
return GetCurrentLambda(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
{
G4double x = 0.0;
if(theLambdaTable) x = GetLambda(kineticEnergy);
else x = RecalculateLambda(kineticEnergy, couple);
if(theLambdaTable) x = GetLambdaFromTable(e);
else x = ComputeCurrentLambda(e);
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::RecalculateLambda(
G4double, const G4MaterialCutsCouple*)
inline G4double G4VEmProcess::RecalculateLambda(G4double e, const G4MaterialCutsCouple* couple)
{
return 0.0;
DefineMaterial(couple);
return ComputeCurrentLambda(e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambda(G4double e)
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
G4VEmModel* currentModel = SelectModel(e);
return currentModel->CrossSectionPerVolume(currentMaterial,particle,e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
G4bool b;
return (((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b));
@@ -289,19 +346,19 @@ inline G4double G4VEmProcess::GetLambda(G4double e)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::ComputeLambda(G4double e)
inline void G4VEmProcess::ComputeIntegralLambda(G4double e)
{
meanFreePath = false;
aboveCSmax = false;
mfpKinEnergy = theEnergyOfCrossSectionMax[currentMaterialIndex];
if (e <= mfpKinEnergy) {
preStepLambda = GetLambda(e);
preStepLambda = GetLambdaFromTable(e);
} else {
aboveCSmax = true;
G4double e1 = e*lambdaFactor;
if(e1 > mfpKinEnergy) {
preStepLambda = GetLambda(e);
G4double preStepLambda1 = GetLambda(e1);
preStepLambda = GetLambdaFromTable(e);
G4double preStepLambda1 = GetLambdaFromTable(e1);
if(preStepLambda1 > preStepLambda) {
mfpKinEnergy = e1;
preStepLambda = preStepLambda1;
@@ -320,15 +377,16 @@ inline G4double G4VEmProcess::GetMeanFreePath(const G4Track& track,
{
*condition = NotForced;
preStepKinEnergy = track.GetKineticEnergy();
if(aboveCSmax && preStepKinEnergy < mfpKinEnergy) ResetNumberOfInteractionLengthLeft();
DefineMaterial(track.GetMaterialCutsCouple());
if( aboveCSmax && preStepKinEnergy < mfpKinEnergy ) ResetNumberOfInteractionLengthLeft();
if (meanFreePath) {
if (integral) ComputeLambda(preStepKinEnergy);
else preStepLambda = GetLambda(preStepKinEnergy);
if(integral) ComputeIntegralLambda(preStepKinEnergy);
else preStepLambda = GetCurrentLambda(preStepKinEnergy);
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;
}
@@ -386,12 +444,11 @@ inline G4double G4VEmProcess::GetElectronEnergyCut()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEmProcess::SetBuildTableFlag(G4bool val)
inline void G4VEmProcess::SetLambdaFactor(G4double val)
{
buildLambdaTable = val;
if(val > 0.0 && val <= 1.0) lambdaFactor = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4VEnergyLoss.hh,v 1.17 2003/03/25 13:36:57 maire Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// ------------------------------------------------------------
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.hh,v 1.34 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4VEnergyLossProcess.hh,v 1.39 2005/04/12 18:31:47 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -56,7 +56,9 @@
// 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.Ivantchenko)
// 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)
//
// Class Description:
//
@@ -102,96 +104,123 @@ public:
virtual ~G4VEnergyLossProcess();
//------------------------------------------------------------------------
// Virtual methods to be implemented in concrete processes
//------------------------------------------------------------------------
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
virtual void PrintInfo() = 0;
protected:
virtual std::vector<G4DynamicParticle*>* SecondariesPostStep(
G4VEmModel*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& tcut) = 0;
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
protected:
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut);
virtual void CorrectionsAlongStep(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
//------------------------------------------------------------------------
// Generic methods common to all processes
//------------------------------------------------------------------------
public:
void PrintInfoDefinition();
void PreparePhysicsTable(const G4ParticleDefinition&);
void BuildPhysicsTable(const G4ParticleDefinition&);
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual std::vector<G4Track*>* SecondariesAlongStep(
const G4Step&,
G4double& tmax,
G4double& eloss,
G4double& kinEnergy) = 0;
virtual void SecondariesPostStep(
G4VEmModel*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& tcut,
G4double& kinEnergy) = 0;
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
// True for all charged particles
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
// Initialise for build of tables
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void PrintInfoDefinition();
// Print out of the class parameters
G4double SampleRange();
G4PhysicsTable* BuildDEDXTable();
G4PhysicsTable* BuildDEDXTableForPreciseRange();
G4PhysicsTable* BuildLambdaTable();
G4PhysicsTable* BuildLambdaSubTable();
// Build tables
void SetBaseParticle(const G4ParticleDefinition* p);
const G4ParticleDefinition* Particle() const;
const G4ParticleDefinition* BaseParticle() const;
const G4ParticleDefinition* SecondaryParticle() const;
// Particle definition
// Binning for dEdx, range, and inverse range tables
void SetDEDXBinning(G4int nbins);
// Binning for dEdx, range, and inverse range tables
// Binning for dEdx, range, and inverse range tables
void SetDEDXBinningForPreciseRange(G4int nbins);
// Binning for dEdx, range, and inverse range tables
void SetLambdaBinning(G4int nbins);
// Binning for lambda table
void SetLambdaBinning(G4int nbins);
// Min kinetic energy for tables
void SetMinKinEnergy(G4double e);
G4double MinKinEnergy() const;
// Min kinetic energy for tables
// Max kinetic energy for tables
void SetMaxKinEnergy(G4double e);
G4double MaxKinEnergy() const;
// Max kinetic energy for tables
// Max kinetic energy for tables
void SetMaxKinEnergyForPreciseRange(G4double e);
// Max kinetic energy for tables
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specifed by the argument.
G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii);
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specifed by the argument.
// Add EM model coupled with fluctuation model for the region
void AddEmModel(G4int, G4VEmModel*, G4VEmFluctuationModel* fluc = 0,
const G4Region* region = 0);
// Add EM model coupled with fluctuation model for the region
void UpdateEmModel(const G4String&, G4double, G4double);
// Define new energy range for thhe model identified by the name
void UpdateEmModel(const G4String&, G4double, G4double);
void AddSubCutoffProcessor(G4VSubCutoffProcessor*, const G4Region* region = 0);
// Add subcutoff processor for the region
void AddSubCutoffProcessor(G4VSubCutoffProcessor*, const G4Region* region = 0);
virtual void ActivateFluorescence(G4bool, const G4Region* region = 0);
virtual void ActivateAugerElectronProduction(G4bool, const G4Region* region = 0);
// Activate deexcitation code
virtual void ActivateDeexcitation(G4bool, const G4Region* region = 0);
virtual void SetSubCutoff(G4bool);
@@ -234,6 +263,8 @@ public:
void SetLossFluctuations(G4bool val);
void SetRandomStep(G4bool val);
void SetIntegral(G4bool val);
G4bool IsIntegral() const;
@@ -259,8 +290,8 @@ public:
G4double currentMinimumStep,
G4double& currentSafety);
// reset NumberOfInteractionLengthLeft
void ResetNumberOfInteractionLengthLeft();
// reset (determine the value of)NumberOfInteractionLengthLeft
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idx) const;
@@ -270,37 +301,16 @@ public:
protected:
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*, G4double cut) = 0;
virtual G4double MaxSecondaryEnergy(const G4DynamicParticle* dp) = 0;
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*) = 0;
void SetParticle(const G4ParticleDefinition* p);
void SetSecondaryParticle(const G4ParticleDefinition* p);
virtual G4double GetMeanFreePath(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimumStep,
G4double& currentSafety);
virtual
G4PhysicsVector* DEDXPhysicsVector(const G4MaterialCutsCouple*);
virtual
G4PhysicsVector* DEDXPhysicsVectorForPreciseRange(const G4MaterialCutsCouple*);
virtual
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
virtual
G4PhysicsVector* SubLambdaPhysicsVector(const G4MaterialCutsCouple*);
G4VEmModel* SelectModel(G4double kinEnergy);
@@ -408,6 +418,7 @@ private:
G4double mfpKinEnergy;
G4bool lossFluctuationFlag;
G4bool lossFluctuationArePossible;
G4bool rndmStepFlag;
G4bool tablesAreBuilt;
G4bool integral;
@@ -539,10 +550,14 @@ inline G4double G4VEnergyLossProcess::GetDEDXDispersion(
G4double length)
{
DefineMaterial(couple);
G4double tmax = MaxSecondaryEnergy(dp);
G4double ekin = dp->GetKineticEnergy();
G4VEmModel* currentModel = SelectModel(ekin*massRatio);
G4double tmax = currentModel->MaxSecondaryKinEnergy(dp);
tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
return modelManager->GetDEDXDispersion(currentMaterial, dp, tmax, length,
currentMaterialIndex);
G4double d = 0.0;
G4VEmFluctuationModel* fm = currentModel->GetModelOfFluctuations();
if(fm) d = fm->Dispersion(currentMaterial,dp,tmax,length);
return d;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -624,16 +639,23 @@ inline G4double G4VEnergyLossProcess::GetContinuousStepLimit(const G4Track&,
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;
}
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" range= "<<fRange
// <<" cMinSt="<<currentMinStep <<" minStepLimit= " << minStepLimit<< G4endl;
} else if (rndmStepFlag) x = SampleRange();
}
//G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" stepLimit= "<<x<<G4endl;
// G4cout<<GetProcessName()<<": e= "<<preStepKinEnergy<<" stepLimit= "<<x<<G4endl;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::SampleRange()
{
return fRange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::ResetNumberOfInteractionLengthLeft()
{
meanFreePath = true;
@@ -641,6 +663,14 @@ inline void G4VEnergyLossProcess::ResetNumberOfInteractionLengthLeft()
G4VProcess::ResetNumberOfInteractionLengthLeft();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEnergyLossProcess::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double cut)
{
return cut;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -680,6 +710,15 @@ inline const G4ParticleDefinition* G4VEnergyLossProcess::SecondaryParticle() con
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VEnergyLossProcess::CorrectionsAlongStep(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double&,
G4double&)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VSubCutoffProcessor* G4VEnergyLossProcess::SubCutoffProcessor(size_t index)
{
G4VSubCutoffProcessor* p = 0;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.hh,v 1.25 2004/11/10 08:54:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4VMultipleScattering.hh,v 1.27 2005/04/15 14:41:21 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -49,6 +49,8 @@
// 30-06-04 make destructor virtual (V.Ivanchenko)
// 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 15-04-05 optimize internal interfaces (V.Ivanchenko)
// 15-04-05 remove boundary flag (V.Ivanchenko)
// -------------------------------------------------------------------
//
@@ -63,13 +65,12 @@
#include "G4MaterialCutsCouple.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4EmModelManager.hh"
#include "G4VEmModel.hh"
class G4Step;
class G4ParticleDefinition;
class G4DataVector;
class G4Navigator;
class G4PhysicsTable;
class G4PhysicsVector;
@@ -84,31 +85,55 @@ public:
virtual ~G4VMultipleScattering();
//------------------------------------------------------------------------
// Virtual methods to be implemented for the concrete model
//------------------------------------------------------------------------
virtual G4bool IsApplicable(const G4ParticleDefinition& p) = 0;
// True for all charged particles
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
virtual G4double TruePathLengthLimit(const G4Track& track,
G4double& lambda,
G4double currentMinimalStep) = 0;
virtual void PrintInfo() = 0;
protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
//------------------------------------------------------------------------
// Methods with standard implementation; may be overwritten if needed
//------------------------------------------------------------------------
public:
// Initialise for build of tables
virtual void PreparePhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
virtual void BuildPhysicsTable(const G4ParticleDefinition&);
// Build physics table during initialisation
//------------------------------------------------------------------------
// Generic methods common to all models
//------------------------------------------------------------------------
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetContinuousStepLimit at every step.
G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety,
G4GPILSelection* selection);
// The function overloads the corresponding function of the base
// class.It limits the step near to boundaries only
// and invokes the method GetContinuousStepLimit at every step.
virtual void PrintInfoDefinition();
// Print out of the class parameters
// Print out of generic class parameters
void PrintInfoDefinition();
void SetBinning(G4int nbins);
G4int Binning() const;
@@ -120,47 +145,41 @@ public:
void SetMaxKinEnergy(G4double e);
G4double MaxKinEnergy() const;
// Print out of the class parameters
// Build empty Physics Vector
G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
G4bool StorePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii = false);
// Store PhysicsTable in a file.
// Return false in case of failure at I/O
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specifed by the argument.
G4bool RetrievePhysicsTable(const G4ParticleDefinition*,
const G4String& directory,
G4bool ascii);
// Retrieve Physics from a file.
// (return true if the Physics Table can be build by using file)
// (return false if the process has no functionality or in case of failure)
// File name should is constructed as processName+particleName and the
// should be placed under the directory specifed by the argument.
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,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
// This method does not used for tracking, it is intended only for tests
G4bool LateralDisplasmentFlag() const;
void SetLateralDisplasmentFlag(G4bool val);
// lateral displacement to be/not to be computed
G4bool BoundaryAlgorithmFlag() const;
void SetBoundary(G4bool val);
// boundary algorith is/isnt active
void SetBuildLambdaTable(G4bool val);
const G4PhysicsTable* LambdaTable() const;
virtual G4double TruePathLengthLimit(const G4Track& track,
G4double& lambda,
G4double currentMinimalStep) = 0;
G4VEmModel* SelectModelForMaterial(G4double kinEnergy, size_t& idxRegion) const;
// Define particle definition
@@ -169,23 +188,18 @@ public:
protected:
virtual void InitialiseProcess(const G4ParticleDefinition*) = 0;
// This method is used for tracking, it returns mean free path value
G4double GetMeanFreePath(const G4Track& track,
G4double,
G4ForceCondition* condition);
// This method is used for tracking, it returns mean free path value
G4double GetLambda(const G4ParticleDefinition* p, G4double& kineticEnergy);
// This method is used for tracking, it returns step limit
G4double GetContinuousStepLimit(const G4Track& track,
G4double previousStepSize,
G4double currentMinimalStep,
G4double& currentSafety);
// This method is used for tracking, it returns step limit
virtual G4PhysicsVector* PhysicsVector(const G4MaterialCutsCouple*);
// Build empty Physics Vector
void SelectModel(G4double& kinEnergy);
// Select concrete model
@@ -205,13 +219,10 @@ private:
G4VMultipleScattering(G4VMultipleScattering &);
G4VMultipleScattering & operator=(const G4VMultipleScattering &right);
// =====================================================================
private:
// =====================================================================
G4ParticleChangeForMSC fParticleChange;
G4EmModelManager* modelManager;
G4Navigator* navigator;
G4VEmModel* currentModel;
// tables and vectors
@@ -235,7 +246,6 @@ private:
G4double currentRange;
G4GPILSelection valueGPILSelectionMSC;
G4bool boundary;
G4bool latDisplasment;
G4bool buildLambdaTable;
};
@@ -290,7 +300,6 @@ inline G4double G4VMultipleScattering::GetContinuousStepLimit(
DefineMaterial(track.GetMaterialCutsCouple());
G4double e = track.GetKineticEnergy();
SelectModel(e);
if(!theLambdaTable) currentModel->SetDynamicParticle(track.GetDynamicParticle());
const G4ParticleDefinition* p = track.GetDefinition();
lambda0 = GetLambda(p, e);
currentRange = G4LossTableManager::Instance()->GetTrancatedRange(p,e,currentCouple);
@@ -329,7 +338,7 @@ inline G4double G4VMultipleScattering::GetLambda(const G4ParticleDefinition* p,
x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
} else {
x = currentModel->CrossSection(currentCouple,p,e,0.0,1.0);
x = currentModel->CrossSection(currentCouple,p,e);
}
return x;
}
@@ -351,6 +360,17 @@ inline G4VParticleChange* G4VMultipleScattering::AlongStepDoIt(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& track,
const G4Step& step)
{
fParticleChange.Initialize(track);
currentModel->SampleSecondaries(currentCouple,track.GetDynamicParticle(),
step.GetStepLength(),step.GetPostStepPoint()->GetSafety());
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SelectModel(G4double& kinEnergy)
{
currentModel = modelManager->SelectModel(kinEnergy, currentMaterialIndex);
@@ -422,20 +442,6 @@ inline void G4VMultipleScattering::SetLateralDisplasmentFlag(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4VMultipleScattering::BoundaryAlgorithmFlag() const
{
return boundary;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetBoundary(G4bool val)
{
boundary = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4VMultipleScattering::SetBuildLambdaTable(G4bool val)
{
buildLambdaTable = val;
@@ -450,4 +456,11 @@ inline const G4ParticleDefinition* G4VMultipleScattering::Particle() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline const G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
{
return theLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4VSubCutoffProcessor.hh,v 1.6 2003/07/21 12:52:06 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.hh,v 1.4 2004/10/25 13:34:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4ionEffectiveCharge.hh,v 1.6 2005/02/26 22:01:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -85,6 +85,7 @@ private:
G4double energyLowLimit;
G4double energyBohr;
G4double massFactor;
G4double minCharge;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -95,8 +96,8 @@ inline G4double G4ionEffectiveCharge::EffectiveChargeSquareRatio(
const G4Material* material,
G4double kineticEnergy)
{
G4double charge = EffectiveCharge(p,material,kineticEnergy)
*chargeCorrection/eplus;
G4double charge = EffectiveCharge(p,material,kineticEnergy)*chargeCorrection
/ eplus;
return charge*charge;
}
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc,v 1.11 2004/11/17 10:11:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmCalculator.cc,v 1.19 2005/05/30 08:55:51 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -37,6 +37,8 @@
// Modifications:
// 12.09.2004 Add verbosity (V.Ivanchenko)
// 17.11.2004 Change signature of methods, add new methods (V.Ivanchenko)
// 08.04.2005 Major optimisation of internal interfaces (V.Ivantchenko)
// 08.05.2005 Use updated interfaces (V.Ivantchenko)
//
// Class Description:
//
@@ -60,12 +62,14 @@
#include "G4ionEffectiveCharge.hh"
#include "G4RegionStore.hh"
#include "G4Element.hh"
#include "G4EmCorrections.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmCalculator::G4EmCalculator()
{
manager = G4LossTableManager::Instance();
corr = manager->EmCorrections();
nLocalMaterials = 0;
verbose = 0;
currentCoupleIndex = 0;
@@ -255,7 +259,7 @@ G4double G4EmCalculator::GetMeanFreePath(G4double kinEnergy,
{
G4double res = DBL_MAX;
G4double x = GetCrossSectionPerVolume(kinEnergy,p, processName, mat,region);
if(x > 0.0) res = 1.0/(x*(mat->GetTotNbOfAtomsPerVolume()));
if(x > 0.0) res = 1.0/x;
if(verbose>1) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " MFP(mm)= " << res/mm
@@ -321,19 +325,46 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
}
if(FindEmModel(p, processName, kinEnergy)) {
// G4cout << "currentModel= " << currentModel << G4endl;
if(UpdateCouple(mat, cut) && UpdateParticle(p, kinEnergy)) {
if(UpdateParticle(p, kinEnergy)) {
G4double escaled = kinEnergy*massRatio;
if(baseParticle) {
G4double e = kinEnergy*massRatio;
res = currentModel->ComputeDEDX(currentCouple, baseParticle, e, cut);
res = currentModel->ComputeDEDXPerVolume(mat, baseParticle, escaled, cut)
* chargeSquare;
if(verbose > 1) {
G4cout << baseParticle->GetParticleName() << " E(MeV)= " << e
G4cout << baseParticle->GetParticleName() << " E(MeV)= " << escaled
<< " DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
res *= chargeSquare;
}
} else {
res = currentModel->ComputeDEDX(currentCouple, p, kinEnergy, cut);
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
}
if(isIon && currentModel->HighEnergyLimit() > 100.*MeV)
res += corr->HighOrderCorrections(p,mat,kinEnergy);
// emulate boundary region for different parameterisations
G4double eth = currentModel->LowEnergyLimit();
if(eth > 0.05*MeV && eth < 10.*MeV && escaled > eth) {
G4double res1 = 0.0;
if(baseParticle) {
res1 = currentModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut)
* chargeSquare;
} else {
res1 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
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;
} else {
res0 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
}
//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
@@ -364,6 +395,33 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
const G4ParticleDefinition* p,
const G4Material* mat)
{
G4double res = corr->NuclearDEDX(p, mat, kinEnergy, false);
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())
<< G4endl;
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeNuclearDEDX(G4double kinEnergy,
const G4String& particle,
const G4String& material)
{
return ComputeNuclearDEDX(kinEnergy,FindParticle(particle),FindMaterial(material));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCalculator::ComputeCrossSectionPerVolume(
G4double kinEnergy,
const G4ParticleDefinition* p,
@@ -373,14 +431,13 @@ G4double G4EmCalculator::ComputeCrossSectionPerVolume(
{
G4double res = 0.0;
if(FindEmModel(p, processName, kinEnergy)) {
if(UpdateCouple(mat, cut) && UpdateParticle(p, kinEnergy)) {
G4double e = kinEnergy;
if(baseParticle) {
e *= kinEnergy*massRatio;
res = currentModel->CrossSection(currentCouple, baseParticle, e, cut, e)*chargeSquare;
} else {
res = currentModel->CrossSection(currentCouple, p, e, cut, e);
}
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
@@ -417,14 +474,13 @@ G4double G4EmCalculator::ComputeCrossSectionPerAtom(
{
G4double res = 0.0;
if(FindEmModel(p, processName, kinEnergy)) {
if(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);
}
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
@@ -446,7 +502,7 @@ G4double G4EmCalculator::ComputeCrossSectionPerAtom(G4double kinEnergy,
G4double cut)
{
return ComputeCrossSectionPerAtom(kinEnergy,FindParticle(particle),processName,
elm->GetZ(),elm->GetA(),cut);
elm->GetZ(),elm->GetN(),cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -459,7 +515,7 @@ G4double G4EmCalculator::ComputeMeanFreePath(G4double kinEnergy,
{
G4double mfp = DBL_MAX;
G4double x = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat, cut);
if(x > 0.0) mfp = 1.0/(x*(currentMaterial->GetTotNbOfAtomsPerVolume()));
if(x > 0.0) mfp = 1.0/x;
if(verbose>1) {
G4cout << "E(MeV)= " << kinEnergy/MeV
<< " MFP(mm)= " << mfp/mm
@@ -488,6 +544,7 @@ G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p, G4double ki
{
if(p != currentParticle) {
currentParticle = p;
baseParticle = 0;
currentParticleName = p->GetParticleName();
}
isApplicable = false;
@@ -495,22 +552,31 @@ G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p, G4double ki
const G4VEnergyLossProcess* proc = FindEnergyLossProcess(p);
if(proc) {
isApplicable = true;
baseParticle = proc->BaseParticle();
baseParticle = proc->BaseParticle();
massRatio = 1.0;
G4double qbase = 1.0;
G4double q = p->GetPDGCharge()/eplus;
if(baseParticle) {
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
qbase = baseParticle->GetPDGCharge()/eplus;
}
if(p->GetParticleType() == "nucleus") {
isIon = true;
chargeSquare =
ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
//G4double emax = currentModel->HighEnergyLimit(p);
//if(emax < 100.*MeV) chargeSquare *= q*q /
// ionEffCharge->EffectiveChargeSquareRatio(p, currentMaterial, emax/massRatio);
} else {
isIon = false;
G4double q = p->GetPDGCharge()/eplus;
chargeSquare = q*q;
}
massRatio = 1.0;
if(baseParticle) {
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
G4double q = baseParticle->GetPDGCharge()/eplus;
chargeSquare /= (q*q);
}
chargeSquare /= (qbase*qbase);
}
}
return isApplicable;
@@ -555,6 +621,9 @@ const G4Region* G4EmCalculator::FindRegion(const G4String& reg)
const G4MaterialCutsCouple* G4EmCalculator::FindCouple(const G4Material* material,
const G4Region* region)
{
if(!material) return 0;
currentMaterial = material;
currentMaterialName = material->GetName();
// Access to materials
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
@@ -600,8 +669,8 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
if (p != currentParticle || processName != currentName) {
currentName = processName;
currentLambda = 0;
G4LossTableManager* manager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = manager->GetEnergyLossProcessVector();
G4LossTableManager* lManager = G4LossTableManager::Instance();
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() == p) {
@@ -611,7 +680,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
}
}
if(!currentLambda) {
const std::vector<G4VEmProcess*> vem = manager->GetEmProcessVector();
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() == p) {
@@ -622,7 +691,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
}
}
if(!currentLambda) {
const std::vector<G4VMultipleScattering*> vmsc = manager->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() == p) {
@@ -651,8 +720,8 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
currentName = processName;
currentModel = 0;
size_t idx = 0;
G4LossTableManager* manager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = manager->GetEnergyLossProcessVector();
G4LossTableManager* lManager = G4LossTableManager::Instance();
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() == p) {
@@ -673,7 +742,7 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
}
}
if(!currentModel) {
const std::vector<G4VEmProcess*> vem = manager->GetEmProcessVector();
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() == p) {
@@ -684,7 +753,7 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
}
}
if(!currentModel) {
const std::vector<G4VMultipleScattering*> vmsc = manager->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() == p) {
@@ -705,8 +774,8 @@ const G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
{
const G4VEnergyLossProcess* elp = 0;
G4LossTableManager* manager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = manager->GetEnergyLossProcessVector();
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel = lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
for(G4int i=0; i<n; i++) {
if((vel[i])->Particle() == p) {
File diff suppressed because it is too large Load Diff
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmModelManager.cc,v 1.24 2004/08/06 11:30:59 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmModelManager.cc,v 1.28 2005/05/13 16:54:05 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -49,6 +49,8 @@
// 21-07-03 Add UpdateEmModel method (V.Ivanchenko)
// 03-11-03 Substitute STL vector for G4RegionModels (V.Ivanchenko)
// 26-01-04 Fix in energy range conditions (V.Ivanchenko)
// 24-03-05 Remove check or IsInCharge (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
//
// Class Description:
//
@@ -153,7 +155,7 @@ G4EmModelManager::~G4EmModelManager()
void G4EmModelManager::Clear()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::Clear()" << G4endl;
}
@@ -229,7 +231,7 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
G4int val)
{
verboseLevel = val;
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::Initialise() for "
<< p->GetParticleName()
<< G4endl;
@@ -243,7 +245,6 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
minSubRange = theMinSubRange;
Clear();
G4RegionStore* regionStore = G4RegionStore::GetInstance();
const G4Region* world = regionStore->GetRegion("DefaultRegionForTheWorld", false);
@@ -270,14 +271,14 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
idxOfRegionModels = new G4int[numOfCouples];
G4int numOfCouples = theCoupleTable->GetTableSize();
idxOfRegionModels = new G4int[numOfCouples+1];
idxOfRegionModels[numOfCouples] = 0;
setOfRegionModels = new G4RegionModels*[nRegions];
upperEkin.resize(nEmModels);
// Order models for regions
for (G4int reg=0; reg<nRegions; reg++) {
const G4Region* region = set[reg];
G4int n = 0;
@@ -292,17 +293,16 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
for (G4int ii=0; ii<nEmModels; ii++) {
G4VEmModel* model = models[ii];
if ( (model->IsInCharge(particle)) &&
(0 == regions[ii] || region == regions[ii]) )
{
if ( 0 == regions[ii] || region == regions[ii] ) {
G4double tmin = model->LowEnergyLimit(particle);
G4double tmax = model->HighEnergyLimit(particle);
if (n) tmin = std::max(tmin, eHigh[n-1]);
G4double tmin = model->LowEnergyLimit();
G4double tmax = model->HighEnergyLimit();
if (n>0) tmin = std::max(tmin, eHigh[n-1]);
if(1 < verboseLevel) {
G4cout << "Model # " << ii << " for region <"
<< region->GetName() << "> "
G4cout << "Model # " << ii << " for region <";
if (region) G4cout << region->GetName();
G4cout << "> "
<< " tmin(MeV)= " << tmin/MeV
<< "; tmax(MeV)= " << tmax/MeV
<< G4endl;
@@ -319,9 +319,10 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
}
eLow[0] = 0.0;
if(0 < verboseLevel) {
G4cout << "New G4RegionModels set with " << n << " models for region <"
<< region->GetName() << "> Elow(MeV)= ";
if(1 < verboseLevel) {
G4cout << "New G4RegionModels set with " << n << " models for region <";
if (region) G4cout << region->GetName();
G4cout << "> Elow(MeV)= ";
for(G4int ii=0; ii<n; ii++) {G4cout << eLow[ii]/MeV << " ";}
G4cout << G4endl;
}
@@ -331,7 +332,7 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
// Access to materials and build cuts
for(size_t i=0; i<numOfCouples; i++) {
for(G4int i=0; i<numOfCouples; i++) {
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
@@ -340,7 +341,7 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
do {reg--;} while (reg>0 && pcuts != (set[reg]->GetProductionCuts()));
idxOfRegionModels[i] = reg;
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::Initialise() for "
<< material->GetName()
<< " indexOfCouple= " << i
@@ -384,8 +385,9 @@ const G4DataVector* G4EmModelManager::Initialise(const G4ParticleDefinition* p,
}
if(0 < verboseLevel) {
G4cout << "G4EmModelManager is initialised; nRegions= " << nRegions
if(1 < verboseLevel) {
G4cout << "G4EmModelManager for " << particle->GetParticleName()
<< " is initialised; nRegions= " << nRegions
<< G4endl;
}
@@ -408,7 +410,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
size_t i = couple->GetIndex();
G4double cut = theCuts[i];
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVector() for "
<< couple->GetMaterial()->GetName()
<< " Ecut(MeV)= " << cut/MeV
@@ -423,7 +425,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
dedxHigh.resize(nmod);
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName()
<< " at the region #" << reg
@@ -456,7 +458,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
else factor[j] = 0.0;
}
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "Loop over " << totBinsLoss << " bins start " << G4endl;
}
}
@@ -479,7 +481,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
G4double dedx = models[regModels->ModelIndex(k)]->ComputeDEDX(couple,particle,e,cut)*fac;
if(dedx < 0.0) dedx = 0.0;
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
<< " E(MeV)= " << e/MeV
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
@@ -507,7 +509,7 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
size_t i = couple->GetIndex();
if(0 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "G4EmModelManager::FillDEDXVector() for "
<< couple->GetMaterial()->GetName()
<< G4endl;
@@ -521,7 +523,7 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
dedxHigh.resize(nmod);
if(0 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName()
<< " at the region #" << reg
@@ -554,7 +556,7 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
else factor[j] = 0.0;
}
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "Loop over " << totBinsLoss << " bins start " << G4endl;
}
}
@@ -577,7 +579,7 @@ void G4EmModelManager::FillDEDXVectorForPreciseRange(
G4double dedx = models[regModels->ModelIndex(k)]->ComputeDEDX(couple,particle,e,e)*fac;
if(dedx < 0.0) dedx = 0.0;
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "Material= " << couple->GetMaterial()->GetName()
<< " E(MeV)= " << e/MeV
<< " dEdx(MeV/mm)= " << dedx*mm/MeV
@@ -602,7 +604,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
G4double e;
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::FillLambdaVector() for particle "
<< particle->GetParticleName()
<< " in " << couple->GetMaterial()->GetName()
@@ -620,7 +622,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
sigmaLow.resize(nmod);
sigmaHigh.resize(nmod);
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "There are " << nmod << " models for "
<< couple->GetMaterial()->GetName() << G4endl;
}
@@ -635,7 +637,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
e = upperEkin[regModels->ModelIndex(0)];
sigmaHigh[0] = models[regModels->ModelIndex(0)]->CrossSection(couple,particle,e,cut,e);
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "### For material " << couple->GetMaterial()->GetName()
<< " " << nmod
<< " models"
@@ -686,7 +688,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
G4double cross = models[regModels->ModelIndex(k)]->CrossSection(couple,particle,e,cut,e)*fac;
if(j==0 && startFromNull) cross = 0.0;
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "FillLambdaVector: " << j << ". e(MeV)= " << e/MeV
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac << " k= " << k << " model= " << regModels->ModelIndex(k)
@@ -704,7 +706,7 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple,
G4bool startFromNull)
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::BuildLambdaSubTable() for particle "
<< particle->GetParticleName() << G4endl;
}
@@ -743,7 +745,7 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
e = upperEkin[regModels->ModelIndex(0)];
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "### For material " << couple->GetMaterial()->GetName()
<< " are available " << nmod
<< " models"
@@ -787,7 +789,7 @@ void G4EmModelManager::FillSubLambdaVector(G4PhysicsVector* aVector,
G4double cross=models[regModels->ModelIndex(k)]->CrossSection(couple,particle,e,subcut,cut)*fac;
if(j==0 && startFromNull) cross = 0.0;
if(1 < verboseLevel) {
if(2 < verboseLevel) {
G4cout << "BuildLambdaTable: e(MeV)= " << e/MeV
<< " cross(1/mm)= " << cross*mm
<< " fac= " << fac
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmMultiModel.cc,v 1.1 2004/05/03 13:13:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4EmMultiModel.cc,v 1.4 2005/04/15 11:40:46 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -35,6 +35,7 @@
// Creation date: 03.05.2004
//
// Modifications:
// 15-04-05 optimize internal interface (V.Ivanchenko)
//
// Class Description:
@@ -57,8 +58,6 @@ G4EmMultiModel::G4EmMultiModel(const G4String& nam)
: G4VEmModel(nam),
nModels(0)
{
highKinEnergy = 100.0*GeV;
lowKinEnergy = 0.1*keV;
model.clear();
tsecmin.clear();
cross_section.clear();
@@ -101,20 +100,6 @@ G4double G4EmMultiModel::MinEnergyCut(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4EmMultiModel::IsInCharge(const G4ParticleDefinition* p)
{
G4bool yes = true;
if(nModels) {
for(G4int i=0; i<nModels; i++) {
G4bool x = (model[i])->IsInCharge(p);
if( !x ) yes = false;
}
}
return yes;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmMultiModel::ComputeDEDX(const G4MaterialCutsCouple* couple,
const G4ParticleDefinition* p,
G4double kineticEnergy,
@@ -152,17 +137,6 @@ G4double G4EmMultiModel::CrossSection(const G4MaterialCutsCouple* couple,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DynamicParticle* G4EmMultiModel::SampleSecondary(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
std::vector<G4DynamicParticle*>* G4EmMultiModel::SampleSecondaries(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
@@ -202,17 +176,6 @@ std::vector<G4DynamicParticle*>* G4EmMultiModel::SampleSecondaries(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmMultiModel:: MaxSecondaryEnergy(const G4DynamicParticle* dp)
{
G4double tmax = 0.0;
if(nModels) {
tmax = (model[0])-> MaxSecondaryEnergy(dp);
}
return tmax;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmMultiModel:: MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kinEnergy)
{
@@ -233,15 +196,6 @@ void G4EmMultiModel::DefineForRegion(const G4Region* r)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmMultiModel::SetDynamicParticle(const G4DynamicParticle* dp)
{
if(nModels) {
for(G4int i=0; i<nModels; i++) {(model[i])->SetDynamicParticle(dp);}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmMultiModel::AddModel(G4VEmModel* p, G4double tmin, G4double tmax)
{
if(tmin < tmax && 0.0 < tmin) {
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4EmProcessOptions.cc,v 1.5 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4EmProcessOptions.cc,v 1.7 2005/05/03 08:09:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +36,7 @@
//
// Modifications:
// 30-06-04 G4EmProcess is pure discrete (V.Ivanchenko)
// 24-03-05 Add ApplyCuts and RandomStep (V.Ivanchenko)
//
// Class Description:
//
@@ -193,7 +194,7 @@ void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
for(itr = v.begin(); itr != v.end(); itr++) {
G4VEnergyLossProcess* p = *itr;
if(p) {
if(std::fabs(p->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
if(std::abs(p->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
p->SetMaxKinEnergy(val);
}
}
@@ -203,7 +204,7 @@ void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
for(itp = w.begin(); itp != w.end(); itp++) {
G4VEmProcess* q = *itp;
if(q) {
if(std::fabs(q->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
if(std::abs(q->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
q->SetMaxKinEnergy(val);
}
}
@@ -214,7 +215,7 @@ void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
for(itm = u.begin(); itm != u.end(); itm++) {
G4VMultipleScattering* s = *itm;
if(s) {
if(std::fabs(s->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
if(std::abs(s->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
s->SetMaxKinEnergy(val);
}
}
@@ -290,6 +291,32 @@ void G4EmProcessOptions::SetStepLimits(G4double v1, G4double v2)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetRandomStep(G4bool 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->SetRandomStep(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetApplyCuts(G4bool val)
{
const std::vector<G4VEmProcess*>& w =
theManager->GetEmProcessVector();
std::vector<G4VEmProcess*>::const_iterator itp;
for(itp = w.begin(); itp != w.end(); itp++) {
G4VEmProcess* q = *itp;
if(q) q->SetApplyCuts(val);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetBuildPreciseRange(G4bool val)
{
theManager->SetBuildPreciseRange(val);
@@ -350,41 +377,21 @@ void G4EmProcessOptions::SetLambdaFactor(G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::ActivateFluorescence(G4bool val, const G4Region* r)
void G4EmProcessOptions::ActivateDeexcitation(G4bool val, const G4Region* r)
{
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->ActivateFluorescence(val,r);
if(p) p->ActivateDeexcitation(val,r);
}
const std::vector<G4VEmProcess*>& w =
theManager->GetEmProcessVector();
std::vector<G4VEmProcess*>::const_iterator itp;
for(itp = w.begin(); itp != w.end(); itp++) {
G4VEmProcess* q = *itp;
if(q) q->ActivateFluorescence(val,r);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::ActivateAugerElectronProduction(G4bool val, const G4Region* r)
{
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->ActivateAugerElectronProduction(val,r);
}
const std::vector<G4VEmProcess*>& w =
theManager->GetEmProcessVector();
std::vector<G4VEmProcess*>::const_iterator itp;
for(itp = w.begin(); itp != w.end(); itp++) {
G4VEmProcess* q = *itp;
if(q) q->ActivateAugerElectronProduction(val,r);
if(q) q->ActivateDeexcitation(val,r);
}
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnergyLossMessenger.cc,v 1.11 2003/10/13 10:49:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnergyLossTables.cc,v 1.32 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
// first version created by P.Urban , 06/04/1998
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4LossTableBuilder.cc,v 1.16 2004/12/07 18:16:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4LossTableBuilder.cc,v 1.17 2005/04/12 18:13:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -127,14 +127,22 @@ void G4LossTableBuilder::BuildRangeTable(const G4PhysicsTable* dedxTable,
G4double energy2 = pv->GetLowEdgeEnergy(j+bin0);
G4double dedx2 = pv->GetValue(energy2, b);
G4double de = (energy2 - energy1) * del;
G4double energy = energy1 - de*0.5;
G4double fac = std::log(dedx2/dedx1)/std::log(energy2/energy1);
G4double de = (energy2 - energy1) * del;
G4double energy = energy1 - de*0.5;
G4bool yes = true;
if(dedx1 < DBL_MIN || dedx2 < DBL_MIN) yes = false;
G4double fac, f;
if(yes) fac = std::log(dedx2/dedx1)/std::log(energy2/energy1);
else fac = (dedx2 - dedx1)/(energy2 - energy1);
for (size_t k=0; k<n; k++) {
energy += de;
G4double f = dedx1*std::exp(fac*std::log(energy/energy1));
range += de/f;
if(yes) f = dedx1*std::exp(fac*std::log(energy/energy1));
else f = dedx1 + fac*(energy - energy1);
if(f > DBL_MIN) range += de/f;
}
v->PutValue(j,range);
energy1 = energy2;
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4LossTableManager.cc,v 1.51 2004/12/09 10:38:02 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4LossTableManager.cc,v 1.58 2005/05/27 18:38:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -52,7 +52,10 @@
// 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
// 14-01-04 Activate precise range calculation (V.Ivanchenko)
// 10-03-04 Fix a problem of Precise Range table (V.Ivanchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
// 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)
//
// Class Description:
//
@@ -73,6 +76,7 @@
#include "G4VEmProcess.hh"
#include "G4ProductionCutsTable.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4EmCorrections.hh"
G4LossTableManager* G4LossTableManager::theInstance = 0;
@@ -129,6 +133,7 @@ G4LossTableManager::G4LossTableManager()
theMessenger = new G4EnergyLossMessenger();
theElectron = G4Electron::Electron();
tableBuilder = new G4LossTableBuilder();
emCorrections= new G4EmCorrections();
integral = true;
integralActive = false;
buildPreciseRange = false;
@@ -136,7 +141,7 @@ G4LossTableManager::G4LossTableManager()
maxEnergyActive = false;
maxEnergyForMuonsActive = false;
stepFunctionActive = false;
verbose = 0;
verbose = 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -179,6 +184,8 @@ void G4LossTableManager::Register(G4VEnergyLossProcess* p)
if(integralActive) p->SetIntegral(integral);
if(minEnergyActive) p->SetMinKinEnergy(minKinEnergy);
if(maxEnergyActive) p->SetMaxKinEnergy(maxKinEnergy);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : " << p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -195,6 +202,8 @@ void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
void G4LossTableManager::Register(G4VMultipleScattering* p)
{
msc_vector.push_back(p);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VMultipleScattering : " << p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -212,6 +221,8 @@ void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
void G4LossTableManager::Register(G4VEmProcess* p)
{
emp_vector.push_back(p);
if(verbose > 1)
G4cout << "G4LossTableManager::Register G4VEmProcess : " << p->GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -254,7 +265,7 @@ void G4LossTableManager::EnergyLossProcessIsInitialised(
{
if (first_entry || (particle == firstParticle && all_tables_are_built) ) {
all_tables_are_built = true;
loss_map.clear();
for (G4int i=0; i<n_loss; i++) {
G4VEnergyLossProcess* el = loss_vector[i];
@@ -289,11 +300,11 @@ void G4LossTableManager::EnergyLossProcessIsInitialised(
base_part_vector[j] = p->BaseParticle();
}
if(maxEnergyForMuonsActive) {
G4double dm = std::fabs(particle->GetPDGMass() - 105.7*MeV);
G4double dm = std::abs(particle->GetPDGMass() - 105.7*MeV);
if(dm < 5.*MeV) p->SetMaxKinEnergy(maxKinEnergyForMuons);
}
if(0 < verbose) {
if(1 < verbose) {
G4cout << "For " << p->GetProcessName()
<< " for " << part_vector[j]->GetParticleName()
<< " tables_are_built= " << tables_are_built[j]
@@ -335,7 +346,7 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
G4VEnergyLossProcess* p)
{
if(0 < verbose) {
if(1 < verbose) {
G4cout << "### G4LossTableManager::BuildDEDXTable() is requested for "
<< aParticle->GetParticleName()
<< " and process " << p->GetProcessName()
@@ -361,7 +372,7 @@ void G4LossTableManager::BuildPhysicsTable(const G4ParticleDefinition* aParticle
}
}
if(0 < verbose) {
if(1 < verbose) {
G4cout << "### G4LossTableManager::BuildDEDXTable end: "
<< "all_tables_are_built= " << all_tables_are_built
<< G4endl;
@@ -391,7 +402,7 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
proc->SetLambdaTable(base_proc->LambdaTable());
proc->SetSubLambdaTable(base_proc->SubLambdaTable());
loss_map[part_vector[j]] = proc;
if (0 < verbose) {
if (1 < verbose) {
G4cout << "For " << proc->GetProcessName()
<< " for " << part_vector[j]->GetParticleName()
<< " base_part= " << part->GetParticleName()
@@ -409,7 +420,7 @@ void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition* aParticle)
{
if(0 < verbose) {
if(1 < verbose) {
G4cout << "G4LossTableManager::BuildTables() for "
<< aParticle->GetParticleName() << G4endl;
}
@@ -423,7 +434,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition
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()) {
if (loss_vector[i]->IsIonisationProcess() || !em) {
em = loss_vector[i];
iem= i;
}
@@ -484,7 +495,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(const G4ParticleDefinition
loss_list[j]->SetSubLambdaTable(lambdaTable);
}
}
if (0 < verbose) {
if (1 < verbose) {
G4cout << "G4LossTableManager::BuildTables: Tables are built for "
<< aParticle->GetParticleName()
<< "; ionisation process: " << em->GetProcessName()
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc,v 1.15 2004/11/10 14:37:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4VEmProcess.cc,v 1.30 2005/05/30 08:22:38 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -37,12 +37,15 @@
// Modifications:
// 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.Ivantchenko)
// 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)
// 14-03-05 Update logic PostStepDoIt (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 18-04-05 Use G4ParticleChangeForGamma (V.Ivantchenko)
//
//
// Class Description:
//
// It is the unified process for e+ annililation at rest and in fly.
// -------------------------------------------------------------------
//
@@ -66,6 +69,7 @@
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -82,11 +86,17 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
integral(false),
meanFreePath(true),
aboveCSmax(true),
buildLambdaTable(true)
buildLambdaTable(true),
applyCuts(false),
startFromNull(true),
nRegions(0)
{
minKinEnergy = 0.1*keV;
maxKinEnergy = 100.0*GeV;
SetVerboseLevel(1);
minKinEnergy = 0.1*keV;
maxKinEnergy = 100.0*GeV;
theGamma = G4Gamma::Gamma();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
pParticleChange = &fParticleChange;
@@ -99,6 +109,7 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
G4VEmProcess::~G4VEmProcess()
{
Clear();
if(theLambdaTable) theLambdaTable->clearAndDestroy();
delete modelManager;
(G4LossTableManager::Instance())->DeRegister(this);
}
@@ -108,9 +119,17 @@ G4VEmProcess::~G4VEmProcess()
void G4VEmProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
{
if(!particle) particle = &part;
if(1 < verboseLevel) {
G4cout << "G4VEmProcess::PreparePhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " local particle " << particle->GetParticleName()
<< G4endl;
}
if(particle == &part) {
Clear();
InitialiseProcess(particle);
theCutsGamma =
modelManager->Initialise(particle,secondaryParticle,2.,verboseLevel);
const G4ProductionCutsTable* theCoupleTable=
@@ -142,10 +161,11 @@ void G4VEmProcess::Clear()
void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEmProcess::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " buildLambdaTable= " << buildLambdaTable
<< G4endl;
}
@@ -153,9 +173,9 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
BuildLambdaTable();
FindLambdaMax();
}
if(-1 < verboseLevel) PrintInfoDefinition();
if(0 < verboseLevel) PrintInfoDefinition();
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEmProcess::BuildPhysicsTable() done for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
@@ -167,7 +187,7 @@ void G4VEmProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
void G4VEmProcess::BuildLambdaTable()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossSTD::BuildLambdaTable() for process "
<< GetProcessName() << " and particle "
<< particle->GetParticleName()
@@ -178,7 +198,6 @@ void G4VEmProcess::BuildLambdaTable()
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
for(size_t i=0; i<numOfCouples; i++) {
if (theLambdaTable->GetFlag(i)) {
@@ -186,12 +205,12 @@ void G4VEmProcess::BuildLambdaTable()
// create physics vector and fill it
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
G4PhysicsVector* aVector = LambdaPhysicsVector(couple);
modelManager->FillLambdaVector(aVector, couple);
modelManager->FillLambdaVector(aVector, couple, startFromNull);
G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector);
}
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "Lambda table is built for "
<< particle->GetParticleName()
<< G4endl;
@@ -220,6 +239,7 @@ void G4VEmProcess::SetSecondaryParticle(const G4ParticleDefinition* p)
void G4VEmProcess::AddEmModel(G4int order, G4VEmModel* p, const G4Region* region)
{
modelManager->AddEmModel(order, p, 0, region);
if(p) p->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -245,7 +265,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
// Integral approach
if (integral) {
G4double lx = GetLambda(finalT, currentCouple);
if(preStepLambda<lx && 0 < verboseLevel) {
if(preStepLambda<lx && 1 < verboseLevel) {
G4cout << "WARING: for " << particle->GetParticleName()
<< " and " << GetProcessName()
<< " E(MeV)= " << finalT/MeV
@@ -258,79 +278,89 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
}
G4VEmModel* currentModel = SelectModel(finalT);
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
/*
/*
if(0 < verboseLevel) {
const G4ParticleDefinition* pd = dynParticle->GetDefinition();
G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= "
<< finalT/MeV
<< " MeV; model= (" << currentModel->LowEnergyLimit(pd)
<< ", " << currentModel->HighEnergyLimit(pd) << ")"
<< " MeV; model= (" << currentModel->LowEnergyLimit()
<< ", " << currentModel->HighEnergyLimit() << ")"
<< G4endl;
}
*/
std::vector<G4DynamicParticle*>* newp = SecondariesPostStep(currentModel,
currentCouple,
dynParticle);
G4double edep = fParticleChange.GetLocalEnergyDeposit();
std::vector<G4DynamicParticle*>* newp =
SecondariesPostStep(currentModel,currentCouple,track.GetDynamicParticle());
if (newp) {
G4int num = newp->size();
if(num > 0) {
fParticleChange.SetNumberOfSecondaries(num);
G4double gcut = (*theCutsGamma)[currentMaterialIndex];
G4double ecut = (*theCutsElectron)[currentMaterialIndex];
G4double pcut = (*theCutsPositron)[currentMaterialIndex];
for (G4int i=0; i<num; i++) {
G4DynamicParticle* dp = (*newp)[i];
const G4ParticleDefinition* p = dp->GetDefinition();
G4double e = dp->GetKineticEnergy();
G4bool good = true;
if (p == G4Gamma::Gamma()) {
if (e < gcut) {
good = false;
edep += e;
}
} else if (p == G4Electron::Electron()) {
if (e < ecut) {
good = false;
edep += e;
}
} else if (p == G4Positron::Positron()) {
if (e < pcut) {
good = false;
edep += e + electron_mass_c2;
}
}
if (good) fParticleChange.AddSecondary(dp);
else delete dp;
fParticleChange.SetNumberOfSecondaries(num);
G4double edep = fParticleChange.GetLocalEnergyDeposit();
for (G4int i=0; i<num; i++) {
G4DynamicParticle* dp = (*newp)[i];
const G4ParticleDefinition* p = dp->GetDefinition();
G4double e = dp->GetKineticEnergy();
G4bool good = true;
if (p == theGamma) {
if (e < (*theCutsGamma)[currentMaterialIndex]) good = false;
} else if (p == theElectron) {
if (e < (*theCutsElectron)[currentMaterialIndex]) good = false;
} else if (p == thePositron) {
if (e < (*theCutsPositron)[currentMaterialIndex]) {
good = false;
e += 2.0*electron_mass_c2;
}
}
}
if (good || !applyCuts) {
fParticleChange.AddSecondary(dp);
} else {
delete dp;
edep += e;
}
}
fParticleChange.ProposeLocalEnergyDeposit(edep);
delete newp;
}
fParticleChange.ProposeLocalEnergyDeposit(edep);
return &fParticleChange;
return G4VDiscreteProcess::PostStepDoIt(track,step);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::PrintInfoDefinition()
{
G4cout << G4endl << GetProcessName() << ": " << G4endl
<< " Lambda tables from threshold to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< " in " << nLambdaBins << " bins."
<< G4endl;
if(verboseLevel > 0) {
G4cout << G4endl << GetProcessName() << ": " ;
PrintInfo();
}
if(0 < verboseLevel) {
if (!buildLambdaTable) return;
if(verboseLevel > 0) {
G4cout << " tables are built for "
<< particle->GetParticleName()
<< G4endl
<< " Lambda tables from "
<< G4BestUnit(minKinEnergy,"Energy")
<< " to "
<< G4BestUnit(maxKinEnergy,"Energy")
<< " in " << nLambdaBins << " bins."
<< G4endl;
}
if(verboseLevel > 1) {
G4cout << "Tables are built for " << particle->GetParticleName()
<< G4endl;
if(2 < verboseLevel) {
G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
if(verboseLevel > 2) {
G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
}
}
}
@@ -349,6 +379,9 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
GetValue(kineticEnergy, b));
cross /= currentMaterial->GetTotNbOfAtomsPerVolume();
} else {
G4VEmModel* model = SelectModel(kineticEnergy);
cross = model->CrossSectionPerVolume(currentMaterial,particle,kineticEnergy);
}
return cross;
@@ -356,6 +389,16 @@ G4double G4VEmProcess::MicroscopicCrossSection(G4double kineticEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEmProcess::ComputeCrossSectionPerAtom(G4double kineticEnergy, G4double Z)
{
G4VEmModel* model = SelectModel(kineticEnergy);
G4double A = G4NistManager::Instance()->FindOrBuildElement(G4int(Z), false)->GetN();
G4double cross = model->ComputeCrossSectionPerAtom(particle,kineticEnergy,Z,A);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VEmProcess::MeanFreePath(const G4Track& track,
G4double s,
G4ForceCondition* cond)
@@ -396,7 +439,7 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& directory,
G4bool ascii)
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEmProcess::RetrievePhysicsTable() for "
<< part->GetParticleName() << " and process "
<< GetProcessName() << G4endl;
@@ -411,13 +454,13 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,filename,ascii);
if ( yes ) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "Lambda table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
}
} else {
if (-1 < verboseLevel) {
if (1 < verboseLevel) {
G4cout << "Lambda table for " << particleName << " in file <"
<< filename << "> is not exist"
<< G4endl;
@@ -432,27 +475,31 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
void G4VEmProcess::FindLambdaMax()
{
if(1 < verboseLevel) {
G4cout << "### FindLambdaMax: " << particle->GetParticleName()
G4cout << "### G4VEmProcess::FindLambdaMax: " << particle->GetParticleName()
<< " and process " << GetProcessName() << G4endl;
}
size_t n = theLambdaTable->length();
G4PhysicsVector* pv = (*theLambdaTable)[0];
size_t nb = pv->GetVectorLength();
G4double emax = pv->GetLowEdgeEnergy(nb);
G4double e, s, smax = 0.0;
G4double e, s, emax, smax;
theEnergyOfCrossSectionMax = new G4double [n];
theCrossSectionMax = new G4double [n];
G4bool b;
for (size_t i=0; i<n; i++) {
pv = (*theLambdaTable)[i];
emax = DBL_MAX;
smax = 0.0;
for (size_t j=0; j<nb; j++) {
e = pv->GetLowEdgeEnergy(j);
s = pv->GetValue(e,b);
if(s > smax) {
smax = s;
emax = e;
if(pv) {
size_t nb = pv->GetVectorLength();
emax = pv->GetLowEdgeEnergy(nb);
smax = 0.0;
for (size_t j=0; j<nb; j++) {
e = pv->GetLowEdgeEnergy(j);
s = pv->GetValue(e,b);
if(s > smax) {
smax = s;
emax = e;
}
}
}
theEnergyOfCrossSectionMax[i] = emax;
@@ -509,12 +556,7 @@ G4double G4VEmProcess::MaxKinEnergy() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::ActivateFluorescence(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::ActivateAugerElectronProduction(G4bool, const G4Region*)
void G4VEmProcess::ActivateDeexcitation(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -529,6 +571,7 @@ const G4PhysicsTable* G4VEmProcess::LambdaTable() const
void G4VEmProcess::SetIntegral(G4bool val)
{
integral = val;
if(integral) buildLambdaTable = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -539,3 +582,32 @@ G4bool G4VEmProcess::IsIntegral() const
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4PhysicsVector* G4VEmProcess::LambdaPhysicsVector(const G4MaterialCutsCouple*)
{
G4PhysicsVector* v = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nLambdaBins);
return v;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::SetBuildTableFlag(G4bool val)
{
buildLambdaTable = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::SetStartFromNullFlag(G4bool val)
{
startFromNull = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::SetApplyCuts(G4bool val)
{
applyCuts = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -22,7 +22,7 @@
//
//
// $Id: G4VEnergyLoss.cc,v 1.45 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
//
// --------------------------------------------------------------
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.cc,v 1.45 2004/12/09 10:38:02 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4VEnergyLossProcess.cc,v 1.57 2005/05/27 18:38:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -78,6 +78,9 @@
// 06-08-04 Clear up names of member functions (V.Ivanchenko)
// 27-08-04 Add NeedBuildTables method (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 11-04-05 Use MaxSecondaryEnergy from a model (V.Ivanchenko)
//
// Class Description:
//
@@ -147,6 +150,7 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name, G4ProcessType t
lambdaFactor(0.1),
mfpKinEnergy(0.0),
lossFluctuationFlag(true),
lossFluctuationArePossible(true),
rndmStepFlag(false),
tablesAreBuilt(false),
integral(true),
@@ -164,7 +168,7 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name, G4ProcessType t
// default dRoverRange and finalRange
SetStepFunction(defaultIntegralRange, 1.0*mm);
SetVerboseLevel(0);
SetVerboseLevel(1);
modelManager = new G4EmModelManager();
(G4LossTableManager::Instance())->Register(this);
@@ -209,7 +213,7 @@ G4VEnergyLossProcess::~G4VEnergyLossProcess()
void G4VEnergyLossProcess::Clear()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::Clear() for " << GetProcessName() << G4endl;
}
@@ -237,7 +241,7 @@ void G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
else particle = &part;
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::PreparePhysicsTable for "
<< GetProcessName()
<< " for " << part.GetParticleName()
@@ -324,7 +328,7 @@ void G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
lManager->EnergyLossProcessIsInitialised(particle, this);
if (0 < verboseLevel) {
if (1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::Initialise() is done "
<< " chargeSqRatio= " << chargeSqRatio
<< " massRatio= " << massRatio
@@ -343,7 +347,7 @@ void G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
// G4cout << "========================================================" << G4endl;
G4cout << "### G4VEnergyLossProcess::BuildPhysicsTable() for "
<< GetProcessName()
@@ -356,9 +360,9 @@ void G4VEnergyLossProcess::BuildPhysicsTable(const G4ParticleDefinition& part)
if(!tablesAreBuilt && &part == particle)
G4LossTableManager::Instance()->BuildPhysicsTable(particle, this);
if(-1 < verboseLevel && (&part == particle) && !baseParticle) PrintInfoDefinition();
if(0 < verboseLevel && (&part == particle) && !baseParticle) PrintInfoDefinition();
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "### G4VEnergyLossProcess::BuildPhysicsTable() done for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
@@ -372,6 +376,11 @@ void G4VEnergyLossProcess::AddEmModel(G4int order, G4VEmModel* p, G4VEmFluctuati
const G4Region* region)
{
modelManager->AddEmModel(order, p, fluc, region);
if(p) p->SetParticleChange(pParticleChange, fluc);
if(!fluc) {
lossFluctuationFlag = false;
lossFluctuationArePossible = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -412,7 +421,7 @@ void G4VEnergyLossProcess::AddSubCutoffProcessor(G4VSubCutoffProcessor* p,
G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTable()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::BuildDEDXTable() for "
<< GetProcessName()
<< " and particle " << particle->GetParticleName()
@@ -424,7 +433,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTable()
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << numOfCouples << " materials"
<< " minKinEnergy= " << minKinEnergy
<< " maxKinEnergy= " << maxKinEnergy
@@ -433,7 +442,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTable()
for(size_t i=0; i<numOfCouples; i++) {
if(1 < verboseLevel)
if(2 < verboseLevel)
G4cout << "G4VEnergyLossProcess::BuildDEDXVector flag= " << theDEDXTable->GetFlag(i) << G4endl;
if (theDEDXTable->GetFlag(i)) {
@@ -448,7 +457,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTable()
}
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::BuildDEDXTable(): table is built for "
<< particle->GetParticleName()
<< G4endl;
@@ -463,7 +472,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTable()
G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTableForPreciseRange()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::BuildDEDXTableForPreciseRange() for "
<< GetProcessName()
<< " and particle " << particle->GetParticleName()
@@ -496,7 +505,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTableForPreciseRange()
}
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::BuildDEDXTableForPreciseRange(): table is built for "
<< particle->GetParticleName()
<< G4endl;
@@ -511,7 +520,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildDEDXTableForPreciseRange()
G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaTable()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::BuildLambdaTable() for process "
<< GetProcessName() << " and particle "
<< particle->GetParticleName()
@@ -537,7 +546,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaTable()
}
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "Lambda table is built for "
<< particle->GetParticleName()
<< G4endl;
@@ -550,7 +559,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaTable()
G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaSubTable()
{
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::BuildLambdaSubTable() for process "
<< GetProcessName() << " and particle "
<< particle->GetParticleName() << G4endl;
@@ -575,7 +584,7 @@ G4PhysicsTable* G4VEnergyLossProcess::BuildLambdaSubTable()
}
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "Table is built for "
<< particle->GetParticleName()
<< G4endl;
@@ -650,24 +659,26 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
}
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4double tmax = MaxSecondaryEnergy(dynParticle);
G4VEmModel* currentModel = SelectModel(preStepScaledEnergy);
G4double tmax = currentModel->MaxSecondaryKinEnergy(dynParticle);
tmax = std::min(tmax,(*theCuts)[currentMaterialIndex]);
/*
/*
G4double eloss0 = eloss;
if(-1 < verboseLevel) {
G4cout << "Before fluct: eloss(MeV)= " << eloss/MeV
<< " tmax= " << tmax
<< " e-eloss= " << preStepKinEnergy-eloss
<< " fluct= " << lossFluctuationFlag
<< G4endl;
}
*/
// Sample fluctuations
if (lossFluctuationFlag && eloss + lowestKinEnergy <= preStepKinEnergy) {
if (lossFluctuationFlag && eloss < preStepKinEnergy) {
eloss = modelManager->SampleFluctuations(currentMaterial, dynParticle,
tmax, length, eloss, preStepScaledEnergy,
currentMaterialIndex);
eloss = currentModel->GetModelOfFluctuations()->
SampleFluctuations(currentMaterial,dynParticle,tmax,length,eloss);
}
/*
if(-1 < verboseLevel) {
@@ -679,37 +690,17 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
}
*/
// Corrections, which cannot be tabulated
CorrectionsAlongStep(currentCouple, dynParticle, eloss, length);
G4double finalT = preStepKinEnergy - eloss;
if (finalT <= lowestKinEnergy) finalT = 0.0;
eloss = preStepKinEnergy-finalT;
fParticleChange.SetProposedKineticEnergy(finalT);
fParticleChange.ProposeLocalEnergyDeposit(eloss);
// Subcutoff and/or deexcitation
std::vector<G4Track*>* newp =
SecondariesAlongStep(step, tmax, eloss, preStepScaledEnergy);
if(newp) {
G4int n = newp->size();
if(n > 0) {
fParticleChange.SetNumberOfSecondaries(n);
G4Track* t;
G4double e;
for (G4int i=0; i<n; i++) {
t = (*newp)[i];
e = t->GetKineticEnergy();
const G4ParticleDefinition* pd = t->GetDefinition();
if (pd != G4Positron::Positron() ) e += electron_mass_c2;
if (e > eloss) e = eloss;
eloss -= e;
pParticleChange->AddSecondary(t);
}
}
delete newp;
}
/*
/*
if(-1 < verboseLevel) {
G4cout << "Final value eloss(MeV)= " << eloss/MeV
<< " preStepKinEnergy= " << preStepKinEnergy
@@ -718,10 +709,9 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
<< G4endl;
}
*/
fParticleChange.ProposeLocalEnergyDeposit(eloss);
return &fParticleChange;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -735,7 +725,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
// Integral approach
if (integral) {
G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy);
if(preStepLambda<lx && 0 < verboseLevel) {
if(preStepLambda<lx && 1 < verboseLevel) {
G4cout << "WARING: for " << particle->GetParticleName()
<< " and " << GetProcessName()
<< " E(MeV)= " << finalT/MeV
@@ -747,16 +737,23 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
}
G4VEmModel* currentModel = SelectModel(postStepScaledEnergy);
G4double tcut = (*theCuts)[currentMaterialIndex];
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
G4double tmax = currentModel->MaxSecondaryEnergy(dynParticle);
G4double tmax = (*theCuts)[currentMaterialIndex];
if (tcut < tmax)
SecondariesPostStep(currentModel,currentCouple,dynParticle,tcut,finalT);
std::vector<G4DynamicParticle*>* newp = SecondariesPostStep(
currentModel, currentCouple, track.GetDynamicParticle(), tmax);
if (newp) {
G4int num = newp->size();
fParticleChange.SetNumberOfSecondaries(num);
for (G4int i=0; i<num; i++) {
fParticleChange.AddSecondary((*newp)[i]);
}
delete newp;
}
/*
if(-1 < verboseLevel) {
const G4ParticleDefinition* pd = dynParticle->GetDefinition();
const G4ParticleDefinition* pd = track.GetDynamicParticle()->GetDefinition();
G4cout << GetProcessName()
<< "::PostStepDoIt: Sample secondary; E= " << finalT/MeV
<< " MeV; model= (" << currentModel->LowEnergyLimit(pd)
@@ -765,14 +762,12 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
<< G4endl;
}
*/
// if (finalT <= 0.0) finalT = 0.0;
finalT = fParticleChange.GetProposedKineticEnergy();
if (finalT <= lowestKinEnergy) {
fParticleChange.SetProposedKineticEnergy(0.0);
return &fParticleChange;
}
fParticleChange.SetProposedKineticEnergy(finalT);
return G4VContinuousDiscreteProcess::PostStepDoIt(track,step);
}
@@ -781,7 +776,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
void G4VEnergyLossProcess::PrintInfoDefinition()
{
if(-1 < verboseLevel) {
if(0 < verboseLevel) {
G4cout << G4endl << GetProcessName() << ": tables are built for "
<< particle->GetParticleName()
<< G4endl
@@ -793,6 +788,7 @@ void G4VEnergyLossProcess::PrintInfoDefinition()
<< G4BestUnit(maxKinEnergy,"Energy")
<< " in " << nLambdaBins << " bins."
<< G4endl;
PrintInfo();
if(theRangeTableForLoss) {
G4cout << " Step function: finalRange(mm)= " << finalRange/mm
<< ", dRoverRange= " << dRoverRange
@@ -880,7 +876,7 @@ void G4VEnergyLossProcess::SetRangeTableForLoss(G4PhysicsTable* p)
{
if(theRangeTableForLoss != p) {
theRangeTableForLoss = p;
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "### Set Range table " << p << " for " << particle->GetParticleName()
<< " and process " << GetProcessName() << G4endl;
}
@@ -900,7 +896,7 @@ void G4VEnergyLossProcess::SetInverseRangeTable(G4PhysicsTable* p)
{
if(theInverseRangeTable != p) {
theInverseRangeTable = p;
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "### Set InverseRange table " << p << " for " << particle->GetParticleName()
<< " and process " << GetProcessName() << G4endl;
}
@@ -921,22 +917,25 @@ void G4VEnergyLossProcess::SetLambdaTable(G4PhysicsTable* p)
if(p) {
size_t n = p->length();
G4PhysicsVector* pv = (*p)[0];
size_t nb = pv->GetVectorLength();
G4double emax = pv->GetLowEdgeEnergy(nb);
G4double e, s, smax = 0.0;
G4double e, s, smax, emax;
theEnergyOfCrossSectionMax = new G4double [n];
theCrossSectionMax = new G4double [n];
G4bool b;
for (size_t i=0; i<n; i++) {
pv = (*p)[i];
emax = DBL_MAX;
smax = 0.0;
for (size_t j=0; j<nb; j++) {
e = pv->GetLowEdgeEnergy(j);
s = pv->GetValue(e,b);
if(s > smax) {
smax = s;
emax = e;
if(pv) {
size_t nb = pv->GetVectorLength();
emax = pv->GetLowEdgeEnergy(nb);
for (size_t j=0; j<nb; j++) {
e = pv->GetLowEdgeEnergy(j);
s = pv->GetValue(e,b);
if(s > smax) {
smax = s;
emax = e;
}
}
}
theEnergyOfCrossSectionMax[i] = emax;
@@ -1132,10 +1131,12 @@ G4bool G4VEnergyLossProcess::StorePhysicsTable(const G4ParticleDefinition* part,
if( !theSubLambdaTable->StorePhysicsTable(name,ascii)) res = false;
}
if ( res ) {
G4cout << "Physics tables are stored for " << particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
if(0 < verboseLevel) {
G4cout << "Physics tables are stored for " << particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
}
} else {
G4cout << "Fail to store Physics Tables for " << particle->GetParticleName()
<< " and process " << GetProcessName()
@@ -1154,7 +1155,7 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
G4bool res = true;
const G4String particleName = part->GetParticleName();
if(0 < verboseLevel) {
if(1 < verboseLevel) {
// G4cout << "========================================================" << G4endl;
G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
<< particleName << " and process " << GetProcessName()
@@ -1172,14 +1173,14 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = theDEDXTable->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(theDEDXTable,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "DEDX table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
}
} else {
fpi = false;
if (0 < verboseLevel) {
if (1 < verboseLevel) {
G4cout << "DEDX table for " << particleName << " from file <"
<< filename << "> is not Retrieved"
<< G4endl;
@@ -1190,7 +1191,7 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = theRangeTableForLoss->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(theRangeTableForLoss,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "Range table for loss for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
@@ -1208,13 +1209,13 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = theDEDXunRestrictedTable->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(theDEDXunRestrictedTable,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "Non-restricted DEDX table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
}
} else {
if (0 < verboseLevel) {
if (1 < verboseLevel) {
G4cout << "Non-restricted DEDX table for " << particleName << " from file <"
<< filename << "> is not Retrieved"
<< G4endl;
@@ -1225,7 +1226,7 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = thePreciseRangeTable->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(thePreciseRangeTable,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "Precise Range table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
@@ -1239,7 +1240,7 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = theInverseRangeTable->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(theInverseRangeTable,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "InverseRange table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
@@ -1258,7 +1259,7 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = theLambdaTable->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "Lambda table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
@@ -1276,7 +1277,7 @@ G4bool G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* pa
yes = theSubLambdaTable->ExistPhysicsTable(filename);
if(yes) yes = G4PhysicsTableHelper::RetrievePhysicsTable(theSubLambdaTable,filename,ascii);
if(yes) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "SubLambda table for " << particleName << " is Retrieved from <"
<< filename << ">"
<< G4endl;
@@ -1306,6 +1307,7 @@ void G4VEnergyLossProcess::SetLinearLossLimit(G4double val)
void G4VEnergyLossProcess::SetLossFluctuations(G4bool val)
{
if(val && !lossFluctuationArePossible) return;
lossFluctuationFlag = val;
}
@@ -1316,6 +1318,13 @@ void G4VEnergyLossProcess::SetSubCutoff(G4bool)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::SetRandomStep(G4bool val)
{
rndmStepFlag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::SetMinSubRange(G4double val)
{
minSubRange = val;
@@ -1394,13 +1403,7 @@ G4double G4VEnergyLossProcess::MaxKinEnergy() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::ActivateFluorescence(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEnergyLossProcess::ActivateAugerElectronProduction(G4bool, const G4Region*)
void G4VEnergyLossProcess::ActivateDeexcitation(G4bool, const G4Region*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VMultipleScattering.cc,v 1.30 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4VMultipleScattering.cc,v 1.36 2005/04/18 17:31:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -45,6 +45,9 @@
// 22-04-04 SampleCosineTheta signature changed back to original
// 27-08-04 Add InitialiseForRun method (V.Ivanchneko)
// 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivantchenko)
// 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
// 15-04-05 optimize internal interface (V.Ivanchenko)
// 15-04-05 remove boundary flag (V.Ivanchenko)
//
// Class Description:
//
@@ -69,27 +72,26 @@
#include "G4ProductionCutsTable.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4Navigator.hh"
#include "G4TransportationManager.hh"
#include "G4PhysicsTableHelper.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType type):
G4VContinuousDiscreteProcess(name, type),
navigator(0),
theLambdaTable(0),
firstParticle(0),
currentParticle(0),
currentCouple(0),
nBins(120),
boundary(false),
latDisplasment(true),
buildLambdaTable(true)
{
minKinEnergy = 100.0*eV;
maxKinEnergy = 100.0*TeV;
//SetVerboseLevel(0);
SetVerboseLevel(1);
pParticleChange = &fParticleChange;
modelManager = new G4EmModelManager();
(G4LossTableManager::Instance())->Register(this);
@@ -108,11 +110,12 @@ G4VMultipleScattering::~G4VMultipleScattering()
void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
{
if(0 < verboseLevel) {
// G4cout << "========================================================" << G4endl;
G4String num = part.GetParticleName();
if(1 < verboseLevel) {
// G4cout << "========================================================" << G4endl;
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " and particle " << num
<< G4endl;
}
@@ -125,7 +128,6 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
for (size_t i=0; i<numOfCouples; i++) {
if (theLambdaTable->GetFlag(i)) {
// create physics vector and fill it
const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(i);
G4PhysicsVector* aVector = PhysicsVector(couple);
@@ -134,21 +136,22 @@ void G4VMultipleScattering::BuildPhysicsTable(const G4ParticleDefinition& part)
}
}
G4String num = part.GetParticleName();
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "Lambda table is built for "
<< num
<< G4endl;
}
if((verboseLevel>=0) && ( num == "e-" || num == "mu+" || num == "proton" || num == "pi-"))
PrintInfoDefinition();
if(2 < verboseLevel) G4cout << *theLambdaTable << G4endl;
}
if(verboseLevel>0 && ( num == "e-" || num == "mu+" ||
num == "proton" || num == "pi-" || num == "GenericIon")) {
PrintInfoDefinition();
if(2 < verboseLevel && theLambdaTable) G4cout << *theLambdaTable << G4endl;
}
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "### G4VMultipleScattering::BuildPhysicsTable() done for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
<< " and particle " << num
<< G4endl;
}
}
@@ -163,8 +166,8 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
currentParticle = &part;
}
if(0 < verboseLevel) {
// G4cout << "========================================================" << G4endl;
if(1 < verboseLevel) {
// G4cout << "========================================================" << G4endl;
G4cout << "### G4VMultipleScattering::PrepearPhysicsTable() for "
<< GetProcessName()
<< " and particle " << part.GetParticleName()
@@ -177,9 +180,6 @@ void G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part
InitialiseProcess(firstParticle);
if(buildLambdaTable)
theLambdaTable = G4PhysicsTableHelper::PreparePhysicsTable(theLambdaTable);
if(latDisplasment && !navigator)
navigator = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
const G4DataVector* theCuts = modelManager->Initialise(firstParticle, 0, 10.0, verboseLevel);
if(2 < verboseLevel) G4cout << theCuts << G4endl;
@@ -194,86 +194,30 @@ void G4VMultipleScattering::AddEmModel(G4int order, G4VEmModel* p,
{
G4VEmFluctuationModel* fm = 0;
modelManager->AddEmModel(order, p, fm, region);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange* G4VMultipleScattering::PostStepDoIt(const G4Track& track,
const G4Step& step)
{
fParticleChange.Initialize(track);
G4double kineticEnergy = track.GetKineticEnergy();
G4double truestep = step.GetStepLength();
if (kineticEnergy > 0.0) {
G4double cth = currentModel->SampleCosineTheta(truestep,kineticEnergy);
G4double sth = std::sqrt(1.-cth*cth);
G4double phi = twopi*G4UniformRand();
G4double dirx = sth*std::cos(phi);
G4double diry = sth*std::sin(phi);
G4ThreeVector oldDirection = track.GetMomentumDirection();
G4ThreeVector newDirection(dirx,diry,cth);
newDirection.rotateUz(oldDirection);
fParticleChange.ProposeMomentumDirection(newDirection);
/*
if(0 < verboseLevel) {
const G4ParticleDefinition* pd = dynParticle->GetDefinition();
G4cout << "G4VMultipleScattering::PostStepDoIt: Sample secondary; E= " << finalT/MeV
<< " MeV; model= (" << currentModel->LowEnergyLimit(pd)
<< ", " << currentModel->HighEnergyLimit(pd) << ")"
<< G4endl;
}
*/
if (latDisplasment) {
G4double safety = step.GetPostStepPoint()->GetSafety();
if ( safety > 0.0) {
G4double r = currentModel->SampleDisplacement();
if (r > safety) r = safety;
// sample direction of lateral displacement
G4double phi = twopi*G4UniformRand();
G4double dirx = std::cos(phi);
G4double diry = std::sin(phi);
G4ThreeVector latDirection(dirx,diry,0.0);
latDirection.rotateUz(oldDirection);
// compute new endpoint of the Step
G4ThreeVector newPosition = (step.GetPostStepPoint())->GetPosition()
+ r*latDirection;
navigator->LocateGlobalPointWithinVolume(newPosition);
fParticleChange.ProposePosition(newPosition);
}
}
}
return &fParticleChange;
if(p)p->SetParticleChange(pParticleChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VMultipleScattering::PrintInfoDefinition()
{
G4cout << G4endl << GetProcessName() << ": Model variant of multiple scattering "
<< "for " << firstParticle->GetParticleName()
<< G4endl;
if (theLambdaTable) {
G4cout << " Lambda tables from "
<< G4BestUnit(MinKinEnergy(),"Energy")
<< " to "
<< G4BestUnit(MaxKinEnergy(),"Energy")
<< " in " << nBins << " bins."
<< G4endl;
}
if (1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << G4endl << GetProcessName() << ": Model variant of multiple scattering "
<< "for " << firstParticle->GetParticleName()
<< G4endl;
if (theLambdaTable) {
G4cout << " Lambda tables from "
<< G4BestUnit(MinKinEnergy(),"Energy")
<< " to "
<< G4BestUnit(MaxKinEnergy(),"Energy")
<< " in " << nBins << " bins."
<< G4endl;
}
PrintInfo();
if (2 < verboseLevel) {
G4cout << "LambdaTable address= " << theLambdaTable << G4endl;
if(theLambdaTable) G4cout << (*theLambdaTable) << G4endl;
}
}
}
@@ -282,9 +226,7 @@ void G4VMultipleScattering::PrintInfoDefinition()
G4PhysicsVector* G4VMultipleScattering::PhysicsVector(const G4MaterialCutsCouple* couple)
{
G4int nbins = 3;
//G4int nbins = nDEDXBins;
if( couple->IsUsed() ) nbins = nBins;
// G4double xmax = maxKinEnergy*std::exp( std::log(maxKinEnergy/minKinEnergy) / ((G4double)(nbins-1)) );
G4PhysicsVector* v = new G4PhysicsLogVector(minKinEnergy, maxKinEnergy, nbins);
return v;
}
@@ -301,10 +243,12 @@ G4bool G4VMultipleScattering::StorePhysicsTable(const G4ParticleDefinition* part
G4bool yes = theLambdaTable->StorePhysicsTable(name,ascii);
if ( yes ) {
G4cout << "Physics table are stored for " << part->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
if ( verboseLevel>0 ) {
G4cout << "Physics table are stored for " << part->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
}
} else {
G4cout << "Fail to store Physics Table for " << part->GetParticleName()
<< " and process " << GetProcessName()
@@ -336,13 +280,13 @@ G4bool G4VMultipleScattering::RetrievePhysicsTable(const G4ParticleDefinition* p
G4String filename = GetPhysicsTableFileName(part,directory,"Lambda",ascii);
yes = G4PhysicsTableHelper::RetrievePhysicsTable(theLambdaTable,filename,ascii);
if ( yes ) {
if (-1 < verboseLevel) {
if (0 < verboseLevel) {
G4cout << "Lambda table for " << part->GetParticleName() << " is retrieved from <"
<< filename << ">"
<< G4endl;
}
} else {
if (-1 < verboseLevel) {
if (1 < verboseLevel) {
G4cout << "Lambda table for " << part->GetParticleName() << " in file <"
<< filename << "> is not exist"
<< G4endl;
@@ -353,10 +297,3 @@ G4bool G4VMultipleScattering::RetrievePhysicsTable(const G4ParticleDefinition* p
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4PhysicsTable* G4VMultipleScattering::LambdaTable() const
{
return theLambdaTable;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -20,8 +20,8 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.cc,v 1.6 2004/12/01 18:01:01 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4ionEffectiveCharge.cc,v 1.10 2005/02/27 18:07:33 vnivanch Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// -------------------------------------------------------------------
//
@@ -36,6 +36,7 @@
//
// 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)
//
// -------------------------------------------------------------------
@@ -53,12 +54,11 @@
G4ionEffectiveCharge::G4ionEffectiveCharge()
{
chargeCorrection = 1.0;
// energyHighLimit = 1.*MeV;
energyHighLimit = 25.*MeV;
// energyLowLimit = 3.25*keV;
energyHighLimit = 10.0*MeV;
energyLowLimit = 1.0*keV;
energyBohr = 25.*keV;
massFactor = amu_c2/(proton_mass_c2*keV);
minCharge = 0.1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -152,6 +152,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
reducedEnergy = std::max(reducedEnergy,energyLowLimit);
G4double q;
// Helium ion case
if( Zi < 2.5 ) {
@@ -172,7 +173,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
G4double zi13 = std::pow(Zi, 0.33333);
G4double zi23 = zi13*zi13;
reducedEnergy = std::max(reducedEnergy,energyBohr/z23);
// v1 is ion velocity in vF unit
G4double v1 = std::sqrt( reducedEnergy / energyBohr )/ vF ;
G4double y ;
@@ -189,18 +190,21 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
G4double y3 = std::pow(y, 0.3) ;
// 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 ) ;
if(q < 0.0) q = 0.0;
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;
// Screen length according to
// J.F.Ziegler and J.M.Manoyan, The stopping of ions in compaunds,
// Nucl. Inst. & Meth. in Phys. Res. B35 (1988) 215-228.
G4double lambda = 10.0 * vF * std::pow(1.0-q, 0.6667) / (zi13 * (6.0 + q)) ;
chargeCorrection = sq * (q + 0.5*(1.0 - q)*std::log(1.0 + lambda*lambda)/(vF*vF) );
if(q > 0.0) chargeCorrection /= 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