Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BetheHeitlerModel.hh 100399 2016-10-20 07:38:12Z gcosmo $
// $Id: G4BetheHeitlerModel.hh 104477 2017-06-01 07:39:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -109,33 +109,20 @@ private:
inline G4double G4BetheHeitlerModel::ScreenFunction1(G4double ScreenVariable)
// compute the value of the screening function 3*PHI1 - PHI2
{
G4double screenVal;
if (ScreenVariable > 1.)
screenVal = 42.24 - 8.368*G4Log(ScreenVariable+0.952);
else
screenVal = 42.392 - ScreenVariable*(7.796 - 1.961*ScreenVariable);
return screenVal;
return (ScreenVariable > 1.)
? 42.24 - 8.368*G4Log(ScreenVariable+0.952)
: 42.392 - ScreenVariable*(7.796 - 1.961*ScreenVariable);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4BetheHeitlerModel::ScreenFunction2(G4double ScreenVariable)
// compute the value of the screening function 1.5*PHI1 - 0.5*PHI2
{
G4double screenVal;
if (ScreenVariable > 1.)
screenVal = 42.24 - 8.368*G4Log(ScreenVariable+0.952);
else
screenVal = 41.405 - ScreenVariable*(5.828 - 0.8945*ScreenVariable);
return screenVal;
return (ScreenVariable > 1.)
? 42.24 - 8.368*G4Log(ScreenVariable+0.952)
: 41.405 - ScreenVariable*(5.828 - 0.8945*ScreenVariable);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -4,7 +4,7 @@
// * *
// * 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 *
// * conditions of the Geant4 Software Liscense, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GoudsmitSaundersonTable.hh 93663 2015-10-28 09:50:49Z gcosmo $
// $Id: G4GoudsmitSaundersonTable.hh 103884 2017-05-03 08:04:50Z gcosmo $
//
// -----------------------------------------------------------------------------
//
@@ -55,6 +55,10 @@
// The new version is several times faster, more robust and accurate
// compared to the earlier version (G4GoudsmitSaundersonMscModel class
// that use these data has been also completely replaced)
// 28.04.2017 M. Novak: the GS angular distributions has been recomputed, the
// data size has been reduced from 16 MB down to 5 MB by using a new
// representation, the class has been modified significantly due to
// this new data representation.
//
// References:
// [1] A.F.Bielajew, NIMB, 111 (1996) 195-208
@@ -62,6 +66,7 @@
//
// -----------------------------------------------------------------------------
#ifndef G4GoudsmitSaundersonTable_h
#define G4GoudsmitSaundersonTable_h 1
@@ -69,35 +74,36 @@
#include "G4Types.hh"
class G4GoudsmitSaundersonTable
{
class G4GoudsmitSaundersonTable {
public:
G4GoudsmitSaundersonTable();
~G4GoudsmitSaundersonTable();
G4GoudsmitSaundersonTable(){};
~G4GoudsmitSaundersonTable();
// initialie:
// - loads the precomputed MSC angular CDFs into memory
// - init. material dependent MSC parameters (Moliere's screening)
// (- only Master thread and only once)
void Initialise();
// samples cos(theta) i.e. angular deflection from the precomputed angular
// distributions in the real multiple scattering case
G4double SampleCosTheta(G4double, G4double, G4double, G4double, G4double, G4double);
G4double SampleCosThetaII(G4double, G4double, G4double, G4double, G4double, G4double);
// structure to store one GS transformed angular distribution (for a given s/lambda_el,s/lambda_elG1)
struct GSMSCAngularDtr {
G4int fNumData; // # of data points
G4double fQScale;
G4double *fUValues; // array of transformed variables
G4double *fParamA; // array of interpolation parameters a
G4double *fParamB; // array of interpolation parameters b
};
// returns with the screening parameter value that results with the first
// transport coefficient (G1) received as input parameter according to the
// screened Rutherford DCS. Used only when fgIsUsePWATotalXsecData is TRUE
// in G4GoudsmitSaundersonMscModel i.e. when PWA screeing is used instead of
// Moliere's one.
G4double GetScreeningParam(G4double);
void LoadMSCData();
GSMSCAngularDtr* GetOne(G4int indx) {return fGSMSCAngularDistributions1[indx];}
// samples angular deflection cos(theta) and sin(theta) for electrons/positrons
// involving sampling of no scattering, single scattering, "few" scattering and
// real multiple scattering
void Sampling(G4double, G4double, G4double, G4double&, G4double&);
void Sampling(G4double lambdaval, G4double qval, G4double scra,
G4double &cost, G4double &sint);
G4double SampleCosTheta(G4double lambdaval, G4double qval, G4double scra,
G4double rndm1, G4double rndm2, G4double rndm);
G4double SampleCosTheta1(G4double lambdaval, G4double qval, G4double scra,
G4double rndm1, G4double rndm2, G4double rndm);
G4double SampleCosTheta2(G4double lambdaval, G4double qval, G4double scra,
G4double rndm1, G4double rndm2, G4double rndm);
G4double GetScreeningParam(G4double G1);
// material dependent MSC parameters (computed at initialisation) regarding
// Moliere's screening parameter
@@ -105,63 +111,51 @@ public:
G4double GetMoliereXc2(G4int matindx){return (*fgMoliereXc2)[matindx];}
private:
// hide assignment operator and cpy ctr.
G4GoudsmitSaundersonTable & operator=(const G4GoudsmitSaundersonTable &right);
G4GoudsmitSaundersonTable(const G4GoudsmitSaundersonTable&);
// load precomputed CDFs of MSC angular distributions over a 2D parameter grid
// CDFs are stored in a variable transformed, equally probable intervall form
// together with the corresponding rational interpolation paraneters
void LoadMSCData();
void LoadMSCDataII();
// initialisation of material dependent Moliere's MSC parameters
void InitMoliereMSCParams();
private:
//@{
/** size of grids of some parameters */
static const G4int fgNumLambdas = 76; /** number of \f$ s/\lambda_{e} $\f-values */
static const G4int fgNumLamG1 = 21; /** number of \f$ s/\lambda_{e}G_{1} $\f-values */
static const G4int fgNumLamG1II = 22; /** number of \f$ s/\lambda_{e}G_{1} $\f-values */
static const G4int fgNumUvalues = 101; /** number of u-vaues */
static const G4int fgNumScreeningParams = 160; /** number of A-vaues */
//@}
//@{
/** girds of fixed parameter values */
/** the grid \f$ s/\lambda_{e} $\f-values; size = fgNumLambdas = 76 */
static const G4double fgLambdaValues[];
/** the grid of \f$ s/\lambda_{e}G_{1} $\f-values; size = fgNumLamG1 = 11 */
static const G4double fgLamG1Values[];
static const G4double fgLamG1ValuesII[];
private:
static bool gIsInitialised; // are the precomputed angular distributions already loaded in?
static constexpr G4int gLAMBNUM = 64; // # L=s/lambda_el in [fLAMBMIN,fLAMBMAX]
static constexpr G4int gQNUM1 = 15; // # Q=s/lambda_el G1 in [fQMIN1,fQMAX1] in the 1-st Q grid
static constexpr G4int gQNUM2 = 32; // # Q=s/lambda_el G1 in [fQMIN2,fQMAX2] in the 2-st Q grid
static constexpr G4int gNUMSCR1 = 201; // # of screening parameters in the A(G1) function
static constexpr G4int gNUMSCR2 = 51; // # of screening parameters in the A(G1) function
static constexpr G4double gLAMBMIN = 1.0; // minimum s/lambda_el
static constexpr G4double gLAMBMAX = 100000.0; // maximum s/lambda_el
static constexpr G4double gQMIN1 = 0.001; // minimum s/lambda_el G1 in the 1-st Q grid
static constexpr G4double gQMAX1 = 0.99; // maximum s/lambda_el G1 in the 1-st Q grid
static constexpr G4double gQMIN2 = 0.99; // minimum s/lambda_el G1 in the 1-st Q grid
static constexpr G4double gQMAX2 = 7.99; // maximum s/lambda_el G1 in the 1-st Q grid
// precomputed A(G1) function with its interpolation parameters
static constexpr G4double gSCRMIN1 = 1.93214991408357e-12;
static constexpr G4double gSCRMAX1 = 2.42974344203683e-01;
static constexpr G4double gSCRMAX2 = 5.50564555556202e+01;
//
static const G4double gG1Values1[];
static const G4double gScrAValues1[];
static const G4double gScrBValues1[];
static const G4double gG1Values2[];
static const G4double gScrAValues2[];
static const G4double gScrBValues2[];
/** the grid of u-values; size = fgNumUvalues = 101 */
static const G4double fgUValues[];
//@}
// precomputed G1(A) function as a table -> run time interpolation to determine
// the screening parameter value A that gives back the given first transport
// coefficient G1
static const G4double fgG1Values[];
static const G4double fgScreeningParam[];
static const G4double fgSrcAValues[];
static const G4double fgSrcBValues[];
//@{
/** Precomputed equaly probable inverse CDF-s over the 3D parameter grid plus
* precomputed parameters necessary for proper rational interpolation of the
* inverse CDF.
*/
static G4double fgInverseQ2CDFs[fgNumLambdas*fgNumLamG1*fgNumUvalues];
static G4double fgInterParamsA2[fgNumLambdas*fgNumLamG1*fgNumUvalues];
static G4double fgInterParamsB2[fgNumLambdas*fgNumLamG1*fgNumUvalues];
static G4double fgInverseQ2CDFsII[fgNumLambdas*fgNumLamG1II*fgNumUvalues];
static G4double fgInterParamsA2II[fgNumLambdas*fgNumLamG1II*fgNumUvalues];
static G4double fgInterParamsB2II[fgNumLambdas*fgNumLamG1II*fgNumUvalues];
//@}
G4double fLogLambda0; // ln(gLAMBMIN)
G4double fLogDeltaLambda; // ln(gLAMBMAX/gLAMBMIN)/(gLAMBNUM-1)
G4double fInvLogDeltaLambda; // 1/[ln(gLAMBMAX/gLAMBMIN)/(gLAMBNUM-1)]
G4double fInvDeltaQ1; // 1/[(gQMAX1-gQMIN1)/(gQNUM1-1)]
G4double fDeltaQ2; // [(gQMAX2-gQMIN2)/(gQNUM2-1)]
G4double fInvDeltaQ2; // 1/[(gQMAX2-gQMIN2)/(gQNUM2-1)]
// for the precumputed A(G1) function
G4double fLogG1FuncMin1;
G4double fInvLogDeltaG1Func1;
G4double fLogG1FuncMin2;
G4double fInvLogDeltaG1Func2;
// vector to store all GS transformed angular distributions
std::vector<GSMSCAngularDtr*> fGSMSCAngularDistributions1;
std::vector<GSMSCAngularDtr*> fGSMSCAngularDistributions2;
//@{
/** Precomputed \f$ b_lambda_{c} $\f and \f$ \chi_c^{2} $\f material dependent
@@ -172,11 +166,8 @@ private:
*/
static std::vector<G4double> *fgMoliereBc;
static std::vector<G4double> *fgMoliereXc2;
//@}
// flag to check if data are alredy in memory
static G4bool fgIsInitialised;
};
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ICRU49NuclearStoppingModel.hh 100399 2016-10-20 07:38:12Z gcosmo $
// $Id: G4ICRU49NuclearStoppingModel.hh 103955 2017-05-04 11:29:54Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -53,6 +53,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4VEmModel.hh"
#include "G4Threading.hh"
class G4ParticleChangeForLoss;
class G4Pow;
@@ -83,10 +84,10 @@ public:
const G4DynamicParticle*,
G4double, G4double) final;
inline void SetFluctuationFlag(G4bool);
private:
void InitialiseArray();
G4double NuclearStoppingPower(G4double kineticEnergy,
G4double Z1, G4double Z2,
G4double A1, G4double A2);
@@ -97,18 +98,14 @@ private:
G4ICRU49NuclearStoppingModel(const G4ICRU49NuclearStoppingModel&) = delete;
G4Pow* g4calc;
G4double theZieglerFactor;
static G4double Z23[100];
// flags
G4bool lossFlucFlag;
#ifdef G4MULTITHREADED
static G4Mutex ICRU49NuclearMutex;
#endif
};
inline void G4ICRU49NuclearStoppingModel::SetFluctuationFlag(G4bool val)
{
lossFlucFlag = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NuclearStopping.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4NuclearStopping.hh 103955 2017-05-04 11:29:54Z gcosmo $
//
// -----------------------------------------------------------------------------
//
@@ -61,8 +61,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4ICRU49NuclearStoppingModel;
class G4NuclearStopping : public G4VEmProcess
{
@@ -101,9 +99,6 @@ private:
G4NuclearStopping & operator=(const G4NuclearStopping &right) = delete;
G4ParticleChangeForLoss nParticleChange;
G4ICRU49NuclearStoppingModel* modelICRU49;
G4bool isInitialized;
};
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PairProductionRelModel.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4PairProductionRelModel.hh 104477 2017-06-01 07:39:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -55,6 +55,8 @@
#include "G4VEmModel.hh"
#include "G4PhysicsTable.hh"
#include "G4NistManager.hh"
#include "G4Log.hh"
#include "G4Exp.hh"
class G4ParticleChangeForGamma;
@@ -63,7 +65,7 @@ class G4PairProductionRelModel : public G4VEmModel
public:
explicit G4PairProductionRelModel(const G4ParticleDefinition* p = 0,
explicit G4PairProductionRelModel(const G4ParticleDefinition* p = nullptr,
const G4String& nam = "BetheHeitlerLPM");
virtual ~G4PairProductionRelModel();
@@ -152,11 +154,10 @@ protected:
static const G4double facFel;
static const G4double facFinel;
static const G4double preS1, logTwo, xsfactor, Egsmall;
static const G4double preS1, logTwo, xsfactor, Egsmall, Eghigh;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
@@ -217,77 +218,50 @@ inline void G4PairProductionRelModel::SetCurrentElement(G4double Z)
inline G4double G4PairProductionRelModel::Phi1(G4double delta) const
{
G4double screenVal;
if (delta > 1.)
screenVal = 21.12 - 4.184*std::log(delta+0.952);
else
screenVal = 20.868 - delta*(3.242 - 0.625*delta);
return screenVal;
return (delta > 1.)
? 21.12 - 4.184*G4Log(delta+0.952)
: 20.868 - delta*(3.242 - 0.625*delta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4PairProductionRelModel::Phi2(G4double delta) const
{
G4double screenVal;
if (delta > 1.)
screenVal = 21.12 - 4.184*std::log(delta+0.952);
else
screenVal = 20.209 - delta*(1.930 + 0.086*delta);
return screenVal;
return (delta > 1.)
? 21.12 - 4.184*G4Log(delta+0.952)
: 20.209 - delta*(1.930 + 0.086*delta);
}
inline G4double G4PairProductionRelModel::ScreenFunction1(G4double ScreenVariable)
// compute the value of the screening function 3*PHI1 - PHI2
{
G4double screenVal;
if (ScreenVariable > 1.)
screenVal = 42.24 - 8.368*std::log(ScreenVariable+0.952);
else
screenVal = 42.392 - ScreenVariable*(7.796 - 1.961*ScreenVariable);
return screenVal;
return (ScreenVariable > 1.)
? 42.24 - 8.368*G4Log(ScreenVariable+0.952)
: 42.392 - ScreenVariable*(7.796 - 1.961*ScreenVariable);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4PairProductionRelModel::ScreenFunction2(G4double ScreenVariable)
// compute the value of the screening function 1.5*PHI1 + 0.5*PHI2
{
G4double screenVal;
if (ScreenVariable > 1.)
screenVal = 42.24 - 8.368*std::log(ScreenVariable+0.952);
else
screenVal = 41.405 - ScreenVariable*(5.828 - 0.8945*ScreenVariable);
return screenVal;
return (ScreenVariable > 1.)
? 42.24 - 8.368*G4Log(ScreenVariable+0.952)
: 41.405 - ScreenVariable*(5.828 - 0.8945*ScreenVariable);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4PairProductionRelModel::DeltaMax() const
{
// k > 50 MeV
G4double FZ = 8.*(lnZ/3. + fCoulomb);
return std::exp( (42.24-FZ)/8.368 ) + 0.952;
return G4Exp( (42.24-FZ)/8.368 ) + 0.952;
}
inline G4double G4PairProductionRelModel::DeltaMin(G4double k) const
{
return 4.*136./z13*(CLHEP::electron_mass_c2/k);
return 544.*CLHEP::electron_mass_c2/(z13*k);
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UniversalFluctuation.hh 101807 2016-11-30 13:42:28Z gunter $
// $Id: G4UniversalFluctuation.hh 104353 2017-05-26 07:24:51Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -0,0 +1,174 @@
//
// ********************************************************************
// * 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: G4UniversalFluctuation2017.hh 104218 2017-05-18 14:23:13Z urban $
//
// -------------------------------------------------------------------
//
// GEANT4 Class header file
//
//
// File name: G4UniversalFluctuation2017
//
// Author: V.Ivanchenko clone a class with the Laszlo Urban model
//
// Creation date: 24.05.2017
//
// Modifications:
//
//
// Class Description:
//
// Implementation of energy loss fluctuations
// -------------------------------------------------------------------
//
#ifndef G4UniversalFluctuation2017_h
#define G4UniversalFluctuation2017_h 1
#include "G4VEmFluctuationModel.hh"
#include "G4ParticleDefinition.hh"
#include "G4Poisson.hh"
#include <CLHEP/Random/RandomEngine.h>
class G4UniversalFluctuation2017 : public G4VEmFluctuationModel
{
public:
explicit G4UniversalFluctuation2017(const G4String& nam = "UniFluc");
virtual ~G4UniversalFluctuation2017();
virtual G4double SampleFluctuations(const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double,
G4double,
G4double) override;
virtual G4double Dispersion(const G4Material*,
const G4DynamicParticle*,
G4double,
G4double) override;
virtual void InitialiseMe(const G4ParticleDefinition*) final;
// Initialisation prestep
virtual void SetParticleAndCharge(const G4ParticleDefinition*,
G4double q2) final;
private:
inline void AddExcitation(CLHEP::HepRandomEngine* rndm,
G4double a, G4double e, G4double& eav,
G4double& eloss, G4double& esig2);
inline void SampleGauss(CLHEP::HepRandomEngine* rndm,
G4double eav, G4double esig2,
G4double& eloss);
// hide assignment operator
G4UniversalFluctuation2017 & operator=(const G4UniversalFluctuation2017 &right) = delete;
G4UniversalFluctuation2017(const G4UniversalFluctuation2017&) = delete;
const G4ParticleDefinition* particle;
const G4Material* lastMaterial;
G4double particleMass;
// Derived quantities
G4double m_Inv_particleMass;
G4double m_massrate;
G4double chargeSquare;
// data members to speed up the fluctuation calculation
G4double ipotFluct;
G4double electronDensity;
G4double f1Fluct;
G4double f2Fluct;
G4double e1Fluct;
G4double e2Fluct;
G4double e1LogFluct;
G4double e2LogFluct;
G4double ipotLogFluct;
G4double e0;
G4double esmall;
G4double e1,e2;
G4double minNumberInteractionsBohr;
G4double minLoss;
G4double nmaxCont;
G4double rate,fw,fw2,fw3;
G4int sizearray;
G4double* rndmarray;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void
G4UniversalFluctuation2017::AddExcitation(CLHEP::HepRandomEngine* rndm,
G4double ax, G4double ex, G4double& eav,
G4double& eloss, G4double& esig2)
{
if(ax > nmaxCont) {
eav += ax*ex;
esig2 += ax*ex*ex;
} else {
G4double p = (G4double)(G4Poisson(ax));
eloss += p*ex;
if(p > 0.) { eloss += (1.-2.*rndm->flat())*ex; }
}
}
inline void
G4UniversalFluctuation2017::SampleGauss(CLHEP::HepRandomEngine* rndm,
G4double eav, G4double esig2,
G4double& eloss)
{
G4double x = eav;
if(esig2 > 0.0) {
G4double sig = std::sqrt(esig2);
G4double deltae = std::min(4.*sig, eav);
if(deltae < 0.25*sig) {
x += (2.*rndm->flat() - 1.)*deltae;
} else {
do {
x = G4RandGauss::shoot(rndm, eav, sig);
} while (x < eav-deltae || x > eav+deltae);
// Loop checking, 23-Feb-2016, Vladimir Ivanchenko
}
}
eloss += x;
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4WentzelOKandVIxSection.hh 98737 2016-08-09 12:51:38Z gcosmo $
// $Id: G4WentzelOKandVIxSection.hh 104307 2017-05-24 09:01:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -64,6 +64,7 @@
#include "G4NuclearFormfactorType.hh"
#include "G4ThreeVector.hh"
#include "G4Pow.hh"
#include "G4Threading.hh"
class G4ParticleDefinition;
@@ -74,23 +75,24 @@ class G4WentzelOKandVIxSection
public:
explicit G4WentzelOKandVIxSection(G4bool combined = true);
explicit G4WentzelOKandVIxSection(G4bool comb=true);
virtual ~G4WentzelOKandVIxSection();
void Initialise(const G4ParticleDefinition*, G4double CosThetaLim);
void SetupParticle(const G4ParticleDefinition*) ;
void SetupParticle(const G4ParticleDefinition*);
// return cos(ThetaMax) for msc and cos(thetaMin) for single scattering
// cut = DBL_MAX means no scattering off electrons
G4double SetupTarget(G4int Z, G4double cut = DBL_MAX);
G4double SetupKinematic(G4double kinEnergy, const G4Material* mat);
G4double SetupTarget(G4int Z, G4double cut);
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax);
G4ThreeVector& SampleSingleScattering(G4double CosThetaMin,
G4double CosThetaMax,
G4double elecRatio = 0.0);
G4double elecRatio);
G4double ComputeSecondTransportMoment(G4double CosThetaMax);
@@ -99,9 +101,7 @@ public:
inline G4double ComputeElectronCrossSection(G4double CosThetaMin,
G4double CosThetaMax);
inline G4double SetupKinematic(G4double kinEnergy, const G4Material* mat);
inline void SetTargetMass(G4double value);
inline G4double GetMomentumSquare() const;
@@ -110,16 +110,13 @@ public:
inline G4double GetCosThetaElec() const;
private:
protected:
void ComputeMaxElectronScattering(G4double cut);
inline G4double FlatFormfactor(G4double x);
void InitialiseA();
// hide assignment operator
G4WentzelOKandVIxSection & operator=
(const G4WentzelOKandVIxSection &right) = delete;
G4WentzelOKandVIxSection(const G4WentzelOKandVIxSection&) = delete;
inline G4double FlatFormfactor(G4double x);
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theElectron;
@@ -179,28 +176,18 @@ private:
static G4double ScreenRSquareElec[100];
static G4double ScreenRSquare[100];
static G4double FormFactor[100];
#ifdef G4MULTITHREADED
static G4Mutex WentzelOKandVIxSectionMutex;
#endif
private:
// hide assignment operator
G4WentzelOKandVIxSection & operator=
(const G4WentzelOKandVIxSection &right) = delete;
G4WentzelOKandVIxSection(const G4WentzelOKandVIxSection&) = delete;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4WentzelOKandVIxSection::SetupKinematic(G4double ekin, const G4Material* mat)
{
if(ekin != tkin || mat != currentMaterial) {
currentMaterial = mat;
tkin = ekin;
mom2 = tkin*(tkin + 2.0*mass);
invbeta2 = 1.0 + mass*mass/mom2;
factB = spin/invbeta2;
cosTetMaxNuc = cosThetaMax;
if(isCombined) {
cosTetMaxNuc = std::max(cosTetMaxNuc,
1.-factorA2*mat->GetIonisation()->GetInvA23()/mom2);
}
}
return cosTetMaxNuc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void G4WentzelOKandVIxSection::SetTargetMass(G4double value)
@@ -236,12 +223,8 @@ inline G4double
G4WentzelOKandVIxSection::ComputeNuclearCrossSection(G4double cosTMin,
G4double cosTMax)
{
G4double xsec = 0.0;
if(cosTMax < cosTMin) {
xsec = targetZ*kinFactor*(cosTMin - cosTMax)/
((1.0 - cosTMin + screenZ)*(1.0 - cosTMax + screenZ));
}
return xsec;
return targetZ*kinFactor*(cosTMin - cosTMax)/
((1.0 - cosTMin + screenZ)*(1.0 - cosTMax + screenZ));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -250,19 +233,15 @@ inline G4double
G4WentzelOKandVIxSection::ComputeElectronCrossSection(G4double cosTMin,
G4double cosTMax)
{
G4double xsec = 0.0;
G4double cost1 = std::max(cosTMin,cosTetMaxElec);
G4double cost2 = std::max(cosTMax,cosTetMaxElec);
if(cost1 > cost2) {
xsec = kinFactor*(cost1 - cost2)/
((1.0 - cost1 + screenZ)*(1.0 - cost2 + screenZ));
}
return xsec;
return (cost1 <= cost2) ? 0.0 : kinFactor*(cost1 - cost2)/
((1.0 - cost1 + screenZ)*(1.0 - cost2 + screenZ));
}
inline G4double G4WentzelOKandVIxSection::FlatFormfactor(G4double x)
{
return 3*(std::sin(x) - x*std::cos(x))/(x*x*x);
return 3.0*(std::sin(x) - x*std::cos(x))/(x*x*x);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4WentzelVIModel.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4WentzelVIModel.hh 104307 2017-05-24 09:01:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -68,8 +68,7 @@ class G4WentzelVIModel : public G4VMscModel
public:
explicit G4WentzelVIModel(G4bool comb = true,
const G4String& nam = "WentzelVIUni");
explicit G4WentzelVIModel(G4bool comb=true, const G4String& nam = "WentzelVIUni");
virtual ~G4WentzelVIModel();
@@ -106,6 +105,8 @@ public:
inline G4double GetFixedCut() const;
// access to cross section class
inline void SetWVICrossSection(G4WentzelOKandVIxSection*);
inline G4WentzelOKandVIxSection* GetWVICrossSection();
inline void SetUseSecondMoment(G4bool);
@@ -120,19 +121,19 @@ public:
void SetSingleScatteringFactor(G4double);
void DefineMaterial(const G4MaterialCutsCouple*);
protected:
inline void DefineMaterial(const G4MaterialCutsCouple*);
private:
G4double ComputeTransportXSectionPerVolume(G4double cosTheta);
inline void SetupParticle(const G4ParticleDefinition*);
private:
G4double ComputeSecondMoment(const G4ParticleDefinition*,
G4double kineticEnergy);
inline void SetupParticle(const G4ParticleDefinition*);
// hide assignment operator
G4WentzelVIModel & operator=(const G4WentzelVIModel &right) = delete;
G4WentzelVIModel(const G4WentzelVIModel&) = delete;
@@ -159,12 +160,6 @@ protected:
const G4Material* currentMaterial;
const G4ParticleDefinition* particle;
// flags
G4bool singleScatteringMode;
private:
G4ParticleChangeForMSC* fParticleChange;
const G4DataVector* currentCuts;
@@ -194,6 +189,7 @@ private:
G4double lowEnergyLimit;
// flags
G4bool singleScatteringMode;
G4bool isCombined;
G4bool useSecondMoment;
};
@@ -201,19 +197,6 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4WentzelVIModel::DefineMaterial(const G4MaterialCutsCouple* cup)
{
if(cup != currentCouple) {
currentCouple = cup;
SetCurrentCouple(cup);
currentMaterial = cup->GetMaterial();
currentMaterialIndex = currentCouple->GetIndex();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4WentzelVIModel::SetupParticle(const G4ParticleDefinition* p)
{
// Initialise mass and charge
@@ -239,6 +222,16 @@ inline G4double G4WentzelVIModel::GetFixedCut() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4WentzelVIModel::SetWVICrossSection(G4WentzelOKandVIxSection* ptr)
{
if(ptr != wokvi) {
delete wokvi;
wokvi = ptr;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4WentzelOKandVIxSection* G4WentzelVIModel::GetWVICrossSection()
{
return wokvi;
@@ -275,13 +268,10 @@ G4WentzelVIModel::SecondMoment(const G4ParticleDefinition* part,
G4double x = 0.0;
if(useSecondMoment) {
DefineMaterial(couple);
if(fSecondMoments) {
x = (*fSecondMoments)[(*theDensityIdx)[currentMaterialIndex]]
->Value(ekin, idx2)
*(*theDensityFactor)[currentMaterialIndex]/(ekin*ekin);
} else {
x = ComputeSecondMoment(part, ekin);
}
x = (fSecondMoments) ?
(*fSecondMoments)[(*theDensityIdx)[currentMaterialIndex]]->Value(ekin, idx2)
*(*theDensityFactor)[currentMaterialIndex]/(ekin*ekin)
: ComputeSecondMoment(part, ekin);
}
return x;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4WentzelVIRelModel.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4WentzelVIRelModel.hh 104307 2017-05-24 09:01:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -55,31 +55,27 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4VMscModel.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4WentzelVIRelXSection.hh"
class G4ParticleDefinition;
class G4LossTableManager;
class G4NistManager;
class G4Pow;
#include "G4WentzelVIModel.hh"
#include "G4Threading.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4WentzelVIRelModel : public G4VMscModel
class G4NistManager;
class G4WentzelVIRelModel : public G4WentzelVIModel
{
public:
explicit G4WentzelVIRelModel(G4bool combined = true);
explicit G4WentzelVIRelModel();
virtual ~G4WentzelVIRelModel();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector&) override;
virtual void StartTracking(G4Track*) override;
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition*,
G4double KineticEnergy,
G4double AtomicNumber,
@@ -87,100 +83,24 @@ public:
G4double cut = DBL_MAX,
G4double emax= DBL_MAX) override;
virtual G4ThreeVector& SampleScattering(const G4ThreeVector&,
G4double safety) override;
virtual G4double
ComputeTruePathLengthLimit(const G4Track& track,
G4double& currentMinimalStep) override;
virtual G4double ComputeGeomPathLength(G4double truePathLength) override;
virtual G4double ComputeTrueStepLength(G4double geomStepLength) override;
virtual void DefineMaterial(const G4MaterialCutsCouple* cup);
private:
G4double ComputeXSectionPerVolume();
inline void SetupParticle(const G4ParticleDefinition*);
inline void DefineMaterial(const G4MaterialCutsCouple*);
void ComputeEffectiveMass();
// hide assignment operator
G4WentzelVIRelModel & operator=(const G4WentzelVIRelModel &right) = delete;
G4WentzelVIRelModel(const G4WentzelVIRelModel&) = delete;
G4LossTableManager* theManager;
G4NistManager* fNistManager;
G4ParticleChangeForMSC* fParticleChange;
G4WentzelVIRelXSection* wokvi;
G4Pow* fG4pow;
static std::vector<G4double> effMass;
G4NistManager* fNistManager;
const G4DataVector* currentCuts;
G4double tlimitminfix;
G4double invsqrt12;
// cache kinematics
G4double preKinEnergy;
G4double tPathLength;
G4double zPathLength;
G4double lambdaeff;
G4double currentRange;
// data for single scattering mode
G4double xtsec;
std::vector<G4double> xsecn;
std::vector<G4double> prob;
G4int nelments;
G4double numlimit;
// cache material
G4int currentMaterialIndex;
const G4MaterialCutsCouple* currentCouple;
const G4Material* currentMaterial;
// single scattering parameters
G4double cosThetaMin;
G4double cosThetaMax;
G4double cosTetMaxNuc;
// projectile
const G4ParticleDefinition* particle;
G4double lowEnergyLimit;
// flags
G4bool isCombined;
G4bool inside;
G4bool singleScatteringMode;
#ifdef G4MULTITHREADED
static G4Mutex WentzelVIRelModelMutex;
#endif
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline
void G4WentzelVIRelModel::DefineMaterial(const G4MaterialCutsCouple* cup)
{
if(cup != currentCouple) {
currentCouple = cup;
SetCurrentCouple(cup);
currentMaterial = cup->GetMaterial();
currentMaterialIndex = currentCouple->GetIndex();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4WentzelVIRelModel::SetupParticle(const G4ParticleDefinition* p)
{
// Initialise mass and charge
if(p != particle) {
particle = p;
wokvi->SetupParticle(p);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4WentzelVIRelXSection.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4WentzelVIRelXSection.hh 104307 2017-05-24 09:01:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -56,218 +56,33 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4WentzelOKandVIxSection.hh"
#include "globals.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4ElementVector.hh"
#include "G4NistManager.hh"
#include "G4ThreeVector.hh"
#include "G4Pow.hh"
class G4ParticleDefinition;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4WentzelVIRelXSection
class G4WentzelVIRelXSection : public G4WentzelOKandVIxSection
{
public:
explicit G4WentzelVIRelXSection(G4bool combined = true);
explicit G4WentzelVIRelXSection();
virtual ~G4WentzelVIRelXSection();
void Initialise(const G4ParticleDefinition*, G4double CosThetaLim);
void SetupParticle(const G4ParticleDefinition*);
// return cos(ThetaMax) for msc and cos(thetaMin) for single scattering
// cut = DBL_MAX means no scattering off electrons
G4double SetupTarget(G4int Z, G4double cut);
G4double ComputeTransportCrossSectionPerAtom(G4double CosThetaMax);
G4ThreeVector& SampleSingleScattering(G4double CosThetaMin,
G4double CosThetaMax,
G4double elecRatio);
inline G4double ComputeNuclearCrossSection(G4double CosThetaMin,
G4double CosThetaMax);
inline G4double ComputeElectronCrossSection(G4double CosThetaMin,
G4double CosThetaMax);
inline G4double SetupKinematic(G4double kinEnergy,
const G4Material* mat,
G4double cut,
G4double tmass);
inline G4double GetMomentumSquare() const;
inline G4double GetCosThetaNuc() const;
inline G4double GetCosThetaElec() const;
virtual G4double SetupKinematic(G4double kinEnergy, const G4Material* mat);
private:
void ComputeMaxElectronScattering(G4double cut);
// hide assignment operator
G4WentzelVIRelXSection & operator=
(const G4WentzelVIRelXSection &right) = delete;
G4WentzelVIRelXSection(const G4WentzelVIRelXSection&) = delete;
const G4ParticleDefinition* theProton;
const G4ParticleDefinition* theElectron;
const G4ParticleDefinition* thePositron;
const G4Material* currentMaterial;
G4NistManager* fNistManager;
G4Pow* fG4pow;
G4ThreeVector temp;
G4double numlimit;
// integer parameters
G4int nwarnings;
G4int nwarnlimit;
G4bool isCombined;
// single scattering parameters
G4double coeff;
G4double cosTetMaxElec;
G4double cosTetMaxNuc;
G4double cosThetaMax;
G4double alpha2;
// projectile
const G4ParticleDefinition* particle;
G4double chargeSquare;
G4double charge3;
G4double spin;
G4double mass;
G4double tkin;
G4double mom2;
G4double momCM2;
G4double invbeta2;
G4double kinFactor;
G4double etag;
G4double ecut;
G4double lowEnergyLimit;
// target
G4int targetZ;
G4double targetMass;
G4double screenZ;
G4double formfactA;
G4double factorA2;
G4double factB;
G4double factB1;
G4double factD;
G4double gam0pcmp;
G4double pcmp2;
static G4double ScreenRSquare[100];
static G4double FormFactor[100];
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4WentzelVIRelXSection::SetupKinematic(G4double kinEnergy,
const G4Material* mat,
G4double cut,
G4double tmass)
{
if(kinEnergy != tkin || mat != currentMaterial ||
ecut != cut || tmass != targetMass) {
currentMaterial = mat;
ecut = cut;
tkin = kinEnergy;
G4double momLab2 = tkin*(tkin + 2.0*mass);
G4double etot = tkin + mass;
G4double ptot = std::sqrt(momLab2);
G4double m12 = mass*mass;
targetMass = tmass;
// relativistic reduced mass from publucation
// A.P. Martynenko, R.N. Faustov, Teoret. mat. Fiz. 64 (1985) 179
//incident particle & target nucleus
G4double Ecm = std::sqrt(m12 + targetMass*targetMass + 2.0*etot*targetMass);
G4double mu_rel = mass*targetMass/Ecm;
G4double momCM = ptot*targetMass/Ecm;
// relative system
mom2 = momCM*momCM;
invbeta2 = 1.0 + mu_rel*mu_rel/mom2;
factB = spin/invbeta2;
factD = std::sqrt(mom2)/tmass;
if(isCombined) {
G4double cost = 1.-factorA2*mat->GetIonisation()->GetInvA23()/mom2;
if(cost > cosTetMaxNuc) { cosTetMaxNuc = cost; }
}
}
return cosTetMaxNuc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4WentzelVIRelXSection::GetMomentumSquare() const
{
return mom2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4WentzelVIRelXSection::GetCosThetaNuc() const
{
return cosTetMaxNuc;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double G4WentzelVIRelXSection::GetCosThetaElec() const
{
return cosTetMaxElec;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4WentzelVIRelXSection::ComputeNuclearCrossSection(G4double cosTMin,
G4double cosTMax)
{
G4double xsec = 0.0;
if(cosTMax < cosTMin) {
xsec = targetZ*kinFactor*(cosTMin - cosTMax)/
((1.0 - cosTMin + screenZ)*(1.0 - cosTMax + screenZ));
}
return xsec;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline G4double
G4WentzelVIRelXSection::ComputeElectronCrossSection(G4double cosTMin,
G4double cosTMax)
{
G4double xsec = 0.0;
G4double cost1 = std::max(cosTMin,cosTetMaxElec);
G4double cost2 = std::max(cosTMax,cosTetMaxElec);
if(cost1 > cost2) {
xsec = kinFactor*(cost1 - cost2)/
((1.0 - cost1 + screenZ)*(1.0 - cost2 + screenZ));
}
return xsec;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eBremsstrahlungRelModel.hh 98737 2016-08-09 12:51:38Z gcosmo $
// $Id: G4eBremsstrahlungRelModel.hh 104373 2017-05-29 09:56:39Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -151,8 +151,14 @@ protected:
G4double densityFactor;
G4double densityCorr;
G4int currentZ;
G4bool isElectron;
// scattering off electrons
G4double nucTerm;
G4double sumTerm;
G4bool scatOffElectron;
G4bool isElectron;
G4int currentZ;
private:
@@ -181,6 +187,7 @@ private:
// flags
G4bool use_completescreening;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eCoulombScatteringModel.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4eCoulombScatteringModel.hh 104307 2017-05-24 09:01:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -51,9 +51,9 @@
//
// Class Description:
//
// Implementation of eCoulombScattering of pointlike charge particle
// Implementation of eCoulombScattering of a charge particle
// on Atomic Nucleus for interval of scattering anles in Lab system
// thetaMin - ThetaMax, nucleus recoil is neglected.
// thetaMin - ThetaMax.
// The model based on analysis of J.M.Fernandez-Varea et al.
// NIM B73(1993)447 originated from G.Wentzel Z.Phys. 40(1927)590 with
// screening parameter from H.A.Bethe Phys. Rev. 89 (1953) 1256.
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4hCoulombScatteringModel.hh 96934 2016-05-18 09:10:41Z gcosmo $
// $Id: G4hCoulombScatteringModel.hh 104307 2017-05-24 09:01:45Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -40,9 +40,9 @@
//
// Class Description:
//
// Implementation of Coulomb Scattering of pointlike charge particle
// Implementation of Coulomb Scattering of a charge particle
// on Atomic Nucleus for interval of scattering anles in Lab system
// thetaMin - ThetaMax, nucleus recoil is neglected.
// thetaMin - ThetaMax.
// The model based on analysis of J.M.Fernandez-Varea et al.
// NIM B73(1993)447 originated from G.Wentzel Z.Phys. 40(1927)590 with
// screening parameter from H.A.Bethe Phys. Rev. 89 (1953) 1256.