Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Cerenkov.cc,v 1.27 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
////////////////////////////////////////////////////////////////////////
// Cerenkov Radiation Class Implementation
@@ -63,6 +62,8 @@
////////////////////////////////////////////////////////////////////////
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Poisson.hh"
#include "G4EmProcessSubType.hh"
@@ -91,13 +92,6 @@
G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
: G4VProcess(processName, type)
{
G4cout << "G4Cerenkov::G4Cerenkov constructor" << G4endl;
G4cout << "NOTE: this is now a G4VProcess!" << G4endl;
G4cout << "Required change in UserPhysicsList: " << G4endl;
G4cout << "change: pmanager->AddContinuousProcess(theCerenkovProcess);" << G4endl;
G4cout << "to: pmanager->AddProcess(theCerenkovProcess);" << G4endl;
G4cout << " pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);" << G4endl;
SetProcessSubType(fCerenkov);
fTrackSecondariesFirst = false;
@@ -347,8 +341,8 @@ G4Cerenkov::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
}
if (verboseLevel>0) {
G4cout << "\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
G4cout <<"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
<< aParticleChange.GetNumberOfSecondaries() << G4endl;
}
return pParticleChange;
@@ -418,12 +412,12 @@ void G4Cerenkov::BuildThePhysicsTable()
// loop over all (photon energy, refraction index)
// pairs stored for this material
for (size_t i = 1;
i < theRefractionIndexVector->GetVectorLength();
i++)
for (size_t ii = 1;
ii < theRefractionIndexVector->GetVectorLength();
++ii)
{
currentRI = (*theRefractionIndexVector)[i];
currentPM = theRefractionIndexVector->Energy(i);
currentRI = (*theRefractionIndexVector)[ii];
currentPM = theRefractionIndexVector->Energy(ii);
currentCAI = 0.5*(1.0/(prevRI*prevRI) +
1.0/(currentRI*currentRI));
@@ -476,15 +470,15 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
const G4Material* aMaterial = aTrack.GetMaterial();
const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
const G4double kineticEnergy = aParticle->GetKineticEnergy();
G4double kineticEnergy = aParticle->GetKineticEnergy();
const G4ParticleDefinition* particleType = aParticle->GetDefinition();
const G4double mass = particleType->GetPDGMass();
G4double mass = particleType->GetPDGMass();
// particle beta
const G4double beta = aParticle->GetTotalMomentum() /
aParticle->GetTotalEnergy();
G4double beta = aParticle->GetTotalMomentum() /
aParticle->GetTotalEnergy();
// particle gamma
const G4double gamma = 1./std::sqrt(1.-beta*beta);
G4double gamma = aParticle->GetTotalEnergy()/mass;
G4MaterialPropertiesTable* aMaterialPropertiesTable =
aMaterial->GetMaterialPropertiesTable();
@@ -537,7 +531,7 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
G4double MeanNumberOfPhotons =
GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
G4double Step = 0.;
Step = 0.;
if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons /
MeanNumberOfPhotons;
@@ -557,7 +551,7 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
(1.-fMaxBetaChange)*
(1.-fMaxBetaChange));
G4double Step = mass * deltaGamma / dedx;
Step = mass * deltaGamma / dedx;
if (Step > 0. && Step < StepLimit) StepLimit = Step;
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ForwardXrayTR.cc,v 1.16 2010-11-01 10:22:18 grichine Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// G4ForwardXrayTR class -- implementation file
//
@@ -39,6 +38,8 @@
#include "G4ForwardXrayTR.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Poisson.hh"
#include "G4Material.hh"
#include "G4PhysicsTable.hh"
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GammaXTRadiator.cc,v 1.6 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
#include <complex>
@@ -24,13 +24,13 @@
// ********************************************************************
//
//
// $Id: G4RegularXTRadiator.cc,v 1.10 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
#include <complex>
#include "G4RegularXTRadiator.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
#include "G4Gamma.hh"
@@ -64,6 +64,99 @@ G4RegularXTRadiator::~G4RegularXTRadiator()
;
}
///////////////////////////////////////////////////////////////////////////
//
//
G4double G4RegularXTRadiator::SpectralXTRdEdx(G4double energy)
{
G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k;
G4double aMa, bMb ,sigma, dump;
G4int k, kMax, kMin;
aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
bMb = fGasThick*GetGasLinearPhotoAbs(energy);
sigma = 0.5*(aMa + bMb);
dump = std::exp(-fPlateNumber*sigma);
if(verboseLevel > 2) G4cout<<" dump = "<<dump<<G4endl;
cofPHC = 4*pi*hbarc;
tmp = (fSigma1 - fSigma2)/cofPHC/energy;
cof1 = fPlateThick*tmp;
cof2 = fGasThick*tmp;
cofMin = energy*(fPlateThick + fGasThick)/fGamma/fGamma;
cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy;
cofMin /= cofPHC;
theta2 = cofPHC/(energy*(fPlateThick + fGasThick));
// if (fGamma < 1200) kMin = G4int(cofMin); // 1200 ?
// else kMin = 1;
kMin = G4int(cofMin);
if (cofMin > kMin) kMin++;
// tmp = (fPlateThick + fGasThick)*energy*fMaxThetaTR;
// tmp /= cofPHC;
// kMax = G4int(tmp);
// if(kMax < 0) kMax = 0;
// kMax += kMin;
kMax = kMin + 49; // 19; // kMin + G4int(tmp);
// tmp /= fGamma;
// if( G4int(tmp) < kMin ) kMin = G4int(tmp);
if(verboseLevel > 2)
{
G4cout<<cof1<<" "<<cof2<<" "<<cofMin<<G4endl;
G4cout<<"kMin = "<<kMin<<"; kMax = "<<kMax<<G4endl;
}
for( k = kMin; k <= kMax; k++ )
{
tmp = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick);
result = (k - cof1)*(k - cof1)*(k + cof2)*(k + cof2);
// tmp = std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
if( k == kMin && kMin == G4int(cofMin) )
{
sum += 0.5*std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
else
{
sum += std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
theta2k = std::sqrt(theta2*std::abs(k-cofMin));
if(verboseLevel > 2)
{
// G4cout<<"k = "<<k<<"; sqrt(theta2k) = "<<theta2k<<"; tmp = "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
// <<"; sum = "<<sum<<G4endl;
G4cout<<k<<" "<<theta2k<<" "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
<<" "<<sum<<G4endl;
}
}
result = 2*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy;
// result *= ( 1 - std::exp(-0.5*fPlateNumber*sigma) )/( 1 - std::exp(-0.5*sigma) );
// fPlateNumber;
result *= ( 1 - dump + 2*dump*fPlateNumber );
/*
fEnergy = energy;
// G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
G4Integrator<G4TransparentRegXTRadiator,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
tmp = integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
0.0,0.3*fMaxThetaTR) +
integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
0.3*fMaxThetaTR,0.6*fMaxThetaTR) +
integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
0.6*fMaxThetaTR,fMaxThetaTR) ;
result += tmp;
*/
return result;
}
///////////////////////////////////////////////////////////////////////////
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Scintillation.cc,v 1.38 2010-12-15 07:39:26 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
////////////////////////////////////////////////////////////////////////
// Scintillation Light Class Implementation
@@ -71,6 +70,8 @@
#include "G4ios.hh"
#include "globals.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleTypes.hh"
#include "G4EmProcessSubType.hh"
@@ -596,12 +597,12 @@ void G4Scintillation::BuildThePhysicsTable()
// loop over all (photon energy, intensity)
// pairs stored for this material
for (size_t i = 1;
i < theFastLightVector->GetVectorLength();
i++)
for (size_t ii = 1;
ii < theFastLightVector->GetVectorLength();
++ii)
{
currentPM = theFastLightVector->Energy(i);
currentIN = (*theFastLightVector)[i];
currentPM = theFastLightVector->Energy(ii);
currentIN = (*theFastLightVector)[ii];
currentCII = 0.5 * (prevIN + currentIN);
@@ -650,12 +651,12 @@ void G4Scintillation::BuildThePhysicsTable()
// loop over all (photon energy, intensity)
// pairs stored for this material
for (size_t i = 1;
i < theSlowLightVector->GetVectorLength();
i++)
for (size_t ii = 1;
ii < theSlowLightVector->GetVectorLength();
++ii)
{
currentPM = theSlowLightVector->Energy(i);
currentIN = (*theSlowLightVector)[i];
currentPM = theSlowLightVector->Energy(ii);
currentIN = (*theSlowLightVector)[ii];
currentCII = 0.5 * (prevIN + currentIN);
@@ -739,8 +740,8 @@ G4double G4Scintillation::sample_time(G4double tau1, G4double tau2)
// make sure the envelope function is
// always larger than the bi-exponential
G4double t = -1.0*tau2*std::log(1-ran1);
G4double g = d*single_exp(t,tau2);
if (ran2 <= bi_exp(t,tau1,tau2)/g) return t;
G4double gg = d*single_exp(t,tau2);
if (ran2 <= bi_exp(t,tau1,tau2)/gg) return t;
}
return -1.0;
}
@@ -24,11 +24,12 @@
// ********************************************************************
//
//
// $Id: G4StrawTubeXTRadiator.cc,v 1.7 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
#include "G4StrawTubeXTRadiator.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4Gamma.hh"
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4SynchrotronRadiation.cc,v 1.8 2010-10-14 18:38:21 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -43,6 +42,8 @@
///////////////////////////////////////////////////////////////////////////
#include "G4SynchrotronRadiation.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "G4EmProcessSubType.hh"
@@ -63,8 +64,8 @@ G4SynchrotronRadiation::G4SynchrotronRadiation(const G4String& processName,
fFieldPropagator = transportMgr->GetPropagatorInField();
fLambdaConst = std::sqrt(3.0)*electron_mass_c2/
(2.5*fine_structure_const*eplus*c_light) ;
fEnergyConst = 1.5*c_light*c_light*eplus*hbar_Planck/electron_mass_c2 ;
(2.5*fine_structure_const*eplus*c_light);
fEnergyConst = 1.5*c_light*c_light*eplus*hbar_Planck/electron_mass_c2 ;
SetProcessSubType(fSynchrotronRadiation);
verboseLevel=1;
@@ -96,7 +97,7 @@ G4SynchrotronRadiation::GetMeanFreePath( const G4Track& trackData,
const G4DynamicParticle* aDynamicParticle = trackData.GetDynamicParticle();
*condition = NotForced ;
*condition = NotForced;
G4double gamma = aDynamicParticle->GetTotalEnergy()/
aDynamicParticle->GetMass();
@@ -126,7 +127,7 @@ G4SynchrotronRadiation::GetMeanFreePath( const G4Track& trackData,
}
if ( fieldExertsForce )
{
pField = fieldMgr->GetDetectorField() ;
pField = fieldMgr->GetDetectorField();
G4ThreeVector globPosition = trackData.GetPosition();
G4double globPosVec[4], FieldValueVec[6];
@@ -145,8 +146,8 @@ G4SynchrotronRadiation::GetMeanFreePath( const G4Track& trackData,
G4ThreeVector unitMomentum = aDynamicParticle->GetMomentumDirection();
G4ThreeVector unitMcrossB = FieldValue.cross(unitMomentum) ;
G4double perpB = unitMcrossB.mag() ;
G4ThreeVector unitMcrossB = FieldValue.cross(unitMomentum);
G4double perpB = unitMcrossB.mag();
if( perpB > 0.0 ) MeanFreePath = fLambdaConst/perpB;
else MeanFreePath = DBL_MAX;
@@ -206,7 +207,7 @@ G4SynchrotronRadiation::PostStepDoIt(const G4Track& trackData,
G4double particleCharge = aDynamicParticle->GetDefinition()->GetPDGCharge();
G4ThreeVector FieldValue;
const G4Field* pField = 0 ;
const G4Field* pField = 0;
G4FieldManager* fieldMgr=0;
G4bool fieldExertsForce = false;
@@ -223,22 +224,22 @@ G4SynchrotronRadiation::PostStepDoIt(const G4Track& trackData,
}
if ( fieldExertsForce )
{
pField = fieldMgr->GetDetectorField() ;
G4ThreeVector globPosition = trackData.GetPosition() ;
G4double globPosVec[4], FieldValueVec[6] ;
globPosVec[0] = globPosition.x() ;
globPosVec[1] = globPosition.y() ;
globPosVec[2] = globPosition.z() ;
pField = fieldMgr->GetDetectorField();
G4ThreeVector globPosition = trackData.GetPosition();
G4double globPosVec[4], FieldValueVec[6];
globPosVec[0] = globPosition.x();
globPosVec[1] = globPosition.y();
globPosVec[2] = globPosition.z();
globPosVec[3] = trackData.GetGlobalTime();
pField->GetFieldValue( globPosVec, FieldValueVec ) ;
pField->GetFieldValue( globPosVec, FieldValueVec );
FieldValue = G4ThreeVector( FieldValueVec[0],
FieldValueVec[1],
FieldValueVec[2] );
G4ThreeVector unitMomentum = aDynamicParticle->GetMomentumDirection();
G4ThreeVector unitMcrossB = FieldValue.cross(unitMomentum);
G4double perpB = unitMcrossB.mag() ;
G4double perpB = unitMcrossB.mag();
if(perpB > 0.0)
{
// M-C of synchrotron photon energy
@@ -255,15 +256,33 @@ G4SynchrotronRadiation::PostStepDoIt(const G4Track& trackData,
G4ParticleMomentum
particleDirection = aDynamicParticle->GetMomentumDirection();
// M-C of its direction
// M-C of its direction, simplified dipole boosted approach
G4double Teta = G4UniformRand()/gamma ; // Very roughly
// G4double Teta, fteta; // = G4UniformRand()/gamma; // Very roughly
G4double Phi = twopi * G4UniformRand() ;
G4double cosTheta, sinTheta, fcos, beta;
G4double dirx = std::sin(Teta)*std::cos(Phi) ,
diry = std::sin(Teta)*std::sin(Phi) ,
dirz = std::cos(Teta) ;
do
{
cosTheta = 1. - 2.*G4UniformRand();
fcos = (1 + cosTheta*cosTheta)*0.5;
}
while( fcos < G4UniformRand() );
beta = std::sqrt(1. - 1./(gamma*gamma));
cosTheta = (cosTheta + beta)/(1. + beta*cosTheta);
if( cosTheta > 1. ) cosTheta = 1.;
if( cosTheta < -1. ) cosTheta = -1.;
sinTheta = std::sqrt(1. - cosTheta*cosTheta );
G4double Phi = twopi * G4UniformRand();
G4double dirx = sinTheta*std::cos(Phi) ,
diry = sinTheta*std::sin(Phi) ,
dirz = cosTheta;
G4ThreeVector gammaDirection ( dirx, diry, dirz);
gammaDirection.rotateUz(particleDirection);
@@ -295,7 +314,7 @@ G4SynchrotronRadiation::PostStepDoIt(const G4Track& trackData,
// Update the incident particle
G4double newKinEnergy = kineticEnergy - energyOfSR ;
G4double newKinEnergy = kineticEnergy - energyOfSR;
aParticleChange.ProposeLocalEnergyDeposit (0.);
if (newKinEnergy > 0.)
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4SynchrotronRadiationInMat.cc,v 1.5 2010-10-14 18:38:21 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -41,6 +40,8 @@
///////////////////////////////////////////////////////////////////////////
#include "G4SynchrotronRadiationInMat.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Integrator.hh"
#include "G4EmProcessSubType.hh"
@@ -126,7 +127,12 @@ G4SynchrotronRadiationInMat::G4SynchrotronRadiationInMat(const G4String& process
TotBin(200),
theGamma (G4Gamma::Gamma() ),
theElectron ( G4Electron::Electron() ),
thePositron ( G4Positron::Positron() ), fAlpha(0.0), fRootNumber(80),
thePositron ( G4Positron::Positron() ),
GammaCutInKineticEnergy(0),
ElectronCutInKineticEnergy(0),
PositronCutInKineticEnergy(0),
ParticleCutInKineticEnergy(0),
fAlpha(0.0), fRootNumber(80),
fVerboseLevel( verboseLevel )
{
G4TransportationManager* transportMgr = G4TransportationManager::GetTransportationManager();
@@ -321,15 +327,33 @@ G4SynchrotronRadiationInMat::PostStepDoIt(const G4Track& trackData,
G4ParticleMomentum
particleDirection = aDynamicParticle->GetMomentumDirection();
// M-C of its direction
// M-C of its direction, simplified dipole busted approach
G4double Teta = G4UniformRand()/gamma ; // Very roughly
// G4double Teta = G4UniformRand()/gamma ; // Very roughly
G4double cosTheta, sinTheta, fcos, beta;
do
{
cosTheta = 1. - 2.*G4UniformRand();
fcos = (1 + cosTheta*cosTheta)*0.5;
}
while( fcos < G4UniformRand() );
beta = std::sqrt(1. - 1./(gamma*gamma));
cosTheta = (cosTheta + beta)/(1. + beta*cosTheta);
if( cosTheta > 1. ) cosTheta = 1.;
if( cosTheta < -1. ) cosTheta = -1.;
sinTheta = std::sqrt(1. - cosTheta*cosTheta );
G4double Phi = twopi * G4UniformRand() ;
G4double dirx = std::sin(Teta)*std::cos(Phi) ,
diry = std::sin(Teta)*std::sin(Phi) ,
dirz = std::cos(Teta) ;
G4double dirx = sinTheta*std::cos(Phi) ,
diry = sinTheta*std::sin(Phi) ,
dirz = cosTheta;
G4ThreeVector gammaDirection ( dirx, diry, dirz);
gammaDirection.rotateUz(particleDirection);
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TransitionRadiation.cc,v 1.10 2010-10-14 18:38:21 vnivanch Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// G4TransitionRadiation class -- implementation file
@@ -24,13 +24,13 @@
// ********************************************************************
//
//
// $Id: G4TransparentRegXTRadiator.cc,v 1.12 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
#include <complex>
#include "G4TransparentRegXTRadiator.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
#include "G4Integrator.hh"
#include "G4Gamma.hh"
@@ -70,7 +70,7 @@ G4TransparentRegXTRadiator::~G4TransparentRegXTRadiator()
G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy)
{
G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC/*, aMa, bMb ,sigma*/;
G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k /*, aMa, bMb ,sigma*/;
G4int k, kMax, kMin;
//aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
@@ -86,6 +86,8 @@ G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy)
cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy;
cofMin /= cofPHC;
theta2 = cofPHC/(energy*(fPlateThick + fGasThick));
// if (fGamma < 1200) kMin = G4int(cofMin); // 1200 ?
// else kMin = 1;
@@ -100,12 +102,16 @@ G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy)
// kMax += kMin;
kMax = kMin + 19; // 9; // kMin + G4int(tmp);
kMax = kMin + 49; // 19; // kMin + G4int(tmp);
// tmp /= fGamma;
// if( G4int(tmp) < kMin ) kMin = G4int(tmp);
// G4cout<<"kMin = "<<kMin<<"; kMax = "<<kMax<<G4endl;
if(verboseLevel > 2)
{
G4cout<<cof1<<" "<<cof2<<" "<<cofMin<<G4endl;
G4cout<<"kMin = "<<kMin<<"; kMax = "<<kMax<<G4endl;
}
for( k = kMin; k <= kMax; k++ )
{
tmp = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick);
@@ -119,10 +125,14 @@ G4double G4TransparentRegXTRadiator::SpectralXTRdEdx(G4double energy)
{
sum += std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
theta2k = std::sqrt(theta2*std::abs(k-cofMin));
if(verboseLevel > 2)
{
G4cout<<"k = "<<k<<"; tmp = "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
<<"; sum = "<<sum<<G4endl;
// G4cout<<"k = "<<k<<"; sqrt(theta2k) = "<<theta2k<<"; tmp = "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
// <<"; sum = "<<sum<<G4endl;
G4cout<<k<<" "<<theta2k<<" "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
<<" "<<sum<<G4endl;
}
}
result = 4*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy;
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VTransitionRadiation.cc,v 1.6 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// G4VTransitionRadiation class -- implementation file
@@ -48,6 +47,8 @@
G4VTransitionRadiation::G4VTransitionRadiation( const G4String& processName,
G4ProcessType type )
: G4VDiscreteProcess(processName, type),
region(0),
model(0),
nSteps(0),
gammaMin(100),
cosDThetaMax(std::cos(0.1))
@@ -151,9 +152,9 @@ void G4VTransitionRadiation::SetRegion(const G4Region* reg)
///////////////////////////////////////////////////////////////////////
void G4VTransitionRadiation::SetModel(G4VTRModel* m)
void G4VTransitionRadiation::SetModel(G4VTRModel* mod)
{
model = m;
model = mod;
}
///////////////////////////////////////////////////////////////////////
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VXTRenergyLoss.cc,v 1.45 2010-06-16 15:34:15 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// History:
// 2001-2002 R&D by V.Grichine
@@ -36,9 +35,12 @@
// 28.09.07, V.Ivanchenko general cleanup without change of algorithms
//
#include "G4Timer.hh"
#include "G4VXTRenergyLoss.hh"
#include "G4Timer.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Poisson.hh"
#include "G4MaterialTable.hh"
#include "G4VDiscreteProcess.hh"
@@ -81,7 +83,7 @@ G4VXTRenergyLoss::G4VXTRenergyLoss(G4LogicalVolume *anEnvelope,
// Initialization of local constants
fTheMinEnergyTR = 1.0*keV;
fTheMaxEnergyTR = 100.0*keV;
fTheMaxAngle = 1.0e-3;
fTheMaxAngle = 1.0e-2;
fTheMinAngle = 5.0e-6;
fBinTR = 50;
@@ -266,13 +268,16 @@ void G4VXTRenergyLoss::BuildPhysicsTable(const G4ParticleDefinition& pd)
G4Exception("G4VXTRenergyLoss::BuildPhysicsTable", "Notification", JustWarning,
"XTR initialisation for neutral particle ?!" );
}
BuildTable();
BuildEnergyTable();
if (fAngleRadDistr)
{
if(verboseLevel > 0)
G4cout<<"Build angle distribution according the transparent regular radiator"
{
G4cout<<"Build angle for energy distribution according the current radiator"
<<G4endl;
BuildAngleTable();
}
BuildAngleForEnergyBank();
}
}
@@ -281,10 +286,11 @@ void G4VXTRenergyLoss::BuildPhysicsTable(const G4ParticleDefinition& pd)
//
// Build integral energy distribution of XTR photons
void G4VXTRenergyLoss::BuildTable()
void G4VXTRenergyLoss::BuildEnergyTable()
{
G4int iTkin, iTR, iPlace;
G4double radiatorCof = 1.0; // for tuning of XTR yield
G4double energySum = 0.0;
fEnergyDistrTable = new G4PhysicsTable(fTotBin);
if(fAngleRadDistr) fAngleDistrTable = new G4PhysicsTable(fTotBin);
@@ -298,12 +304,15 @@ void G4VXTRenergyLoss::BuildTable()
if(fGammaTkinCut > fTheMaxEnergyTR) fMaxEnergyTR = 2.0*fGammaTkinCut;
else fMaxEnergyTR = fTheMaxEnergyTR;
G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
G4cout.precision(4);
G4Timer timer;
timer.Start();
if(verboseLevel > 0) {
if(verboseLevel > 0)
{
G4cout<<G4endl;
G4cout<<"Lorentz Factor"<<"\t"<<"XTR photon number"<<G4endl;
G4cout<<G4endl;
@@ -317,49 +326,33 @@ void G4VXTRenergyLoss::BuildTable()
fGamma = 1.0 + (fProtonEnergyVector->
GetLowEdgeEnergy(iTkin)/proton_mass_c2);
fMaxThetaTR = 25.0/(fGamma*fGamma); // theta^2
fMaxThetaTR = 2500.0/(fGamma*fGamma) ; // theta^2
fTheMinAngle = 1.0e-3; // was 5.e-6, e-6 !!!, e-5, e-4
if( fMaxThetaTR > fTheMaxAngle ) fMaxThetaTR = fTheMaxAngle;
else
{
if( fMaxThetaTR < fTheMinAngle ) fMaxThetaTR = fTheMinAngle;
}
G4PhysicsLinearVector* angleVector = new G4PhysicsLinearVector(0.0,
fMaxThetaTR,
fBinTR );
G4double energySum = 0.0;
G4double angleSum = 0.0;
G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
if( fMaxThetaTR > fTheMaxAngle ) fMaxThetaTR = fTheMaxAngle;
else if( fMaxThetaTR < fTheMinAngle ) fMaxThetaTR = fTheMinAngle;
energySum = 0.0;
energyVector->PutValue(fBinTR-1,energySum);
angleVector->PutValue(fBinTR-1,angleSum);
for( iTR = fBinTR - 2; iTR >= 0; iTR-- )
{
// Legendre96 or Legendre20
{
// Legendre96 or Legendre10
energySum += radiatorCof*fCofTR*integral.Legendre10(
energySum += radiatorCof*fCofTR*integral.Legendre10(
this,&G4VXTRenergyLoss::SpectralXTRdEdx,
energyVector->GetLowEdgeEnergy(iTR),
energyVector->GetLowEdgeEnergy(iTR+1) );
energyVector->PutValue(iTR,energySum/fTotalDist);
}
iPlace = iTkin;
fEnergyDistrTable->insertAt(iPlace,energyVector);
if(fAngleRadDistr)
{
angleSum += fCofTR*integral.Legendre10(
this,&G4VXTRenergyLoss::AngleXTRdEdx,
angleVector->GetLowEdgeEnergy(iTR),
angleVector->GetLowEdgeEnergy(iTR+1) );
angleVector ->PutValue(iTR,angleSum);
}
energyVector->PutValue(iTR,energySum/fTotalDist);
}
if(verboseLevel > 0)
{
{
G4cout
// <<iTkin<<"\t"
// <<"fGamma = "
@@ -367,14 +360,12 @@ void G4VXTRenergyLoss::BuildTable()
// <<"sumN = "
<<energySum // <<"; sumA = "<<angleSum
<<G4endl;
}
iPlace = iTkin;
fEnergyDistrTable->insertAt(iPlace,energyVector);
if(fAngleRadDistr) fAngleDistrTable->insertAt(iPlace,angleVector);
}
}
timer.Stop();
G4cout.precision(6);
if(verboseLevel > 0) {
if(verboseLevel > 0)
{
G4cout<<G4endl;
G4cout<<"total time for build X-ray TR energy loss tables = "
<<timer.GetUserElapsed()<<" s"<<G4endl;
@@ -385,10 +376,92 @@ void G4VXTRenergyLoss::BuildTable()
//////////////////////////////////////////////////////////////////////////
//
//
// Bank of angle distributions for given energies (slow!)
void G4VXTRenergyLoss::BuildEnergyTable()
void G4VXTRenergyLoss::BuildAngleForEnergyBank()
{
if( this->GetProcessName() == "TranspRegXTRadiator" ||
this->GetProcessName() == "TranspRegXTRmodel" ||
this->GetProcessName() == "RegularXTRadiator" ||
this->GetProcessName() == "RegularXTRmodel" )
{
BuildAngleTable();
return;
}
G4int i, iTkin, iTR;
G4double angleSum = 0.0;
fGammaTkinCut = 0.0;
// setting of min/max TR energies
if(fGammaTkinCut > fTheMinEnergyTR) fMinEnergyTR = fGammaTkinCut;
else fMinEnergyTR = fTheMinEnergyTR;
if(fGammaTkinCut > fTheMaxEnergyTR) fMaxEnergyTR = 2.0*fGammaTkinCut;
else fMaxEnergyTR = fTheMaxEnergyTR;
G4PhysicsLogVector* energyVector = new G4PhysicsLogVector( fMinEnergyTR,
fMaxEnergyTR,
fBinTR );
G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
G4cout.precision(4);
G4Timer timer;
timer.Start();
for( iTkin = 0; iTkin < fTotBin; iTkin++ ) // Lorentz factor loop
{
fGamma = 1.0 + (fProtonEnergyVector->
GetLowEdgeEnergy(iTkin)/proton_mass_c2);
fMaxThetaTR = 2500.0/(fGamma*fGamma) ; // theta^2
fTheMinAngle = 1.0e-3; // was 5.e-6, e-6 !!!, e-5, e-4
if( fMaxThetaTR > fTheMaxAngle ) fMaxThetaTR = fTheMaxAngle;
else if( fMaxThetaTR < fTheMinAngle ) fMaxThetaTR = fTheMinAngle;
fAngleForEnergyTable = new G4PhysicsTable(fBinTR);
for( iTR = 0; iTR < fBinTR; iTR++ )
{
angleSum = 0.0;
fEnergy = energyVector->GetLowEdgeEnergy(iTR);
G4PhysicsLinearVector* angleVector = new G4PhysicsLinearVector(0.0,
fMaxThetaTR,
fBinTR );
angleVector ->PutValue(fBinTR - 1, angleSum);
for( i = fBinTR - 2; i >= 0; i-- )
{
// Legendre96 or Legendre10
angleSum += integral.Legendre10(
this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
angleVector->GetLowEdgeEnergy(i),
angleVector->GetLowEdgeEnergy(i+1) );
angleVector ->PutValue(i, angleSum);
}
fAngleForEnergyTable->insertAt(iTR, angleVector);
}
fAngleBank.push_back(fAngleForEnergyTable);
}
timer.Stop();
G4cout.precision(6);
if(verboseLevel > 0)
{
G4cout<<G4endl;
G4cout<<"total time for build X-ray TR angle for energy loss tables = "
<<timer.GetUserElapsed()<<" s"<<G4endl;
}
fGamma = 0.;
return;
}
////////////////////////////////////////////////////////////////////////
@@ -414,7 +487,8 @@ void G4VXTRenergyLoss::BuildAngleTable()
G4cout.precision(4);
G4Timer timer;
timer.Start();
if(verboseLevel > 0) {
if(verboseLevel > 0)
{
G4cout<<G4endl;
G4cout<<"Lorentz Factor"<<"\t"<<"XTR photon number"<<G4endl;
G4cout<<G4endl;
@@ -453,7 +527,8 @@ void G4VXTRenergyLoss::BuildAngleTable()
}
timer.Stop();
G4cout.precision(6);
if(verboseLevel > 0) {
if(verboseLevel > 0)
{
G4cout<<G4endl;
G4cout<<"total time for build XTR angle for given energy tables = "
<<timer.GetUserElapsed()<<" s"<<G4endl;
@@ -487,6 +562,7 @@ G4PhysicsFreeVector* G4VXTRenergyLoss::GetAngleVector(G4double energy, G4int n)
if (cofMin > kMin) kMin++;
//kMax = kMin + fBinTR -1;
if(verboseLevel > 2)
{
G4cout<<"n-1 = "<<n-1<<"; theta = "
@@ -494,9 +570,9 @@ G4PhysicsFreeVector* G4VXTRenergyLoss::GetAngleVector(G4double energy, G4int n)
<<0.
<<"; angleSum = "<<angleSum<<G4endl;
}
angleVector->PutValue(n-1,fMaxThetaTR, angleSum);
// angleVector->PutValue(n-1,fMaxThetaTR, angleSum);
for( iTheta = n - 2; iTheta >= 1; iTheta-- )
for( iTheta = n - 1; iTheta >= 1; iTheta-- )
{
k = iTheta- 1 + kMin;
@@ -511,11 +587,13 @@ G4PhysicsFreeVector* G4VXTRenergyLoss::GetAngleVector(G4double energy, G4int n)
{
angleSum += 0.5*tmp; // 0.5*std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
else if(iTheta == n-1);
else
{
angleSum += tmp; // std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
theta = std::abs(k-cofMin)*cofPHC/energy/(fPlateThick + fGasThick);
if(verboseLevel > 2)
{
G4cout<<"iTheta = "<<iTheta<<"; k = "<<k<<"; theta = "
@@ -710,7 +788,7 @@ G4VParticleChange* G4VXTRenergyLoss::PostStepDoIt( const G4Track& aTrack,
// theta = std::fabs(G4RandGauss::shoot(0.0,pi/gamma));
theta2 = GetRandomAngle(energyTR,iTkin);
if(theta2 > 0.) theta = std::sqrt(theta2);
else theta = theta2;
else theta = 0.; // theta2;
}
else theta = std::fabs(G4RandGauss::shoot(0.0,pi/gamma));
@@ -810,7 +888,7 @@ G4double G4VXTRenergyLoss::SpectralAngleXTRdEdx(G4double varAngle)
G4double G4VXTRenergyLoss::SpectralXTRdEdx(G4double energy)
{
G4int i, iMax = 8;
G4double result = 0.0;
G4double angleSum = 0.0;
G4double lim[8] = { 0.0, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0 };
@@ -819,16 +897,34 @@ G4double G4VXTRenergyLoss::SpectralXTRdEdx(G4double energy)
G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
fEnergy = energy;
for( i = 0; i < iMax-1; i++ )
/*
if( fAngleRadDistr && ( fEnergy == fEnergyForAngle ) )
{
result += integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
lim[i],lim[i+1]);
// result += integral.Legendre10(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
// lim[i],lim[i+1]);
}
fAngleVector ->PutValue(fBinTR - 1, angleSum);
return result;
for( i = fBinTR - 2; i >= 0; i-- )
{
angleSum += integral.Legendre10(
this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
fAngleVector->GetLowEdgeEnergy(i),
fAngleVector->GetLowEdgeEnergy(i+1) );
fAngleVector ->PutValue(i, angleSum);
}
}
else
*/
{
for( i = 0; i < iMax-1; i++ )
{
angleSum += integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
lim[i],lim[i+1]);
// result += integral.Legendre10(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
// lim[i],lim[i+1]);
}
}
return angleSum;
}
//////////////////////////////////////////////////////////////////////////
@@ -28,6 +28,7 @@
#include <complex>
#include "G4XTRRegularRadModel.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
#include "G4Gamma.hh"
@@ -60,6 +61,99 @@ G4XTRRegularRadModel::~G4XTRRegularRadModel()
;
}
///////////////////////////////////////////////////////////////////////////
//
//
G4double G4XTRRegularRadModel::SpectralXTRdEdx(G4double energy)
{
G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k;
G4double aMa, bMb ,sigma, dump;
G4int k, kMax, kMin;
aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
bMb = fGasThick*GetGasLinearPhotoAbs(energy);
sigma = 0.5*(aMa + bMb);
dump = std::exp(-fPlateNumber*sigma);
if(verboseLevel > 2) G4cout<<" dump = "<<dump<<G4endl;
cofPHC = 4*pi*hbarc;
tmp = (fSigma1 - fSigma2)/cofPHC/energy;
cof1 = fPlateThick*tmp;
cof2 = fGasThick*tmp;
cofMin = energy*(fPlateThick + fGasThick)/fGamma/fGamma;
cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy;
cofMin /= cofPHC;
theta2 = cofPHC/(energy*(fPlateThick + fGasThick));
// if (fGamma < 1200) kMin = G4int(cofMin); // 1200 ?
// else kMin = 1;
kMin = G4int(cofMin);
if (cofMin > kMin) kMin++;
// tmp = (fPlateThick + fGasThick)*energy*fMaxThetaTR;
// tmp /= cofPHC;
// kMax = G4int(tmp);
// if(kMax < 0) kMax = 0;
// kMax += kMin;
kMax = kMin + 49; // 19; // kMin + G4int(tmp);
// tmp /= fGamma;
// if( G4int(tmp) < kMin ) kMin = G4int(tmp);
if(verboseLevel > 2)
{
G4cout<<cof1<<" "<<cof2<<" "<<cofMin<<G4endl;
G4cout<<"kMin = "<<kMin<<"; kMax = "<<kMax<<G4endl;
}
for( k = kMin; k <= kMax; k++ )
{
tmp = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick);
result = (k - cof1)*(k - cof1)*(k + cof2)*(k + cof2);
// tmp = std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
if( k == kMin && kMin == G4int(cofMin) )
{
sum += 0.5*std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
else
{
sum += std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
}
theta2k = std::sqrt(theta2*std::abs(k-cofMin));
if(verboseLevel > 2)
{
// G4cout<<"k = "<<k<<"; sqrt(theta2k) = "<<theta2k<<"; tmp = "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
// <<"; sum = "<<sum<<G4endl;
G4cout<<k<<" "<<theta2k<<" "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
<<" "<<sum<<G4endl;
}
}
result = 2*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy;
// result *= ( 1 - std::exp(-0.5*fPlateNumber*sigma) )/( 1 - std::exp(-0.5*sigma) );
// fPlateNumber;
result *= dump*( -1 + dump + 2*fPlateNumber );
/*
fEnergy = energy;
// G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
G4Integrator<G4TransparentRegXTRadiator,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
tmp = integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
0.0,0.3*fMaxThetaTR) +
integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
0.3*fMaxThetaTR,0.6*fMaxThetaTR) +
integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
0.6*fMaxThetaTR,fMaxThetaTR) ;
result += tmp;
*/
return result;
}
///////////////////////////////////////////////////////////////////////////
@@ -28,6 +28,7 @@
#include <complex>
#include "G4XTRTransparentRegRadModel.hh"
#include "G4PhysicalConstants.hh"
#include "Randomize.hh"
#include "G4Integrator.hh"
#include "G4Gamma.hh"