Import Geant4 10.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2016-06-30 14:12:05 +02:00
parent a654a7ab1f
commit 4ec577e5c4
2021 changed files with 100995 additions and 78277 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizationHelper.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizationHelper.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// GEANT4 Class file
//
@@ -155,7 +155,7 @@ void G4PolarizationHelper::TestInteractionFrame()
G4ThreeVector dir0=G4ThreeVector(0.,0.,1.);
G4ThreeVector dir2=G4ThreeVector(std::sin(theta),0.,std::cos(theta));
G4StokesVector pol0=G4ThreeVector(0.,0.,1.);
G4StokesVector pol1=G4ThreeVector(0.,0.,1.);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizationManager.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizationManager.cc 97384 2016-06-02 09:59:17Z gcosmo $
//
// GEANT4 Class file
//
@@ -47,25 +47,25 @@
#include "G4LogicalVolume.hh"
G4ThreadLocal G4PolarizationManager * G4PolarizationManager::instance = 0;
G4ThreadLocal G4PolarizationManager * G4PolarizationManager::instance = nullptr;
G4PolarizationManager* G4PolarizationManager::GetInstance()
{
if (instance == 0) instance = new G4PolarizationManager();
if (instance == nullptr) instance = new G4PolarizationManager();
return instance;
}
void G4PolarizationManager::Dispose()
{
if (instance != 0)
if (instance != nullptr)
{
delete instance;
instance = 0;
instance = nullptr;
}
}
G4PolarizationManager::G4PolarizationManager()
: messenger(0), verboseLevel(0), activated(true)
: messenger(nullptr), verboseLevel(0), activated(true)
{
messenger = new G4PolarizationMessenger(this);
}
@@ -81,9 +81,8 @@ void G4PolarizationManager::ListVolumes()
<<" registered volume(s) : "<<G4endl;
if (!activated)
G4cout<<" but polarization deactivated "<<G4endl;
for (PolarizationMap::const_iterator cit=volumePolarizations.begin();
cit!=volumePolarizations.end();cit++) {
G4cout<<cit->first->GetName()<<" : "<<cit->second<<G4endl;
for (auto vp : volumePolarizations) {
G4cout << vp.first->GetName() << " : " << vp.second << G4endl;
}
}
@@ -97,10 +96,9 @@ void G4PolarizationManager::SetVolumePolarization(G4LogicalVolume* lVol, const G
void G4PolarizationManager::SetVolumePolarization(const G4String & lVolName, const G4ThreeVector & pol)
{
for (PolarizationMap::iterator it=volumePolarizations.begin();
it!=volumePolarizations.end();it++) {
if (it->first->GetName()==lVolName) {
it->second=pol;
for (auto& vp : volumePolarizations) {
if (vp.first->GetName()==lVolName) {
vp.second=pol;
if (verboseLevel>=1) G4cout<<" SetVolumePolarization "
<<lVolName<<" "
<<pol<<G4endl;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedAnnihilationModel.cc 91742 2015-08-04 11:48:51Z gcosmo $
// $Id: G4PolarizedAnnihilationModel.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -63,7 +63,10 @@
G4PolarizedAnnihilationModel::G4PolarizedAnnihilationModel(const G4ParticleDefinition* p,
const G4String& nam)
: G4eeToTwoGammaModel(p,nam),crossSectionCalculator(0),verboseLevel(0),gParticleChange(0),
: G4eeToTwoGammaModel(p,nam),
crossSectionCalculator(nullptr),
verboseLevel(0),
gParticleChange(nullptr),
gIsInitialised(false)
{
crossSectionCalculator=new G4PolarizedAnnihilationCrossSection();
@@ -185,6 +188,11 @@ void G4PolarizedAnnihilationModel::SampleSecondaries(std::vector<G4DynamicPartic
const G4bool targetIsPolarized = polarizationManager->IsPolarized(aLVolume);
theTargetPolarization = polarizationManager->GetVolumePolarization(aLVolume);
if (verboseLevel >= 1) {
G4cout << "G4PolarizedComptonModel::SampleSecondaries in "
<< aLVolume->GetName() << G4endl;
}
// transfer target electron polarization in frame of positron
if (targetIsPolarized)
theTargetPolarization.rotateUz(dp->GetMomentumDirection());
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedBremsstrahlungCrossSection.cc 77295 2013-11-22 11:02:41Z gcosmo $
// $Id: G4PolarizedBremsstrahlungCrossSection.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -132,11 +132,11 @@ void G4PolarizedBremsstrahlungCrossSection::Initialize(
}
}
else {
G4double alpha_sc = (111 * std::pow(theZ, -1./3.)) / Xsi;
GG = std::log(alpha_sc)- 2 - fCoul;
G4double alpha_sc = (111. * std::pow(theZ, -1./3.)) / Xsi;
GG = std::log(alpha_sc)- 2. - fCoul;
}
if(GG<-1) GG=-1; // *KL* do we need this ?!
if(GG<-1.) GG=-1.; // *KL* do we need this ?!
G4double I_Lept = (Lept0E2 + Lept1E2) * (3.+2.*GG) - 2 * Lept0E * Lept1E * (1. + 4. * u2 * Xsi2 * GG);
G4double F_Lept = Lept1E * 4. * GammaE * u * Xsi * (1. - 2 * Xsi) * GG / I_Lept;
@@ -166,14 +166,14 @@ void G4PolarizedBremsstrahlungCrossSection::Initialize(
}
G4double I_Gamma = (Lept0E2 + Lept1E2)*(3+2*GG) - 2 * Lept0E * Lept1E * (1 + 4 * u2 * Xsi2 * GG);
G4double D_Gamma = 8 * Lept0E * Lept1E * u2 * Xsi2 * GG / I_Gamma;
G4double L_Gamma = GammaE * ((Lept0E + Lept1E) * (3 + 2 * GG)
- 2 * Lept1E * (1 + 4 * u2 * Xsi2 * GG))/I_Gamma;
G4double T_Gamma = 4 * GammaE * Lept1E * Xsi * u * (2 * Xsi - 1) * GG / I_Gamma ;
G4double I_Gamma = (Lept0E2 + Lept1E2)*(3.+2.*GG) - 2. * Lept0E * Lept1E * (1. + 4. * u2 * Xsi2 * GG);
G4double D_Gamma = 8. * Lept0E * Lept1E * u2 * Xsi2 * GG / I_Gamma;
G4double L_Gamma = GammaE * ((Lept0E + Lept1E) * (3. + 2. * GG)
- 2. * Lept1E * (1. + 4. * u2 * Xsi2 * GG))/I_Gamma;
G4double T_Gamma = 4. * GammaE * Lept1E * Xsi * u * (2. * Xsi - 1.) * GG / I_Gamma ;
G4double Stokes_P1 = D_Gamma ;
G4double Stokes_P2 = 0 ;
G4double Stokes_P2 = 0.;
G4double Stokes_P3 = (Stokes_S3*L_Gamma + Stokes_S1*T_Gamma) ;
theFinalGammaPolarization.SetPhoton();
@@ -196,7 +196,7 @@ G4double G4PolarizedBremsstrahlungCrossSection::XSection(const G4StokesVector &
const G4StokesVector & /*pol3*/)
{
G4cout<<"ERROR dummy routine G4PolarizedBremsstrahlungCrossSection::XSection called \n";
return 0;
return 0.;
}
// return expected mean polarisation
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PolarizedCompton.cc 93113 2015-10-07 07:49:04Z gcosmo $
// $Id: G4PolarizedCompton.cc 97175 2016-05-27 12:42:05Z gcosmo $
//
//
// File name: G4PolarizedCompton
@@ -175,26 +175,34 @@ G4double G4PolarizedCompton::PostStepGetPhysicalInteractionLength(
G4double previousStepSize,
G4ForceCondition* condition)
{
// save previous value
// save previous values
G4double nLength = theNumberOfInteractionLengthLeft;
G4double iLength = currentInteractionLength;
// *** compute uppolarized step limit ***
// *** compute unpolarized step limit ***
// this changes theNumberOfInteractionLengthLeft and currentInteractionLength
G4double x = G4VEmProcess::PostStepGetPhysicalInteractionLength(aTrack,
previousStepSize,
condition);
G4double x0 = x;
G4double satFact = 1.0;
// *** add corrections on polarisation ***
if (theAsymmetryTable && useAsymmetryTable && x < DBL_MAX) {
G4double curLength = currentInteractionLength*ComputeSaturationFactor(aTrack);
satFact = ComputeSaturationFactor(aTrack);
G4double curLength = currentInteractionLength*satFact;
G4double prvLength = iLength*satFact;
if(nLength > 0.0) {
theNumberOfInteractionLengthLeft =
std::max(nLength - previousStepSize/curLength, 0.0);
std::max(nLength - previousStepSize/prvLength, 0.0);
}
x = theNumberOfInteractionLengthLeft * curLength;
}
if (verboseLevel>=2) {
G4cout << "G4PolarizedCompton::PostStepGetPhysicalInteractionLength: "
<< x/mm << " mm " << G4endl;
G4cout << "G4PolarizedCompton::PostStepGPIL: "
<< std::setprecision(8) << x/mm << " mm;" << G4endl
<< " unpolarized value: "
<< std::setprecision(8) << x0/mm << " mm." << G4endl;
}
return x;
}
@@ -297,8 +305,8 @@ void G4PolarizedCompton::BuildAsymmetryTable(const G4ParticleDefinition& part)
G4int nbins = LambdaBinning();
G4double emin = MinKinEnergy();
G4double emax = MaxKinEnergy();
G4PhysicsLogVector* aVector = 0;
G4PhysicsLogVector* bVector = 0;
G4PhysicsLogVector* aVector = nullptr;
G4PhysicsLogVector* bVector = nullptr;
for(size_t i=0; i<numOfCouples; ++i) {
if (theAsymmetryTable->GetFlag(i)) {
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedComptonCrossSection.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizedComptonCrossSection.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// GEANT4 Class file
//
@@ -189,7 +189,7 @@ G4double G4PolarizedComptonCrossSection::TotalXSection(G4double /*xmin*/, G4doub
{
// G4double k0 = gammaEnergy / electron_mass_c2 ;
G4double k1 = 1 + 2*k0 ;
G4double k1 = 1. + 2.*k0 ;
// // pi*re^2
// G4double re=2.81794e-15; //m
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PolarizedComptonModel.cc 93316 2015-10-16 12:36:02Z gcosmo $
// $Id: G4PolarizedComptonModel.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -71,7 +71,7 @@ static const G4int nlooplim = 10000;
G4PolarizedComptonModel::G4PolarizedComptonModel(const G4ParticleDefinition*,
const G4String& nam)
: G4KleinNishinaCompton(0,nam),
: G4KleinNishinaCompton(nullptr,nam),
verboseLevel(0)
{
crossSectionCalculator = new G4PolarizedComptonCrossSection();
@@ -91,7 +91,7 @@ G4double G4PolarizedComptonModel::ComputeAsymmetryPerAtom
G4double asymmetry = 0.0 ;
G4double k0 = gammaEnergy / electron_mass_c2 ;
G4double k1 = 1 + 2*k0 ;
G4double k1 = 1. + 2.*k0 ;
asymmetry = -k0;
asymmetry *= (k0 + 1.)*sqr(k1)*G4Log(k1) - 2.*k0*(5.*sqr(k0) + 4.*k0 + 1.);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedGammaConversionModel.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizedGammaConversionModel.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -67,7 +67,7 @@
G4PolarizedGammaConversionModel::G4PolarizedGammaConversionModel(const G4ParticleDefinition* pd,
const G4String& nam)
: G4BetheHeitlerModel(pd,nam), crossSectionCalculator(0)
: G4BetheHeitlerModel(pd,nam), crossSectionCalculator(nullptr)
{
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedMollerBhabhaModel.cc 91742 2015-08-04 11:48:51Z gcosmo $
// $Id: G4PolarizedMollerBhabhaModel.cc 96114 2016-03-16 18:51:33Z gcosmo $
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -70,7 +70,7 @@ G4PolarizedMollerBhabhaModel::G4PolarizedMollerBhabhaModel(const G4ParticleDefin
// G4cout<<" particle==electron "<<(p==theElectron)<<G4endl;
isElectron=(p==theElectron); // necessary due to wrong order in G4MollerBhabhaModel constructor!
if (p==0) {
if (p==nullptr) {
}
if (!isElectron) {
@@ -106,7 +106,7 @@ G4double G4PolarizedMollerBhabhaModel::ComputeCrossSectionPerElectron(
// G4cout<<"calc eIoni xsec "<<xs<<G4endl;
// G4cout<<" "<<kinEnergy<<" "<<cut<<" "<<emax<<G4endl;
G4double factor=1.;
if (xs!=0) {
if (xs!=0.) {
// G4cout<<"calc asym"<<G4endl;
G4double tmax = MaxSecondaryEnergy(pd, kinEnergy);
tmax = std::min(emax, tmax);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedMollerCrossSection.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizedMollerCrossSection.cc 96114 2016-03-16 18:51:33Z gcosmo $
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -91,23 +91,23 @@ void G4PolarizedMollerCrossSection::Initialize(
// G4cout<<"Polarized differential moller cross section"<<G4endl;
// G4cout<<"Initial state polarisation contributions"<<G4endl;
// G4cout<<"Diagonal Matrix Elements"<<G4endl;
G4double xx = (gamma - f*e*gmo*(3 + gamma))/(4*f*e*gamma2);
G4double yy = (-1 + f*e*gmo2 + 2*gamma)/(4*f*e*gamma2);
G4double zz = (-(e*gmo*(3 + gamma)) + e2*gmo*(3 + gamma) +
gamma*(-1 + 2*gamma))/(4*f*e*gamma2);
G4double xx = (gamma - f*e*gmo*(3. + gamma))/(4.*f*e*gamma2);
G4double yy = (-1. + f*e*gmo2 + 2.*gamma)/(4.*f*e*gamma2);
G4double zz = (-(e*gmo*(3. + gamma)) + e2*gmo*(3. + gamma) +
gamma*(-1. + 2.*gamma))/(4.*f*e*gamma2);
phi0 += xx*pol0.x()*pol1.x() + yy*pol0.y()*pol1.y() + zz*pol0.z()*pol1.z();
if (usephi==1.) {
// G4cout<<"Non-diagonal Matrix Elements"<<G4endl;
G4double xy = 0;
G4double xz = -((-1 + 2*e)*gmo)/(2*sqrttwo*gamma2*
G4double xy = 0.;
G4double xz = -((-1. + 2.*e)*gmo)/(2.*sqrttwo*gamma2*
std::sqrt(-((f*e)/gpo)));
G4double yx = 0;
G4double yz = 0;
G4double zx = -((-1 + 2*e)*gmo)/(2*sqrttwo*gamma2*
G4double yx = 0.;
G4double yz = 0.;
G4double zx = -((-1. + 2.*e)*gmo)/(2.*sqrttwo*gamma2*
std::sqrt(-((f*e)/gpo)));
G4double zy = 0;
G4double zy = 0.;
phi0+=yx*pol0.y()*pol1.x() + xy*pol0.x()*pol1.y();
phi0+=zx*pol0.z()*pol1.x() + xz*pol0.x()*pol1.z();
phi0+=zy*pol0.z()*pol1.y() + yz*pol0.y()*pol1.z();
@@ -124,38 +124,38 @@ void G4PolarizedMollerCrossSection::Initialize(
// initial electron K1
if (!pol0.IsZero()) {
G4double xxP1K1 = (std::sqrt(gpo/(1 + e2*gmo + gamma - 2*e*gamma))*
(gamma - e*gpo))/(4*e2*gamma);
G4double xyP1K1 = 0;
G4double xzP1K1 = (-1 + 2*e*gamma)/(2*sqrttwo*f*gamma*
std::sqrt(e*e2*(1 + e + gamma - e*gamma)));
G4double yxP1K1 = 0;
G4double yyP1K1 = (-gamma2 + e*(-1 + gamma*(2 + gamma)))/(4*f*e2*gamma2);
G4double yzP1K1 = 0;
G4double zxP1K1 = (1 + 2*e2*gmo - 2*e*gamma)/(2*sqrttwo*f*e*gamma*
std::sqrt(e*(1 + e + gamma - e*gamma)));
G4double zyP1K1 = 0;
G4double zzP1K1 = (-gamma + e*(1 - 2*e*gmo + gamma))/(4*f*e2*gamma*
std::sqrt(1 - (2*e)/(f*gpo)));
G4double xxP1K1 = (std::sqrt(gpo/(1. + e2*gmo + gamma - 2.*e*gamma))*
(gamma - e*gpo))/(4.*e2*gamma);
G4double xyP1K1 = 0.;
G4double xzP1K1 = (-1. + 2.*e*gamma)/(2.*sqrttwo*f*gamma*
std::sqrt(e*e2*(1. + e + gamma - e*gamma)));
G4double yxP1K1 = 0.;
G4double yyP1K1 = (-gamma2 + e*(-1. + gamma*(2. + gamma)))/(4.*f*e2*gamma2);
G4double yzP1K1 = 0.;
G4double zxP1K1 = (1. + 2.*e2*gmo - 2.*e*gamma)/(2.*sqrttwo*f*e*gamma*
std::sqrt(e*(1. + e + gamma - e*gamma)));
G4double zyP1K1 = 0.;
G4double zzP1K1 = (-gamma + e*(1. - 2.*e*gmo + gamma))/(4.*f*e2*gamma*
std::sqrt(1. - (2.*e)/(f*gpo)));
phi2[0] += xxP1K1*pol0.x() + xyP1K1*pol0.y() + xzP1K1*pol0.z();
phi2[1] += yxP1K1*pol0.x() + yyP1K1*pol0.y() + yzP1K1*pol0.z();
phi2[2] += zxP1K1*pol0.x() + zyP1K1*pol0.y() + zzP1K1*pol0.z();
}
// initial electron K2
if (!pol1.IsZero()) {
G4double xxP1K2 = ((1 + e*(-3 + gamma))*std::sqrt(gpo/(1 + e2*gmo + gamma -
2*e*gamma)))/(4*f*e*gamma);
G4double xyP1K2 = 0;
G4double xzP1K2 = (-2 + 2*e + gamma)/(2*sqrttwo*f2*gamma*
std::sqrt(e*(1 + e + gamma - e*gamma)));
G4double yxP1K2 = 0;
G4double yyP1K2 = (1 - 2*gamma + e*(-1 + gamma*(2 + gamma)))/(4*f2*e*gamma2);
G4double yzP1K2 = 0;
G4double zxP1K2 = (2*e*(1 + e*gmo - 2*gamma) + gamma)/(2*sqrttwo*f2*gamma*
std::sqrt(e*(1 + e + gamma - e*gamma)));
G4double zyP1K2 = 0;
G4double zzP1K2 = (1 - 2*gamma + e*(-1 - 2*e*gmo + 3*gamma))/
(4*f2*e*gamma*std::sqrt(1 - (2*e)/(f*gpo)));
G4double xxP1K2 = ((1. + e*(-3. + gamma))*std::sqrt(gpo/(1. + e2*gmo + gamma -
2.*e*gamma)))/(4.*f*e*gamma);
G4double xyP1K2 = 0.;
G4double xzP1K2 = (-2. + 2.*e + gamma)/(2.*sqrttwo*f2*gamma*
std::sqrt(e*(1. + e + gamma - e*gamma)));
G4double yxP1K2 = 0.;
G4double yyP1K2 = (1. - 2.*gamma + e*(-1. + gamma*(2. + gamma)))/(4.*f2*e*gamma2);
G4double yzP1K2 = 0.;
G4double zxP1K2 = (2.*e*(1. + e*gmo - 2.*gamma) + gamma)/(2.*sqrttwo*f2*gamma*
std::sqrt(e*(1. + e + gamma - e*gamma)));
G4double zyP1K2 = 0.;
G4double zzP1K2 = (1. - 2.*gamma + e*(-1. - 2.*e*gmo + 3.*gamma))/
(4.*f2*e*gamma*std::sqrt(1. - (2.*e)/(f*gpo)));
phi2[0] += xxP1K2*pol1.x() + xyP1K2*pol1.y() + xzP1K2*pol1.z();
phi2[1] += yxP1K2*pol1.x() + yyP1K2*pol1.y() + yzP1K2*pol1.z();
phi2[2] += zxP1K2*pol1.x() + zyP1K2*pol1.y() + zzP1K2*pol1.z();
@@ -168,19 +168,19 @@ void G4PolarizedMollerCrossSection::Initialize(
if (!pol0.IsZero()) {
G4double xxP2K1 = (-1 + e + e*gamma)/(4*f2*gamma*
std::sqrt((e*(2 + e*gmo))/gpo));
G4double xyP2K1 = 0;
G4double xzP2K1 = -((1 + 2*f*gamma)*std::sqrt(f/(-2 + e - e*gamma)))/
(2*sqrttwo*f2*e*gamma);
G4double yxP2K1 = 0;
G4double yyP2K1 = (1 - 2*gamma + e*(-1 + gamma*(2 + gamma)))/(4*f2*e*gamma2);
G4double yzP2K1 = 0;
G4double zxP2K1 = (1 + 2*e*(-2 + e + gamma - e*gamma))/(2*sqrttwo*f*e*
std::sqrt(-(f*(2 + e*gmo)))*gamma);
G4double zyP2K1 = 0;
G4double zzP2K1 = (std::sqrt((e*gpo)/(2 + e*gmo))*
(-3 + e*(5 + 2*e*gmo - 3*gamma) + 2*gamma))/(4*f2*e*gamma);
G4double xxP2K1 = (-1. + e + e*gamma)/(4.*f2*gamma*
std::sqrt((e*(2. + e*gmo))/gpo));
G4double xyP2K1 = 0.;
G4double xzP2K1 = -((1. + 2.*f*gamma)*std::sqrt(f/(-2. + e - e*gamma)))/
(2.*sqrttwo*f2*e*gamma);
G4double yxP2K1 = 0.;
G4double yyP2K1 = (1. - 2.*gamma + e*(-1. + gamma*(2. + gamma)))/(4.*f2*e*gamma2);
G4double yzP2K1 = 0.;
G4double zxP2K1 = (1. + 2.*e*(-2. + e + gamma - e*gamma))/(2.*sqrttwo*f*e*
std::sqrt(-(f*(2. + e*gmo)))*gamma);
G4double zyP2K1 = 0.;
G4double zzP2K1 = (std::sqrt((e*gpo)/(2. + e*gmo))*
(-3. + e*(5. + 2.*e*gmo - 3.*gamma) + 2.*gamma))/(4.*f2*e*gamma);
phi3[0] += xxP2K1*pol0.x() + xyP2K1*pol0.y() + xzP2K1*pol0.z();
phi3[1] += yxP2K1*pol0.x() + yyP2K1*pol0.y() + yzP2K1*pol0.z();
@@ -189,19 +189,19 @@ void G4PolarizedMollerCrossSection::Initialize(
// initial electron K2
if (!pol1.IsZero()) {
G4double xxP2K2 = (-2 - e*(-3 + gamma) + gamma)/
(4*f*e*gamma* std::sqrt((e*(2 + e*gmo))/gpo));
G4double xyP2K2 = 0;
G4double xzP2K2 = ((-2*e + gamma)*std::sqrt(f/(-2 + e - e*gamma)))/
(2*sqrttwo*f*e2*gamma);
G4double yxP2K2 = 0;
G4double yyP2K2 = (-gamma2 + e*(-1 + gamma*(2 + gamma)))/(4*f*e2*gamma2);
G4double yzP2K2 = 0;
G4double zxP2K2 = (gamma + 2*e*(-1 + e - e*gamma))/
(2*sqrttwo*e2* std::sqrt(-(f*(2 + e*gmo)))*gamma);
G4double zyP2K2 = 0;
G4double zzP2K2 = (std::sqrt((e*gpo)/(2 + e*gmo))*
(-2 + e*(3 + 2*e*gmo - gamma) + gamma))/(4*f*e2*gamma);
G4double xxP2K2 = (-2. - e*(-3. + gamma) + gamma)/
(4.*f*e*gamma* std::sqrt((e*(2. + e*gmo))/gpo));
G4double xyP2K2 = 0.;
G4double xzP2K2 = ((-2.*e + gamma)*std::sqrt(f/(-2. + e - e*gamma)))/
(2.*sqrttwo*f*e2*gamma);
G4double yxP2K2 = 0.;
G4double yyP2K2 = (-gamma2 + e*(-1. + gamma*(2. + gamma)))/(4.*f*e2*gamma2);
G4double yzP2K2 = 0.;
G4double zxP2K2 = (gamma + 2.*e*(-1. + e - e*gamma))/
(2.*sqrttwo*e2* std::sqrt(-(f*(2. + e*gmo)))*gamma);
G4double zyP2K2 = 0.;
G4double zzP2K2 = (std::sqrt((e*gpo)/(2. + e*gmo))*
(-2. + e*(3. + 2.*e*gmo - gamma) + gamma))/(4.*f*e2*gamma);
phi3[0] += xxP2K2*pol1.x() + xyP2K2*pol1.y() + xzP2K2*pol1.z();
phi3[1] += yxP2K2*pol1.x() + yyP2K2*pol1.y() + yzP2K2*pol1.z();
phi3[2] += zxP2K2*pol1.x() + zyP2K2*pol1.y() + zzP2K2*pol1.z();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedPEEffectCrossSection.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizedPEEffectCrossSection.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// GEANT4 Class file
//
@@ -78,7 +78,7 @@ void G4PolarizedPEEffectCrossSection::Initialize(G4double aGammaE,
// ************ added by Karim Polarization transfer to e- in PhotoelectricEffect.
// ************
// ***********************************************************
G4double Gfactor = aLept0E/electron_mass_c2+1;
G4double Gfactor = aLept0E/electron_mass_c2+1.;
G4double Gfactor_2 = Gfactor * Gfactor;
G4double BETA = sqrt(1. - 1./(Gfactor_2));
@@ -86,7 +86,7 @@ void G4PolarizedPEEffectCrossSection::Initialize(G4double aGammaE,
G4double Stokes_P3 = beamPol.z() ;
G4double m0_c2 = electron_mass_c2;
G4double Lept0E = aLept0E/m0_c2+1, Lept0E2 = Lept0E * Lept0E ;
G4double Lept0E = aLept0E/m0_c2+1., Lept0E2 = Lept0E * Lept0E ;
G4double GammaE = aGammaE/m0_c2;
@@ -142,7 +142,7 @@ G4double G4PolarizedPEEffectCrossSection::XSection(const G4StokesVector & /*pol2
const G4StokesVector & /*pol3*/)
{
cout<<"ERROR dummy routine G4PolarizedPEEffectCrossSection::XSection() called\n";
return 0;
return 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedPEEffectModel.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4PolarizedPEEffectModel.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -67,7 +67,9 @@
G4PolarizedPEEffectModel::G4PolarizedPEEffectModel(const G4ParticleDefinition*,
const G4String& nam)
: G4PEEffectFluoModel(nam),crossSectionCalculator(0),verboseLevel(0)
: G4PEEffectFluoModel(nam),
crossSectionCalculator(nullptr),
verboseLevel(0)
{
}
@@ -99,6 +101,10 @@ void G4PolarizedPEEffectModel::SampleSecondaries(std::vector<G4DynamicParticle*>
// std::vector<G4DynamicParticle*>* vdp =
G4PEEffectFluoModel::SampleSecondaries(vdp,couple, dp, tmin, maxEnergy);
if (verboseLevel >= 1) {
G4cout << "G4PolarizedPEEffectModel::SampleSecondaries" << G4endl;
}
if(vdp && vdp->size()>0) {
G4double gamEnergy0 = dp->GetKineticEnergy();
G4double lepEnergy1 = (*vdp)[0]->GetKineticEnergy();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PolarizedPairProductionCrossSection.cc 77295 2013-11-22 11:02:41Z gcosmo $
// $Id: G4PolarizedPairProductionCrossSection.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -111,34 +111,34 @@ void G4PolarizedPairProductionCrossSection::Initialize(G4double aGammaE,
if(delta < 0.5) {
GG = std::log(2.* Lept0E * Lept1E / GammaE) - 2. - fCoul;
}
else if ( delta < 120) {
else if ( delta < 120.) {
for (G4int j=2; j<=19; j++) {
if(SCRN[1][j] >= delta) {
GG =std::log(2 * Lept0E * Lept1E / GammaE) - 2 - fCoul
GG =std::log(2. * Lept0E * Lept1E / GammaE) - 2. - fCoul
-(SCRN[2][j-1]+(delta-SCRN[1][j-1])*(SCRN[2][j]-SCRN[2][j-1])/(SCRN[1][j]-SCRN[1][j-1]));
break;
}
}
}
else {
G4double alpha_sc = (111 * std::pow(theZ, -1./3.)) / Xsi;
GG = std::log(alpha_sc)- 2 - fCoul;
G4double alpha_sc = (111. * std::pow(theZ, -1./3.)) / Xsi;
GG = std::log(alpha_sc)- 2. - fCoul;
}
if(GG<-1) GG=-1; // *KL* do we need this ?!
if(GG<-1.) GG=-1.; // *KL* do we need this ?!
G4double I_Lepton = (Lept0E2 + Lept1E2)*(3+2*GG) + 2 * Lept0E * Lept1E * (1 + 4 * u2 * Xsi2 * GG);
G4double I_Lepton = (Lept0E2 + Lept1E2)*(3+2*GG) + 2. * Lept0E * Lept1E * (1. + 4. * u2 * Xsi2 * GG);
// G4double D_Lepton1 = -8 * Lept0E * Lept1E * u2 * Xsi2 * GG / I_Lepton;
G4double L_Lepton1 = GammaE * ((Lept0E - Lept1E) * (3. + 2. * GG)+2 * Lept1E * (1 + 4 * u2 * Xsi2 * GG))/I_Lepton;
G4double L_Lepton1 = GammaE * ((Lept0E - Lept1E) * (3. + 2. * GG)+2 * Lept1E * (1. + 4. * u2 * Xsi2 * GG))/I_Lepton;
G4double T_Lepton1 = 4 * GammaE * Lept1E * Xsi * u * (1. - 2. * Xsi) * GG / I_Lepton ;
G4double T_Lepton1 = 4. * GammaE * Lept1E * Xsi * u * (1. - 2. * Xsi) * GG / I_Lepton ;
G4double Stokes_S1 = (Stokes_P3 * T_Lepton1) ;
G4double Stokes_S2 = 0;
G4double Stokes_S2 = 0.;
G4double Stokes_S3 = (Stokes_P3 * L_Lepton1) ;
@@ -146,26 +146,26 @@ void G4PolarizedPairProductionCrossSection::Initialize(G4double aGammaE,
theFinalElectronPolarization.setY(Stokes_S2);
theFinalElectronPolarization.setZ(Stokes_S3);
if(theFinalElectronPolarization.mag2()>1) {
if(theFinalElectronPolarization.mag2()>1.) {
G4cout<<" WARNING in pol-conv theFinalElectronPolarization \n";
G4cout
<<"\t"<<theFinalElectronPolarization
<<"\t GG\t"<<GG
<<"\t delta\t"<<delta
<<G4endl;
theFinalElectronPolarization.setX(0);
theFinalElectronPolarization.setY(0);
theFinalElectronPolarization.setX(0.);
theFinalElectronPolarization.setY(0.);
theFinalElectronPolarization.setZ(Stokes_S3);
if(Stokes_S3>1) theFinalElectronPolarization.setZ(1);
if(Stokes_S3>1.) theFinalElectronPolarization.setZ(1.);
}
G4double L_Lepton2 = GammaE * ((Lept1E - Lept0E) * (3. + 2. * GG)+2 * Lept0E * (1 + 4 * u2 * Xsi2 * GG))/I_Lepton;
G4double L_Lepton2 = GammaE * ((Lept1E - Lept0E) * (3. + 2. * GG)+2 * Lept0E * (1. + 4. * u2 * Xsi2 * GG))/I_Lepton;
G4double T_Lepton2 = 4 * GammaE * Lept0E * Xsi * u * (1. - 2. * Xsi) * GG / I_Lepton ;
G4double T_Lepton2 = 4. * GammaE * Lept0E * Xsi * u * (1. - 2. * Xsi) * GG / I_Lepton ;
G4double Stokes_SS1 = (Stokes_P3 * T_Lepton2) ;
G4double Stokes_SS2 = 0;
G4double Stokes_SS2 = 0.;
G4double Stokes_SS3 = (Stokes_P3 * L_Lepton2) ;
theFinalPositronPolarization.SetPhoton();
@@ -174,7 +174,7 @@ void G4PolarizedPairProductionCrossSection::Initialize(G4double aGammaE,
theFinalPositronPolarization.setY(Stokes_SS2);
theFinalPositronPolarization.setZ(Stokes_SS3);
if(theFinalPositronPolarization.mag2()>1) {
if(theFinalPositronPolarization.mag2()>1.) {
G4cout<<" WARNING in pol-conv theFinalPositronPolarization \n";
G4cout
<<"\t"<<theFinalPositronPolarization
@@ -188,7 +188,7 @@ G4double G4PolarizedPairProductionCrossSection::XSection(const G4StokesVector &
const G4StokesVector & /*pol3*/)
{
G4cout<<"ERROR dummy routine G4PolarizedPairProductionCrossSection::XSection called \n";
return 0;
return 0.;
}
// return expected mean polarisation
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4StokesVector.cc 68046 2013-03-13 14:31:38Z gcosmo $
// $Id: G4StokesVector.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// GEANT4 Class file
//
@@ -120,8 +120,8 @@ void G4StokesVector::InvRotateAz(G4ThreeVector nInteractionFrame,
if (cosphi>1.+1.e-8 || cosphi<-1.-1.e-8) {
G4cout<<" warning G4StokesVector::RotateAz cosphi>1 or cosphi<-1\n";
}
if (cosphi>1) cosphi=1.;
else if (cosphi<-1)cosphi=-1.;
if (cosphi>1.) cosphi=1.;
else if (cosphi<-1.)cosphi=-1.;
// check sign once more!
G4double hel=(yParticleFrame.cross(nInteractionFrame)*particleDirection)>0?1.:-1.;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ePolarizedBremsstrahlung.cc 93113 2015-10-07 07:49:04Z gcosmo $
// $Id: G4ePolarizedBremsstrahlung.cc 96114 2016-03-16 18:51:33Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -71,7 +71,7 @@ void G4ePolarizedBremsstrahlung::InitialiseEnergyLossProcess(
SetSecondaryParticle(G4Gamma::Gamma());
SetIonisation(false);
G4VEmFluctuationModel* fm = 0;
G4VEmFluctuationModel* fm = nullptr;
//G4VEmFluctuationModel* fm = new G4UniversalFluctuation();
G4VEmModel* em = new G4ePolarizedBremsstrahlungModel;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ePolarizedBremsstrahlungModel.cc 75601 2013-11-04 13:08:15Z gcosmo $
// $Id: G4ePolarizedBremsstrahlungModel.cc 97384 2016-06-02 09:59:17Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -56,7 +56,7 @@
G4ePolarizedBremsstrahlungModel::G4ePolarizedBremsstrahlungModel(
const G4ParticleDefinition* p, const G4String& nam)
: G4SeltzerBergerModel(p,nam),
crossSectionCalculator(0)
crossSectionCalculator(nullptr)
{
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ePolarizedIonisation.cc 93113 2015-10-07 07:49:04Z gcosmo $
// $Id: G4ePolarizedIonisation.cc 97175 2016-05-27 12:42:05Z gcosmo $
// -------------------------------------------------------------------
//
// GEANT4 Class file
@@ -176,23 +176,32 @@ G4double G4ePolarizedIonisation::PostStepGetPhysicalInteractionLength(const G4Tr
G4double step,
G4ForceCondition* cond)
{
// save previous value
// save previous values
G4double nLength = theNumberOfInteractionLengthLeft;
G4double iLength = currentInteractionLength;
// *** get unploarised mean free path from lambda table ***
// *** get unpolarised mean free path from lambda table ***
// this changes theNumberOfInteractionLengthLeft and currentInteractionLength
G4double x = G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(track, step, cond);
G4double x0 = x;
G4double satFact = 1.;
// *** add corrections on polarisation ***
if(theAsymmetryTable && theTransverseAsymmetryTable && x < DBL_MAX) {
G4double curLength = currentInteractionLength*ComputeSaturationFactor(track);
satFact = ComputeSaturationFactor(track);
G4double curLength = currentInteractionLength*satFact;
G4double prvLength = iLength*satFact;
if(nLength > 0.0) {
theNumberOfInteractionLengthLeft =
std::max(nLength - step/curLength, 0.0);
std::max(nLength - step/prvLength, 0.0);
}
x = theNumberOfInteractionLengthLeft * curLength;
}
if (verboseLevel>=2) {
G4cout << "G4ePolarizedIonisation::PostStepGetPhysicalInteractionLength: "
<< x/mm << " mm " << G4endl;
G4cout << "G4ePolarizedIonisation::PostStepGPIL: "
<< std::setprecision(8) << x/mm << " mm;" << G4endl
<< " unpolarized value: "
<< std::setprecision(8) << x0/mm << " mm." << G4endl;
}
return x;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4eplusPolarizedAnnihilation.cc 93113 2015-10-07 07:49:04Z gcosmo $
// $Id: G4eplusPolarizedAnnihilation.cc 97175 2016-05-27 12:42:05Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -128,25 +128,34 @@ G4double G4eplusPolarizedAnnihilation::PostStepGetPhysicalInteractionLength(
G4double previousStepSize,
G4ForceCondition* condition)
{
// save previous value
// save previous values
G4double nLength = theNumberOfInteractionLengthLeft;
G4double iLength = currentInteractionLength;
// *** compute uppolarized step limit ***
// *** compute unpolarized step limit ***
// this changes theNumberOfInteractionLengthLeft and currentInteractionLength
G4double x = G4VEmProcess::PostStepGetPhysicalInteractionLength(track,
previousStepSize,
condition);
G4double x0 = x;
G4double satFact = 1.0;
// *** add corrections on polarisation ***
if(theAsymmetryTable && theTransverseAsymmetryTable && x < DBL_MAX) {
G4double curLength = currentInteractionLength*ComputeSaturationFactor(track);
satFact = ComputeSaturationFactor(track);
G4double curLength = currentInteractionLength*satFact;
G4double prvLength = iLength*satFact;
if(nLength > 0.0) {
theNumberOfInteractionLengthLeft =
std::max(nLength - previousStepSize/curLength, 0.0);
std::max(nLength - previousStepSize/prvLength, 0.0);
}
x = theNumberOfInteractionLengthLeft * curLength;
}
if (verboseLevel>=2) {
G4cout << "G4eplusPolarizedAnnihilation::PostStepGetPhysicalInteractionLength: "
<< x/mm << " mm " << G4endl;
G4cout << "G4eplusPolarizedAnnihilation::PostStepGPIL: "
<< std::setprecision(8) << x/mm << " mm;" << G4endl
<< " unpolarized value: "
<< std::setprecision(8) << x0/mm << " mm." << G4endl;
}
return x;
}