Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
+69 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.106 2007/11/12 10:34:23 vnivanch Exp $
$Id: History,v 1.124 2008/11/13 14:14:07 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,74 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
12 November 08: V.Ivant (emmuons-V09-01-15)
G4EnergyLossForExtrapolator - added method TrueStepLength; fixed initialisation
before a step
27 October 08: V.Ivant (emmuons-V09-01-14)
G4EnergyLossForExtrapolator - make method ComputeTrueStep public and cleanup
16 October 08: V.Ivant (emmuons-V09-01-13)
G4MuMscModel - remove obsolete
G4EnergyLossForExtrapolator - added spline option
G4MuIonisation, G4MuBremsstrahlung, G4MuPairProduction,
G4MuMultipleScattering - change SubType and improved cout
4 August 08: V.Ivant (emmuons-V09-01-12)
G4MuMscModel - added protection for ions
31 July 08: V.Ivant (emmuons-V09-01-11)
G4MuMscModel - do not define min and max energy in constructor but use Set
methods
G4MuMultipleScattering - added cout of model names
21 April 08: V.Ivanchenko (emmuons-V09-01-10)
G4MuBremsstrahlungModel, G4MuPairProductionModel - use CrossSectionPerVolume
from the base class, do not use A in CrossSEctionPerAtom
G4MuMscModel - do not use A in SetupTarget
04 April 08: V.Ivanchenko (emmuons-V09-01-09)
G4MuMultipleScattering - use G4WentzelVIModel model
build table for particles with mass < GeV
04 April 08: V.Ivanchenko (emmuons-V09-01-08)
- G4MuBremsstrahlungModel - instead of static const use members of a class,
this allows to reuse the model for different
particle type
27 March 08: V.Ivanchenko (emmuons-V09-01-07)
- G4MuPairProductionModel - fixed nan value at initialisation
of the sampling table
26 March 08: V.Ivanchenko (emmuons-V09-01-06)
- G4MuMscModel - fixed outstanding bug in sampling of scattering
25 March 08: V.Ivanchenko (emmuons-V09-01-05)
- G4MuMscModel - added shift along particle direction for displacement
- G4MuBetheBlochModel - update computation of correction
17 March 08: V.Ivanchenko (emmuons-V09-01-04)
- G4MuMscModel - fixed sampling
14 March 08: V.Ivanchenko (emmuons-V09-01-03)
- G4MuMscModel - use G4VMscModel interface
06 March 08: V.Ivanchenko (emmuons-V09-01-02)
- G4MuBremsstrahlungModel - remove ignoreCut flag, remove obsolete methods
and members, set some members protected to
be used by G4hBremsstrahlungModel
- G4MuPairProductionModel - remove ignoreCut flag, set some members protected
to be used by G4hBremsstrahlungModel
- SubType for all processes is initialized
22 February 08: V.Ivanchenko (emmuons-V09-01-01)
G4MuMscModel - added sampling of tail distribution
14 January 08: V.Ivanchenko (emmuons-V09-01-00)
G4MuMscModel - added computation of the second moment of the distribution;
fixed sampling
G4MuMultipleScattering - modified default RangeFactor
12 November 07: V.Ivanchenko (emmuons-V09-00-04)
11 November 07: V.Ivanchenko (emmuons-V09-00-03)
G4MuMscModel - fixed computation of transport cross section
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EnergyLossForExtrapolator.hh,v 1.9 2007/07/28 13:44:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4EnergyLossForExtrapolator.hh,v 1.12 2008/11/13 14:14:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//---------------------------------------------------------------------------
//
@@ -80,22 +80,30 @@ public:
const G4Material*, const G4ParticleDefinition*);
G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
const G4Material*, const G4ParticleDefinition*);
const G4Material*, const G4ParticleDefinition*);
G4double TrueStepLength(G4double kinEnergy, G4double step,
const G4Material*, const G4ParticleDefinition* part);
inline G4double EnergyAfterStep(G4double kinEnergy, G4double step,
const G4Material*, const G4String& particleName);
const G4Material*, const G4String& particleName);
inline G4double EnergyBeforeStep(G4double kinEnergy, G4double step,
const G4Material*, const G4String& particleName);
const G4Material*, const G4String& particleName);
inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*, const G4ParticleDefinition* part);
const G4Material*,
const G4ParticleDefinition* part);
inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*, const G4String& particleName);
const G4Material*,
const G4String& particleName);
inline G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part,
G4double kinEnergy, G4double stepLength);
inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*, const G4ParticleDefinition*);
const G4Material*, const G4ParticleDefinition*);
inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*, const G4String& particleName);
@@ -112,6 +120,9 @@ private:
void Initialisation();
G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
G4double kinEnergy);
G4PhysicsTable* PrepareTable();
const G4ParticleDefinition* FindParticle(const G4String& name);
@@ -122,13 +133,10 @@ private:
void ComputeProtonDEDX(const G4ParticleDefinition* part, G4PhysicsTable* table);
G4double ComputeTrueStep(const G4Material*, const G4ParticleDefinition* part,
G4double kinEnergy, G4double stepLength);
void ComputeTrasportXS(const G4ParticleDefinition* part, G4PhysicsTable* table);
inline G4double ComputeValue(G4double x, const G4PhysicsTable* table);
inline G4double ComputeScatteringAngle(G4double x);
// hide assignment operator
G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right);
G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&);
@@ -157,6 +165,7 @@ private:
G4PhysicsTable* invRangePositron;
G4PhysicsTable* invRangeMuon;
G4PhysicsTable* invRangeProton;
G4PhysicsTable* mscElectron;
const G4Material* currentMaterial;
G4int index;
@@ -213,51 +222,56 @@ inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kin
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double step,
const G4Material* mat,
const G4String& name)
inline G4double
G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double step,
const G4Material* mat,
const G4String& name)
{
return EnergyDispersion(kinEnergy,step,mat,FindParticle(name));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
inline G4double
G4EnergyLossForExtrapolator::AverageScatteringAngle(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
if(!isInitialised) Initialisation();
G4double theta = 0.0;
if(mat && part && kinEnergy > 0.0) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
if(step > 0.001*radLength) theta = ComputeScatteringAngle(stepLength);
if(SetupKinematics(part, mat, kinEnergy)) {
G4double t = stepLength/radLength;
G4double y = std::max(0.001, t);
theta = 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(y))/(beta2*gam*mass);
}
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EnergyLossForExtrapolator::ComputeScatteringAngle(G4double x)
inline G4double
G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
const G4ParticleDefinition* part,
G4double kinEnergy,
G4double stepLength)
{
G4double t = x/radLength;
return 19.23*MeV*std::sqrt(charge2*t)*(1.0 + 0.038*std::log(t))/(beta2*gam*mass);
}
G4double theta = AverageScatteringAngle(kinEnergy,stepLength,mat,part);
return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EnergyLossForExtrapolator::EnergyDispersion(
G4double kinEnergy,
inline
G4double G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
if(!isInitialised) Initialisation();
G4double sig2 = 0.0;
if(mat && part ) {
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
sig2 = (1.0/beta2 - 0.5)* twopi_mc2_rcl2 * tmax*step * electronDensity * charge2;
sig2 = (1.0/beta2 - 0.5)*twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
}
return sig2;
}
@@ -268,8 +282,8 @@ inline G4double G4EnergyLossForExtrapolator::ComputeValue(G4double x,
const G4PhysicsTable* table)
{
G4double res = 0.0;
bool b;
res = ((*table)[index])->GetValue(x, b);
G4bool b;
if(table) res = ((*table)[index])->GetValue(x, b);
return res;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MuBetheBlochModel.hh,v 1.17 2007/05/22 17:35:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlung.hh,v 1.29 2007/05/23 08:49:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuBremsstrahlung.hh,v 1.30 2008/02/29 17:50:05 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -115,20 +115,22 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
inline
G4bool G4MuBremsstrahlung::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
inline
G4double G4MuBremsstrahlung::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
{
return lowestKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlungModel.hh,v 1.17 2007/10/11 09:25:31 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuBremsstrahlungModel.hh,v 1.21 2008/07/22 16:11:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -44,14 +44,16 @@
// 13-02-03 Add name (V.Ivanchenko)
// 10-02-04 Add lowestKinEnergy (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 13-02-06 add ComputeCrossSectionPerAtom (mma)
// 13-02-06 Add ComputeCrossSectionPerAtom (mma)
// 11-10-07 Add ignoreCut flag (V.Ivanchenko)
// 28-02-08 Reorganized protected methods and members (V.Ivanchenko)
// 06-03-08 Remove obsolete methods and members (V.Ivanchenko)
//
//
// Class Description:
//
// Implementation of energy loss for gamma emission by muons
// Implementation of bremssrahlung by muons
// -------------------------------------------------------------------
//
@@ -60,6 +62,7 @@
#define G4MuBremsstrahlungModel_h 1
#include "G4VEmModel.hh"
#include "G4NistManager.hh"
class G4Element;
class G4ParticleChangeForLoss;
@@ -78,8 +81,6 @@ public:
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
void SetLowestKineticEnergy(G4double e) {lowestKinEnergy = e;};
G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
@@ -89,13 +90,7 @@ public:
G4double Z, G4double A,
G4double cutEnergy,
G4double maxEnergy);
virtual G4double CrossSectionPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
virtual G4double ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
@@ -107,87 +102,98 @@ public:
G4double tmin,
G4double maxEnergy);
inline void SetLowestKineticEnergy(G4double e);
protected:
G4double ComputMuBremLoss(G4double Z, G4double tkin, G4double cut);
G4double ComputeMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double cut);
virtual G4double ComputeDMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double gammaEnergy);
G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
public:
G4double ComputMuBremLoss(G4double Z, G4double A, G4double tkin, G4double cut);
G4double ComputeMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double A,
G4double cut);
G4double ComputeDMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double A,
G4double gammaEnergy);
inline void SetIgnoreCutFlag(G4bool);
inline G4bool IgnoreCutFlag() const;
private:
G4DataVector* ComputePartialSumSigma(const G4Material* material,
G4double tkin, G4double cut);
const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple) const;
void MakeSamplingTables();
G4DataVector* ComputePartialSumSigma(const G4Material* material,
G4double tkin, G4double cut);
const G4Element* SelectRandomAtom(const G4MaterialCutsCouple* couple) const;
// hide assignment operator
G4MuBremsstrahlungModel & operator=(const G4MuBremsstrahlungModel &right);
G4MuBremsstrahlungModel(const G4MuBremsstrahlungModel&);
G4ParticleDefinition* theGamma;
protected:
const G4ParticleDefinition* particle;
G4NistManager* nist;
G4double mass;
G4double rmass;
G4double cc;
G4double coeff;
G4double sqrte;
G4double bh;
G4double bh1;
G4double btf;
G4double btf1;
private:
G4ParticleDefinition* theGamma;
G4ParticleChangeForLoss* fParticleChange;
G4double highKinEnergy;
G4double lowKinEnergy;
G4double lowestKinEnergy;
G4double minThreshold;
G4double mass;
// tables for sampling
G4int nzdat,ntdat,NBIN;
static G4double zdat[5],adat[5],tdat[8];
G4double ya[1001], proba[5][8][1001];
G4double cutFixed;
G4bool ignoreCut;
std::vector<G4DataVector*> partialSumSigma;
G4bool samplingTablesAreFilled;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MuBremsstrahlungModel::MaxSecondaryEnergy(
const G4ParticleDefinition*,
G4double kineticEnergy)
inline
G4double G4MuBremsstrahlungModel::MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy)
{
return kineticEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4MuBremsstrahlungModel::SetIgnoreCutFlag(G4bool val)
inline void G4MuBremsstrahlungModel::SetLowestKineticEnergy(G4double e)
{
ignoreCut = val;
lowestKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4MuBremsstrahlungModel::IgnoreCutFlag() const
inline
G4double G4MuBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*)
{
return ignoreCut;
return minThreshold;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4MuBremsstrahlungModel::SetParticle(const G4ParticleDefinition* p)
{
if(!particle) {
particle = p;
mass = particle->GetPDGMass();
rmass=mass/electron_mass_c2 ;
cc=classic_electr_radius/rmass ;
coeff= 16.*fine_structure_const*cc*cc/3. ;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MuIonisation.hh,v 1.30 2007/05/23 08:49:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -1,256 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuMscModel.hh,v 1.4 2007/11/09 19:48:09 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
//
// GEANT4 Class header file
//
//
// File name: G4MuMscModel
//
// Author: V.Ivanchenko on base of L.Urban model
//
// Creation date: 25.10.2007
//
// Modifications:
//
//
// Class Description:
//
// Implementation of the model of multiple scattering based on
// H.W.Lewis Phys Rev 78 (1950) 526 and L.Urban model
// -------------------------------------------------------------------
//
#ifndef G4MuMscModel_h
#define G4MuMscModel_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4eCoulombScatteringModel.hh"
#include "G4PhysicsTable.hh"
#include "G4MscStepLimitType.hh"
#include "G4MaterialCutsCouple.hh"
class G4LossTableManager;
class G4ParticleChangeForMSC;
class G4SafetyHelper;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MuMscModel : public G4eCoulombScatteringModel
{
public:
G4MuMscModel(G4double frange = 0.2,
G4double thetaMax = 0.04,
G4double tMax = TeV*TeV,
const G4String& nam = "MuMscUni");
virtual ~G4MuMscModel();
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight=0.,
G4double cut = DBL_MAX,
G4double emax= DBL_MAX);
void SampleScattering(const G4DynamicParticle*, G4double safety);
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double);
G4double ComputeTruePathLengthLimit(const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
G4double ComputeGeomPathLength(G4double truePathLength);
G4double ComputeTrueStepLength(G4double geomStepLength);
inline void SetStepLimitType(G4MscStepLimitType);
inline void SetLateralDisplasmentFlag(G4bool val);
inline G4double GetLambda(G4double kinEnergy);
inline G4double GetLambda2(G4double kinEnergy);
// inline void SetThetaLimit(G4double);
inline void SetRangeFactor(G4double);
private:
void BuildTables();
G4double ComputeLambda2(G4double kinEnergy, G4double cut);
inline void DefineMaterial(const G4MaterialCutsCouple*);
// hide assignment operator
G4MuMscModel & operator=(const G4MuMscModel &right);
G4MuMscModel(const G4MuMscModel&);
G4ParticleChangeForMSC* fParticleChange;
G4SafetyHelper* safetyHelper;
G4PhysicsTable* theLambdaTable;
G4PhysicsTable* theLambda2Table;
G4LossTableManager* theManager;
const G4DataVector* currentCuts;
G4double dtrl;
G4double facrange;
G4double thetaLimit;
G4double numlimit;
G4double tlimitminfix;
G4double invsqrt12;
G4double lowBinEnergy;
G4double highBinEnergy;
// cash
G4double preKinEnergy;
G4double xSection;
G4double ecut;
G4double lambda0;
G4double tPathLength;
G4double zPathLength;
G4double lambdaeff;
G4double currentRange;
G4double par1;
G4double par2;
G4double par3;
G4int currentMaterialIndex;
G4int nbins;
G4int nwarnings;
G4int nwarnlimit;
const G4MaterialCutsCouple* currentCouple;
G4MscStepLimitType steppingAlgorithm;
G4bool samplez;
G4bool latDisplasment;
G4bool isInitialized;
G4bool buildTables;
G4bool newrun;
G4bool inside;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4MuMscModel::SetLateralDisplasmentFlag(G4bool val)
{
latDisplasment = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
/*
inline
void G4MuMscModel::SetThetaLimit(G4double val)
{
thetaLimit = val;
}
*/
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4MuMscModel::SetRangeFactor(G4double val)
{
facrange = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4MuMscModel::SetStepLimitType(G4MscStepLimitType val)
{
steppingAlgorithm = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4MuMscModel::DefineMaterial(const G4MaterialCutsCouple* cup)
{
if(cup != currentCouple) {
currentCouple = cup;
currentMaterialIndex = currentCouple->GetIndex();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4double G4MuMscModel::GetLambda(G4double e)
{
G4double x;
if(theLambdaTable) {
G4bool b;
x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
} else {
x = CrossSection(currentCouple,particle,e);
}
if(x > DBL_MIN) x = 1./x;
else x = DBL_MAX;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4double G4MuMscModel::GetLambda2(G4double e)
{
G4double x;
if(theLambda2Table) {
G4bool b;
x = ((*theLambda2Table)[currentMaterialIndex])->GetValue(e, b);
} else {
x = ComputeLambda2(e, (*currentCuts)[currentMaterialIndex]);
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuMultipleScattering.hh,v 1.1 2007/10/26 09:52:37 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuMultipleScattering.hh,v 1.2 2008/04/13 17:19:13 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -----------------------------------------------------------------------------
//
@@ -59,7 +59,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MuMscModel;
class G4VMscModel;
class G4MuMultipleScattering : public G4VMultipleScattering
@@ -93,7 +93,7 @@ protected:
private: // data members
G4MuMscModel* mscModel;
G4VMscModel* mscModel;
G4double thetaLimit;
G4double dtrl;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuPairProduction.hh,v 1.29 2007/05/23 08:49:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuPairProduction.hh,v 1.30 2008/02/29 17:50:05 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -114,20 +114,22 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
inline
G4bool G4MuPairProduction::IsApplicable(const G4ParticleDefinition& p)
{
return (p.GetPDGCharge() != 0.0 && p.GetPDGMass() > 10.0*MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
inline
G4double G4MuPairProduction::MinPrimaryEnergy(const G4ParticleDefinition*,
const G4Material*,
G4double)
{
return lowestKinEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuPairProductionModel.hh,v 1.24 2007/10/11 13:52:03 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuPairProductionModel.hh,v 1.27 2008/07/22 16:11:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -47,6 +47,7 @@
// 13-02-06 Add ComputeCrossSectionPerAtom (mma)
// 12-05-06 Add parameter to SelectRandomAtom (A.Bogdanov)
// 11-10-07 Add ignoreCut flag (V.Ivanchenko)
// 28-02-08 Reorganized protected methods and members (V.Ivanchenko)
//
// Class Description:
@@ -61,6 +62,7 @@
#define G4MuPairProductionModel_h 1
#include "G4VEmModel.hh"
#include "G4NistManager.hh"
#include <vector>
class G4Element;
@@ -69,7 +71,6 @@ class G4ParticleChangeForGamma;
class G4MuPairProductionModel : public G4VEmModel
{
public:
G4MuPairProductionModel(const G4ParticleDefinition* p = 0,
@@ -77,14 +78,8 @@ public:
virtual ~G4MuPairProductionModel();
void SetParticle(const G4ParticleDefinition*);
void Initialise(const G4ParticleDefinition*, const G4DataVector&);
void SetLowestKineticEnergy(G4double e) {lowestKinEnergy = e;};
G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
@@ -93,31 +88,26 @@ public:
G4double cutEnergy,
G4double maxEnergy);
virtual G4double CrossSectionPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy);
virtual G4double ComputeDEDXPerVolume(const G4Material*,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy);
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SetLowestKineticEnergy(G4double e);
inline G4double MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*);
inline void SetParticle(const G4ParticleDefinition*);
protected:
inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
public:
G4double ComputMuPairLoss(G4double Z, G4double tkin, G4double cut,
G4double tmax);
@@ -125,13 +115,14 @@ public:
G4double Z,
G4double cut);
G4double ComputeDMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double pairEnergy);
virtual G4double ComputeDMicroscopicCrossSection(G4double tkin,
G4double Z,
G4double pairEnergy);
inline void SetIgnoreCutFlag(G4bool);
inline G4double MaxSecondaryEnergy(const G4ParticleDefinition*,
G4double kineticEnergy);
inline G4bool IgnoreCutFlag() const;
inline void SetCurrentElement(G4double Z);
private:
@@ -143,8 +134,6 @@ private:
void MakeSamplingTables();
void SetCurrentElement(G4double Z);
inline G4double InterpolatedIntegralCrossSection(
G4double dt, G4double dz, G4int iz,
G4int it, G4int iy, G4double z);
@@ -153,13 +142,10 @@ private:
G4MuPairProductionModel & operator=(const G4MuPairProductionModel &right);
G4MuPairProductionModel(const G4MuPairProductionModel&);
G4ParticleDefinition* theElectron;
G4ParticleDefinition* thePositron;
G4ParticleChangeForLoss* fParticleChange;
G4ParticleChangeForGamma* gParticleChange;
protected:
G4double minPairEnergy;
G4double lowestKinEnergy;
const G4ParticleDefinition* particle;
G4NistManager* nist;
G4double factorForCross;
G4double sqrte;
@@ -169,28 +155,62 @@ private:
G4double z23;
G4double lnZ;
const G4ParticleDefinition* particle;
static G4double xgi[8],wgi[8];
private:
G4ParticleDefinition* theElectron;
G4ParticleDefinition* thePositron;
G4ParticleChangeForLoss* fParticleChange;
G4double minPairEnergy;
G4double lowestKinEnergy;
// tables for sampling
G4int nzdat;
G4int ntdat;
G4int nbiny;
size_t nmaxElements;
static G4double zdat[5],adat[5],tdat[8],xgi[8],wgi[8];
static G4double zdat[5],adat[5],tdat[8];
G4double ya[1001],proba[5][8][1001];
G4double ymin;
G4double ymax;
G4double dy;
G4bool ignoreCut;
G4bool samplingTablesAreFilled;
std::vector<G4double> partialSum;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4MuPairProductionModel::SetLowestKineticEnergy(G4double e)
{
lowestKinEnergy = e;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* )
{
return minPairEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p)
{
if(!particle) {
particle = p;
particleMass = particle->GetPDGMass();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4MuPairProductionModel::MaxSecondaryEnergy(
const G4ParticleDefinition*,
G4double kineticEnergy)
@@ -205,9 +225,10 @@ inline void G4MuPairProductionModel::SetCurrentElement(G4double Z)
{
if(Z != currentZ) {
currentZ = Z;
z13 = std::pow(Z,0.333333333);
G4int iz = G4int(Z);
z13 = nist->GetZ13(iz);
z23 = z13*z13;
lnZ = std::log(Z);
lnZ = nist->GetLOGZ(iz);
}
}
@@ -228,18 +249,4 @@ inline G4double G4MuPairProductionModel::InterpolatedIntegralCrossSection(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4MuPairProductionModel::SetIgnoreCutFlag(G4bool val)
{
ignoreCut = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4bool G4MuPairProductionModel::IgnoreCutFlag() const
{
return ignoreCut;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EnergyLossForExtrapolator.cc,v 1.13 2007/07/28 13:44:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4EnergyLossForExtrapolator.cc,v 1.18 2008/11/13 14:14:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//---------------------------------------------------------------------------
//
@@ -66,6 +66,8 @@
#include "G4MuPairProductionModel.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4ProductionCuts.hh"
#include "G4LossTableManager.hh"
#include "G4WentzelVIModel.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -87,6 +89,7 @@ G4EnergyLossForExtrapolator:: ~G4EnergyLossForExtrapolator()
delete invRangeElectron;
delete invRangePositron;
delete invRangeProton;
delete mscElectron;
delete cuts;
}
@@ -99,8 +102,8 @@ G4double G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
{
if(!isInitialised) Initialisation();
G4double kinEnergyFinal = kinEnergy;
if(mat && part) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
G4double r = ComputeRange(kinEnergy,part);
if(r <= step) {
kinEnergyFinal = 0.0;
@@ -124,8 +127,8 @@ G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
if(!isInitialised) Initialisation();
G4double kinEnergyFinal = kinEnergy;
if(mat && part) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
G4double r = ComputeRange(kinEnergy,part);
if(step < linLossLimit*r) {
@@ -140,10 +143,34 @@ G4double G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
const G4ParticleDefinition* part,
G4double kinEnergy, G4double stepLength)
G4double G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double res = stepLength;
if(!isInitialised) Initialisation();
if(SetupKinematics(part, mat, kinEnergy)) {
if(part == electron || part == positron) {
G4double x = stepLength*ComputeValue(kinEnergy, mscElectron);
if(x < 0.2) res *= (1.0 + 0.5*x + x*x/3.0);
else if(x < 0.9999) res = -std::log(1.0 - x)*stepLength/x;
else res = ComputeRange(kinEnergy,part);
} else {
res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
}
}
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
const G4Material* mat,
G4double kinEnergy)
{
if(!part || !mat || kinEnergy < keV) return false;
if(!isInitialised) Initialisation();
G4bool flag = false;
if(part != currentParticle) {
@@ -181,8 +208,7 @@ G4double G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
}
if(tmax > maxEnergyTransfer) tmax = maxEnergyTransfer;
}
G4double theta = ComputeScatteringAngle(stepLength);
return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -230,6 +256,7 @@ void G4EnergyLossForExtrapolator::Initialisation()
invRangePositron = PrepareTable();
invRangeMuon = PrepareTable();
invRangeProton = PrepareTable();
mscElectron = PrepareTable();
G4LossTableBuilder builder;
@@ -261,6 +288,7 @@ void G4EnergyLossForExtrapolator::Initialisation()
builder.BuildRangeTable(dedxProton, rangeProton);
builder.BuildInverseRangeTable(rangeProton, invRangeProton);
ComputeTrasportXS(electron, mscElectron);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -272,6 +300,7 @@ G4PhysicsTable* G4EnergyLossForExtrapolator::PrepareTable()
for(G4int i=0; i<nmat; i++) {
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
v->SetSpline(G4LossTableManager::Instance()->SplineFlag());
table->push_back(v);
}
return table;
@@ -487,3 +516,44 @@ void G4EnergyLossForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
G4PhysicsTable* table)
{
G4DataVector v;
G4WentzelVIModel* msc = new G4WentzelVIModel();
msc->SetPolarAngleLimit(CLHEP::pi);
msc->Initialise(part, v);
mass = part->GetPDGMass();
charge2 = 1.0;
currentParticle = part;
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(0<verbose) {
G4cout << "G4EnergyLossForExtrapolator::ComputeProtonDEDX for " << part->GetParticleName()
<< G4endl;
}
for(G4int i=0; i<nmat; i++) {
const G4Material* mat = (*mtable)[i];
if(1<verbose)
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<nbins; j++) {
G4double e = aVector->GetLowEdgeEnergy(j);
G4double xs = msc->CrossSectionPerVolume(mat,part,e);
aVector->PutValue(j,xs);
if(1<verbose) {
G4cout << "j= " << j << " e(MeV)= " << e/MeV
<< " xs(1/mm)= " << xs*mm << G4endl;
}
}
}
delete msc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuBetheBlochModel.cc,v 1.23 2007/05/22 17:35:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuBetheBlochModel.cc,v 1.24 2008/03/25 12:31:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -274,7 +274,7 @@ G4double G4MuBetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
dedx *= twopi_mc2_rcl2*eDensity/beta2;
//High order corrections
dedx += corr->HighOrderCorrections(p,material,kineticEnergy);
dedx += corr->HighOrderCorrections(p,material,kineticEnergy,cutEnergy);
return dedx;
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlung.cc,v 1.38 2007/05/22 17:35:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuBremsstrahlung.cc,v 1.41 2008/10/16 13:37:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -81,7 +81,9 @@ G4MuBremsstrahlung::G4MuBremsstrahlung(const G4String& name)
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
isInitialised(false)
{}
{
SetProcessSubType(fBremsstrahlung);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -90,8 +92,9 @@ G4MuBremsstrahlung::~G4MuBremsstrahlung()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
const G4ParticleDefinition*)
void G4MuBremsstrahlung::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*)
{
if(!isInitialised) {
@@ -104,9 +107,9 @@ void G4MuBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*
G4MuBremsstrahlungModel* em = new G4MuBremsstrahlungModel();
em->SetLowestKineticEnergy(lowestKinEnergy);
G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
em->SetLowEnergyLimit(0.1*keV);
em->SetHighEnergyLimit(100.0*TeV);
G4VEmFluctuationModel* fm = 0;
em->SetLowEnergyLimit(MinKinEnergy());
em->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(1, em, fm);
}
}
@@ -114,10 +117,7 @@ void G4MuBremsstrahlung::InitialiseEnergyLossProcess(const G4ParticleDefinition*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuBremsstrahlung::PrintInfo()
{
G4cout << " Parametrised model "
<< G4endl;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuBremsstrahlungModel.cc,v 1.24 2007/11/08 11:48:28 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuBremsstrahlungModel.cc,v 1.32 2008/07/22 16:11:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -45,11 +45,12 @@
// 27-01-03 Make models region aware (V.Ivanchenko)
// 13-02-03 Add name (V.Ivanchenko)
// 10-02-04 Add lowestKinEnergy (V.Ivanchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 03-08-05 Angular correlations according to PRM (V.Ivantchenko)
// 08-04-05 Major optimisation of internal interfaces (V.Ivanchenko)
// 03-08-05 Angular correlations according to PRM (V.Ivanchenko)
// 13-02-06 add ComputeCrossSectionPerAtom (mma)
// 21-03-06 Fix problem of initialisation in case when cuts are not defined (VI)
// 07-11-07 Improve sampling of final state (A.Bogdanov)
// 28-02-08 Use precomputed Z^1/3 and Log(A) (V.Ivanchenko)
//
//
@@ -73,14 +74,6 @@
#include "G4ParticleChangeForLoss.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// static members
//
G4double G4MuBremsstrahlungModel::zdat[]={1., 4., 13., 29., 92.};
G4double G4MuBremsstrahlungModel::adat[]={1.01, 9.01, 26.98, 63.55, 238.03};
G4double G4MuBremsstrahlungModel::tdat[]={1.e3, 1.e4, 1.e5, 1.e6, 1.e7, 1.e8,
1.e9, 1.e10};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
@@ -89,16 +82,17 @@ G4MuBremsstrahlungModel::G4MuBremsstrahlungModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
particle(0),
sqrte(sqrt(exp(1.))),
bh(202.4),
bh1(446.),
btf(183.),
btf1(1429.),
fParticleChange(0),
lowestKinEnergy(1.0*GeV),
minThreshold(1.0*keV),
nzdat(5),
ntdat(8),
NBIN(1000),
cutFixed(0.98*keV),
ignoreCut(false),
samplingTablesAreFilled(false)
minThreshold(1.0*keV)
{
theGamma = G4Gamma::Gamma();
nist = G4NistManager::Instance();
if(p) SetParticle(p);
}
@@ -116,24 +110,6 @@ G4MuBremsstrahlungModel::~G4MuBremsstrahlungModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlungModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple*)
{
return minThreshold;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlungModel::SetParticle(const G4ParticleDefinition* p)
{
if(!particle) {
particle = p;
mass = particle->GetPDGMass();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
@@ -141,13 +117,15 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
highKinEnergy = HighEnergyLimit();
// partial cross section is computed for fixed energy
G4double fixedEnergy = 0.5*highKinEnergy;
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
if(theCoupleTable) {
G4int numOfCouples = theCoupleTable->GetTableSize();
// clear old data
G4int nn = partialSumSigma.size();
G4int nc = cuts.size();
if(nn > 0) {
@@ -157,11 +135,14 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
}
partialSumSigma.clear();
}
// fill new data
if (numOfCouples>0) {
for (G4int i=0; i<numOfCouples; i++) {
G4double cute = DBL_MAX;
// protection for usage with extrapolator
if(i < nc) cute = cuts[i];
if(cute < cutFixed || ignoreCut) cute = cutFixed;
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
@@ -170,12 +151,15 @@ void G4MuBremsstrahlungModel::Initialise(const G4ParticleDefinition* p,
}
}
}
if(!samplingTablesAreFilled) MakeSamplingTables();
if(pParticleChange)
fParticleChange =
reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
// define pointer to G4ParticleChange
if(!fParticleChange) {
if(pParticleChange)
fParticleChange =
reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -187,33 +171,32 @@ G4double G4MuBremsstrahlungModel::ComputeDEDXPerVolume(
G4double cutEnergy)
{
G4double dedx = 0.0;
if (kineticEnergy <= lowestKinEnergy || ignoreCut) return dedx;
if (kineticEnergy <= lowestKinEnergy) return dedx;
G4double tmax = kineticEnergy;
G4double cut = min(cutEnergy,tmax);
if(cut < cutFixed) cut = cutFixed;
G4double cut = std::min(cutEnergy,tmax);
if(cut < minThreshold) cut = minThreshold;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomicNumDensityVector =
material->GetAtomicNumDensityVector();
material->GetAtomicNumDensityVector();
// loop for elements in the material
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;
G4double loss = ComputMuBremLoss(Z, A, kineticEnergy, cut);
G4double loss =
ComputMuBremLoss((*theElementVector)[i]->GetZ(), kineticEnergy, cut);
dedx += loss*theAtomicNumDensityVector[i];
}
// G4cout << "BR e= " << kineticEnergy << " dedx= " << dedx << G4endl;
if(dedx < 0.) dedx = 0.;
return dedx;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z, G4double A,
G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z,
G4double tkin, G4double cut)
{
G4double totalEnergy = mass + tkin;
@@ -238,7 +221,7 @@ G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z, G4double A,
for(G4int i=0; i<6; i++)
{
G4double ep = (aa + xgi[i]*hhh)*totalEnergy;
loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, A, ep);
loss += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
}
aa += hhh;
}
@@ -253,7 +236,6 @@ G4double G4MuBremsstrahlungModel::ComputMuBremLoss(G4double Z, G4double A,
G4double G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double A,
G4double cut)
{
G4double totalEnergy = tkin + mass;
@@ -271,7 +253,7 @@ G4double G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(
G4double aaa = log(vcut);
G4double bbb = log(vmax);
G4int kkk = (G4int)((bbb-aaa)/ak1)+k2 ;
G4double hhh = (bbb-aaa)/float(kkk);
G4double hhh = (bbb-aaa)/G4double(kkk);
G4double aa = aaa;
@@ -280,13 +262,15 @@ G4double G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(
for(G4int i=0; i<6; i++)
{
G4double ep = exp(aa + xgi[i]*hhh)*totalEnergy;
cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, A, ep);
cross += ep*wgi[i]*ComputeDMicroscopicCrossSection(tkin, Z, ep);
}
aa += hhh;
}
cross *=hhh;
//G4cout << "BR e= " << tkin<< " cross= " << cross/barn << G4endl;
return cross;
}
@@ -295,16 +279,9 @@ G4double G4MuBremsstrahlungModel::ComputeMicroscopicCrossSection(
G4double G4MuBremsstrahlungModel::ComputeDMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double A,
G4double gammaEnergy)
// differential cross section
{
static const G4double sqrte=sqrt(exp(1.)) ;
static const G4double bh=202.4,bh1=446.,btf=183.,btf1=1429. ;
static const G4double rmass=mass/electron_mass_c2 ;
static const G4double cc=classic_electr_radius/rmass ;
static const G4double coeff= 16.*fine_structure_const*cc*cc/3. ;
G4double dxsection = 0.;
if( gammaEnergy > tkin) return dxsection ;
@@ -314,22 +291,25 @@ G4double G4MuBremsstrahlungModel::ComputeDMicroscopicCrossSection(
G4double delta = 0.5*mass*mass*v/(E-gammaEnergy) ;
G4double rab0=delta*sqrte ;
G4double z13 = exp(-log(Z)/3.) ;
G4double dn = 1.54*exp(0.27*log(A)) ;
G4int iz = G4int(Z);
if(iz < 1) iz = 1;
G4double z13 = 1.0/nist->GetZ13(iz);
G4double dn = 1.54*nist->GetA27(iz);
G4double b,b1,dnstar ;
if(Z<1.5)
if(1 == iz)
{
b=bh;
b1=bh1;
dnstar=dn ;
b = bh;
b1 = bh1;
dnstar = dn;
}
else
{
b=btf;
b1=btf1;
dnstar = exp((1.-1./Z)*log(dn)) ;
b = btf;
b1 = btf1;
dnstar = dn/std::pow(dn, 1./Z);
}
// nucleus contribution logarithm
@@ -358,50 +338,21 @@ G4double G4MuBremsstrahlungModel::ComputeDMicroscopicCrossSection(
G4double G4MuBremsstrahlungModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double Z, G4double A,
G4double Z, G4double,
G4double cutEnergy,
G4double)
{
G4double cut = min(cutEnergy, kineticEnergy);
if(cut < cutFixed || ignoreCut) cut = cutFixed;
G4double cross =
ComputeMicroscopicCrossSection (kineticEnergy, Z, A/(g/mole), cut);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuBremsstrahlungModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy)
G4double maxEnergy)
{
G4double cross = 0.0;
if (cutEnergy >= maxEnergy || kineticEnergy <= lowestKinEnergy) return cross;
G4double tmax = min(maxEnergy, kineticEnergy);
G4double cut = min(cutEnergy, tmax);
if(cut < cutFixed || ignoreCut) cut = cutFixed;
if (kineticEnergy <= lowestKinEnergy) return cross;
G4double tmax = std::min(maxEnergy, kineticEnergy);
G4double cut = std::min(cutEnergy, kineticEnergy);
if(cut < minThreshold) cut = minThreshold;
if (cut >= tmax) return cross;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector =
material->GetAtomicNumDensityVector();
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double A = (*theElementVector)[i]->GetA()/(g/mole);
G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cut);
if(tmax < kineticEnergy) {
cr -= ComputeMicroscopicCrossSection(kineticEnergy, Z, A, tmax);
}
cross += theAtomNumDensityVector[i] * cr;
cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
if(tmax < kineticEnergy) {
cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
}
return cross;
}
@@ -409,27 +360,26 @@ G4double G4MuBremsstrahlungModel::CrossSectionPerVolume(
G4DataVector* G4MuBremsstrahlungModel::ComputePartialSumSigma(
const G4Material* material,
G4double kineticEnergy,
G4double cut)
G4double kineticEnergy,
G4double cut)
// Build the table of cross section per element. The table is built for MATERIAL
// This table is used by DoIt to select randomly an element in the material.
// Build the table of cross section per element.
// The table is built for material
// This table is used to select randomly an element in the material.
{
G4int nElements = material->GetNumberOfElements();
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector =
material->GetAtomicNumDensityVector();
material->GetAtomicNumDensityVector();
G4DataVector* dv = new G4DataVector();
G4double cross = 0.0;
for (G4int i=0; i<nElements; i++ ) {
G4double Z = (*theElementVector)[i]->GetZ();
G4double A = (*theElementVector)[i]->GetA()/(g/mole) ;
cross += theAtomNumDensityVector[i]
* ComputeMicroscopicCrossSection(kineticEnergy, Z, A, cut);
* ComputeMicroscopicCrossSection(kineticEnergy,
(*theElementVector)[i]->GetZ(), cut);
dv->push_back(cross);
}
return dv;
@@ -437,126 +387,52 @@ G4DataVector* G4MuBremsstrahlungModel::ComputePartialSumSigma(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlungModel::MakeSamplingTables()
{
G4double AtomicNumber,AtomicWeight,KineticEnergy,
TotalEnergy,Maxep;
for (G4int iz=0; iz<nzdat; iz++)
{
AtomicNumber = zdat[iz];
AtomicWeight = adat[iz]*g/mole ;
for (G4int it=0; it<ntdat; it++)
{
KineticEnergy = tdat[it];
TotalEnergy = KineticEnergy + mass;
Maxep = KineticEnergy ;
G4double CrossSection = 0.0 ;
// calculate the differential cross section
// numerical integration in
// log ...............
G4double c = log(Maxep/cutFixed) ;
G4double ymin = -5. ;
G4double ymax = 0. ;
G4double dy = (ymax-ymin)/NBIN ;
G4double y = ymin - 0.5*dy ;
G4double yy = ymin - dy ;
G4double x = exp(y);
G4double fac = exp(dy);
G4double dx = exp(yy)*(fac - 1.0);
for (G4int i=0 ; i<NBIN; i++)
{
y += dy ;
x *= fac;
dx*= fac;
G4double ep = cutFixed*exp(c*x) ;
CrossSection += ep*dx*ComputeDMicroscopicCrossSection(
KineticEnergy,AtomicNumber,
AtomicWeight,ep) ;
ya[i]=y ;
proba[iz][it][i] = CrossSection ;
}
proba[iz][it][NBIN] = CrossSection ;
ya[NBIN] = 0. ; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if(CrossSection > 0.)
{
for(G4int ib=0; ib<=NBIN; ib++)
{
proba[iz][it][ib] /= CrossSection ;
}
}
}
}
samplingTablesAreFilled = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double minEnergy,
G4double maxEnergy)
void G4MuBremsstrahlungModel::SampleSecondaries(
std::vector<G4DynamicParticle*>* vdp,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double minEnergy,
G4double maxEnergy)
{
G4double kineticEnergy = dp->GetKineticEnergy();
// check against insufficient energy
G4double tmax = min(kineticEnergy, maxEnergy);
G4double tmin = min(kineticEnergy, minEnergy);
if(tmin < cutFixed || ignoreCut) tmin = cutFixed;
G4double tmax = std::min(kineticEnergy, maxEnergy);
G4double tmin = std::min(kineticEnergy, minEnergy);
if(tmin < minThreshold) tmin = minThreshold;
if(tmin >= tmax) return;
// ===== the begining of a new code ======
// ===== sampling of energy transfer ======
G4ParticleMomentum partDirection = dp->GetMomentumDirection();
// select randomly one element constituing the material
const G4Element* anElement = SelectRandomAtom(couple);
G4double Z = anElement->GetZ();
G4double totalEnergy = kineticEnergy + mass;
G4double totalMomentum = sqrt(kineticEnergy*(kineticEnergy + 2.0*mass));
G4double AtomicNumber = anElement->GetZ();
G4double AtomicWeight = anElement->GetA()/(g/mole);
G4double func1 = tmin*ComputeDMicroscopicCrossSection(
kineticEnergy,AtomicNumber,
AtomicWeight,tmin);
G4double func1 = tmin*
ComputeDMicroscopicCrossSection(kineticEnergy,Z,tmin);
G4double lnepksi, epksi;
G4double func2;
G4double ksi2;
do {
lnepksi = log(tmin) + G4UniformRand()*log(kineticEnergy/tmin);
epksi = exp(lnepksi);
func2 = epksi*ComputeDMicroscopicCrossSection(
kineticEnergy,AtomicNumber,
AtomicWeight,epksi);
ksi2 = G4UniformRand();
func2 = epksi*ComputeDMicroscopicCrossSection(kineticEnergy,Z,epksi);
} while(func2/func1 < ksi2);
} while(func2 < func1*G4UniformRand());
// ===== the end of a new code =====
// create G4DynamicParticle object for the Gamma
G4double gEnergy = epksi;
// sample angle
// ===== sample angle =====
G4double gam = totalEnergy/mass;
G4double rmax = gam*min(1.0, totalEnergy/gEnergy - 1.0);
rmax *= rmax;
G4double x = G4UniformRand()*rmax/(1.0 + rmax);
G4double rmax = gam*std::min(1.0, totalEnergy/gEnergy - 1.0);
G4double rmax2= rmax*rmax;
G4double x = G4UniformRand()*rmax2/(1.0 + rmax2);
G4double theta = sqrt(x/(1.0 - x))/gam;
G4double sint = sin(theta);
@@ -576,7 +452,8 @@ void G4MuBremsstrahlungModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
fParticleChange->SetProposedMomentumDirection(partDirection);
// save secondary
G4DynamicParticle* aGamma = new G4DynamicParticle(theGamma,gDirection,gEnergy);
G4DynamicParticle* aGamma =
new G4DynamicParticle(theGamma,gDirection,gEnergy);
vdp->push_back(aGamma);
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuIonisation.cc,v 1.54 2007/05/22 17:35:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuIonisation.cc,v 1.57 2008/10/27 10:55:07 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -98,9 +98,10 @@ G4MuIonisation::G4MuIonisation(const G4String& name)
theBaseParticle(0),
isInitialised(false)
{
SetStepFunction(0.2, 1*mm);
SetIntegral(true);
SetVerboseLevel(1);
// SetStepFunction(0.2, 1*mm);
//SetIntegral(true);
//SetVerboseLevel(1);
SetProcessSubType(fIonisation);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -124,7 +125,7 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
flucModel = new G4UniversalFluctuation();
G4VEmModel* em = new G4BraggModel();
em->SetLowEnergyLimit(0.1*keV);
em->SetLowEnergyLimit(MinKinEnergy());
em->SetHighEnergyLimit(0.2*MeV);
AddEmModel(1, em, flucModel);
G4VEmModel* em1 = new G4BetheBlochModel();
@@ -133,7 +134,7 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
AddEmModel(2, em1, flucModel);
G4VEmModel* em2 = new G4MuBetheBlochModel();
em2->SetLowEnergyLimit(1.0*GeV);
em2->SetHighEnergyLimit(100.0*TeV);
em2->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(3, em2, flucModel);
ratio = electron_mass_c2/mass;
@@ -144,12 +145,7 @@ void G4MuIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* par
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuIonisation::PrintInfo()
{
G4cout << " Bether-Bloch model for E > 0.2 MeV, "
<< "parametrisation of Bragg peak below, "
<< G4endl;
G4cout << " radiative corrections for E > 1 GeV" << G4endl;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,571 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuMscModel.cc,v 1.6 2007/11/11 17:40:48 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4MuMscModel
//
// Author: Laszlo Mu
//
// Creation date: 03.03.2001
//
// Modifications:
//
// 27-03-03 Move model part from G4MultipleScattering80 (V.Ivanchenko)
//
// Class Description:
//
// Implementation of the model of multiple scattering based on
// H.W.Lewis Phys Rev 78 (1950) 526 and others
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MuMscModel.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4LossTableManager.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4TransportationManager.hh"
#include "G4SafetyHelper.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4PhysicsTableHelper.hh"
#include "G4ElementVector.hh"
#include "G4ProductionCutsTable.hh"
#include "G4PhysicsLogVector.hh"
//#include "G4Poisson.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
using namespace std;
G4MuMscModel::G4MuMscModel(G4double frange,
G4double thetaMax,
G4double tMax,
const G4String& nam)
: G4eCoulombScatteringModel(0.0,thetaMax,false,tMax,nam),
theLambdaTable(0),
theLambda2Table(0),
dtrl(0.05),
facrange(frange),
thetaLimit(thetaMax),
numlimit(0.2),
lowBinEnergy(keV),
highBinEnergy(PeV),
nbins(60),
nwarnings(0),
nwarnlimit(50),
currentCouple(0),
isInitialized(false),
buildTables(true),
newrun(true),
inside(false)
{
invsqrt12 = 1./sqrt(12.);
tlimitminfix = 1.e-6*mm;
theManager = G4LossTableManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MuMscModel::~G4MuMscModel()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuMscModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector& cuts)
{
SetupParticle(p);
newrun = true;
xSection = currentRange = targetZ = ecut = tkin = 0.0;
// set values of some data members
if(!isInitialized) {
isInitialized = true;
if(p->GetParticleName() == "GenericIon") buildTables = false;
if (pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForMSC*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForMSC();
safetyHelper = G4TransportationManager::GetTransportationManager()
->GetSafetyHelper();
safetyHelper->InitialiseHelper();
}
G4eCoulombScatteringModel::Initialise(p, cuts);
currentCuts = &cuts;
if(buildTables)
theLambda2Table = G4PhysicsTableHelper::PreparePhysicsTable(theLambda2Table);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuMscModel::BuildTables()
{
//G4cout << "G4MuMscModel::BuildTables flags newrun= " << newrun
// << " buildTables= " << buildTables << G4endl;
newrun = false;
if(!buildTables) return;
// Access to materials
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4double e, s, cut;
for(size_t i=0; i<numOfCouples; i++) {
if (theLambda2Table->GetFlag(i)) {
// create physics vector and fill it
DefineMaterial(theCoupleTable->GetMaterialCutsCouple(i));
cut = (*currentCuts)[currentMaterialIndex];
G4PhysicsVector* aVector =
new G4PhysicsLogVector(lowBinEnergy, highBinEnergy, nbins);
for(G4int j=0; j<nbins; j++) {
e = aVector->GetLowEdgeEnergy(j);
s = ComputeLambda2(e, cut);
//G4cout << j << " " << currentCouple->GetMaterial()->GetName()
// << " e(MeV)= " << e << " cut(MeV)= " << cut
// << " L2= " << s << G4endl;
aVector->PutValue(j, s);
}
G4PhysicsTableHelper::SetPhysicsVector(theLambda2Table, i, aVector);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuMscModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z, G4double A,
G4double cutEnergy, G4double)
{
if(p == particle && kinEnergy == tkin && Z == targetZ &&
cutEnergy == ecut) return xSection;
ecut = cutEnergy;
xSection = 0.0;
SetupParticle(p);
G4double ekin = std::max(keV, kinEnergy);
SetupTarget(Z, A, ekin);
G4double tmax = tkin;
if(p == theElectron) tmax *= 0.5;
else if(p != thePositron) {
G4double ratio = electron_mass_c2/mass;
tmax = 2.0*mom2/
(electron_mass_c2*(1.0 + ratio*(tkin/mass + 1.0) + ratio*ratio));
}
G4double t = std::min(cutEnergy, tmax);
G4double mom21 = t*(t + 2.0*electron_mass_c2);
t = tkin - t;
G4double mom22 = t*(t + 2.0*mass);
cosTetMaxElec = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
if(cosTetMaxElec < cosTetMaxNuc) cosTetMaxElec = cosTetMaxNuc;
if(cosTetMaxElec < 1.0) {
G4double x2 = screenZ/(1.0 - cosTetMaxElec + screenZ);
xSection += (x2 - 1.0 - log(x2))/Z;
}
// G4cout << "cut= " << ecut << " e= " << tkin << " croosE= "
// << xSection/barn << G4endl;
if(cosTetMaxNuc < 1.0) {
G4double x1 = screenZ*formfactA;
G4double x2 = 1.0 - cosTetMaxNuc + screenZ;
G4double x3 = 1.0 - x1;
G4double x4 = 1.0/(formfactA*x2 + x3);
G4double x5 = screenZ/x2;
xSection += ((1.0 - 2.0*x1/x3)*log(x4/x5) - 1.0 +
x5 - (1.0 - 4.0*x1)*(1.0 - x4))/(x3*x3);
}
xSection *= coeff*Z*Z*chargeSquare*invbeta2/mom2;
// G4cout << " croosE= " << xSection/barn << " screenZ= "
// << screenZ << " formF= " << formfactA << G4endl;
return xSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuMscModel::ComputeLambda2(G4double kinEnergy,
G4double cutEnergy)
{
G4double res = 0.0;
SetupParticle(particle);
G4double ekin = std::max(keV, kinEnergy);
const G4Material* mat = currentCouple->GetMaterial();
const G4ElementVector* theElementVector = mat->GetElementVector();
const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
size_t nelm = mat->GetNumberOfElements();
SetupKinematic(ekin);
G4double tmax = tkin;
if(particle == theElectron) tmax *= 0.5;
else if(particle != thePositron) {
G4double ratio = electron_mass_c2/mass;
tmax = 2.0*mom2/
(electron_mass_c2*(1.0 + ratio*(tkin/mass + 1.0) + ratio*ratio));
}
G4double t = std::min(cutEnergy, tmax);
G4double mom21 = t*(t + 2.0*electron_mass_c2);
t = tkin - t;
G4double mom22 = t*(t + 2.0*mass);
cosTetMaxElec = (mom2 + mom22 - mom21)*0.5/sqrt(mom2*mom22);
if(cosTetMaxElec < 0.0) cosTetMaxElec = 0.0;
G4double x, x1, x2, y;
for (size_t i=0; i<nelm; i++) {
const G4Element* elm = (*theElementVector)[i];
G4double Z = elm->GetZ();
SetupTarget(Z, elm->GetN(), tkin);
G4double s = 0.0;
G4double costm = cosTetMaxElec;
if(costm < cosTetMaxNuc) costm = cosTetMaxNuc;
if(costm < 1.0) {
x = 1.0 - costm + screenZ;
y = (x - screenZ*(screenZ/x + 2.0*log(x/screenZ)))/Z;
if(y < 0.0) {
nwarnings++;
if(nwarnings < nwarnlimit)
G4cout << "Electron scattering <0 for L2 " << y << G4endl;
y = 0.0;
}
s += y;
}
// G4cout << "cut= " << cut << " e= " << tkin << " croosE= "
// << xSection/barn << G4endl;
// limit main integral because of nuclear size effect
if(cosTetMaxNuc < 1.0) {
x1 = screenZ*formfactA;
x2 = 1.0 - cosTetMaxNuc + screenZ;
G4double x3 = 1.0 - x1;
G4double f = 1.0/formfactA;
G4double d = f - screenZ;
G4double x4 = f/(x2 + d);
G4double x5 = screenZ/x2;
y = (screenZ*(1.0 - x5) + (d*d - screenZ*(2.0*d - 3.0*screenZ))*(1.0 - x4)/f -
2.0*screenZ*f*log(x4/x5)/d)/(x3*x3);
if(y < 0.0) {
nwarnings++;
if(nwarnings < nwarnlimit)
G4cout << "Nuclear scattering <0 for L2 " << y << G4endl;
y = 0.0;
}
s += y;
}
res += Z*Z*s*theAtomNumDensityVector[i];
}
res *= 0.25*coeff*chargeSquare*invbeta2/mom2;
// G4cout << " croosE= " << xSection/barn << " screenZ= "
// << screenZ << " formF= " << formfactA << G4endl;
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuMscModel::ComputeTruePathLengthLimit(
const G4Track& track,
G4PhysicsTable* theTable,
G4double currentMinimalStep)
{
G4double tlimit = currentMinimalStep;
const G4DynamicParticle* dp = track.GetDynamicParticle();
// initialisation for 1st step
if(track.GetCurrentStepNumber() == 1) {
inside = false;
SetupParticle(dp->GetDefinition());
theLambdaTable = theTable;
if(newrun && buildTables) BuildTables();
}
// initialisation for each step
preKinEnergy = dp->GetKineticEnergy();
DefineMaterial(track.GetMaterialCutsCouple());
lambda0 = GetLambda(preKinEnergy);
currentRange =
theManager->GetRangeFromRestricteDEDX(particle,preKinEnergy,currentCouple);
// extra check for abnormal situation
// this check needed to run MSC with eIoni and eBrem inactivated
if(tlimit > currentRange) tlimit = currentRange;
// stop here if small range particle
if(inside) return tlimit;
// pre step
G4StepPoint* sp = track.GetStep()->GetPreStepPoint();
G4StepStatus stepStatus = sp->GetStepStatus();
G4double presafety = sp->GetSafety();
// compute presafety again if presafety <= 0 and no boundary
// i.e. when it is needed for optimization purposes
if(stepStatus != fGeomBoundary && presafety < tlimitminfix)
presafety = safetyHelper->ComputeSafety(sp->GetPosition());
// G4cout << "G4MuMscModel::ComputeTruePathLengthLimit tlimit= "
// <<tlimit<<" safety= " << presafety
// << " range= " <<currentRange<<G4endl;
// far from geometry boundary
if(currentRange < presafety) {
inside = true;
// limit mean scattering angle
} else {
tlimit = std::min(facrange*lambda0, tlimit);
}
/*
G4cout << particle->GetParticleName() << " e= " << preKinEnergy
<< " L0= " << lambda0 << " R= " << currentRange
<< "tlimit= " << tlimit
<< " currentMinimalStep= " << currentMinimalStep << G4endl;
*/
return tlimit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuMscModel::ComputeGeomPathLength(G4double truelength)
{
tPathLength = truelength;
zPathLength = tPathLength;
G4double tau = tPathLength/lambda0;
lambdaeff = lambda0;
//G4cout << "ComputeGeomPathLength: tLength= " << tPathLength
// << " lambda0= " << lambda0 << " tau= " << tau << G4endl;
// small step
if(tau < numlimit) {
par1 = -1. ;
par2 = par3 = 0. ;
zPathLength *= (1.0 - 0.5*tau + tau*tau/6.0);
// medium step
} else if(tPathLength < currentRange*dtrl) {
zPathLength = lambda0*(1.0 - exp(-tau));
} else if(tkin < mass) {
par1 = 1./currentRange;
par2 = 1./(par1*lambda0);
par3 = 1.+ par2;
lambdaeff = 1.0/(par1*par3);
G4double x = tPathLength/currentRange;
G4double x1;
if(x < numlimit) x1 = x*(1.0 - 0.5*x + x*x/3.0);
else x1 = log(1.0 - x);
zPathLength = lambdaeff*(1.-exp(par3*x1));
} else {
G4double T1 = theManager->GetEnergy(particle,
currentRange-tPathLength,
currentCouple);
G4double lambda1 = GetLambda(T1);
par1 = (lambda0-lambda1)/(lambda0*tPathLength) ;
par2 = 1./(par1*lambda0) ;
par3 = 1.+ par2 ;
lambdaeff = 1.0/(par1*par3);
zPathLength = lambdaeff*(1.-exp(par3*log(lambda1/lambda0)));
}
// if(zPathLength > lambda0) zPathLength = lambda0;
if(zPathLength > tPathLength) zPathLength = tPathLength;
return zPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuMscModel::ComputeTrueStepLength(G4double geomStepLength)
{
// step defined other than transportation
if(geomStepLength == zPathLength) return tPathLength;
tPathLength = geomStepLength;
zPathLength = geomStepLength;
G4double tau = geomStepLength/lambda0;
if(tau < numlimit) {
tPathLength *= (1.0 + 0.5*tau - tau*tau/3.0);
} else if(par1 < 0.) {
tPathLength = -lambda0*log(1.0 - tau);
} else {
G4double x = par1*par3*geomStepLength;
if(x < numlimit)
tPathLength = (1.- exp(- x*(1.- 0.5*x + x*x/3.0)/par3))/par1 ;
else if (x < 1.0)
tPathLength = (1.-exp(log(1.- x)/par3))/par1;
else
tPathLength = currentRange;
}
if(tPathLength < geomStepLength) tPathLength = geomStepLength;
return tPathLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuMscModel::SampleScattering(const G4DynamicParticle* dynParticle,
G4double safety)
{
G4double kinEnergy = dynParticle->GetKineticEnergy();
if(kinEnergy == 0.0) return;
G4double x1 = 0.5*tPathLength/lambdaeff;
/*
G4cout << "G4MuMscModel::SampleScattering t(mm)= " << tPathLength
<< " 1/lambdaeff= " << 1.0/lambdaeff
<< " matIdx= " << currentMaterialIndex << G4endl;
*/
/*
G4double y1 = 1.0 - x1;
G4double x2 = tPathLength*GetLambda2(0.5*(preKinEnergy + kinEnergy));
G4double x3 = (x2 - x1*x1)/(x1*y1);
if(x3 <= 0.0 || x3 >= 0.33) {
nwarnings++;
if(nwarnings < nwarnlimit)
G4cout << "G4MuMscModel::SampleScattering: ePre(MeV)= " << preKinEnergy/MeV
<< " ePost(MeV)= " << kinEnergy/MeV
<< " <x>= " << x1 << " sqrt(<x^2>)= " << sqrt(x2)
<< " x3= " << x3
<< G4endl;
x3 = std::min(1.0/y1,0.16666);
}
G4double x4 = 0.25*(3.0*x3 + sqrt(x3*(x3 + 8.0)))/(1.0 - x3);
*/
G4double x = G4UniformRand();
G4double z;
//if(x < y1) z = x1*pow(x/y1,x4);
//else z = 1.0 - y1*pow((1.0 - x)/x1,x4);
z = -x1*log(x);
G4double cost = 1.0 - 2.0*z;
if(cost < -1.0) cost = -1.0;
else if(cost > 1.0) cost = 1.0;
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi*G4UniformRand();
G4double dirx = sint*cos(phi);
G4double diry = sint*sin(phi);
// G4cout << "G4MuMscModel::SampleSecondaries: tstep(mm)= " << truestep/mm
// << " lambdaeff= " << lambdaeff
// << " rms= " << rms << G4endl;
G4ThreeVector oldDirection = dynParticle->GetMomentumDirection();
G4ThreeVector newDirection(dirx,diry,cost);
newDirection.rotateUz(oldDirection);
fParticleChange->ProposeMomentumDirection(newDirection);
if (latDisplasment && safety > tlimitminfix) {
G4double rms= sqrt(2.0*x1);
G4double rx = zPathLength*(0.5*dirx + invsqrt12*G4RandGauss::shoot(0.0,rms));
G4double ry = zPathLength*(0.5*diry + invsqrt12*G4RandGauss::shoot(0.0,rms));
G4double r = sqrt(rx*rx + ry*ry);
/*
G4cout << "G4MuMscModel::SampleSecondaries: e(MeV)= " << kineticEnergy
<< " sinTheta= " << sth << " r(mm)= " << r
<< " trueStep(mm)= " << truestep
<< " geomStep(mm)= " << zPathLength
<< G4endl;
*/
G4ThreeVector latDirection(rx,ry,0.0);
latDirection.rotateUz(oldDirection);
G4ThreeVector Position = *(fParticleChange->GetProposedPosition());
G4double fac = 1.;
if(r > safety) {
// ******* so safety is computed at boundary too ************
G4double newsafety = safetyHelper->ComputeSafety(Position);
if(r > newsafety)
fac = newsafety/r ;
}
if(fac > 0.) {
// compute new endpoint of the Step
G4ThreeVector newPosition = Position+fac*r*latDirection;
// definitely not on boundary
if(1. == fac) {
safetyHelper->ReLocateWithinVolume(newPosition);
} else {
// check safety after displacement
G4double postsafety = safetyHelper->ComputeSafety(newPosition);
// displacement to boundary
if(postsafety <= 0.0) {
safetyHelper->Locate(newPosition, newDirection);
// not on the boundary
} else {
safetyHelper->ReLocateWithinVolume(newPosition);
}
}
fParticleChange->ProposePosition(newPosition);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuMultipleScattering.cc,v 1.3 2007/11/09 19:48:10 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuMultipleScattering.cc,v 1.12 2008/10/16 13:37:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -----------------------------------------------------------------------------
//
@@ -46,7 +46,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MuMultipleScattering.hh"
#include "G4MuMscModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4MscStepLimitType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -60,7 +60,7 @@ G4MuMultipleScattering::G4MuMultipleScattering(G4double tet,
dtrl = 0.05;
samplez = false ;
isInitialized = false;
SetRangeFactor(0.04);
SetRangeFactor(0.2);
SetLateralDisplasmentFlag(true);
}
@@ -83,25 +83,29 @@ void G4MuMultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
// Modification of parameters between runs
if(isInitialized) {
if (p->GetParticleType() != "nucleus") {
if (p->GetParticleType() != "nucleus" && p->GetPDGMass() < GeV) {
mscModel->SetStepLimitType(StepLimitType());
mscModel->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
//mscModel->SetThetaLimit(thetaLimit);
mscModel->SetRangeFactor(RangeFactor());
}
mscModel->SetPolarAngleLimit(PolarAngleLimit());
return;
}
if (p->GetParticleType() == "nucleus") {
if (p->GetParticleType() == "nucleus" || p->GetPDGMass() > GeV) {
SetLateralDisplasmentFlag(false);
SetBuildLambdaTable(false);
// SetRangeFactor(0.2);
}
// initialisation of parameters
// G4String part_name = p->GetParticleName();
mscModel = new G4MuMscModel(RangeFactor(),thetaLimit);
// initialisation of the model
mscModel = new G4WentzelVIModel();
mscModel->SetStepLimitType(StepLimitType());
mscModel->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
mscModel->SetRangeFactor(RangeFactor());
mscModel->SetPolarAngleLimit(PolarAngleLimit());
mscModel->SetLowEnergyLimit(MinKinEnergy());
mscModel->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(1,mscModel);
isInitialized = true;
@@ -111,10 +115,10 @@ void G4MuMultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
void G4MuMultipleScattering::PrintInfo()
{
G4cout << " Boundary/stepping algorithm is active with RangeFactor= "
<< RangeFactor()
<< " Step limit type " << StepLimitType()
<< G4endl;
G4cout << " RangeFactor= " << RangeFactor()
<< ", step limit type: " << StepLimitType()
<< ", lateralDisplacement: " << LateralDisplasmentFlag()
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuPairProduction.cc,v 1.48 2007/05/22 17:35:58 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuPairProduction.cc,v 1.51 2008/10/16 13:37:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -88,7 +88,9 @@ G4MuPairProduction::G4MuPairProduction(const G4String& name)
theBaseParticle(0),
lowestKinEnergy(1.*GeV),
isInitialised(false)
{}
{
SetProcessSubType(fPairProdByCharged);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -97,8 +99,9 @@ G4MuPairProduction::~G4MuPairProduction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuPairProduction::InitialiseEnergyLossProcess(const G4ParticleDefinition* part,
const G4ParticleDefinition*)
void G4MuPairProduction::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition*)
{
if (!isInitialised) {
isInitialised = true;
@@ -109,9 +112,9 @@ void G4MuPairProduction::InitialiseEnergyLossProcess(const G4ParticleDefinition*
G4MuPairProductionModel* em = new G4MuPairProductionModel();
em->SetLowestKineticEnergy(lowestKinEnergy);
G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
em->SetLowEnergyLimit(0.1*keV);
em->SetHighEnergyLimit(100.0*TeV);
G4VEmFluctuationModel* fm = 0;
em->SetLowEnergyLimit(MinKinEnergy());
em->SetHighEnergyLimit(MaxKinEnergy());
AddEmModel(1, em, fm);
}
}
@@ -119,10 +122,7 @@ void G4MuPairProduction::InitialiseEnergyLossProcess(const G4ParticleDefinition*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4MuPairProduction::PrintInfo()
{
G4cout << " Parametrised model "
<< G4endl;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuPairProductionModel.cc,v 1.35 2007/10/11 13:52:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4MuPairProductionModel.cc,v 1.39 2008/07/22 16:11:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// -------------------------------------------------------------------
//
@@ -103,13 +103,14 @@ using namespace std;
G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4VEmModel(nam),
minPairEnergy(4.*electron_mass_c2),
lowestKinEnergy(1.*GeV),
factorForCross(4.*fine_structure_const*fine_structure_const
particle(0),
factorForCross(4.*fine_structure_const*fine_structure_const
*classic_electr_radius*classic_electr_radius/(3.*pi)),
sqrte(sqrt(exp(1.))),
currentZ(0),
particle(0),
fParticleChange(0),
minPairEnergy(4.*electron_mass_c2),
lowestKinEnergy(1.*GeV),
nzdat(5),
ntdat(8),
nbiny(1000),
@@ -117,10 +118,10 @@ G4MuPairProductionModel::G4MuPairProductionModel(const G4ParticleDefinition* p,
ymin(-5.),
ymax(0.),
dy((ymax-ymin)/nbiny),
ignoreCut(false),
samplingTablesAreFilled(false)
{
SetLowEnergyLimit(minPairEnergy);
nist = G4NistManager::Instance();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
@@ -135,24 +136,6 @@ G4MuPairProductionModel::~G4MuPairProductionModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::MinEnergyCut(const G4ParticleDefinition*,
const G4MaterialCutsCouple* )
{
return minPairEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::SetParticle(const G4ParticleDefinition* p)
{
if(!particle) {
particle = p;
particleMass = particle->GetPDGMass();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
@@ -160,19 +143,12 @@ void G4MuPairProductionModel::Initialise(const G4ParticleDefinition* p,
if(p) SetParticle(p);
MakeSamplingTables();
}
if(pParticleChange) {
if(ignoreCut) {
gParticleChange =
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
fParticleChange = 0;
} else {
if(!fParticleChange) {
if(pParticleChange)
fParticleChange =
reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
gParticleChange = 0;
}
} else {
fParticleChange = new G4ParticleChangeForLoss();
gParticleChange = 0;
else
fParticleChange = new G4ParticleChangeForLoss();
}
}
@@ -185,8 +161,7 @@ G4double G4MuPairProductionModel::ComputeDEDXPerVolume(
G4double cutEnergy)
{
G4double dedx = 0.0;
if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy
|| ignoreCut)
if (cutEnergy <= minPairEnergy || kineticEnergy <= lowestKinEnergy)
return dedx;
const G4ElementVector* theElementVector = material->GetElementVector();
@@ -215,7 +190,7 @@ G4double G4MuPairProductionModel::ComputMuPairLoss(G4double Z,
SetCurrentElement(Z);
G4double loss = 0.0;
G4double cut = min(cutEnergy,tmax);
G4double cut = std::min(cutEnergy,tmax);
if(cut <= minPairEnergy) return loss;
// calculate the rectricted loss
@@ -250,13 +225,10 @@ G4double G4MuPairProductionModel::ComputeMicroscopicCrossSection(
G4double tkin,
G4double Z,
G4double cut)
{
G4double cross = 0. ;
G4double cross = 0.;
SetCurrentElement(Z);
G4double tmax = MaxSecondaryEnergy(particle, tkin);
if (tmax <= cut) return cross;
G4double ak1=6.9 ;
@@ -399,44 +371,20 @@ G4double G4MuPairProductionModel::ComputeCrossSectionPerAtom(
G4double kineticEnergy,
G4double Z, G4double,
G4double cutEnergy,
G4double)
{
G4double cut = max(minPairEnergy,cutEnergy);
if(ignoreCut) cut = minPairEnergy;
G4double cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MuPairProductionModel::CrossSectionPerVolume(
const G4Material* material,
const G4ParticleDefinition*,
G4double kineticEnergy,
G4double cutEnergy,
G4double maxEnergy)
G4double maxEnergy)
{
G4double cross = 0.0;
if (kineticEnergy <= lowestKinEnergy) return cross;
maxEnergy += particleMass;
SetCurrentElement(Z);
G4double tmax = std::min(maxEnergy, kineticEnergy);
G4double cut = std::min(cutEnergy, kineticEnergy);
if(cut < minPairEnergy) cut = minPairEnergy;
if (cut >= tmax) return cross;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector = material->
GetAtomicNumDensityVector();
for (size_t i=0; i<material->GetNumberOfElements(); i++) {
G4double Z = (*theElementVector)[i]->GetZ();
SetCurrentElement(Z);
G4double tmax = min(maxEnergy,MaxSecondaryEnergy(particle, kineticEnergy));
G4double cut = max(minPairEnergy,cutEnergy);
if(ignoreCut) cut = minPairEnergy;
if(cut < tmax) {
G4double cr = ComputeMicroscopicCrossSection(kineticEnergy, Z, cut)
- ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
cross += theAtomNumDensityVector[i] * cr;
}
cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
if(tmax < kineticEnergy) {
cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
}
return cross;
}
@@ -450,37 +398,44 @@ void G4MuPairProductionModel::MakeSamplingTables()
G4double Z = zdat[iz];
SetCurrentElement(Z);
for (G4int it=0; it<ntdat; it++)
{
for (G4int it=0; it<ntdat; it++) {
G4double kineticEnergy = tdat[it];
G4double maxPairEnergy = MaxSecondaryEnergy(particle,kineticEnergy);
// G4cout << "Z= " << currentZ << " z13= " << z13
//<< " mE= " << maxPairEnergy << G4endl;
G4double CrossSection = 0.0 ;
G4double y = ymin - 0.5*dy ;
G4double yy = ymin - dy ;
G4double x = exp(y);
G4double fac = exp(dy);
G4double dx = exp(yy)*(fac - 1.0);
if(maxPairEnergy > minPairEnergy) {
G4double c = log(maxPairEnergy/minPairEnergy);
G4double y = ymin - 0.5*dy ;
G4double yy = ymin - dy ;
G4double x = exp(y);
G4double fac = exp(dy);
G4double dx = exp(yy)*(fac - 1.0);
for (G4int i=0 ; i<nbiny; i++)
{
y += dy ;
if(c > 0.0) {
x *= fac;
dx*= fac;
G4double ep = minPairEnergy*exp(c*x) ;
CrossSection += ep*dx*ComputeDMicroscopicCrossSection(
kineticEnergy, Z, ep);
}
ya[i] = y;
proba[iz][it][i] = CrossSection;
G4double c = log(maxPairEnergy/minPairEnergy);
for (G4int i=0 ; i<nbiny; i++) {
y += dy ;
if(c > 0.0) {
x *= fac;
dx*= fac;
G4double ep = minPairEnergy*exp(c*x) ;
CrossSection +=
ep*dx*ComputeDMicroscopicCrossSection(kineticEnergy, Z, ep);
}
ya[i] = y;
proba[iz][it][i] = CrossSection;
}
} else {
for (G4int i=0 ; i<nbiny; i++) {
proba[iz][it][i] = CrossSection;
}
}
ya[nbiny]=ymax;
proba[iz][it][nbiny] = CrossSection;
}
@@ -514,7 +469,7 @@ void G4MuPairProductionModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
G4double maxPairEnergy = MaxSecondaryEnergy(particle,kineticEnergy);
G4double maxEnergy = std::min(tmax, maxPairEnergy);
G4double minEnergy = std::max(tmin, minPairEnergy);
if(ignoreCut)minEnergy = minPairEnergy;
if(minEnergy >= maxEnergy) return;
//G4cout << "emin= " << minEnergy << " emax= " << maxEnergy
// << " minPair= " << minPairEnergy << " maxpair= " << maxPairEnergy
@@ -617,10 +572,7 @@ void G4MuPairProductionModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
// primary change
kineticEnergy -= (ElectronEnergy + PositronEnergy);
if(fParticleChange)
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
else
gParticleChange->SetProposedKineticEnergy(kineticEnergy);
fParticleChange->SetProposedKineticEnergy(kineticEnergy);
vdp->push_back(aParticle1);
vdp->push_back(aParticle2);
@@ -654,7 +606,6 @@ const G4Element* G4MuPairProductionModel::SelectRandomAtom(
SetCurrentElement(Z);
G4double maxPairEnergy = MaxSecondaryEnergy(particle,kinEnergy);
G4double minEnergy = std::max(tmin, minPairEnergy);
if(ignoreCut)minEnergy = minPairEnergy;
G4int iz;
for(iz=1; iz<nzdat; iz++) {if(Z <= zdat[iz]) break;}