Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -1,4 +1,4 @@
$Id: History,v 1.316 2007/06/11 15:01:26 vnivanch Exp $
$Id: History,v 1.360 2007/12/07 17:35:51 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,142 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
07 December 07: V.Ivant (emstand-V09-00-22)
G4UrbanMscModel90 is created on base of G4UrbanMscModel of release 9.0
G4hMultipleScattering uses G4UrbanMscModel90
30 November 07: V.Ivant (emstand-V09-00-21)
G4UrbanMscModel - L.Urban fix sign of mean scattering angle for
negatively changed particles
29 November 07: V.Ivant (emstand-V09-00-20)
G4UrbanMscModel - added extra protection in sampling of angle - no
sampling if mean angle below tausmall
28 November 07: V.Ivant (emstand-V09-00-19)
G4UrbanMscModel - L.Urban added extra protection in sampling of angle
to avoid NaN
G4eCoulombScatteringModel - added a protection against precision lost
22 November 07: V.Ivant (emstand-V09-00-18)
G4UrbanMscModel - change parameter tausmall to avoid lost of numerical
precision and NaN values
20 November 07: V.Ivant (emstand-V09-00-17)
G4eCoulombScatteringModel - fixed crash happens at initialisation when
several elements with the same Z are defined
11 November 07: V.Ivant (emstand-V09-00-16)
G4eCoulombScatteringModel - fixed computation of transport cross section
09 November 07: V.Ivant (emstand-V09-00-15)
- G4ionIonisation, G4ionGasIonisation, G4CoulombScatteringModel:
fill NIEL energy deposit
29 October 07: V.Ivant (emstand-V09-00-14)
- G4UrbanMscModel (V.Ivanchenko) - fixed nan for heavy ions introduced
in previous tag
27 October 07: V.Ivant (emstand-V09-00-13)
- G4eCoulombScatteringModel, G4CoulombScatteringModel use precomputed
Z^1/3 and log(A) values to speed up the code; revised nuclear size
correction
- G4UrbanMscModel (L.Urban):
- changed initialisation for ions - parameters are protected
from modification
- use sampleScattering method instead of SampleSecondaries
- use different correction to Highland formula for different
particle type (electron, muons, others)
- tuning ComputeGeomPathLength in order to get better low
energy behaviour for heavy particles (mu, hadrons)
- small modification of theta0 in ComputeTheta0 (based on data)
- some old inconsistency/bug has been cured in SampleCosineTheta
now the variable prob is always in [0,1]
08 October 07: V.Ivant (emstand-V09-00-12)
- G4eCoulombScatteringModel, G4CoulombScatteringModel
- add cut dependence for scattering off electrons
- reorganized protected methods
02 October 07: V.Ivant (emstand-V09-00-11)
G4eplusAnnihilation - enable AtRest
G4PAIModel - general cleanup, fixed memory leak
G4PAIySection - a new class which substitutes G4PAIxSection,
this class is free of memory leak
27 Septamber 07: V.Ivant (emstand-V09-00-10)
G4IonFluctuations - added dependence on cut in the formula of width on cut,
reduces cut dependence of Bragg peak width for ions; use Fermi energy
from G4Material
G4BohrFluctuations - minor cleanup
26 Septamber 07: V.Ivant (emstand-V09-00-09)
G4PAIphotonModel, G4PAIModel - fixed MaxSecondaryEnergy method for
e- and e+ and use it for definition of max energy transfer;
added control on all cout by fVerbose;
28 August 07: V.Ivant (emstand-V09-00-08)
- G4eCoulombScatteringModel - fixed compilation warning
15 August 07: V.Ivant (emstand-V09-00-07)
- G4eCoulombScatteringModel and G4CoulombScatteringModel - fixed bug in
computation of screening parameters in SampleSecondary method;
reorganised initialisation of kinematics and screening parameters;
used Z(Z+1) factor to take into account scattering off e-
13 August 07: V.Ivant (emstand-V09-00-06)
- G4CoulombScatteringModel - fixed bug in kinematic of final state
- G4ionIonisation - add protected methods BetheBlochEnergyThreshold()
and NuclearStoppingFlag()
- G4ionGasIonisation - added complete implementation of the method
CorrectionsAlongStep() and do not call base class
- G4UrbanMscModel - tail of angular distribution modified; compare (L.Urban)
safety with zero after lateral displacement (VI)
02 August 07: V.Ivant (emstand-V09-00-05)
- G4UrbanMscModel - compare safety not with 0 but with tlimitminfix
31 July 07: V.Ivant (emstand-V09-00-04)
- G4CoulombScatteringModel - introduce energy threshold between models
with and without nuclear recoil
- G4eCoulombScatteringModel - add array to cash screen parameters
- G4CoulombScatteringModel - fix bug in SamplingSecondaries
30 July 07: V.Ivant (emstand-V09-00-03)
30 July 07: L.Urban
- G4UrbanMscModel - new, simpler model functions to describe the angular
distribution; theta0 of this distribution has been changed too (now
the form of theta0 is the same as in the Highland formula, but the
parameter values are different for e+/e- and the other (heavy) particles;
the change for the UseDistanseToBoundary case: tlimitmin = 10 stepmin;
some cosmetics in ComputeTruePathLengthLimit.
28 July 07: V.Ivant (emstand-V09-00-02)
- G4eCoulombScatteringModel - updated screen radius model
- G4ionIonisation - remove obsolete method DefineMassCharge
- G4ionGasIonisation - new ion ionisation process with descrete ion charge and
no equilibrium btween ion and media
- G4BraggModel, G4BraggIonModel - more safe computation of scattering angle
16 July 07: V.Ivant (emstand-V09-00-01)
- G4CoulombScattering - update InitialiseProcess and PrintInfo methods
to ensure parameters of models change between runs and more clear cout
- G4eCoulombScatteringModel, G4CoulombScatteringModel - added nuclear size
effect; added separate simulation of scattering on atomic electrons taking
into account cuts; fixed cross section for compounds.
13 July 07: V.Ivant (emstand-V09-00-00)
- G4UniversalFluctuation - added protection such that no sampling of
fluctuations is done if mean energy loss at the step is below minimal
excitation energy of the media. The fix is important for cases of
low-dense gases and very small steps.
19 June 07: V.Ivant (emstand-V08-03-10)
- G4UrbanMscModel for skin > 0 use range instead of TrueStepLimit
for computation of distance to boundary, this provides stable
step limitation by GeomFactor (L.Urban)
11 May 07: V.Ivant (emstand-V08-03-09)
- G4MultipleScattering, G4hMultipleScattering - substitute name
"G4v71" -> "Minimal"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ASTARStopping.hh,v 1.5 2006/06/29 19:49:58 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
#ifndef G4ASTARStopping_h
#define G4ASTARStopping_h 1
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BetheBlochModel.hh,v 1.9 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BetheHeitlerModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BohrFluctuations.hh,v 1.2 2006/06/29 19:50:04 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4BohrFluctuations.hh,v 1.3 2007/09/27 13:53:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -112,9 +112,9 @@ inline G4double G4BohrFluctuations::Dispersion(
if(!particle) InitialiseMe(dp->GetDefinition());
G4double electronDensity = material->GetElectronDensity();
kineticEnergy = dp->GetKineticEnergy();
G4double gam = kineticEnergy/particleMass + 1.0;
beta2 = 1.0 - 1.0/(gam*gam);
kineticEnergy = dp->GetKineticEnergy();
G4double etot = kineticEnergy + particleMass;
beta2 = kineticEnergy*(kineticEnergy + 2.0*particleMass)/(etot*etot);
G4double siga = (1.0/beta2 - 0.5) * twopi_mc2_rcl2 * tmax * length
* electronDensity * chargeSquare;
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BraggIonModel.hh,v 1.8 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BraggModel.hh,v 1.10 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4ComptonScattering.hh,v 1.20 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//------------------ G4ComptonScattering physics process -----------------------
// by Michel Maire, April 1996
@@ -25,7 +25,7 @@
//
//
// $Id: G4ComptonScattering52.hh,v 1.4 2007/05/16 14:00:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//------------------ G4ComptonScattering52 physics process -----------------------
// by Michel Maire, April 1996
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CoulombScattering.hh,v 1.6 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4CoulombScattering.hh,v 1.8 2007/07/31 17:24:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -70,6 +70,7 @@ public:
void SetQ2Max(G4double);
// obsolete method to be removed
void SetBuildTableFlag(G4bool);
// Print out of the class parameters
@@ -88,8 +89,11 @@ private:
G4double thetaMin;
G4double thetaMax;
G4double q2Max;
G4double thEnergy;
G4double thEnergyElec;
G4bool isInitialised;
G4bool buildTableFlag;
G4bool buildElmTableFlag;
const G4ParticleDefinition* aParticle;
};
@@ -124,10 +128,8 @@ inline void G4CoulombScattering::SetQ2Max(G4double val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4CoulombScattering::SetBuildTableFlag(G4bool val)
{
buildTableFlag = val;
}
inline void G4CoulombScattering::SetBuildTableFlag(G4bool)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CoulombScatteringModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4CoulombScatteringModel.hh,v 1.11 2007/10/09 08:16:29 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,7 @@
// logic of building - only elements from G4ElementTable
// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
// 19.10.06 V.Ivanchenko use inheritance from G4eCoulombScatteringModel
// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
//
// Class Description:
//
@@ -71,11 +72,19 @@ class G4CoulombScatteringModel : public G4eCoulombScatteringModel
public:
G4CoulombScatteringModel(G4double thetaMin = 0.0, G4double thetaMax = pi,
G4bool build = true, G4double tlim = TeV*TeV,
G4bool build = false, G4double tlim = TeV*TeV,
const G4String& nam = "CoulombScattering");
virtual ~G4CoulombScatteringModel();
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
G4double A,
G4double cut,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
@@ -84,10 +93,6 @@ public:
private:
G4double CalculateCrossSectionPerAtom(const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z);
G4double SelectIsotope(const G4Element*);
// hide assignment operator
@@ -96,8 +101,6 @@ private:
G4ParticleTable* theParticleTable;
const G4NistManager* theMatManager;
const G4ParticleDefinition* theProton;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -25,7 +25,7 @@
//
//
// $Id: G4GammaConversion.hh,v 1.22 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------------ G4GammaConversion physics process------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4InitXscPAI.hh,v 1.8 2006/06/29 19:50:22 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// G4InitXscPAI.hh -- header file
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IonFluctuations.hh,v 1.2 2006/06/29 19:50:24 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4IonFluctuations.hh,v 1.3 2007/09/27 13:53:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4KleinNishinaCompton.hh,v 1.9 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MollerBhabhaModel.hh,v 1.19 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MscModel71.hh,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MultipleScattering.hh,v 1.35 2007/05/18 18:43:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -----------------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MultipleScattering71.hh,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------- G4MultipleScattering71 physics process --------------------------
@@ -58,7 +58,7 @@
//------------------------------------------------------------------------------
//
// $Id: G4MultipleScattering71.hh,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
// class description
//
@@ -37,6 +37,7 @@
//
// Modifications:
// 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
// 26-09-07 Fixed tmax computation (V.Ivantchenko)
//
//
// Class Description:
@@ -54,6 +55,7 @@
#include "G4VEmModel.hh"
#include "globals.hh"
#include "G4VEmFluctuationModel.hh"
#include "G4PAIySection.hh"
class G4PhysicsLogVector;
class G4PhysicsTable;
@@ -104,14 +106,15 @@ public:
void DefineForRegion(const G4Region* r) ;
void ComputeSandiaPhotoAbsCof();
void BuildPAIonisationTable(const G4ParticleDefinition*);
void BuildLambdaVector(const G4MaterialCutsCouple* matCutsCouple);
void BuildPAIonisationTable();
void BuildLambdaVector();
G4double GetdNdxCut( G4int iPlace, G4double transferCut);
G4double GetdEdxCut( G4int iPlace, G4double transferCut);
G4double GetPostStepTransfer( G4double scaledTkin );
G4double GetEnergyTransfer( G4int iPlace,
G4double position,
G4int iTransfer );
G4double position,
G4int iTransfer );
void SetVerboseLevel(G4int verbose){fVerbose=verbose;};
@@ -139,6 +142,7 @@ private:
G4int fTotBin;
G4int fMeanNumber;
G4PhysicsLogVector* fParticleEnergyVector ;
G4PAIySection fPAIySection;
// vectors
@@ -151,6 +155,10 @@ private:
std::vector<const G4MaterialCutsCouple*> fMaterialCutsCoupleVector;
std::vector<const G4Region*> fPAIRegionVector;
const G4MaterialCutsCouple* fCutCouple;
const G4Material* fMaterial;
G4double fDeltaCutInKinEnergy;
size_t fMatIndex ;
G4double** fSandiaPhotoAbsCof ;
G4int fSandiaIntervalNumber ;
@@ -158,13 +166,15 @@ private:
G4PhysicsLogVector* fdEdxVector ;
std::vector<G4PhysicsLogVector*> fdEdxTable ;
G4PhysicsLogVector* fLambdaVector ;
std::vector<G4PhysicsLogVector*> fLambdaTable ;
G4PhysicsLogVector* fLambdaVector ;
std::vector<G4PhysicsLogVector*> fLambdaTable ;
G4PhysicsLogVector* fdNdxCutVector ;
std::vector<G4PhysicsLogVector*> fdNdxCutTable ;
G4PhysicsLogVector* fdNdxCutVector ;
std::vector<G4PhysicsLogVector*> fdNdxCutTable ;
const G4ParticleDefinition* fParticle;
const G4ParticleDefinition* fElectron;
const G4ParticleDefinition* fPositron;
G4ParticleChangeForLoss* fParticleChange;
G4double fMass;
@@ -177,18 +187,24 @@ private:
G4double fBg2lim;
G4double fTaulim;
G4double fQc;
G4bool isInitialised;
};
/////////////////////////////////////////////////////////////////////
inline G4double G4PAIModel::MaxSecondaryEnergy( const G4ParticleDefinition*,
inline G4double G4PAIModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
G4double kinEnergy)
{
G4double gamma= kinEnergy/fMass + 1.0;
G4double tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*fRatio + fRatio*fRatio);
G4double tmax = kinEnergy;
if(p == fElectron) tmax *= 0.5;
else if(p != fPositron) {
G4double mass = p->GetPDGMass();
G4double ratio= electron_mass_c2/mass;
G4double gamma= kinEnergy/mass + 1.0;
tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*ratio + ratio*ratio);
}
return tmax;
}
@@ -37,6 +37,7 @@
//
// Modifications:
// 11.04.05 Major optimisation of internal interfaces (V.Ivantchenko)
// 26-09-07 Fixed tmax computation (V.Ivantchenko)
//
//
// Class Description:
@@ -141,6 +142,7 @@ private:
G4double fHighestKineticEnergy;
G4int fTotBin;
G4int fMeanNumber;
G4int fVerbose;
G4PhysicsLogVector* fProtonEnergyVector ;
@@ -183,6 +185,8 @@ private:
const G4ParticleDefinition* fParticle;
const G4ParticleDefinition* fElectron;
const G4ParticleDefinition* fPositron;
G4ParticleChangeForLoss* fParticleChange;
G4double fMass;
@@ -195,18 +199,24 @@ private:
G4double fBg2lim;
G4double fTaulim;
G4double fQc;
G4bool isInitialised;
};
/////////////////////////////////////////////////////////////////////
inline G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition*,
inline G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition* p,
G4double kinEnergy)
{
G4double gamma= kinEnergy/fMass + 1.0;
G4double tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*fRatio + fRatio*fRatio);
G4double tmax = kinEnergy;
if(p == fElectron) tmax *= 0.5;
else if(p != fPositron) {
G4double mass = p->GetPDGMass();
G4double ratio= electron_mass_c2/mass;
G4double gamma= kinEnergy/mass + 1.0;
tmax = 2.0*electron_mass_c2*(gamma*gamma - 1.) /
(1. + 2.0*gamma*ratio + ratio*ratio);
}
return tmax;
}
@@ -214,13 +224,9 @@ inline G4double G4PAIPhotonModel::MaxSecondaryEnergy( const G4ParticleDefinition
inline void G4PAIPhotonModel::DefineForRegion(const G4Region* r)
{
// G4Region* rPAI = r;
// fPAIRegionVector.push_back(rPAI);
fPAIRegionVector.push_back(r);
}
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4PAIxSection.hh,v 1.12 2006/06/29 19:50:44 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// G4PAIxSection.hh -- header file
@@ -0,0 +1,250 @@
//
// ********************************************************************
// * 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: G4PAIySection.hh,v 1.1 2007/10/01 17:45:14 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// G4PAIySection.hh -- header file
//
//
// Preparation of ionizing collision cross section according to Photo Absorption
// Ionization (PAI) model for simulation of ionization energy losses in very thin
// absorbers. Author: Vladimir.Grichine@cern.ch
//
// History:
//
// 01.10.07, V.Ivanchenko create using V.Grichine G4PAIxSection class
#ifndef G4PAIYSECTION_HH
#define G4PAIYSECTION_HH
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
#include "G4SandiaTable.hh"
class G4PAIySection
{
public:
G4PAIySection();
~G4PAIySection();
void Initialize(const G4Material* material,
G4double maxEnergyTransfer,
G4double betaGammaSq);
void InitPAI() ;
void NormShift( G4double betaGammaSq ) ;
void SplainPAI( G4double betaGammaSq ) ;
// Physical methods
G4double RutherfordIntegral( G4int intervalNumber,
G4double limitLow,
G4double limitHigh ) ;
G4double ImPartDielectricConst( G4int intervalNumber,
G4double energy ) ;
G4double RePartDielectricConst(G4double energy) ;
G4double DifPAIySection( G4int intervalNumber,
G4double betaGammaSq ) ;
G4double PAIdNdxCerenkov( G4int intervalNumber,
G4double betaGammaSq ) ;
G4double PAIdNdxPlasmon( G4int intervalNumber,
G4double betaGammaSq ) ;
void IntegralPAIySection() ;
void IntegralCerenkov() ;
void IntegralPlasmon() ;
G4double SumOverInterval(G4int intervalNumber) ;
G4double SumOverIntervaldEdx(G4int intervalNumber) ;
G4double SumOverInterCerenkov(G4int intervalNumber) ;
G4double SumOverInterPlasmon(G4int intervalNumber) ;
G4double SumOverBorder( G4int intervalNumber,
G4double energy ) ;
G4double SumOverBorderdEdx( G4int intervalNumber,
G4double energy ) ;
G4double SumOverBordCerenkov( G4int intervalNumber,
G4double energy ) ;
G4double SumOverBordPlasmon( G4int intervalNumber,
G4double energy ) ;
G4double GetStepEnergyLoss( G4double step ) ;
G4double GetStepCerenkovLoss( G4double step ) ;
G4double GetStepPlasmonLoss( G4double step ) ;
// Inline access functions
G4int GetNumberOfGammas() const { return fNumberOfGammas ; }
G4int GetSplineSize() const { return fSplineNumber ; }
G4int GetIntervalNumber() const { return fIntervalNumber ; }
G4double GetEnergyInterval(G4int i){ return fEnergyInterval[i] ; }
G4double GetDifPAIySection(G4int i){ return fDifPAIySection[i] ; }
G4double GetPAIdNdxCrenkov(G4int i){ return fdNdxCerenkov[i] ; }
G4double GetPAIdNdxPlasmon(G4int i){ return fdNdxPlasmon[i] ; }
G4double GetMeanEnergyLoss() const {return fIntegralPAIySection[0] ; }
G4double GetMeanCerenkovLoss() const {return fIntegralCerenkov[0] ; }
G4double GetMeanPlasmonLoss() const {return fIntegralPlasmon[0] ; }
G4double GetNormalizationCof() const { return fNormalizationCof ; }
inline G4double GetPAItable(G4int i,G4int j) const ;
inline G4double GetLorentzFactor(G4int i) const ;
inline G4double GetSplineEnergy(G4int i) const ;
inline G4double GetIntegralPAIySection(G4int i) const ;
inline G4double GetIntegralPAIdEdx(G4int i) const ;
inline G4double GetIntegralCerenkov(G4int i) const ;
inline G4double GetIntegralPlasmon(G4int i) const ;
private :
// Local class constants
static const G4double fDelta ; // energy shift from interval border = 0.001
static const G4double fError ; // error in lin-log approximation = 0.005
static G4int fNumberOfGammas ; // = 111 ;
static const G4double fLorentzFactor[112] ; // static gamma array
static
const G4int fRefGammaNumber ; // The number of gamma for creation of spline (15)
G4int fIntervalNumber ; // The number of energy intervals
G4double fNormalizationCof ; // Normalization cof for PhotoAbsorptionXsection
G4double fDensity ; // Current density
G4double fElectronDensity ; // Current electron (number) density
G4int fSplineNumber ; // Current size of spline
G4SandiaTable* fSandia;
G4double fEnergyInterval[500] ;
G4double fA1[500] ;
G4double fA2[500] ;
G4double fA3[500] ;
G4double fA4[500] ;
static
const G4int fMaxSplineSize ; // Max size of output splain arrays = 500
G4double fSplineEnergy[500] ; // energy points of splain
G4double fRePartDielectricConst[500] ; // Real part of dielectric const
G4double fImPartDielectricConst[500] ; // Imaginary part of dielectric const
G4double fIntegralTerm[500] ; // Integral term in PAI cross section
G4double fDifPAIySection[500] ; // Differential PAI cross section
G4double fdNdxCerenkov[500] ; // dNdx of Cerenkov collisions
G4double fdNdxPlasmon[500] ; // dNdx of Plasmon collisions
G4double fIntegralPAIySection[500] ; // Integral PAI cross section ?
G4double fIntegralPAIdEdx[500] ; // Integral PAI dEdx ?
G4double fIntegralCerenkov[500] ; // Integral Cerenkov N>omega ?
G4double fIntegralPlasmon[500] ; // Integral Plasmon N>omega ?
G4double fPAItable[500][112] ; // Output array
} ;
//////////////// Inline methods //////////////////////////////////
//
inline G4double G4PAIySection::GetPAItable(G4int i, G4int j) const
{
return fPAItable[i][j] ;
}
inline G4double G4PAIySection::GetLorentzFactor(G4int j) const
{
return fLorentzFactor[j] ;
}
inline G4double G4PAIySection::GetSplineEnergy(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIySection::GetSplineEnergy");
}
return fSplineEnergy[i] ;
}
inline G4double G4PAIySection::GetIntegralPAIySection(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIySection::GetIntegralPAIySection");
}
return fIntegralPAIySection[i] ;
}
inline G4double G4PAIySection::GetIntegralPAIdEdx(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIySection::GetIntegralPAIySection");
}
return fIntegralPAIdEdx[i] ;
}
inline G4double G4PAIySection::GetIntegralCerenkov(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIySection::GetIntegralCerenkov");
}
return fIntegralCerenkov[i] ;
}
inline G4double G4PAIySection::GetIntegralPlasmon(G4int i) const
{
if(i < 1 || i > fSplineNumber)
{
G4Exception("Invalid argument in G4PAIySection::GetIntegralPlasmon");
}
return fIntegralPlasmon[i] ;
}
#endif
// ----------------- end of G4PAIySection header file -------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4PEEffectModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4PSTARStopping.hh,v 1.4 2006/06/29 19:50:48 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
#ifndef G4PSTARStopping_h
#define G4PSTARStopping_h 1
@@ -25,7 +25,7 @@
//
//
// $Id: G4PhotoElectricEffect.hh,v 1.24 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------------ G4PhotoElectricEffect physics process ------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4PolarizedComptonScattering.hh,v 1.9 2006/06/29 19:51:14 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// --------- G4PolarizedComptonScattering physics process ----------------------
// by Vicente Lara, March 1998
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4UniversalFluctuation.hh,v 1.5 2007/04/03 11:08:36 urban Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UrbanMscModel.hh,v 1.29 2007/06/21 15:04:24 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4UrbanMscModel.hh,v 1.31 2007/10/29 08:42:43 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -114,28 +114,29 @@ public:
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition* particle,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight=0.,
G4double cut =0.,
G4double emax=DBL_MAX);
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight=0.,
G4double cut =0.,
G4double emax=DBL_MAX);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double length,
G4double safety);
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double);
virtual G4double ComputeTruePathLengthLimit(
const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
void SampleScattering(const G4DynamicParticle*,
G4double safety);
virtual G4double ComputeGeomPathLength(G4double truePathLength);
G4double ComputeTruePathLengthLimit(const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
virtual G4double ComputeTrueStepLength(G4double geomStepLength);
G4double ComputeGeomPathLength(G4double truePathLength);
G4double ComputeTrueStepLength(G4double geomStepLength);
G4double ComputeTheta0(G4double truePathLength,
G4double KineticEnergy);
@@ -180,6 +181,8 @@ private:
G4double mass;
G4double charge;
G4double masslimite,masslimitmu;
G4double taubig;
G4double tausmall;
G4double taulim;
@@ -0,0 +1,277 @@
//
// ********************************************************************
// * 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: G4UrbanMscModel90.hh,v 1.1 2007/12/07 17:35:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
//
// GEANT4 Class header file
//
//
// File name: G4UrbanMscModel90
//
// Author: V.Ivanchenko clone Laszlo Urban model
//
// Creation date: 07.12.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 G4UrbanMscModel90_h
#define G4UrbanMscModel90_h 1
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4VEmModel.hh"
#include "G4PhysicsTable.hh"
#include "G4MscStepLimitType.hh"
class G4ParticleChangeForMSC;
class G4SafetyHelper;
class G4LossTableManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4UrbanMscModel90 : public G4VEmModel
{
public:
G4UrbanMscModel90(G4double facrange, G4double dtrl, G4double lambdalimit,
G4double facgeom,G4double skin,
G4bool samplez, G4MscStepLimitType stepAlg,
const G4String& nam = "UrbanMscUni");
virtual ~G4UrbanMscModel90();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition* particle,
G4double KineticEnergy,
G4double AtomicNumber,
G4double AtomicWeight=0.,
G4double cut =0.,
G4double emax=DBL_MAX);
void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double);
void SampleScattering(const G4DynamicParticle*,
G4double safety);
G4double ComputeTruePathLengthLimit(const G4Track& track,
G4PhysicsTable* theLambdaTable,
G4double currentMinimalStep);
G4double ComputeGeomPathLength(G4double truePathLength);
G4double ComputeTrueStepLength(G4double geomStepLength);
G4double ComputeTheta0(G4double truePathLength,
G4double KineticEnergy);
void SetStepLimitType(G4MscStepLimitType);
void SetLateralDisplasmentFlag(G4bool val);
void SetRangeFactor(G4double);
void SetGeomFactor(G4double);
void SetSkin(G4double);
private:
G4double SampleCosineTheta(G4double trueStepLength, G4double KineticEnergy);
G4double SampleDisplacement();
G4double LatCorrelation();
G4double GetLambda(G4double kinEnergy);
void GeomLimit(const G4Track& track);
void SetParticle(const G4ParticleDefinition* p);
// hide assignment operator
G4UrbanMscModel90 & operator=(const G4UrbanMscModel90 &right);
G4UrbanMscModel90(const G4UrbanMscModel90&);
const G4ParticleDefinition* particle;
G4ParticleChangeForMSC* fParticleChange;
G4SafetyHelper* safetyHelper;
G4PhysicsTable* theLambdaTable;
const G4MaterialCutsCouple* couple;
G4LossTableManager* theManager;
G4double mass;
G4double charge;
G4double masslimite,masslimitmu;
G4double taubig;
G4double tausmall;
G4double taulim;
G4double currentTau;
G4double dtrl;
G4double lambdalimit;
G4double facrange;
G4double frscaling1,frscaling2;
G4double tlimit;
G4double tlimitmin;
G4double tlimitminfix;
G4double nstepmax;
G4double geombig;
G4double geommin;
G4double geomlimit;
G4double facgeom;
G4double skin;
G4double skindepth;
G4double smallstep;
G4double presafety;
G4double facsafety;
G4double lambda0;
G4double lambdaeff;
G4double tPathLength;
G4double zPathLength;
G4double par1,par2,par3 ;
G4double stepmin ;
G4double currentKinEnergy;
G4double currentRange;
G4double currentRadLength;
G4double Zeff;
G4int currentMaterialIndex;
G4MscStepLimitType steppingAlgorithm;
G4bool samplez;
G4bool latDisplasment;
G4bool isInitialized;
G4bool inside;
G4bool insideskin;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel90::SetLateralDisplasmentFlag(G4bool val)
{
latDisplasment = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel90::SetSkin(G4double val)
{
skin = val;
stepmin = tlimitminfix;
skindepth = skin*stepmin;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel90::SetRangeFactor(G4double val)
{
facrange = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel90::SetGeomFactor(G4double val)
{
facgeom = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel90::SetStepLimitType(G4MscStepLimitType val)
{
steppingAlgorithm = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
G4double G4UrbanMscModel90::GetLambda(G4double e)
{
G4double x;
if(theLambdaTable) {
G4bool b;
x = ((*theLambdaTable)[currentMaterialIndex])->GetValue(e, b);
} else {
x = CrossSection(couple,particle,e);
}
if(x > DBL_MIN) x = 1./x;
else x = DBL_MAX;
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4UrbanMscModel90::SetParticle(const G4ParticleDefinition* p)
{
if (p != particle) {
particle = p;
mass = p->GetPDGMass();
charge = p->GetPDGCharge()/eplus;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4WaterStopping.hh,v 1.2 2006/06/29 19:51:56 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
#ifndef G4WaterStopping_h
#define G4WaterStopping_h 1
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eBremsstrahlung.hh,v 1.36 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eBremsstrahlungModel.hh,v 1.22 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eCoulombScatteringModel.hh,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4eCoulombScatteringModel.hh,v 1.20 2007/10/24 10:42:05 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -43,6 +43,7 @@
// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
// 19.08.06 V.Ivanchenko add inline function ScreeningParameter and
// make some members protected
// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
//
// Class Description:
//
@@ -62,9 +63,11 @@
#include "G4VEmModel.hh"
#include "G4PhysicsTable.hh"
#include "G4NistManager.hh"
#include "globals.hh"
class G4ParticleChangeForGamma;
class G4ParticleDefinition;
class G4eCoulombScatteringModel : public G4VEmModel
{
@@ -72,7 +75,7 @@ class G4eCoulombScatteringModel : public G4VEmModel
public:
G4eCoulombScatteringModel(G4double thetaMin = 0.0, G4double thetaMax = pi,
G4bool build = true, G4double tlim = TeV*TeV,
G4bool build = false, G4double tlim = TeV*TeV,
const G4String& nam = "eCoulombScattering");
virtual ~G4eCoulombScatteringModel();
@@ -81,11 +84,11 @@ public:
virtual G4double ComputeCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
G4double A,
G4double cut,
G4double emax);
G4double kinEnergy,
G4double Z,
G4double A,
G4double cut,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
@@ -95,28 +98,65 @@ public:
protected:
G4double ScreeningParameter(G4double Z, G4double q2,
G4double mom2, G4double invbeta2);
G4double ComputeElectronXSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z,
G4double A,
G4double cut);
virtual G4double CalculateCrossSectionPerAtom(
const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z, G4double A);
inline void SetupParticle(const G4ParticleDefinition*);
inline void SetupKinematic(G4double kinEnergy);
inline void SetupTarget(G4double Z, G4double A, G4double kinEnergy);
private:
G4double CalculateCrossSectionPerAtom(const G4ParticleDefinition*,
G4double kinEnergy,
G4double Z);
// hide assignment operator
G4eCoulombScatteringModel & operator=(const G4eCoulombScatteringModel &right);
G4eCoulombScatteringModel(const G4eCoulombScatteringModel&);
protected:
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
G4ParticleChangeForGamma* fParticleChange;
G4NistManager* fNistManager;
G4double coeff;
G4double constn;
G4double cosThetaMin;
G4double cosThetaMax;
G4double cosTetMaxNuc;
G4double cosTetMaxElec;
G4double q2Limit;
G4double elecXSection;
G4double nucXSection;
G4double ecut;
// projectile
const G4ParticleDefinition* particle;
G4double chargeSquare;
G4double spin;
G4double mass;
G4double tkin;
G4double mom2;
G4double invbeta2;
// target
G4double targetZ;
G4double targetA;
G4double screenZ;
G4double formfactA;
private:
@@ -136,36 +176,53 @@ private:
G4bool isInitialised;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z, G4double,
G4double, G4double)
inline
void G4eCoulombScatteringModel::SetupParticle(const G4ParticleDefinition* p)
{
G4double x;
G4bool b;
if(theCrossSectionTable) {
x = std::exp((((*theCrossSectionTable)[index[G4int(Z)]]))
->GetValue(kinEnergy, b));
} else x = CalculateCrossSectionPerAtom(p, kinEnergy, Z);
// G4cout << "G4eCoulombScatteringModel: e= " << kinEnergy
// << " cs= " << x << G4endl;
return x;
}
inline G4double G4eCoulombScatteringModel::ScreeningParameter(
G4double Z,
G4double q2,
G4double mom2,
G4double invbeta2)
{
G4double a = invbeta2*Z*Z*q2*alpha2;
return std::pow(Z,0.6666667)*a0*(1.13 + 3.76*a)/mom2;
// Initialise mass and charge
if(p != particle) {
particle = p;
mass = particle->GetPDGMass();
spin = particle->GetPDGSpin();
G4double q = particle->GetPDGCharge()/eplus;
chargeSquare = q*q;
tkin = 0.0;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4eCoulombScatteringModel::SetupKinematic(G4double ekin)
{
if(ekin != tkin) {
tkin = ekin;
mom2 = tkin*(tkin + 2.0*mass);
invbeta2 = 1.0 + mass*mass/mom2;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4eCoulombScatteringModel::SetupTarget(G4double Z, G4double A,
G4double e)
{
if(e != tkin || Z != targetZ || A != targetA) {
targetZ = Z;
targetA = A;
SetupKinematic(e);
cosTetMaxNuc = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
G4double x = fNistManager->GetZ13(Z);
screenZ = a0*x*x*(1.13 + 3.76*invbeta2*Z*Z*chargeSquare*alpha2)/mom2;
if(particle == theProton && A < 1.5 && cosTetMaxNuc < 0.0)
cosTetMaxNuc = 0.0;
// A.V. Butkevich et al., NIM A 488 (2002) 282
x = fNistManager->GetLOGA(A);
formfactA = mom2*constn*std::exp(0.54*x);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eIonisation.hh,v 1.35 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eeToTwoGammaModel.hh,v 1.14 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eplusAnnihilation.hh,v 1.23 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4hIonisation.hh,v 1.37 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hMultipleScattering.hh,v 1.3 2007/05/18 18:43:32 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4hMultipleScattering.hh,v 1.4 2007/12/07 17:35:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -----------------------------------------------------------------------------
//
@@ -59,7 +59,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4UrbanMscModel;
class G4UrbanMscModel90;
class G4hMultipleScattering : public G4VMultipleScattering
@@ -92,7 +92,7 @@ protected:
private: // data members
G4UrbanMscModel* mscUrban;
G4UrbanMscModel90* mscUrban;
G4double lambdalimit;
G4double dtrl;
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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: G4ionGasIonisation.hh,v 1.2 2007/08/13 06:13:30 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4ionGasIonisation
//
// Author: Vladimir Ivanchenko
//
// Creation date: 23.07.2007
//
// Modifications:
//
//
// Class Description:
//
// This class manages the ionisation process for ions. It inherites
// from G4ionIonisation and sample ion/media charge exchange
//
// -------------------------------------------------------------------
//
#ifndef G4ionGasIonisation_h
#define G4ionGasIonisation_h 1
#include "G4ionIonisation.hh"
class G4Material;
class G4ionGasIonisation : public G4ionIonisation
{
public:
G4ionGasIonisation(const G4String& name = "ionGasIoni");
virtual ~G4ionGasIonisation();
virtual void PrintInfo();
protected:
// Initialise process before run
virtual void InitialiseEnergyLossProcess(
const G4ParticleDefinition*,
const G4ParticleDefinition*);
// Initialise dynamic charge before step
virtual void InitialiseMassCharge(const G4Track&);
// Apply correction after step and modify dynamic charge
virtual void CorrectionsAlongStep(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
private:
// Sample change of charge of the projectile ion
G4double SampleChargeAfterStep(G4double qeff, G4double xeff);
// hide assignment operator
G4ionGasIonisation & operator=(const G4ionGasIonisation &right);
G4ionGasIonisation(const G4ionGasIonisation&);
const G4ParticleDefinition* currParticle;
const G4ParticleDefinition* baseParticle;
G4double basePartMass;
G4double currMassRatio;
G4double atomXS;
G4double preStepKinEnergy;
G4int currentIonZ;
G4int ionZ;
G4bool initialised;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionIonisation.hh,v 1.46 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ionIonisation.hh,v 1.50 2007/11/09 11:45:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -54,11 +54,14 @@
// 11-04-05 Move MaxSecondary energy to model (V.Ivanchneko)
// 11-04-04 Move MaxSecondaryEnergy to models (V.Ivanchenko)
// 10-05-06 Add a possibility to download user data (V.Ivantchenko)
// 22-07-06 Remove obsolete method (V.Ivantchenko)
// 07-11-07 Moved CorrectionsAlongStep to cc (V.Ivantchenko)
//
// Class Description:
//
// This class manages the ionisation process for ions.
// it inherites from G4VContinuousDiscreteProcess via G4VEnergyLoss.
// This class manages the ionisation process for ions. Effective charge,
// nuclear stopping power, energy loss corrections are taken into account.
// It inherites from G4VEnergyLossLoss.
//
// -------------------------------------------------------------------
@@ -84,7 +87,7 @@ public:
virtual ~G4ionIonisation();
G4bool IsApplicable(const G4ParticleDefinition& p);
inline G4bool IsApplicable(const G4ParticleDefinition& p);
// Print out of the class parameters
virtual void PrintInfo();
@@ -98,34 +101,33 @@ public:
protected:
void CorrectionsAlongStep(
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*);
void InitialiseEnergyLossProcess(const G4ParticleDefinition*,
const G4ParticleDefinition*);
virtual void CorrectionsAlongStep(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double& eloss,
G4double& length);
void InitialiseMassCharge(const G4Track&);
inline void InitialiseMassCharge(const G4Track&);
G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
const G4Material*, G4double cut);
inline G4double MinPrimaryEnergy(const G4ParticleDefinition* p,
const G4Material*, G4double cut);
inline G4double BetheBlochEnergyThreshold();
inline G4bool NuclearStoppingFlag();
// protected pointers
G4ionEffectiveCharge* effCharge;
G4EmCorrections* corr;
private:
void DefineMassCharge(const G4ParticleDefinition* pd,
const G4Material* mat,
G4double mass,
G4double kinEnergy);
// hide assignment operator
G4ionIonisation & operator=(const G4ionIonisation &right);
G4ionIonisation(const G4ionIonisation&);
G4ionEffectiveCharge* effCharge;
G4EmCorrections* corr;
// cash
const G4Material* curMaterial;
const G4ParticleDefinition* curParticle;
@@ -178,30 +180,6 @@ inline void G4ionIonisation::InitialiseMassCharge(const G4Track& track)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4ionIonisation::CorrectionsAlongStep(
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double& s)
{
if(eloss < preKinEnergy) {
const G4ParticleDefinition* part = dp->GetDefinition();
const G4Material* mat = couple->GetMaterial();
if(preKinEnergy*massRatio > eth)
eloss += s*corr->HighOrderCorrections(part,mat,preKinEnergy);
else {
if(stopDataActive)
eloss *= corr->EffectiveChargeCorrection(part,mat,preKinEnergy);
if(nuclearStopping)
eloss += s*corr->NuclearDEDX(part,mat,preKinEnergy - eloss*0.5);
}
fParticleChange.SetProposedCharge(effCharge->EffectiveCharge(part,
mat,preKinEnergy-eloss));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4ionIonisation::ActivateStoppingData(G4bool val)
{
stopDataActive = val;
@@ -216,4 +194,18 @@ inline void G4ionIonisation::ActivateNuclearStopping(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4ionIonisation::BetheBlochEnergyThreshold()
{
return eth;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4bool G4ionIonisation::NuclearStoppingFlag()
{
return nuclearStopping;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ASTARStopping.cc,v 1.6 2006/06/29 19:52:36 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//---------------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BetheBlochModel.cc,v 1.13 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4BetheHeitlerModel.cc,v 1.11 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BohrFluctuations.cc,v 1.4 2006/06/29 19:52:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4BohrFluctuations.cc,v 1.6 2007/09/27 14:02:41 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -95,19 +95,11 @@ G4double G4BohrFluctuations::SampleFluctuations(const G4Material* material,
G4double siga = Dispersion(material,dp,tmax,length);
G4double loss = meanLoss;
G4double navr = minNumberInteractionsBohr;
// Gaussian fluctuation
G4bool gauss = true;
if (meanLoss < minNumberInteractionsBohr*tmax) {
navr = meanLoss*meanLoss/siga;
if (navr < minNumberInteractionsBohr) gauss = false;
}
//G4cout << "### meanLoss= " << meanLoss << " navr= " << navr << " sig= " << sqrt(siga) << G4endl;
if(gauss) {
G4double navr = meanLoss*meanLoss/siga;
//G4cout << "### meanLoss= " << meanLoss << " navr= " << navr << G4endl;
if (navr >= minNumberInteractionsBohr) {
// Increase fluctuations for big fractional energy loss
if ( meanLoss > minFraction*kineticEnergy ) {
G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
G4double b2 = 1.0 - 1.0/(gam*gam);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BraggIonModel.cc,v 1.16 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4BraggIonModel.cc,v 1.17 2007/07/28 13:30:53 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -249,10 +249,11 @@ void G4BraggIonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
G4double deltaMomentum =
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double totMomentum = sqrt(energy2 - mass*mass);
G4double totMomentum = energy*sqrt(beta2);
G4double cost = deltaKinEnergy * (energy + electron_mass_c2) /
(deltaMomentum * totMomentum);
G4double sint = sqrt(1.0 - cost*cost);
if(cost > 1.0) cost = 1.0;
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi * G4UniformRand() ;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BraggModel.cc,v 1.15 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4BraggModel.cc,v 1.16 2007/07/28 13:30:53 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -213,7 +213,7 @@ void G4BraggModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double maxEnergy)
{
G4double tmax = MaxSecondaryKinEnergy(dp);
G4double xmax = min(tmax, maxEnergy);
G4double xmax = std::min(tmax, maxEnergy);
if(xmin >= xmax) return;
G4double kineticEnergy = dp->GetKineticEnergy();
@@ -243,10 +243,11 @@ void G4BraggModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double deltaMomentum =
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double totMomentum = sqrt(energy2 - mass*mass);
G4double totMomentum = energy*sqrt(beta2);
G4double cost = deltaKinEnergy * (energy + electron_mass_c2) /
(deltaMomentum * totMomentum);
G4double sint = sqrt(1.0 - cost*cost);
if(cost > 1.0) cost = 1.0;
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi * G4UniformRand() ;
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ComptonScattering.cc,v 1.27 2006/09/14 10:27:19 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------ G4ComptonScattering physics process -----------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4ComptonScattering52.cc,v 1.5 2007/05/16 14:00:56 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------ G4ComptonScattering52 physics process -----------------------------
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CoulombScattering.cc,v 1.7 2006/10/19 09:44:27 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4CoulombScattering.cc,v 1.11 2007/11/20 18:43:25 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -51,6 +51,7 @@
#include "G4CoulombScattering.hh"
#include "G4CoulombScatteringModel.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4Electron.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -60,10 +61,20 @@ G4CoulombScattering::G4CoulombScattering(const G4String& name)
: G4VEmProcess(name),thetaMin(0.0),thetaMax(pi),q2Max(DBL_MAX),
isInitialised(false)
{
SetLambdaBinning(80);
SetMinKinEnergy(1.0*keV);
SetMaxKinEnergy(100.0*GeV);
buildTableFlag = true;
G4VEmProcess::SetBuildTableFlag(true);
SetStartFromNullFlag(false);
SetIntegral(true);
SetMinKinEnergy(keV);
SetMaxKinEnergy(PeV);
thEnergy = PeV;
thEnergyElec = PeV;
if(name == "CoulombScat") {
thEnergy = 10.*MeV;
thEnergyElec = 10.*GeV;
}
SetLambdaBinning(120);
SetSecondaryParticle(G4Electron::Electron());
buildElmTableFlag = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -73,31 +84,39 @@ G4CoulombScattering::~G4CoulombScattering()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition*)
void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition* p)
{
if(!isInitialised) {
isInitialised = true;
// SetVerboseLevel(3);
// SetBuildTableFlag(buildTableFlag);
SetBuildTableFlag(false);
SetStartFromNullFlag(false);
SetIntegral(true);
SetLambdaFactor(0.8);
SetSecondaryParticle(0);
aParticle = p;
G4double mass = p->GetPDGMass();
if (mass > GeV || p->GetParticleType() == "nucleus") {
buildElmTableFlag = false;
verboseLevel = 0;
} else {
G4String name = p->GetParticleName();
if(name != "e-" && name != "e+" &&
name != "mu+" && name != "mu-" && name != "pi+" &&
name != "kaon+" && name != "proton" ) verboseLevel = 0;
}
G4double emin = MinKinEnergy();
G4double emax = MaxKinEnergy();
if(GetProcessName() == "eCoulombScat") {
G4double eth = thEnergy;
if(mass < MeV) eth = thEnergyElec;
if(eth > emin) {
G4eCoulombScatteringModel* model =
new G4eCoulombScatteringModel(thetaMin,thetaMax,buildTableFlag,q2Max);
new G4eCoulombScatteringModel(thetaMin,thetaMax,buildElmTableFlag,q2Max);
model->SetLowEnergyLimit(emin);
model->SetHighEnergyLimit(emax);
model->SetHighEnergyLimit(std::min(eth,emax));
AddEmModel(1, model);
} else {
}
if(eth < emax) {
G4CoulombScatteringModel* model =
new G4CoulombScatteringModel(thetaMin,thetaMax,buildTableFlag,q2Max);
model->SetLowEnergyLimit(emin);
new G4CoulombScatteringModel(thetaMin,thetaMax,buildElmTableFlag,q2Max);
model->SetLowEnergyLimit(eth);
model->SetHighEnergyLimit(emax);
AddEmModel(1, model);
AddEmModel(2, model);
}
}
}
@@ -106,10 +125,15 @@ void G4CoulombScattering::InitialiseProcess(const G4ParticleDefinition*)
void G4CoulombScattering::PrintInfo()
{
G4cout << " Coulomb scattering with ThetaMin(degree)= " << thetaMin/degree
<< "; ThetaMax(degree)= " << thetaMax/degree
<< "; q2Max(GeV^2)= " << q2Max/(GeV*GeV)
<< G4endl;
G4cout << " Scattering of " << aParticle->GetParticleName()
<< " with " << thetaMin/degree
<< " < Theta(degree) < " << thetaMax/degree
<< "; Eth(MeV)= ";
if(aParticle->GetPDGMass() < MeV) G4cout << thEnergyElec;
else G4cout << thEnergy;
if(q2Max < DBL_MAX) G4cout << "; q2Max(GeV^2)= " << q2Max/(GeV*GeV);
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CoulombScatteringModel.cc,v 1.8 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4CoulombScatteringModel.cc,v 1.29 2007/11/09 11:45:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,7 @@
// logic of building - only elements from G4ElementTable
// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
// 19.10.06 V.Ivanchenko use inheritance from G4eCoulombScatteringModel
// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
//
// Class Description:
//
@@ -69,7 +70,6 @@ G4CoulombScatteringModel::G4CoulombScatteringModel(
{
theMatManager = G4NistManager::Instance();
theParticleTable = G4ParticleTable::GetParticleTable();
theProton = G4Proton::Proton();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -79,40 +79,61 @@ G4CoulombScatteringModel::~G4CoulombScatteringModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4CoulombScatteringModel::CalculateCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z)
G4double G4CoulombScatteringModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z,
G4double A,
G4double cutEnergy,
G4double)
{
G4double cross= 0.0;
if(p == particle && kinEnergy == tkin && Z == targetZ &&
A == targetA && cutEnergy == ecut) return nucXSection;
// Lab system
G4double ekin = std::max(keV, kinEnergy);
nucXSection = ComputeElectronXSectionPerAtom(p,ekin,Z,A,cutEnergy);
// CM system
G4int iz = G4int(Z);
G4double m = p->GetPDGMass();
G4double mom2 = kinEnergy*(kinEnergy + 2.0*m);
G4double mass2= m*m;
G4double m1 = theMatManager->GetAtomicMassAmu(iz)*amu_c2;
G4double etot = kinEnergy + m + m1;
G4double etot = tkin + mass;
G4double ptot = sqrt(mom2);
G4double bet = ptot/etot;
G4double bet = ptot/(etot + m1);
G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
G4double momCM = gam*(ptot - bet*etot);
G4double momCM= gam*(ptot - bet*etot);
// G4cout << "ptot= " << ptot << " etot= " << etot << " beta= "
// << bet << " gam= " << gam << " Z= " << Z << " A= " << A << G4endl;
// G4cout << " CM. mom= " << momCM << " m= " << m
// << " m1= " << m1 << " iz= " << iz <<G4endl;
G4double momCM2 = momCM*momCM;
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/momCM2);
if(1 == iz && p == theProton) costm = std::max(0.0, costm);
cosTetMaxNuc = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/momCM2);
if(1.5 > targetA && p == theProton && cosTetMaxNuc < 0.0) cosTetMaxNuc = 0.0;
//G4cout << " ctmax= " << cosTetMaxNuc
//<< " ctmin= " << cosThetaMin << G4endl;
// Cross section in CM system
if(costm < cosThetaMin) {
G4double q = p->GetPDGCharge()/eplus;
G4double q2 = q*q;
G4double invbeta2 = 1.0 + mass2/momCM2;
G4double A = ScreeningParameter(Z, q2, momCM2, invbeta2);
G4double a = 2.0*A + 1.0;
G4double f = q * m1 /(m + m1);
cross = coeff*f*f*Z*(Z + 1.0)*invbeta2*(cosThetaMin - costm)/
((a - cosThetaMin)*(a - costm)*momCM2);
if(cosTetMaxNuc < cosThetaMin) {
G4double effmass = mass*m1/(mass + m1);
G4double x1 = 1.0 - cosThetaMin;
G4double x2 = 1.0 - cosTetMaxNuc;
G4double z1 = x1 + screenZ;
G4double z2 = x2 + screenZ;
G4double d = 1.0/formfactA;
G4double zn1= x1 + d;
G4double zn2= x2 + d;
nucXSection += coeff*Z*Z*chargeSquare*(1.0 + effmass*effmass/momCM2)
*(1./z1 - 1./z2 + 1./zn1 - 1./zn2 +
2.0*formfactA*std::log(z1*zn2/(z2*zn1)))/momCM2;
//G4cout << "XS: x1= " << x1 << " x2= " << x2
//<< " cross= " << cross << G4endl;
//G4cout << "momCM2= " << momCM2 << " invbeta2= " << invbeta2
// << " coeff= " << coeff << G4endl;
}
//G4cout << "p= " << mom << " momCM= " << momCM << " Z= " << Z << " A= " << A
//<< " cross= " << cross << " m1(GeV)= " << m1/GeV <<G4endl;
return cross;
if(nucXSection < 0.0) nucXSection = 0.0;
return nucXSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -142,81 +163,91 @@ G4double G4CoulombScatteringModel::SelectIsotope(const G4Element* elm)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4CoulombScatteringModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double,
G4double)
void G4CoulombScatteringModel::SampleSecondaries(
std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double cutEnergy,
G4double maxEnergy)
{
const G4Material* aMaterial = couple->GetMaterial();
const G4ParticleDefinition* p = dp->GetDefinition();
G4double kinEnergy = dp->GetKineticEnergy();
// Select isotope and setup
SetupParticle(p);
const G4Element* elm =
SelectRandomAtom(aMaterial, p, dp->GetKineticEnergy());
SelectRandomAtom(aMaterial,p,kinEnergy,cutEnergy,maxEnergy);
G4double Z = elm->GetZ();
G4double N = SelectIsotope(elm);
G4double A = SelectIsotope(elm);
G4int iz = G4int(Z);
G4int in = G4int(N + 0.5);
G4double m2 = theParticleTable->GetIonTable()->GetNucleusMass(iz, in);
G4double m1 = dp->GetMass();
G4int ia = G4int(A + 0.5);
G4double q = p->GetPDGCharge()/eplus;
G4double q2 = q*q;
G4double cross =
ComputeCrossSectionPerAtom(p,kinEnergy,Z,A,cutEnergy,maxEnergy);
// Transformation to CM system
G4LorentzVector lv1 = dp->Get4Momentum();
G4ThreeVector dir = dp->GetMomentumDirection();
G4LorentzVector lv2(0.0,0.0,0.0,m2);
G4LorentzVector lv = lv1 + lv2;
G4ThreeVector bst = lv.boostVector();
lv1.boost(-bst);
lv2.boost(-bst);
G4ThreeVector p1 = lv1.vect();
G4double momCM2 = p1.mag2();
G4double invbeta2 = 1.0 + m1*m1/momCM2;
G4double A = ScreeningParameter(Z, q2, momCM2, invbeta2);
G4double a = 2.0*A + 1.0;
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/momCM2);
if(1 == iz && p == theProton) costm = std::max(0.0, costm);
if(costm > cosThetaMin) return;
G4double x = G4UniformRand();
G4double y = (a + 1.0 - cosThetaMin)/(cosThetaMin - costm);
G4double st2 = 0.5*(y*(1.0 - costm) - a*x)/(y + x);
if(st2 < 0.0 || st2 > 1.0) {
G4cout << "G4CoulombScatteringModel::SampleSecondaries WARNING st2= "
<< st2 << G4endl;
st2 = 0.0;
G4double costm = cosTetMaxNuc;
G4double formf = formfactA;
if(G4UniformRand()*cross < elecXSection) {
costm = cosTetMaxElec;
formf = 0.0;
}
G4double tet = 2.0*asin(sqrt(st2));
G4double cost= cos(tet);
G4double sint= sin(tet);
// G4cout << "SampleSec: Ekin= " << kinEnergy << " m1= " << m1
// << " Z= "<< Z << " A= " <<A<< G4endl;
G4double phi = twopi * G4UniformRand();
if(costm >= cosThetaMin) return;
G4ThreeVector v1(cos(phi)*sint,sin(phi)*sint,cost);
G4double p1tot = sqrt(momCM2);
// v1.rotateUz(p1);
G4LorentzVector lfv1(v1.x()*p1tot,v1.y()*p1tot,v1.z(),lv1.e());
lfv1.boost(bst);
// kinematics in CM system
G4double m1 = theParticleTable->GetIonTable()->GetNucleusMass(iz, ia);
G4double etot = kinEnergy + mass;
G4double ptot = sqrt(mom2);
G4double bet = ptot/(etot + m1);
G4double gam = 1.0/sqrt((1.0 - bet)*(1.0 + bet));
G4double pCM = gam*(ptot - bet*etot);
G4double eCM = gam*(etot - bet*ptot);
G4LorentzVector lfv2 = lv - lfv1;
G4double x1 = 1. - cosThetaMin + screenZ;
G4double x2 = 1. - costm;
G4double x3 = cosThetaMin - costm;
G4ThreeVector newdir = lfv1.vect().unit();
fParticleChange->ProposeMomentumDirection(newdir);
G4double ekin = lfv1.e() - m1;
G4double grej, z, z1;
do {
z = G4UniformRand()*x3;
z1 = (x1*x2 - screenZ*z)/(x1 + z);
if(z1 < 0.0) z1 = 0.0;
else if(z1 > 2.0) z1 = 2.0;
grej = 1.0/(1.0 + formf*z1);
} while ( G4UniformRand() > grej*grej );
G4double cost = 1.0 - z1;
G4double sint= sqrt(z1*(2.0 - z1));
G4double phi = twopi * G4UniformRand();
// projectile after scattering
G4double pzCM = pCM*cost;
G4ThreeVector v1(pCM*cos(phi)*sint,pCM*sin(phi)*sint,gam*(pzCM + bet*eCM));
G4ThreeVector dir = dp->GetMomentumDirection();
G4ThreeVector newDirection = v1.unit();
newDirection.rotateUz(dir);
fParticleChange->ProposeMomentumDirection(newDirection);
G4double elab = gam*(eCM + bet*pzCM);
G4double ekin = elab - mass;
if(ekin < 0.0) ekin = 0.0;
G4double plab = sqrt(ekin*(ekin + 2.0*mass));
fParticleChange->SetProposedKineticEnergy(ekin);
ekin = lfv2.e() - m2;
if(ekin > Z*aMaterial->GetIonisation()->GetMeanExcitationEnergy()) {
G4ParticleDefinition* ion = theParticleTable->GetIon(iz, in, 0.0);
G4DynamicParticle* newdp = new G4DynamicParticle(ion, lfv2);
// recoil
G4double erec = kinEnergy - ekin;
if(erec > Z*aMaterial->GetIonisation()->GetMeanExcitationEnergy()) {
G4ParticleDefinition* ion = theParticleTable->FindIon(iz, ia, 0, iz);
G4ThreeVector p2 = (ptot*dir - plab*newDirection).unit();
G4DynamicParticle* newdp = new G4DynamicParticle(ion, p2, erec);
fvect->push_back(newdp);
} else if(ekin > 0.0) {
fParticleChange->ProposeLocalEnergyDeposit(ekin);
} else if(erec > 0.0) {
fParticleChange->ProposeLocalEnergyDeposit(erec);
fParticleChange->ProposeNonIonizingEnergyDeposit(erec);
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4GammaConversion.cc,v 1.27 2006/09/14 10:27:19 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------------ G4GammaConversion physics process -------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4InitXscPAI.cc,v 1.9 2006/06/29 19:53:00 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// G4InitXscPAI.cc -- class implementation file
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IonFluctuations.cc,v 1.3 2006/06/29 19:53:02 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4IonFluctuations.cc,v 1.5 2007/09/27 14:01:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -44,6 +44,7 @@
// 13-02-03 Add name (V.Ivanchenko)
// 23-05-03 Add control on parthalogical cases (V.Ivanchenko)
// 16-10-03 Changed interface to Initialisation (V.Ivanchenko)
// 27-09-07 Use FermiEnergy from material, add cut dependence (V.Ivanchenko)
//
// Class Description:
//
@@ -99,28 +100,20 @@ G4double G4IonFluctuations::SampleFluctuations(const G4Material* material,
G4double& meanLoss)
{
if(meanLoss <= minLoss) return meanLoss;
if(dp->GetDefinition() != particle) {
particle = dp->GetDefinition();
charge = particle->GetPDGCharge()/eplus;
}
// G4cout << "### meanLoss= " << meanLoss << G4endl;
G4double siga = Dispersion(material,dp,tmax,length);
G4double loss = meanLoss;
G4double navr = minNumberInteractionsBohr;
navr = meanLoss*meanLoss/siga;
// G4cout << "### siga= " << sqrt(siga) << " navr= " << navr << G4endl;
// Gaussian fluctuation
G4bool gauss = true;
if (meanLoss >= minNumberInteractionsBohr*tmax) {
navr = meanLoss*meanLoss/siga;
if (navr < minNumberInteractionsBohr) gauss = false;
}
if (navr >= minNumberInteractionsBohr) {
if(gauss) {
// Increase fluctuations for big fractional energy loss
//G4cout << "siga= " << siga << G4endl;
if ( meanLoss > minFraction*kineticEnergy ) {
G4double gam = (kineticEnergy - meanLoss)/particleMass + 1.0;
@@ -157,36 +150,45 @@ G4double G4IonFluctuations::Dispersion(
G4double& tmax,
G4double& length)
{
particleMass = dp->GetMass();
G4double q = dp->GetCharge()/eplus;
chargeSquare = q*q;
chargeSqRatio = chargeSquare/(charge*charge);
particle = dp->GetDefinition();
charge = particle->GetPDGCharge()/eplus;
particleMass = particle->GetPDGMass();
G4double q = dp->GetCharge()/eplus;
chargeSquare = q*q;
chargeSqRatio = chargeSquare/(charge*charge);
//chargeSquare = charge*charge;
//chargeSqRatio = 1.0;
G4double electronDensity = material->GetElectronDensity();
kineticEnergy = dp->GetKineticEnergy();
// G4cout << "e= " << kineticEnergy << " m= " << particleMass
// << " tmax= " << tmax << " l= " << length << " q^2= " << chargeSquare << G4endl;
G4double gam = kineticEnergy/particleMass + 1.0;
beta2 = 1.0 - 1.0/(gam*gam);
G4double siga = (1.0/beta2 - 0.5)*tmax*length*electronDensity*twopi_mc2_rcl2*chargeSquare;
// G4cout << "siga= " << siga << G4endl;
G4double etot = kineticEnergy + particleMass;
//G4cout << "e= " << kineticEnergy << " m= " << particleMass
// << " tmax= " << tmax << " l= " << length << " q^2= " << chargeSquare << G4endl;
beta2 = kineticEnergy*(kineticEnergy + 2.*particleMass)/(etot*etot);
G4double siga = (1. - beta2*0.5)*tmax*length*electronDensity*
twopi_mc2_rcl2*chargeSquare/beta2;
// Low velocity - additional ion charge fluctuations according to
// Q.Yang et al., NIM B61(1991)149-155.
G4double zeff = electronDensity/(material->GetTotNbOfAtomsPerVolume());
//G4cout << "siga= " << siga << " zeff= " << zeff << G4endl;
//G4cout << "siga= " << siga << " zeff= " << zeff << " c= " << c << G4endl;
// correction factors with cut dependence
if ( beta2 < 3.0*theBohrBeta2*zeff ) {
G4double a = CoeffitientA (zeff);
G4double b = CoeffitientB (material, zeff);
// G4cout << "a= " << a << " b= " << b << G4endl;
siga *= (a*chargeSqRatio + b);
// G4cout << "a= " << a << " b= " << b << G4endl;
siga *= (1. + (a*chargeSqRatio + b - 1.0)*2.0*electron_mass_c2*beta2/tmax);
} else {
// H.Geissel et al. NIM B, 195 (2002) 3.
siga *= RelativisticFactor(material, zeff);
siga *= (1. + RelativisticFactor(material, zeff)*2.0*electron_mass_c2*beta2/
(tmax*(1.0 - beta2)));
}
// G4cout << "siga= " << siga << G4endl;
return siga;
}
@@ -377,14 +379,19 @@ G4double G4IonFluctuations::CoeffitientB(const G4Material* material, G4double& z
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4IonFluctuations::RelativisticFactor(const G4Material*, G4double& zeff)
G4double G4IonFluctuations::RelativisticFactor(const G4Material* material,
G4double& zeff)
{
// H.Geissel et al. NIM B, 195 (2002) 3.
G4double factor = 1.0 + 0.667*theBohrBeta2*(1.0 - beta2)
* log(2.0*electron_mass_c2/(5.0*charge*eV))
/ ((1.0 - 0.5*beta2)*beta2*zeff) ;
factor *= (1.0 + 1.415e-4*chargeSquare/beta2);
// G4cout << "factor= " << factor << G4endl;
G4double eF = material->GetIonisation()->GetFermiEnergy();
G4double bF2= 2.0*eF/electron_mass_c2;
G4double I = material->GetIonisation()->GetMeanExcitationEnergy();
G4double f = 0.4*bF2*(1.0 - beta2)/((1.0 - 0.5*beta2)*beta2*zeff);
if(beta2 > bF2) f *= log(2.0*electron_mass_c2*beta2/I);
else f *= log(4.0*eF/I);
G4double factor = (1.0 + f)*(1.0 + 1.415e-4*chargeSquare/beta2);
return factor;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4KleinNishinaCompton.cc,v 1.9 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MollerBhabhaModel.cc,v 1.30 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MscModel71.cc,v 1.5 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MultipleScattering.cc,v 1.69 2007/06/11 15:01:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4MultipleScattering.cc,v 1.70 2007/10/29 08:57:19 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -----------------------------------------------------------------------------
//
@@ -172,20 +172,22 @@ void G4MultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
return;
}
// initialisation of parameters
G4String part_name = p->GetParticleName();
mscUrban = new G4UrbanMscModel(RangeFactor(),dtrl,lambdalimit,
GeomFactor(),Skin(),
samplez,StepLimitType());
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
// defaults for ions, which cannot be overwritten
if (p->GetParticleType() == "nucleus") {
mscUrban->SetStepLimitType(fMinimal);
SetStepLimitType(fMinimal);
SetLateralDisplasmentFlag(false);
SetBuildLambdaTable(false);
SetSkin(0.0);
SetRangeFactor(0.2);
}
// initialisation of parameters - defaults for particles other
// than ions can be overwritten by users
mscUrban = new G4UrbanMscModel(RangeFactor(),dtrl,lambdalimit,
GeomFactor(),Skin(),
samplez,StepLimitType());
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
AddEmModel(1,mscUrban);
isInitialized = true;
/*
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4MultipleScattering71.cc,v 1.4 2006/10/16 15:26:49 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -----------------------------------------------------------------------------
// 16/05/01 value of cparm changed , L.Urban
@@ -44,11 +44,12 @@
#include "G4MaterialCutsCouple.hh"
#include "G4MaterialTable.hh"
#include "G4SandiaTable.hh"
#include "G4PAIxSection.hh"
#include "G4OrderedTable.hh"
#include "G4PAIModel.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Poisson.hh"
#include "G4Step.hh"
#include "G4Material.hh"
@@ -70,64 +71,67 @@ G4PAIModel::G4PAIModel(const G4ParticleDefinition* p, const G4String& nam)
fMeanNumber(20),
fParticle(0),
fHighKinEnergy(100.*TeV),
fLowKinEnergy(2.0*MeV),
fTwoln10(2.0*log(10.0)),
fBg2lim(0.0169),
fTaulim(8.4146e-3)
{
if(p) SetParticle(p);
// fLowestKineticEnergy = LowEnergyLimit();
// fHighestKineticEnergy = HighEnergyLimit();
fElectron = G4Electron::Electron();
fPositron = G4Positron::Positron();
fLowestKineticEnergy = fMass*fLowestGamma;
fHighestKineticEnergy = fMass*fHighestGamma;
fParticleEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
fHighestKineticEnergy,
fTotBin );
fPAItransferTable = 0;
fPAIdEdxTable = 0;
fSandiaPhotoAbsCof = 0;
fdEdxVector = 0;
fLambdaVector = 0;
fdNdxCutVector = 0;
isInitialised = false;
}
////////////////////////////////////////////////////////////////////////////
G4PAIModel::~G4PAIModel()
{
// G4cout << "PAI: start destruction" << G4endl;
if(fParticleEnergyVector) delete fParticleEnergyVector;
if(fdEdxVector) delete fdEdxVector ;
if ( fLambdaVector) delete fLambdaVector;
if ( fdNdxCutVector) delete fdNdxCutVector;
if(fdEdxVector) delete fdEdxVector ;
if(fLambdaVector) delete fLambdaVector;
if(fdNdxCutVector) delete fdNdxCutVector;
if( fPAItransferTable )
{
fPAItransferTable->clearAndDestroy();
delete fPAItransferTable ;
}
if(fSandiaPhotoAbsCof)
{
for(G4int i=0;i<fSandiaIntervalNumber;i++)
{
delete[] fSandiaPhotoAbsCof[i];
fPAItransferTable->clearAndDestroy();
delete fPAItransferTable ;
}
delete[] fSandiaPhotoAbsCof;
}
if( fPAIdEdxTable )
{
fPAIdEdxTable->clearAndDestroy();
delete fPAIdEdxTable ;
}
if(fSandiaPhotoAbsCof)
{
for(G4int i=0;i<fSandiaIntervalNumber;i++)
{
delete[] fSandiaPhotoAbsCof[i];
}
delete[] fSandiaPhotoAbsCof;
}
//G4cout << "PAI: end destruction" << G4endl;
}
///////////////////////////////////////////////////////////////////////////////
void G4PAIModel::SetParticle(const G4ParticleDefinition* p)
{
if(fParticle == p) return;
fParticle = p;
fMass = fParticle->GetPDGMass();
fSpin = fParticle->GetPDGSpin();
G4double q = fParticle->GetPDGCharge()/eplus;
fChargeSquare = q*q;
fLowKinEnergy *= fMass/proton_mass_c2;
fLowKinEnergy = 0.2*MeV*fMass/proton_mass_c2;
fRatio = electron_mass_c2/fMass;
fQc = fMass/fRatio;
}
@@ -137,56 +141,58 @@ void G4PAIModel::SetParticle(const G4ParticleDefinition* p)
void G4PAIModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(!fParticle) SetParticle(p);
if(isInitialised) return;
isInitialised = true;
SetParticle(p);
fLowestKineticEnergy = fMass*(fLowestGamma - 1.0);
fHighestKineticEnergy = fMass*(fHighestGamma - 1.0);
fParticleEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
fHighestKineticEnergy,
fTotBin);
if(pParticleChange)
fParticleChange = reinterpret_cast<G4ParticleChangeForLoss*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForLoss();
// Prepare initialization
fPAItransferTable = new G4PhysicsTable(fTotBin);
fPAIdEdxTable = new G4PhysicsTable(fTotBin);
const G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
size_t numOfMat = G4Material::GetNumberOfMaterials();
size_t numRegions = fPAIRegionVector.size();
for(size_t iReg = 0; iReg < fPAIRegionVector.size();++iReg) // region loop
for(size_t iReg = 0; iReg < numRegions; ++iReg) // region loop
{
const G4Region* curReg = fPAIRegionVector[iReg];
// (*fPAIRegionVector[iRegion])
vector<G4Material*>::const_iterator matIter = curReg->GetMaterialIterator();
size_t jMat;
size_t numOfMat = curReg->GetNumberOfMaterials();
// for(size_t jMat = 0; jMat < curReg->GetNumberOfMaterials();++jMat){}
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
size_t numberOfMat = G4Material::GetNumberOfMaterials();
for(jMat = 0 ; jMat < numOfMat; ++jMat) // region material loop
for(size_t jMat = 0; jMat < numOfMat; ++jMat) // region material loop
{
const G4MaterialCutsCouple* matCouple = theCoupleTable->
GetMaterialCutsCouple( *matIter, curReg->GetProductionCuts() );
fMaterialCutsCoupleVector.push_back(matCouple);
fMaterial = (*theMaterialTable)[jMat];
fCutCouple = theCoupleTable->GetMaterialCutsCouple( fMaterial,
curReg->GetProductionCuts() );
if( fCutCouple ) {
fMaterialCutsCoupleVector.push_back(fCutCouple);
size_t iMatGlob;
for(iMatGlob = 0 ; iMatGlob < numberOfMat ; iMatGlob++ )
{
if( *matIter == (*theMaterialTable)[iMatGlob]) break ;
fDeltaCutInKinEnergy =
(*theCoupleTable->GetEnergyCutsVector(1))[fCutCouple->GetIndex()];
//ComputeSandiaPhotoAbsCof();
BuildPAIonisationTable();
fPAIxscBank.push_back(fPAItransferTable);
fPAIdEdxBank.push_back(fPAIdEdxTable);
fdEdxTable.push_back(fdEdxVector);
BuildLambdaVector();
fdNdxCutTable.push_back(fdNdxCutVector);
fLambdaTable.push_back(fLambdaVector);
}
fMatIndex = iMatGlob;
ComputeSandiaPhotoAbsCof();
BuildPAIonisationTable(p);
fPAIxscBank.push_back(fPAItransferTable);
fPAIdEdxBank.push_back(fPAIdEdxTable);
fdEdxTable.push_back(fdEdxVector);
BuildLambdaVector(matCouple);
fdNdxCutTable.push_back(fdNdxCutVector);
fLambdaTable.push_back(fLambdaVector);
matIter++;
}
}
}
@@ -194,7 +200,7 @@ void G4PAIModel::Initialise(const G4ParticleDefinition* p,
//////////////////////////////////////////////////////////////////
void G4PAIModel::ComputeSandiaPhotoAbsCof()
{
{
G4int i, j, numberOfElements ;
static const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
@@ -240,110 +246,77 @@ void G4PAIModel::ComputeSandiaPhotoAbsCof()
// the tables are built for MATERIALS
// *********
void
G4PAIModel::BuildPAIonisationTable(const G4ParticleDefinition* p)
void G4PAIModel::BuildPAIonisationTable()
{
G4double LowEdgeEnergy , ionloss ;
G4double massRatio, tau, Tmax, Tmin, Tkin, deltaLow, gamma, bg2 ;
/*
if( fPAItransferTable )
{
fPAItransferTable->clearAndDestroy() ;
delete fPAItransferTable ;
}
*/
fPAItransferTable = new G4PhysicsTable(fTotBin);
/*
if( fPAIdEdxTable )
{
fPAIdEdxTable->clearAndDestroy() ;
delete fPAIdEdxTable ;
}
*/
fPAIdEdxTable = new G4PhysicsTable(fTotBin);
G4double tau, Tmax, Tmin, Tkin, deltaLow, gamma, bg2 ;
// if(fdEdxVector) delete fdEdxVector ;
if(fdEdxVector) delete fdEdxVector;
fdEdxVector = new G4PhysicsLogVector( fLowestKineticEnergy,
fHighestKineticEnergy,
fTotBin ) ;
Tmin = fSandiaPhotoAbsCof[0][0] ; // low energy Sandia interval
fHighestKineticEnergy,
fTotBin);
G4SandiaTable* sandia = fMaterial->GetSandiaTable();
Tmin = sandia->GetSandiaCofForMaterialPAI(0,0)*keV;
deltaLow = 100.*eV; // 0.5*eV ;
for (G4int i = 0 ; i < fTotBin ; i++) //The loop for the kinetic energy
{
LowEdgeEnergy = fParticleEnergyVector->GetLowEdgeEnergy(i) ;
tau = LowEdgeEnergy/fMass ;
// if(tau < 0.01) tau = 0.01 ;
gamma = tau +1. ;
// G4cout<<"gamma = "<<gamma<<endl ;
bg2 = tau*( tau + 2. );
if(p->GetParticleName() == "e-")
{
Tmax = 0.5*LowEdgeEnergy;
}
else if(p->GetParticleName() == "e+")
{
Tmax = LowEdgeEnergy; // Unclear??
}
else
{
massRatio = electron_mass_c2/fMass ;
Tmax = 2.*electron_mass_c2*bg2/(1. + 2.*gamma*massRatio+massRatio*massRatio);
}
Tmax = MaxSecondaryEnergy(fParticle, LowEdgeEnergy);
// Tmax = std::min(fDeltaCutInKinEnergy, Tmax);
Tkin = Tmax ;
// G4cout<<"proton Tkin = "<<LowEdgeEnergy/MeV<<" MeV"
// <<" Tmax = "<<Tmax/MeV<<" MeV"<<G4endl;
// Tkin = DeltaCutInKineticEnergyNow ;
// if ( DeltaCutInKineticEnergyNow > Tmax) // was <
{
Tkin = Tmax ;
}
if ( Tkin < Tmin + deltaLow ) // low energy safety
{
if ( Tmax < Tmin + deltaLow ) // low energy safety
Tkin = Tmin + deltaLow ;
}
/*
G4PAIxSection protonPAI( fMatIndex,
Tkin,
bg2,
fSandiaPhotoAbsCof,
fSandiaIntervalNumber ) ;
*/
fPAIySection.Initialize(fMaterial, Tkin, bg2);
// G4cout<<"ionloss = "<<ionloss*cm/keV<<" keV/cm"<<endl ;
// G4cout<<"n1 = "<<protonPAI.GetIntegralPAIxSection(1)*cm<<" 1/cm"<<endl ;
// G4cout<<"protonPAI.GetSplineSize() = "<<
// protonPAI.GetSplineSize()<<G4endl<<G4endl ;
G4PhysicsFreeVector* transferVector = new
G4PhysicsFreeVector(protonPAI.GetSplineSize()) ;
G4PhysicsFreeVector* dEdxVector = new
G4PhysicsFreeVector(protonPAI.GetSplineSize()) ;
G4int n = fPAIySection.GetSplineSize();
G4PhysicsFreeVector* transferVector = new G4PhysicsFreeVector(n) ;
G4PhysicsFreeVector* dEdxVector = new G4PhysicsFreeVector(n);
for( G4int k = 0 ; k < protonPAI.GetSplineSize() ; k++ )
for( G4int k = 0 ; k < n; k++ )
{
transferVector->PutValue( k ,
protonPAI.GetSplineEnergy(k+1),
protonPAI.GetIntegralPAIxSection(k+1) ) ;
fPAIySection.GetSplineEnergy(k+1),
fPAIySection.GetIntegralPAIySection(k+1) ) ;
dEdxVector->PutValue( k ,
protonPAI.GetSplineEnergy(k+1),
protonPAI.GetIntegralPAIdEdx(k+1) ) ;
fPAIySection.GetSplineEnergy(k+1),
fPAIySection.GetIntegralPAIdEdx(k+1) ) ;
}
ionloss = protonPAI.GetMeanEnergyLoss() ; // total <dE/dx>
if ( ionloss <= 0.) ionloss = DBL_MIN ;
ionloss = fPAIySection.GetMeanEnergyLoss() ; // total <dE/dx>
if ( ionloss < DBL_MIN) ionloss = DBL_MIN;
fdEdxVector->PutValue(i,ionloss) ;
fPAItransferTable->insertAt(i,transferVector) ;
fPAIdEdxTable->insertAt(i,dEdxVector) ;
// delete[] transferVector ;
} // end of Tkin loop
// theLossTable->insert(fdEdxVector);
// end of material loop
// G4cout<<"G4PAIonisation::BuildPAIonisationTable() have been called"<<G4endl ;
// G4cout<<"G4PAIonisation::BuildLossTable() have been called"<<G4endl ;
} // end of Tkin loop
// theLossTable->insert(fdEdxVector);
// end of material loop
// G4cout<<"G4PAIonisation::BuildPAIonisationTable() have been called"<<G4endl ;
// G4cout<<"G4PAIonisation::BuildLossTable() have been called"<<G4endl ;
}
///////////////////////////////////////////////////////////////////////
@@ -352,28 +325,10 @@ G4PAIModel::BuildPAIonisationTable(const G4ParticleDefinition* p)
// tables are built for MATERIALS
//
void
G4PAIModel::BuildLambdaVector(const G4MaterialCutsCouple* matCutsCouple)
void G4PAIModel::BuildLambdaVector()
{
G4int i ;
G4double dNdxCut, lambda;
G4double kCarTolerance = G4GeometryTolerance::GetInstance()
->GetSurfaceTolerance();
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
size_t jMatCC;
for (jMatCC = 0 ; jMatCC < numOfCouples ; jMatCC++ )
{
if( matCutsCouple == theCoupleTable->GetMaterialCutsCouple(jMatCC) ) break;
}
if( jMatCC == numOfCouples && jMatCC > 0 ) jMatCC--;
const vector<G4double>* deltaCutInKineticEnergy = theCoupleTable->
GetEnergyCutsVector(idxG4ElectronCut);
//G4double kCarTolerance = G4GeometryTolerance::GetInstance()
// ->GetSurfaceTolerance();
if (fLambdaVector) delete fLambdaVector;
if (fdNdxCutVector) delete fdNdxCutVector;
@@ -384,18 +339,17 @@ G4PAIModel::BuildLambdaVector(const G4MaterialCutsCouple* matCutsCouple)
fdNdxCutVector = new G4PhysicsLogVector( fLowestKineticEnergy,
fHighestKineticEnergy,
fTotBin ) ;
G4double deltaCutInKineticEnergyNow = (*deltaCutInKineticEnergy)[jMatCC] ;
if(fVerbose)
if(fVerbose > 1)
{
G4cout<<"PAIModel DeltaCutInKineticEnergyNow = "
<<deltaCutInKineticEnergyNow/keV<<" keV"<<G4endl;
G4cout<<"PAIModel DeltaCutInKineticEnergyNow = "
<<fDeltaCutInKinEnergy/keV<<" keV"<<G4endl;
}
for ( i = 0 ; i < fTotBin ; i++ )
for (G4int i = 0 ; i < fTotBin ; i++ )
{
dNdxCut = GetdNdxCut(i,deltaCutInKineticEnergyNow) ;
lambda = dNdxCut <= DBL_MIN ? DBL_MAX: 1.0/dNdxCut ;
G4double dNdxCut = GetdNdxCut(i,fDeltaCutInKinEnergy) ;
G4double lambda = dNdxCut <= DBL_MIN ? DBL_MAX: 1.0/dNdxCut ;
if (lambda <= 1000*kCarTolerance) lambda = 1000*kCarTolerance ; // Mmm ???
// if (lambda <= 1000*kCarTolerance) lambda = 1000*kCarTolerance ; // Mmm ???
fLambdaVector->PutValue(i, lambda) ;
fdNdxCutVector->PutValue(i, dNdxCut) ;
@@ -588,8 +542,8 @@ void G4PAIModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
fPAItransferTable = fPAIxscBank[jMat];
fdNdxCutVector = fdNdxCutTable[jMat];
G4double tmax = min(MaxSecondaryKinEnergy(dp), maxEnergy);
if( tmin >= tmax && fVerbose)
G4double tmax = std::min(MaxSecondaryKinEnergy(dp), maxEnergy);
if( tmin >= tmax && fVerbose > 0)
{
G4cout<<"G4PAIModel::SampleSecondary: tmin >= tmax "<<G4endl;
}
@@ -606,35 +560,25 @@ void G4PAIModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
// G4cout<<"G4PAIModel::SampleSecondaries; deltaKIn = "<<deltaTkin/keV<<" keV "<<G4endl;
if( deltaTkin <= 0. && fVerbose )
if( deltaTkin <= 0. && fVerbose > 0)
{
G4cout<<"Tkin of secondary e- <= 0."<<G4endl;
G4cout<<"G4PAIModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
G4cout<<"G4PAIModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
// deltaTkin = 10*eV;
G4cout<<"Set G4PAIModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
G4cout<<"G4PAIModel::SampleSecondary e- deltaTkin = "<<deltaTkin<<G4endl;
}
if( deltaTkin <= 0.) return;
if(deltaTkin > kineticEnergy &&
particleMass != electron_mass_c2) deltaTkin = kineticEnergy;
if (deltaTkin > 0.5*kineticEnergy &&
(dp->GetDefinition()->GetParticleName() == "e-" ||
dp->GetDefinition()->GetParticleName() == "e+") ) deltaTkin = 0.5*kineticEnergy;
if( deltaTkin > tmax) deltaTkin = tmax;
G4double deltaTotalMomentum = sqrt(deltaTkin*(deltaTkin + 2. * electron_mass_c2 ));
G4double totalMomentum = sqrt(pSquare);
G4double costheta = deltaTkin*(totalEnergy + electron_mass_c2)
/(deltaTotalMomentum * totalMomentum);
if( costheta >= 0.99999 ) costheta = 0.99999;
G4double sintheta, sin2 = 1. - costheta*costheta;
if( sin2 <= 0.) sintheta = 0.;
else sintheta = sqrt(sin2);
if( costheta > 0.99999 ) costheta = 0.99999;
G4double sintheta = 0.0;
G4double sin2 = 1. - costheta*costheta;
if( sin2 > 0.) sintheta = sqrt(sin2);
// direction of the delta electron
G4double phi = twopi*G4UniformRand();
G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
@@ -798,8 +742,8 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
G4int iTkin, iTransfer, iPlace ;
G4long numOfCollisions=0;
// G4cout<<"G4PAIModel::SampleFluctuations"<<G4endl ;
// G4cout<<"in: "<<fMaterialCutsCoupleVector[jMat]->GetMaterial()->GetName()<<G4endl ;
// G4cout<<"G4PAIModel::SampleFluctuations"<<G4endl ;
//G4cout<<"in: "<<fMaterialCutsCoupleVector[jMat]->GetMaterial()->GetName()<<G4endl ;
G4double loss = 0.0, charge2 ;
G4double stepSum = 0., stepDelta, lambda, omega;
@@ -837,7 +781,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
if(stepSum >= step) break;
numOfCollisions++;
}
// G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl ;
// G4cout<<"##1 numOfCollisions = "<<numOfCollisions<<G4endl ;
while(numOfCollisions)
{
@@ -876,7 +820,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
numOfCollisions++;
}
// G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl ;
//G4cout<<"##2 numOfCollisions = "<<numOfCollisions<<G4endl ;
while(numOfCollisions)
{
@@ -922,7 +866,7 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
numOfCollisions++;
}
// G4cout<<"numOfCollisions = "<<numOfCollisions<<endl ;
//G4cout<<"##3 numOfCollisions = "<<numOfCollisions<<endl ;
while(numOfCollisions)
{
@@ -950,7 +894,8 @@ G4double G4PAIModel::SampleFluctuations( const G4Material* material,
}
}
}
// G4cout<<"PAIModel AlongStepLoss = "<<loss/keV<<" keV, on step = "<<step/mm<<" mm"<<G4endl ;
// G4cout<<"PAIModel AlongStepLoss = "<<loss/keV<<" keV, on step = "
// <<step/mm<<" mm"<<G4endl ;
if(loss > Tkin) loss=Tkin;
if(loss < 0. ) loss = 0.;
return loss ;
@@ -49,6 +49,7 @@
#include "G4PAIPhotonModel.hh"
#include "Randomize.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Gamma.hh"
#include "G4Poisson.hh"
#include "G4Step.hh"
@@ -76,6 +77,11 @@ G4PAIPhotonModel::G4PAIPhotonModel(const G4ParticleDefinition* p, const G4String
fTaulim(8.4146e-3)
{
if(p) SetParticle(p);
fVerbose = 0;
fElectron = G4Electron::Electron();
fPositron = G4Positron::Positron();
fProtonEnergyVector = new G4PhysicsLogVector(fLowestKineticEnergy,
fHighestKineticEnergy,
fTotBin);
@@ -91,6 +97,8 @@ G4PAIPhotonModel::G4PAIPhotonModel(const G4ParticleDefinition* p, const G4String
fdNdxCutVector = 0;
fdNdxCutPhotonVector = 0;
fdNdxCutPlasmonVector = 0;
isInitialised = false;
}
////////////////////////////////////////////////////////////////////////////
@@ -146,6 +154,9 @@ void G4PAIPhotonModel::SetParticle(const G4ParticleDefinition* p)
void G4PAIPhotonModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(isInitialised) return;
isInitialised = true;
if(!fParticle) SetParticle(p);
if(pParticleChange)
@@ -160,8 +171,6 @@ void G4PAIPhotonModel::Initialise(const G4ParticleDefinition* p,
{
const G4Region* curReg = fPAIRegionVector[iReg];
// (*fPAIRegionVector[iRegion])
vector<G4Material*>::const_iterator matIter = curReg->GetMaterialIterator();
size_t jMat;
size_t numOfMat = curReg->GetNumberOfMaterials();
@@ -301,15 +310,13 @@ G4PAIPhotonModel::BuildPAIonisationTable()
// G4cout<<"gamma = "<<gamma<<endl ;
bg2 = tau*(tau + 2. ) ;
massRatio = electron_mass_c2/proton_mass_c2 ;
Tmax = 2.*electron_mass_c2*bg2/(1.+2.*gamma*massRatio+massRatio*massRatio) ;
Tmax = MaxSecondaryEnergy(fParticle, LowEdgeEnergy);
// G4cout<<"proton Tkin = "<<LowEdgeEnergy/MeV<<" MeV"
// <<" Tmax = "<<Tmax/MeV<<" MeV"<<G4endl;
// Tkin = DeltaCutInKineticEnergyNow ;
// if ( DeltaCutInKineticEnergyNow > Tmax) // was <
{
Tkin = Tmax ;
}
Tkin = Tmax ;
if ( Tkin < Tmin + deltaLow ) // low energy safety
{
Tkin = Tmin + deltaLow ;
@@ -359,12 +366,11 @@ G4PAIPhotonModel::BuildPAIonisationTable()
fPAIplasmonTable->insertAt(i,plasmonVector) ;
fPAIdEdxTable->insertAt(i,dEdxVector) ;
// delete[] transferVector ;
} // end of Tkin loop
// theLossTable->insert(fdEdxVector);
// end of material loop
// G4cout<<"G4PAIonisation::BuildPAIonisationTable() have been called"<<G4endl ;
// G4cout<<"G4PAIonisation::BuildLossTable() have been called"<<G4endl ;
} // end of Tkin loop
// theLossTable->insert(fdEdxVector);
// end of material loop
// G4cout<<"G4PAIonisation::BuildPAIonisationTable() have been called"<<G4endl ;
// G4cout<<"G4PAIonisation::BuildLossTable() have been called"<<G4endl ;
}
///////////////////////////////////////////////////////////////////////
@@ -419,11 +425,13 @@ G4PAIPhotonModel::BuildLambdaVector(const G4MaterialCutsCouple* matCutsCouple)
G4double deltaCutInKineticEnergyNow = (*deltaCutInKineticEnergy)[jMatCC];
G4double photonCutInKineticEnergyNow = (*photonCutInKineticEnergy)[jMatCC];
G4cout<<"PAIPhotonModel deltaCutInKineticEnergyNow = "
<<deltaCutInKineticEnergyNow/keV<<" keV"<<G4endl;
G4cout<<"PAIPhotonModel photonCutInKineticEnergyNow = "
<<photonCutInKineticEnergyNow/keV<<" keV"<<G4endl;
if(fVerbose > 0)
{
G4cout<<"PAIPhotonModel deltaCutInKineticEnergyNow = "
<<deltaCutInKineticEnergyNow/keV<<" keV"<<G4endl;
G4cout<<"PAIPhotonModel photonCutInKineticEnergyNow = "
<<photonCutInKineticEnergyNow/keV<<" keV"<<G4endl;
}
for ( i = 0 ; i < fTotBin ; i++ )
{
dNdxPhotonCut = GetdNdxPhotonCut(i,photonCutInKineticEnergyNow);
@@ -626,8 +634,9 @@ G4double G4PAIPhotonModel::ComputeDEDX(const G4MaterialCutsCouple* matCC,
size_t jMat;
G4double particleMass = p->GetPDGMass();
G4double scaledTkin = kineticEnergy*proton_mass_c2/particleMass;
G4double charge = p->GetPDGCharge();
G4double charge2 = charge*charge, dEdx;
G4double charge = p->GetPDGCharge()/eplus;
G4double charge2 = charge*charge;
G4double dEdx = 0.;
for( jMat = 0 ;jMat < fMaterialCutsCoupleVector.size() ; ++jMat )
{
@@ -746,7 +755,7 @@ void G4PAIPhotonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
fdNdxCutPlasmonVector = fdNdxCutPlasmonTable[jMat];
G4double tmax = min(MaxSecondaryKinEnergy(dp), maxEnergy);
if( tmin >= tmax )
if( tmin >= tmax && fVerbose > 0)
{
G4cout<<"G4PAIPhotonModel::SampleSecondary: tmin >= tmax "<<G4endl;
}
@@ -754,7 +763,7 @@ void G4PAIPhotonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
G4ThreeVector direction = dp->GetMomentumDirection();
G4double particleMass = dp->GetMass();
G4double kineticEnergy = dp->GetKineticEnergy();
G4double scaledTkin = kineticEnergy*proton_mass_c2/particleMass;
G4double scaledTkin = kineticEnergy*fMass/particleMass;
G4double totalEnergy = kineticEnergy + particleMass;
G4double pSquare = kineticEnergy*(totalEnergy+particleMass);
@@ -783,23 +792,23 @@ void G4PAIPhotonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
if( deltaTkin <= 0. )
{
G4cout<<"Tkin of secondary e- <= 0."<<G4endl;
G4cout<<"G4PAIPhotonModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
deltaTkin = 10*eV;
G4cout<<"Set G4PAIPhotonModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
G4cout<<"G4PAIPhotonModel::SampleSecondary e- deltaTkin = "<<deltaTkin<<G4endl;
}
if( deltaTkin <= 0.) return;
G4double deltaTotalMomentum = sqrt(deltaTkin*(deltaTkin + 2. * electron_mass_c2 ));
G4double totalMomentum = sqrt(pSquare);
G4double costheta = deltaTkin*(totalEnergy + electron_mass_c2)
/(deltaTotalMomentum * totalMomentum);
if (costheta < 0.) costheta = 0.;
if (costheta > +1.) costheta = +1.;
if( costheta > 0.99999 ) costheta = 0.99999;
G4double sintheta = 0.0;
G4double sin2 = 1. - costheta*costheta;
if( sin2 > 0.) sintheta = sqrt(sin2);
// direction of the delta electron
G4double phi = twopi*G4UniformRand();
G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
G4ThreeVector deltaDirection(dirx,diry,dirz);
@@ -830,26 +839,15 @@ void G4PAIPhotonModel::SampleSecondaries(std::vector<G4DynamicParticle*>* vdp,
if( deltaTkin <= 0. )
{
G4cout<<"Tkin of secondary photon <= 0."<<G4endl;
G4cout<<"G4PAIPhotonModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
deltaTkin = 10*eV;
G4cout<<"Set G4PAIPhotonModel::SampleSecondary::deltaTkin = "<<deltaTkin<<G4endl;
G4cout<<"G4PAIPhotonModel::SampleSecondary gamma deltaTkin = "<<deltaTkin<<G4endl;
}
// G4double deltaTotalMomentum = sqrt(deltaTkin*(deltaTkin + 2. * electron_mass_c2 ));
// G4double totalMomentum = sqrt(pSquare);
// deltaTkin*(totalEnergy + electron_mass_c2)
// /(deltaTotalMomentum * totalMomentum);
if( deltaTkin <= 0.) return;
G4double costheta = 0.; // G4UniformRand(); // VG: ??? for start only
if (costheta < 0.) costheta = 0.;
if (costheta > 1.) costheta = 1.;
// direction of the 'Cherenkov' photon
G4double phi = twopi*G4UniformRand();
G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
// direction of the 'Cherenkov' photon
G4double phi = twopi*G4UniformRand();
G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
G4ThreeVector deltaDirection(dirx,diry,dirz);
@@ -25,7 +25,7 @@
//
//
// $Id: G4PAIxSection.cc,v 1.21 2006/06/29 19:53:20 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
// G4PAIxSection.cc -- class implementation file
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4PEEffectModel.cc,v 1.6 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4PSTARStopping.cc,v 1.5 2006/06/29 19:53:24 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//---------------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4PhotoElectricEffect.cc,v 1.37 2006/09/14 10:27:19 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//------------------ G4PhotoElectricEffect physics process ---------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4PolarizedComptonScattering.cc,v 1.16 2006/06/29 19:53:30 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
//
//---------- G4PolarizedComptonScattering physics process ----------------------
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.cc,v 1.14 2007/04/03 11:08:36 urban Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4UniversalFluctuation.cc,v 1.15 2007/07/13 11:01:50 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -55,6 +55,7 @@
// 20-03-07 'GLANDZ' part rewritten completely, no 'very small loss'
// regime any more (L.Urban)
// 03-04-07 correction to get better width of eloss distr.(L.Urban)
// 13-07-07 add protection for very small step or low-density material (VI)
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -179,6 +180,9 @@ G4double G4UniversalFluctuation::SampleFluctuations(const G4Material* material,
lastMaterial = material;
}
// very small step or low-density material
if(tmax <= e0) return meanLoss;
G4double a1 = 0. , a2 = 0., a3 = 0. ;
// correction to get better width even using stepmax
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UrbanMscModel.cc,v 1.60 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4UrbanMscModel.cc,v 1.77 2007/11/30 13:53:02 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -137,6 +137,17 @@
// 10-04-07 optimize logic of ComputeTruePathLengthLimit, remove
// unused members, use unique G4SafetyHelper (V.Ivanchenko)
// 01-05-07 optimization for skin > 0 (L.Urban)
// 05-07-07 modified model functions in SampleCosineTheta (L.Urban)
// 06-07-07 theta0 is not the same for e-/e+ as for heavy particles (L.Urban)
// 02-08-07 compare safety not with 0. but with tlimitminfix (V.Ivanchenko)
// 09-08-07 tail of angular distribution has been modified (L.Urban)
// 22-10-07 - corr. in ComputeGeomPathLength in order to get better low
// energy behaviour for heavy particles,
// - theta0 is slightly modified,
// - some old inconsistency/bug is cured in SampleCosineTheta,
// now 0 <= prob <= 1 in any case (L.Urban)
// 26-10-07 different correction parameters for e/mu/hadrons in ComputeTheta0
// 30-11-07 fix in ComputeTheta0 (L.Urban)
//
// Class Description:
@@ -157,7 +168,6 @@
#include "G4LossTableManager.hh"
#include "G4ParticleChangeForMSC.hh"
#include "G4TransportationManager.hh"
#include "G4Navigator.hh"
#include "G4SafetyHelper.hh"
#include "G4Poisson.hh"
@@ -181,8 +191,11 @@ G4UrbanMscModel::G4UrbanMscModel(G4double m_facrange, G4double m_dtrl,
samplez(m_samplez),
isInitialized(false)
{
masslimite = 0.6*MeV;
masslimitmu = 110.*MeV;
taubig = 8.0;
tausmall = 1.e-20;
tausmall = 1.e-16;
taulim = 1.e-6;
currentTau = taulim;
tlimitminfix = 1.e-6*mm;
@@ -530,7 +543,7 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
{
//compute geomlimit and presafety
GeomLimit(track);
// is far from boundary
if(currentRange <= presafety)
{
@@ -543,7 +556,6 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
if((stepStatus == fGeomBoundary) || (stepNumber == 1))
{
if(stepNumber == 1) smallstep = 1.e10;
else smallstep = 1.;
@@ -557,15 +569,7 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
if (currentRange > lambda0) tlimit = facr*currentRange;
else tlimit = facr*lambda0;
// constraint from the geometry (if tlimit above is too big)
G4double tgeom = geombig;
if(geomlimit > geommin)
{
if(stepStatus == fGeomBoundary)
tgeom = geomlimit/facgeom;
else
tgeom = 2.*geomlimit/facgeom;
}
if(tlimit > currentRange) tlimit = currentRange;
//define stepmin here (it depends on lambda!)
//rough estimation of lambda_elastic/lambda_transport
@@ -576,15 +580,24 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
skindepth = skin*stepmin;
//define tlimitmin
tlimitmin = lambda0/nstepmax;
if(tlimitmin < stepmin) tlimitmin = 1.01*stepmin;
tlimitmin = 10.*stepmin;
if(tlimitmin < tlimitminfix) tlimitmin = tlimitminfix;
//lower limit for tlimit
if(tlimit < tlimitmin) tlimit = tlimitmin;
//check against geometry limit
if(tlimit > tgeom) tlimit = tgeom;
// constraint from the geometry (if tlimit above is too big)
G4double tgeom = geombig;
if((geomlimit < geombig) && (geomlimit > geommin))
{
if(stepStatus == fGeomBoundary)
tgeom = geomlimit/facgeom;
else
tgeom = 2.*geomlimit/facgeom;
if(tlimit > tgeom) tlimit = tgeom;
}
}
//if track starts far from boundaries increase tlimit!
@@ -600,7 +613,7 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
G4double tnow = tlimit;
// optimization ...
if(geomlimit < geombig) tnow = max(tlimit,facsafety*geomlimit);
// step reduction near to boundary
if(smallstep < skin)
{
@@ -631,7 +644,7 @@ G4double G4UrbanMscModel::ComputeTruePathLengthLimit(
{
// compute presafety again if presafety <= 0 and no boundary
// i.e. when it is needed for optimization purposes
if((stepStatus != fGeomBoundary) && (presafety <= 0.))
if((stepStatus != fGeomBoundary) && (presafety < tlimitminfix))
presafety = safetyHelper->ComputeSafety(sp->GetPosition());
// is far from boundary
@@ -692,7 +705,8 @@ void G4UrbanMscModel::GeomLimit(const G4Track& track)
if((track.GetVolume() != 0) &&
(track.GetVolume() != safetyHelper->GetWorldVolume()))
{
G4double cstep = tPathLength;
G4double cstep = currentRange;
geomlimit = safetyHelper->CheckNextStep(
track.GetStep()->GetPreStepPoint()->GetPosition(),
track.GetMomentumDirection(),
@@ -734,7 +748,7 @@ G4double G4UrbanMscModel::ComputeGeomPathLength(G4double)
if (tPathLength < currentRange*dtrl) {
if(tau < taulim) zmean = tPathLength*(1.-0.5*tau) ;
else zmean = lambda0*(1.-exp(-tau));
} else if(currentKinEnergy < mass) {
} else if(currentKinEnergy < mass) {
par1 = 1./currentRange ;
par2 = 1./(par1*lambda0) ;
par3 = 1.+par2 ;
@@ -832,31 +846,30 @@ G4double G4UrbanMscModel::ComputeTheta0(G4double trueStepLength,
KineticEnergy*(KineticEnergy+2.*mass)/
((currentKinEnergy+mass)*(KineticEnergy+mass)));
G4double y = trueStepLength/currentRadLength;
G4double theta0 = c_highland*charge*sqrt(y)/betacp;
y = log(y);
theta0 *= sqrt(1.+y*(0.105+0.0035*y));
//correction for small Zeff (based on high energy
// proton scattering data)
// see G.Shen at al. Phys.Rev.D20(1979) p.1584
theta0 *= 1.-0.24/(Zeff*(Zeff+1.));
G4double theta0 = c_highland*std::abs(charge)*sqrt(y)/betacp;
y = log(y);
if(mass < masslimite)
theta0 *= (1.+0.051*y);
else if(mass < masslimitmu)
theta0 *= (1.+0.044*y);
else
theta0 *= (1.+0.038*y);
return theta0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4UrbanMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle* dynParticle,
G4double truestep,
G4double safety)
void G4UrbanMscModel::SampleScattering(const G4DynamicParticle* dynParticle,
G4double safety)
{
G4double kineticEnergy = dynParticle->GetKineticEnergy();
if((kineticEnergy <= 0.0) || (truestep <= tlimitminfix)) return;
if((kineticEnergy <= 0.0) || (tPathLength <= tlimitminfix)) return;
G4double cth = SampleCosineTheta(truestep,kineticEnergy);
G4double cth = SampleCosineTheta(tPathLength,kineticEnergy);
// protection against 'bad' cth values
if(cth > 1.) cth = 1.;
if(cth < -1.) cth = -1.;
G4double sth = sqrt((1.0 - cth)*(1.0 + cth));
G4double phi = twopi*G4UniformRand();
G4double dirx = sth*cos(phi);
@@ -867,13 +880,13 @@ void G4UrbanMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
newDirection.rotateUz(oldDirection);
fParticleChange->ProposeMomentumDirection(newDirection);
if (latDisplasment && safety > 0.0) {
if (latDisplasment && safety > tlimitminfix) {
G4double r = SampleDisplacement();
/*
G4cout << "G4UrbanMscModel::SampleSecondaries: e(MeV)= " << kineticEnergy
<< " sinTheta= " << sth << " r(mm)= " << r
<< " trueStep(mm)= " << truestep
<< " trueStep(mm)= " << tPathLength
<< " geomStep(mm)= " << zPathLength
<< G4endl;
*/
@@ -902,7 +915,6 @@ void G4UrbanMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
if(r > safety) {
// ******* so safety is computed at boundary too ************
G4double newsafety = safetyHelper->ComputeSafety(Position);
//G4double newsafety = safety;
if(r > newsafety)
fac = newsafety/r ;
}
@@ -912,18 +924,17 @@ void G4UrbanMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
// compute new endpoint of the Step
G4ThreeVector newPosition = Position+fac*r*latDirection;
// definetly not on boundary
// definitely not on boundary
if(1. == fac) {
//if(0. < fac) {
safetyHelper->ReLocateWithinVolume(newPosition);
} else {
// check safety after displacement
G4double postsafety = safetyHelper->ComputeSafety(newPosition);
// displacement to boundary
if(postsafety <= 0.) {
// if(postsafety < tlimitminfix) {
if(postsafety <= 0.0) {
safetyHelper->Locate(newPosition, newDirection);
// not on the boundary
@@ -976,19 +987,20 @@ G4double G4UrbanMscModel::SampleCosineTheta(G4double trueStepLength,
sy += st*sin(phi);
sz += ct;
}
cth = sz/sqrt(sx*sx+sy*sy+sz*sz);
cth = sz/sqrt(sx*sx+sy*sy+sz*sz);
}
}
else
{
if(trueStepLength >= currentRange*dtrl)
if(par1*trueStepLength < 1.)
tau = -par2*log(1.-par1*trueStepLength) ;
// for the case if ioni/brems are inactivated
// see the corresponding condition in ComputeGeomPathLength
else if(1.-KineticEnergy/currentKinEnergy > taulim)
tau = taubig ;
if(trueStepLength >= currentRange*dtrl)
{
if(par1*trueStepLength < 1.)
tau = -par2*log(1.-par1*trueStepLength) ;
// for the case if ioni/brems are inactivated
// see the corresponding condition in ComputeGeomPathLength
else if(1.-KineticEnergy/currentKinEnergy > taulim)
tau = taubig ;
}
currentTau = tau ;
lambdaeff = trueStepLength/currentTau;
currentRadLength = couple->GetMaterial()->GetRadlen();
@@ -996,82 +1008,79 @@ G4double G4UrbanMscModel::SampleCosineTheta(G4double trueStepLength,
if (tau >= taubig) cth = -1.+2.*G4UniformRand();
else if (tau >= tausmall)
{
G4double b,bx,b1,ebx,eb1;
G4double prob = 0., qprob = 1. ;
G4double b=2.,bp1=3.,bm1=1.;
G4double prob = 0. ;
G4double a = 1., ea = 0., eaa = 1.;
G4double xmean1 = 1., xmean2 = 0.;
G4double xsi = 3.;
G4double theta0 = ComputeTheta0(trueStepLength,KineticEnergy);
if(theta0 > taulim) a = 0.5/(1.-cos(theta0)) ;
else a = 1.0/(theta0*theta0) ;
// protexction for very small angles
if(theta0 < tausmall) return cth;
G4double sth = sin(0.5*theta0);
a = 0.25/(sth*sth);
ea = exp(-2.*a);
eaa = 1.-ea ;
xmean1 = (1.+ea)/eaa-1./a;
G4double xmeanth = exp(-tau);
G4double c = 3. ;
G4double c1 = c-1.;
G4double x0 = 1.-xsi/a ;
if(x0 < 0.)
b = 1./xmeanth ;
bp1 = b+1.;
bm1 = b-1.;
// protection
if(bm1 > 0.)
xmean2 = b-0.5*bp1*bm1*log(bp1/bm1);
else
{
// 1 model function
b = exp(tau);
bx = b-1.;
b1 = b+1.;
ebx=exp((c1)*log(bx)) ;
eb1=exp((c1)*log(b1)) ;
b = 1.+tau;
bp1 = 2.+tau;
bm1 = tau;
xmean2 = 1.+tau*(1.-log(2./tau));
}
if((xmean1 >= xmeanth) && (xmean2 <= xmeanth))
{
//normal case
prob = (xmeanth-xmean2)/(xmean1-xmean2);
}
else
{
//empirical tail parameter
// based some exp. data
c = 2.40-0.027*exp(2.*log(Zeff)/3.);
if(c == 2.) c = 2.+taulim ;
if(c <= 1.) c = 1.+taulim ;
c1 = c-1.;
ea = exp(-xsi) ;
eaa = 1.-ea ;
xmean1 = 1.-(1.-(1.+xsi)*ea)/(eaa*a) ;
// from the continuity of the 1st derivative at x=x0
b = 1.+(c-xsi)/a ;
b1 = b+1. ;
bx = c/a ;
eb1=exp((c1)*log(b1)) ;
ebx=exp((c1)*log(bx)) ;
xmean2 = (x0*eb1+ebx-(eb1*bx-b1*ebx)/(c-2.))/(eb1-ebx) ;
G4double f1x0 = a*ea/eaa ;
G4double f2x0 = c1*eb1*ebx/(eb1-ebx)/exp(c*log(bx)) ;
// from continuity at x=x0
prob = f2x0/(f1x0+f2x0) ;
// from xmean = xmeanth
qprob = (f1x0+f2x0)*xmeanth/(f2x0*xmean1+f1x0*xmean2) ;
// x1 < xth ( x2 < xth automatically if b = 1/xth)
// correct a (xmean1)
if((xmeanth-xmean1)/xmeanth < 1.e-5)
{
// xmean1 is small probably due to precision problems
xmean1 = 0.50*(1.+xmeanth);
prob = (xmeanth-xmean2)/(xmean1-xmean2);
}
else
{
// correct a in order to have x1=xth
G4int i=0, imax=10;
do
{
a = 1./(1.-xmeanth+2.*ea/eaa);
ea = exp(-2.*a);
eaa = 1.-ea;
xmean1 = (1.+ea)/eaa-1./a;
i += 1;
} while ((std::abs((xmeanth-xmean1)/xmeanth) > 0.05) && (i < imax));
prob = 1.;
}
}
// sampling of costheta
if (G4UniformRand() < qprob)
{
if (G4UniformRand() < prob)
cth = 1.+log(ea+G4UniformRand()*eaa)/a ;
else
cth = b-b1*bx/exp(log(ebx-G4UniformRand()*(ebx-eb1))/c1) ;
}
if (G4UniformRand() < prob)
cth = 1.+log(ea+G4UniformRand()*eaa)/a ;
else
{
cth = -1.+2.*G4UniformRand();
}
cth = b-bp1*bm1/(bm1+2.*G4UniformRand()) ;
}
}
return cth ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4UrbanMscModel::SampleDisplacement()
@@ -1135,3 +1144,12 @@ G4double G4UrbanMscModel::LatCorrelation()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4UrbanMscModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
File diff suppressed because it is too large Load Diff
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4WaterStopping.cc,v 1.2 2006/06/29 19:53:40 gunter Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//---------------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eBremsstrahlung.cc,v 1.48 2007/05/23 08:47:34 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eBremsstrahlungModel.cc,v 1.39 2007/05/23 08:47:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eCoulombScatteringModel.cc,v 1.11 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4eCoulombScatteringModel.cc,v 1.39 2007/11/28 12:36:23 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -42,6 +42,7 @@
// logic of building - only elements from G4ElementTable
// 08.08.06 V.Ivanchenko build internal table in ekin scale, introduce faclim
// 19.08.06 V.Ivanchenko add inline function ScreeningParameter
// 09.10.07 V.Ivanchenko reorganized methods, add cut dependence in scattering off e-
//
// Class Description:
//
@@ -56,6 +57,9 @@
#include "G4ElementTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Proton.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -78,9 +82,19 @@ G4eCoulombScatteringModel::G4eCoulombScatteringModel(
buildTable(build),
isInitialised(false)
{
fNistManager = G4NistManager::Instance();
theElectron = G4Electron::Electron();
thePositron = G4Positron::Positron();
theProton = G4Proton::Proton();
a0 = alpha2*electron_mass_c2*electron_mass_c2/(0.885*0.885);
G4double p0 = electron_mass_c2*classic_electr_radius;
coeff = twopi*p0*p0;
coeff = twopi*p0*p0;
constn = 6.937e-6/(MeV*MeV);
tkin = targetZ = targetA = mom2 = DBL_MIN;
elecXSection = nucXSection = 0.0;
ecut = DBL_MAX;
particle = 0;
for(size_t j=0; j<100; j++) {index[j] = -1;}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -98,121 +112,223 @@ G4eCoulombScatteringModel::~G4eCoulombScatteringModel()
void G4eCoulombScatteringModel::Initialise(const G4ParticleDefinition* p,
const G4DataVector&)
{
if(isInitialised) return;
isInitialised = true;
// G4cout << "!!! G4eCoulombScatteringModel::Initialise for "
// << p->GetParticleName() << " cos(TetMin)= " << cosThetaMin
// << " cos(TetMax)= " << cosThetaMax <<G4endl;
if(!isInitialised) {
isInitialised = true;
if(pParticleChange)
fParticleChange =
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForGamma();
if(pParticleChange)
fParticleChange =
reinterpret_cast<G4ParticleChangeForGamma*>(pParticleChange);
else
fParticleChange = new G4ParticleChangeForGamma();
} else {
return;
}
if(!buildTable || p->GetParticleName() == "GenericIon") return;
if(p->GetParticleType() == "nucleus") buildTable = false;
if(!buildTable) return;
// Compute cross section multiplied by Ptot^2*beta^2
theCrossSectionTable = new G4PhysicsTable();
G4PhysicsLogVector* ptrVector;
G4double e, value;
// Compute log cross section table per atom
if(!theCrossSectionTable) theCrossSectionTable = new G4PhysicsTable();
nbins = 2*G4int(log10(highKEnergy/lowKEnergy));
}
const G4ElementTable* elmt = G4Element::GetElementTable();
size_t nelm = G4Element::GetNumberOfElements();
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
for(size_t j=0; j<nelm; j++) {
G4double G4eCoulombScatteringModel::ComputeCrossSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z, G4double A,
G4double cutEnergy, G4double)
{
if(p == particle && kinEnergy == tkin && Z == targetZ &&
A == targetA && cutEnergy == ecut) return nucXSection;
ptrVector = new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
const G4Element* elm = (*elmt)[j];
G4double Z = elm->GetZ();
index[G4int(Z)] = j;
for(G4int i=0; i<=nbins; i++) {
e = ptrVector->GetLowEdgeEnergy( i ) ;
value = CalculateCrossSectionPerAtom(p, e, Z);
ptrVector->PutValue( i, log(value) );
//G4cout << "### G4eCoulombScatteringModel::ComputeCrossSectionPerAtom for "
// << p->GetParticleName() << " Z= " << Z << " A= " << A
// << " e= " << kinEnergy << G4endl;
nucXSection = ComputeElectronXSectionPerAtom(p,kinEnergy,Z,A,cutEnergy);
// nuclear cross section
if(theCrossSectionTable) {
G4bool b;
G4int iz = G4int(Z);
G4int idx = index[iz];
// compute table for given Z
if(-1 == idx) {
idx = theCrossSectionTable->size();
index[iz] = idx;
G4PhysicsLogVector* ptrVector
= new G4PhysicsLogVector(lowKEnergy, highKEnergy, nbins);
// G4cout << "New vector Z= " << iz << " A= " << A << " idx= " << idx << G4endl;
G4double e, value;
for(G4int i=0; i<=nbins; i++) {
e = ptrVector->GetLowEdgeEnergy( i ) ;
value = CalculateCrossSectionPerAtom(p, e, Z, A);
ptrVector->PutValue( i, log(value) );
}
theCrossSectionTable->push_back(ptrVector);
}
theCrossSectionTable->insert(ptrVector);
// take value from the table
nucXSection +=
std::exp((((*theCrossSectionTable)[idx]))->GetValue(kinEnergy, b));
// compute value from scratch
} else nucXSection += CalculateCrossSectionPerAtom(p, kinEnergy, Z, A);
// G4cout << " cross(bn)= " << nucXSection/barn << G4endl;
if(nucXSection < 0.0) nucXSection = 0.0;
return nucXSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4eCoulombScatteringModel::ComputeElectronXSectionPerAtom(
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z,
G4double A,
G4double cutEnergy)
{
if(p == particle && kinEnergy == tkin && Z == targetZ &&
cutEnergy == ecut) return elecXSection;
ecut = cutEnergy;
elecXSection = 0.0;
SetupParticle(p);
G4double ekin = std::max(keV, kinEnergy);
//G4double ekin = kinEnergy;
SetupTarget(Z, A, ekin);
G4double tmax = tkin;
if(p == theElectron) tmax *= 0.5;
else if(p != thePositron) {
G4double ratio = electron_mass_c2/mass;
G4double tau = tkin/mass;
tmax = 2.0*electron_mass_c2*tau*(tau + 2.)/
(1.0 + 2.0*ratio*(tau + 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 < cosThetaMin) {
G4double x1 = 1.0 - cosThetaMin + screenZ;
G4double x2 = 1.0 - cosTetMaxElec + screenZ;
elecXSection = coeff*Z*chargeSquare*invbeta2*
(cosThetaMin - cosTetMaxElec)/(x1*x2*mom2);
}
// G4cout << "cut= " << ecut << " e= " << tkin
// << " croosE(barn)= " << elecXSection/barn
// << " cosEl= " << cosTetMaxElec << " costmin= " << cosThetaMin << G4endl;
return elecXSection;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4eCoulombScatteringModel::CalculateCrossSectionPerAtom(
const G4ParticleDefinition* p,
const G4ParticleDefinition* p,
G4double kinEnergy,
G4double Z)
G4double Z, G4double A)
{
G4double cross = 0.0;
G4double m = p->GetPDGMass();
G4double tkin = std::max(keV, kinEnergy);
G4double mom2 = tkin*(tkin + 2.0*m);
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
if(costm < cosThetaMin) {
G4double q = p->GetPDGCharge()/eplus;
G4double q2 = q*q;
G4double invbeta2 = 1.0 + m*m/mom2;
G4double A = ScreeningParameter(Z, q2, mom2, invbeta2);
G4double a = 2.0*A + 1.0;
cross = coeff*Z*(Z + 1.0)*q2*invbeta2*(cosThetaMin - costm)/
((a - cosThetaMin)*(a - costm)*mom2);
/*
if(Z == 13 || Z == 79) {
G4cout << "## e= " << kinEnergy << " beta= " << sqrt (1.0/invbeta2)
<<" Z= " << Z
<< " sig(bn)= " << cross/barn
<< " cosMax= " << costm
<< " cosMin= " << cosThetaMin
<< G4endl;
G4double atommass = 27.0;
if(Z == 79) atommass = 197.0;
G4double u0 = 1.e+6*atommass*cm2/(cross*Avogadro);
G4double u1 = 0.5*u0/( A* ( (1.0 + A)*log(1.0 + 1.0/A) -1.0 ) );
G4cout << " l0= " << u0 << " l1= " << u1
<< " A= " << A << G4endl;
}
*/
SetupParticle(p);
G4double ekin = std::max(keV, kinEnergy);
//G4double ekin = kinEnergy;
SetupTarget(Z, A, ekin);
if(cosTetMaxNuc < cosThetaMin) {
G4double x1 = 1.0 - cosThetaMin;
G4double x2 = 1.0 - cosTetMaxNuc;
G4double x3 = cosThetaMin - cosTetMaxNuc;
G4double z1 = x1 + screenZ;
G4double z2 = x2 + screenZ;
G4double d = 1.0/formfactA - screenZ;
G4double d1 = 1.0 - formfactA*screenZ;
G4double zn1= x1 + d;
G4double zn2= x2 + d;
cross = coeff*Z*Z*chargeSquare*invbeta2
*(x3/(z1*z2) + x3/(zn1*zn2) +
2.0*std::log(z1*zn2/(z2*zn1))/d) / (mom2*d1*d1);
}
// G4cout << "CalculateCrossSectionPerAtom: e(MeV)= " << tkin
// << " cross(b)= " << cross/barn << " ctmin= " << cosThetaMin
// << " ctmax= " << cosTetMaxNuc << G4endl;
return cross;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4eCoulombScatteringModel::SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double,
G4double)
void G4eCoulombScatteringModel::SampleSecondaries(
std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double cutEnergy,
G4double maxEnergy)
{
const G4Material* aMaterial = couple->GetMaterial();
const G4ParticleDefinition* p = dp->GetDefinition();
G4double mass = dp->GetMass();
G4double kinEnergy = dp->GetKineticEnergy();
G4double mom2 = kinEnergy*(kinEnergy + 2.0*mass);
const G4Element* elm = SelectRandomAtom(aMaterial, p, kinEnergy);
// Select atom and setup
SetupParticle(p);
const G4Element* elm =
SelectRandomAtom(aMaterial,p,kinEnergy,cutEnergy,maxEnergy);
G4double Z = elm->GetZ();
G4double q = p->GetPDGCharge()/eplus;
G4double q2 = q*q;
G4double A = elm->GetN();
G4double invbeta2 = 1.0 + mass*mass/mom2;
G4double a = 2.*ScreeningParameter(Z, q2, mom2, invbeta2);
G4double cross =
ComputeCrossSectionPerAtom(p,kinEnergy,Z,A,cutEnergy,maxEnergy);
G4double costm = std::max(cosThetaMax, 1.0 - 0.5*q2Limit/mom2);
G4double costm = cosTetMaxNuc;
G4double formf = formfactA;
if(G4UniformRand()*cross < elecXSection) {
costm = cosTetMaxElec;
formf = 0.0;
}
/*
G4cout << "G4eCoul...SampleSecondaries: e(MeV)= " << tkin
<< " ctmin= " << cosThetaMin
<< " ctmaxN= " << cosTetMaxNuc
<< " ctmax= " << costm
<< " Z= " << Z << " A= " << A
<< " cross= " << cross/barn << " crossE= " << elecXSection/barn
<< G4endl;
*/
if(costm >= cosThetaMin) return;
G4double x = G4UniformRand();
G4double y = (a + 1.0 - cosThetaMin)/(cosThetaMin - costm);
G4double st2 = 0.5*(y*(1.0 - costm) - a*x)/(y + x);
if(st2 < 0.0 || st2 > 1.0) {
G4cout << "G4eCoulombScatteringModel::SampleSecondaries WARNING st2= "
<< st2 << G4endl;
st2 = 0.0;
}
G4double tet = 2.0*asin(sqrt(st2));
G4double cost= cos(tet);
G4double sint= sin(tet);
G4double x1 = 1. - cosThetaMin + screenZ;
G4double x2 = 1. - costm;
G4double x3 = cosThetaMin - costm;
G4double grej, z, z1;
do {
z = G4UniformRand()*x3;
z1 = (x1*x2 - screenZ*z)/(x1 + z);
if(z1 < 0.0) z1 = 0.0;
else if(z1 > 2.0) z1 = 2.0;
grej = 1.0/(1.0 + formf*z1);
} while ( G4UniformRand() > grej*grej );
G4double cost = 1.0 - z1;
G4double sint= sqrt(z1*(2.0 - z1));
/*
if(sint > 0.1)
G4cout<<"## SampleSecondaries: e(MeV)= " << kinEnergy
<< " sint= " << sint << " Z= " << Z << " screenZ= " << screenZ
<< " cn= " << formf
<< G4endl;
*/
G4double phi = twopi * G4UniformRand();
G4ThreeVector direction = dp->GetMomentumDirection();
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eIonisation.cc,v 1.53 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4eeToTwoGammaModel.cc,v 1.14 2007/05/23 08:47:35 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eplusAnnihilation.cc,v 1.26 2006/09/14 10:27:19 maire Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4eplusAnnihilation.cc,v 1.27 2007/10/02 10:17:12 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -66,7 +66,9 @@ using namespace std;
G4eplusAnnihilation::G4eplusAnnihilation(const G4String& name)
: G4VEmProcess(name), isInitialised(false)
{}
{
enableAtRestDoIt = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4hIonisation.cc,v 1.69 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hMultipleScattering.cc,v 1.6 2007/06/11 15:01:26 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4hMultipleScattering.cc,v 1.7 2007/12/07 17:35:52 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -----------------------------------------------------------------------------
//
@@ -47,6 +47,7 @@
#include "G4hMultipleScattering.hh"
#include "G4UrbanMscModel.hh"
#include "G4UrbanMscModel90.hh"
#include "G4MscStepLimitType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -99,7 +100,7 @@ void G4hMultipleScattering::InitialiseProcess(const G4ParticleDefinition* p)
// initialisation of parameters
G4String part_name = p->GetParticleName();
mscUrban = new G4UrbanMscModel(RangeFactor(),dtrl,lambdalimit,
mscUrban = new G4UrbanMscModel90(RangeFactor(),dtrl,lambdalimit,
GeomFactor(),Skin(),
samplez,StepLimitType());
mscUrban->SetLateralDisplasmentFlag(LateralDisplasmentFlag());
@@ -0,0 +1,166 @@
//
// ********************************************************************
// * 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: G4ionGasIonisation.cc,v 1.3 2007/11/09 11:45:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
// GEANT4 Class file
//
//
// File name: G4ionGasIonisation
//
// Author: Vladimir Ivanchenko
//
// Creation date: 23.07.2007
//
// Modifications:
//
//
// -------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ionGasIonisation.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4GenericIon.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
G4ionGasIonisation::G4ionGasIonisation(const G4String& name)
: G4ionIonisation(name),
currParticle(0),
baseParticle(0),
initialised(false)
{
atomXS = CLHEP::pi*CLHEP::Bohr_radius*CLHEP::Bohr_radius;
verboseLevel = 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ionGasIonisation::~G4ionGasIonisation()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ionGasIonisation::InitialiseEnergyLossProcess(
const G4ParticleDefinition* part,
const G4ParticleDefinition* bpart)
{
G4ionIonisation::InitialiseEnergyLossProcess(part, bpart);
if(initialised) return;
currParticle = part;
if(part == bpart || part == G4GenericIon::GenericIon()) baseParticle = 0;
else if(bpart == 0) baseParticle = G4GenericIon::GenericIon();
else baseParticle = bpart;
if(baseParticle) basePartMass = baseParticle->GetPDGMass();
else basePartMass = currParticle->GetPDGMass();
initialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ionGasIonisation::PrintInfo()
{
G4ionIonisation::PrintInfo();
G4cout << " Version of ion process with simulation discrete ion/media change exchange."
<< G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ionGasIonisation::InitialiseMassCharge(const G4Track& track)
{
// First step of an ion
if(track.GetCurrentStepNumber() == 1) {
currParticle = track.GetDefinition();
ionZ = G4int(currParticle->GetPDGCharge()/eplus + 0.5);
currentIonZ = G4int(track.GetDynamicParticle()->GetCharge()/eplus + 0.5);
currMassRatio = basePartMass/currParticle->GetPDGMass();
}
// any step
G4double q = eplus*currentIonZ;
SetDynamicMassCharge(currMassRatio, q*q);
preStepKinEnergy = track.GetKineticEnergy();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ionGasIonisation::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double& s)
{
// add corrections
if(eloss < preStepKinEnergy) {
const G4ParticleDefinition* part = dp->GetDefinition();
const G4Material* mat = couple->GetMaterial();
// use Bethe-Bloch with corrections
if(preStepKinEnergy*currMassRatio > BetheBlochEnergyThreshold())
eloss += s*corr->HighOrderCorrections(part,mat,preStepKinEnergy);
// use nuclear stopping
else if(NuclearStoppingFlag()) {
G4double nloss = s*corr->NuclearDEDX(part,mat,preStepKinEnergy - eloss*0.5);
eloss += nloss;
fParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
}
// effective number of collisions
G4double x = mat->GetElectronDensity()*s*atomXS;
// equilibrium charge
G4double q = fParticleChange.GetProposedCharge();
// sample charge change during the step
fParticleChange.SetProposedCharge(SampleChargeAfterStep(q, x));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4ionGasIonisation::SampleChargeAfterStep(G4double qeff, G4double xeff)
{
// qeff - equilibrium charge
// xeff - effective number of collisions
// q - current charge
G4double q = eplus*currentIonZ;
if(verboseLevel > 1) G4cout << "G4ionGasIonisation: Q1= " << currentIonZ
<< " Qeff= " << qeff/eplus << " Neff= " << xeff
<< G4endl;
return q;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionIonisation.cc,v 1.43 2007/05/22 17:34:36 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-00 $
// $Id: G4ionIonisation.cc,v 1.44 2007/11/09 11:45:45 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
// -------------------------------------------------------------------
//
@@ -53,6 +53,7 @@
// 13-05-06 Add data for light ion stopping in water (V.Ivantchenko)
// 14-01-07 use SetEmModel() and SetFluctModel() from G4VEnergyLossProcess (mma)
// 16-05-07 Add data for light ion stopping only for GenericIon (V.Ivantchenko)
// 07-11-07 Fill non-ionizing energy loss (V.Ivantchenko)
//
//
// -------------------------------------------------------------------
@@ -169,3 +170,30 @@ void G4ionIonisation::AddStoppingData(G4int Z, G4int A,
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4ionIonisation::CorrectionsAlongStep(const G4MaterialCutsCouple* couple,
const G4DynamicParticle* dp,
G4double& eloss,
G4double& s)
{
if(eloss < preKinEnergy) {
const G4ParticleDefinition* part = dp->GetDefinition();
const G4Material* mat = couple->GetMaterial();
if(preKinEnergy*massRatio > eth)
eloss += s*corr->HighOrderCorrections(part,mat,preKinEnergy);
else {
if(stopDataActive)
eloss *= corr->EffectiveChargeCorrection(part,mat,preKinEnergy);
if(nuclearStopping) {
G4double nloss = s*corr->NuclearDEDX(part,mat,preKinEnergy - eloss*0.5);
eloss += nloss;
fParticleChange.ProposeNonIonizingEnergyDeposit(nloss);
}
}
fParticleChange.SetProposedCharge(effCharge->EffectiveCharge(part,
mat,preKinEnergy-eloss));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....