Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -73,12 +73,14 @@
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "Randomize.hh"
#include "G4PhysicsModelCatalog.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
: G4VProcess(processName, type)
, fNumPhotons(0)
{
secID = G4PhysicsModelCatalog::GetModelID("model_Cerenkov");
SetProcessSubType(fCerenkov);
thePhysicsTable = nullptr;
@@ -110,7 +112,8 @@ void G4Cerenkov::ProcessDescription(std::ostream& out) const
G4OpticalParameters* params = G4OpticalParameters::Instance();
out << "Maximum beta change per step: " << params->GetCerenkovMaxBetaChange();
out << "Maximum photons per step: " << params->GetCerenkovMaxPhotonsPerStep();
out << "Track secondaries first: " << params->GetCerenkovTrackSecondariesFirst();
out << "Track secondaries first: "
<< params->GetCerenkovTrackSecondariesFirst();
out << "Stack photons: " << params->GetCerenkovStackPhotons();
out << "Verbose level: " << params->GetCerenkovVerboseLevel();
}
@@ -155,12 +158,12 @@ void G4Cerenkov::BuildPhysicsTable(const G4ParticleDefinition&)
// Retrieve vector of refraction indices for the material
// from the material's optical properties table
G4Material* aMaterial = (*theMaterialTable)[i];
G4Material* aMaterial = (*theMaterialTable)[i];
G4MaterialPropertiesTable* MPT = aMaterial->GetMaterialPropertiesTable();
if(MPT)
{
cerenkovIntegral = new G4PhysicsFreeVector();
cerenkovIntegral = new G4PhysicsFreeVector();
G4MaterialPropertyVector* refractiveIndex = MPT->GetProperty(kRINDEX);
if(refractiveIndex)
@@ -273,8 +276,8 @@ G4VParticleChange* G4Cerenkov::PostStepDoIt(const G4Track& aTrack,
}
////////////////////////////////////////////////////////////////
G4double Pmin = Rindex->GetMinLowEdgeEnergy();
G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
G4double Pmin = Rindex->Energy(0);
G4double Pmax = Rindex->GetMaxEnergy();
G4double dp = Pmax - Pmin;
G4double nMax = Rindex->GetMaxValue();
@@ -369,6 +372,7 @@ G4VParticleChange* G4Cerenkov::PostStepDoIt(const G4Track& aTrack,
aSecondaryTrack->SetTouchableHandle(
aStep.GetPreStepPoint()->GetTouchableHandle());
aSecondaryTrack->SetParentID(aTrack.GetTrackID());
aSecondaryTrack->SetCreatorModelID(secID);
aParticleChange.AddSecondary(aSecondaryTrack);
}
@@ -454,9 +458,10 @@ G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
particleType, kineticEnergy, couple);
G4double Step = Range - RangeMin;
// If the step is smaller than 1e-15 mm, it may happen that the particle
// does not move. See bug 1992.
if(Step < 1.e-15 * mm)
// If the step is smaller than G4ThreeVector::getTolerance(), it may happen
// that the particle does not move. See bug 1992.
static const G4double minAllowedStep = G4ThreeVector::getTolerance();
if(Step < minAllowedStep)
return StepLimit;
if(Step < StepLimit)
@@ -512,22 +517,22 @@ G4double G4Cerenkov::GetAverageNumberOfPhotons(
G4int materialIndex = aMaterial->GetIndex();
// Retrieve the Cerenkov Angle Integrals for this material
G4PhysicsFreeVector* CerenkovAngleIntegrals =
(G4PhysicsFreeVector*) ((*thePhysicsTable)(materialIndex));
G4PhysicsVector* CerenkovAngleIntegrals = ((*thePhysicsTable)(materialIndex));
if(!(CerenkovAngleIntegrals->IsFilledVectorExist()))
G4int length = CerenkovAngleIntegrals->GetVectorLength();
if(0 == length)
return 0.0;
// Min and Max photon energies
G4double Pmin = Rindex->GetMinLowEdgeEnergy();
G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
G4double Pmin = Rindex->Energy(0);
G4double Pmax = Rindex->GetMaxEnergy();
// Min and Max Refraction Indices
G4double nMin = Rindex->GetMinValue();
G4double nMax = Rindex->GetMaxValue();
// Max Cerenkov Angle Integral
G4double CAImax = CerenkovAngleIntegrals->GetMaxValue();
G4double CAImax = (*CerenkovAngleIntegrals)[length - 1];
G4double dp, ge;
// If n(Pmax) < 1/Beta -- no photons generated
@@ -571,18 +576,28 @@ G4double G4Cerenkov::GetAverageNumberOfPhotons(
void G4Cerenkov::SetTrackSecondariesFirst(const G4bool state)
{
fTrackSecondariesFirst = state;
G4OpticalParameters::Instance()->SetCerenkovTrackSecondariesFirst(
fTrackSecondariesFirst);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Cerenkov::SetMaxBetaChangePerStep(const G4double value)
{
fMaxBetaChange = value * CLHEP::perCent;
G4OpticalParameters::Instance()->SetCerenkovMaxBetaChange(fMaxBetaChange);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Cerenkov::SetMaxNumPhotonsPerStep(const G4int NumPhotons)
{
fMaxPhotons = NumPhotons;
G4OpticalParameters::Instance()->SetCerenkovMaxPhotonsPerStep(fMaxPhotons);
}
void G4Cerenkov::SetStackPhotons(const G4bool stackingFlag)
{
fStackingFlag = stackingFlag;
G4OpticalParameters::Instance()->SetCerenkovStackPhotons(fStackingFlag);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -591,6 +606,13 @@ void G4Cerenkov::DumpPhysicsTable() const
G4cout << "Dump Physics Table!" << G4endl;
for(size_t i = 0; i < thePhysicsTable->entries(); ++i)
{
((G4PhysicsFreeVector*) (*thePhysicsTable)[i])->DumpValues();
(*thePhysicsTable)[i]->DumpValues();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Cerenkov::SetVerboseLevel(G4int verbose)
{
verboseLevel = verbose;
G4OpticalParameters::Instance()->SetCerenkovVerboseLevel(verboseLevel);
}
@@ -44,6 +44,7 @@
#include "G4Poisson.hh"
#include "G4ProductionCutsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicsModelCatalog.hh"
//////////////////////////////////////////////////////////////////////
//
@@ -58,6 +59,7 @@ G4ForwardXrayTR::G4ForwardXrayTR(const G4String& matName1,
const G4String& processName)
: G4TransitionRadiation(processName)
{
secID = G4PhysicsModelCatalog::GetModelID("model_XrayTR");
fPtrGamma = nullptr;
fGammaCutInKineticEnergy = nullptr;
fGammaTkinCut = fMinEnergyTR = fMaxEnergyTR = fMaxThetaTR = 0.0;
@@ -532,7 +534,13 @@ G4VParticleChange* G4ForwardXrayTR::PostStepDoIt(const G4Track& aTrack,
directionTR.rotateUz(particleDir);
G4DynamicParticle* aPhotonTR =
new G4DynamicParticle(G4Gamma::Gamma(), directionTR, energyTR);
aParticleChange.AddSecondary(aPhotonTR);
// Create the G4Track
G4Track* aSecondaryTrack = new G4Track(aPhotonTR, aTrack.GetGlobalTime(), aTrack.GetPosition());
aSecondaryTrack->SetTouchableHandle(aStep.GetPostStepPoint()->GetTouchableHandle());
aSecondaryTrack->SetParentID(aTrack.GetTrackID());
aSecondaryTrack->SetCreatorModelID(secID);
aParticleChange.AddSecondary(aSecondaryTrack);
}
}
}
@@ -607,7 +615,13 @@ G4VParticleChange* G4ForwardXrayTR::PostStepDoIt(const G4Track& aTrack,
directionTR.rotateUz(particleDir);
G4DynamicParticle* aPhotonTR =
new G4DynamicParticle(G4Gamma::Gamma(), directionTR, energyTR);
aParticleChange.AddSecondary(aPhotonTR);
// Create the G4Track
G4Track* aSecondaryTrack = new G4Track(aPhotonTR, aTrack.GetGlobalTime(), aTrack.GetPosition());
aSecondaryTrack->SetTouchableHandle(aStep.GetPostStepPoint()->GetTouchableHandle());
aSecondaryTrack->SetParentID(aTrack.GetTrackID());
aSecondaryTrack->SetCreatorModelID(secID);
aParticleChange.AddSecondary(aSecondaryTrack);
}
}
}
@@ -0,0 +1,218 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// 19.09.21 V. Grichine, first version
//
#include "G4GaussXTRadiator.hh"
#include "G4PhysicalConstants.hh"
////////////////////////////////////////////////////////////////////////////
// Constructor, destructor
G4GaussXTRadiator::G4GaussXTRadiator(
G4LogicalVolume* anEnvelope, G4double alphaPlate, G4double alphaGas, G4Material* foilMat, G4Material* gasMat,
G4double a, G4double b, G4int n, const G4String& processName)
: G4VXTRenergyLoss(anEnvelope, foilMat, gasMat, a, b, n, processName)
{
if(verboseLevel > 0)
G4cout << "Gauss X-ray TR radiator EM process is called"
<< G4endl;
fAlphaPlate = alphaPlate;
fAlphaGas = alphaGas; // 1000; //
}
///////////////////////////////////////////////////////////////////////////
G4GaussXTRadiator::~G4GaussXTRadiator() {}
///////////////////////////////////////////////////////////////////////////
void G4GaussXTRadiator::ProcessDescription(std::ostream& out) const
{
out << "Simulation of forward X-ray transition radiation generated by\n"
"relativistic charged particles crossing the interface between\n"
"two materials.\n";
}
///////////////////////////////////////////////////////////////////////////
G4double G4GaussXTRadiator::SpectralXTRdEdx(G4double energy)
{
G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k;
G4int k, kMax, kMin;
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));
kMin = G4int(cofMin);
if(cofMin > kMin)
kMin++;
kMax = kMin + 49;
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);
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 << " " << theta2k << " "
<< std::sin(tmp) * std::sin(tmp) * std::abs(k - cofMin) / result
<< " " << sum << G4endl;
}
}
result = 4. * (cof1 + cof2) * (cof1 + cof2) * sum / energy;
result *= fPlateNumber;
return result;
}
///////////////////////////////////////////////////////////////////////////
//
// Approximation for radiator interference factor for the case of
// Gauss-distributed regular radiator. The plate and gas gap thicknesses are Gauss distributed with RMS
// sa and sb for plate and gas, respectively.
// The mean values of the plate and gas gap thicknesses
// are supposed to be about XTR formation zones.
G4double G4GaussXTRadiator::GetStackFactor(G4double energy,
G4double gamma,
G4double varAngle)
{
G4double result, Qa, Qb, Q, Qn, aZa, bZb, aMa, bMb;
G4double Ma, Mb, Za, Zb;
G4double sa = fPlateThick/fAlphaPlate;
G4double sb = fGasThick/fAlphaGas;
Za = GetPlateFormationZone(energy, gamma, varAngle);
aZa = fPlateThick / Za ;
Zb = GetGasFormationZone(energy, gamma, varAngle);
bZb = fGasThick / Zb ;
Ma = GetPlateLinearPhotoAbs(energy);
aMa = fPlateThick * Ma;
Mb = GetGasLinearPhotoAbs(energy);
bMb = fGasThick * Mb;
// Gauss fluctuation of gas gaps according to RMS = sb = b/fAlphaGas
G4double gre, gim, pre, pim;
pre = -0.5 * aMa - sa * sa * ( 4./ Za / Za - Ma*Ma )/8.;
gre = -0.5 * bMb - sb * sb * ( 4./ Zb / Zb - Mb*Mb )/8.;
pim = sa * sa * Ma/2./Za - aZa;
gim = sb * sb * Mb/2./Zb - bZb;
Qa = std::exp(pre);
Qb = std::exp(gre);
// Q = Qa * Qb;
G4complex Ha( Qa * std::cos(pim), Qa * std::sin(pim) );
G4complex Hb( Qb * std::cos(gim), Qb * std::sin(gim) );
G4double hre, him, hnre, hnim;
hre = pre + gre;
him = pim + gim;
G4double nn = G4double(fPlateNumber);
hnre = nn*hre;
hnim = nn*him;
Q = std::exp(hre);
Qn = std::exp(hnre);
// G4complex H = Ha * Hb;
G4complex H( Q * std::cos(him), Q * std::sin(him) );
G4complex Hn( Qn * std::cos(hnim), Qn * std::sin(hnim) );
// G4complex Hs = conj(H);
// G4double sigma, D;
// sigma = aMa * fPlateThick + bMb * fGasThick;
// D = 1.0 / ((1 - Q) * (1 - Q) + 4 * Q * std::sin(0.5 * (aZa + bZb)) * std::sin(0.5 * (aZa + bZb)));
// G4complex F1 = ( 1.0 - Ha ) * ( 1.0 - Hb ) * ( 1.0 - Hs ) * G4double(fPlateNumber) * D;
G4complex F1 = ( 1.0 - Ha ) * ( 1.0 - Hb ) * nn / ( 1. - H );
// G4complex F2 = ( 1.0 - Ha ) * ( 1.0 - Ha ) * Hb * ( 1.0 - Hs ) * ( 1.0 - Hs ) * (1.0 - std::exp( -0.5 * fPlateNumber * sigma) ) * D * D;
G4complex F2 = ( 1.0 - Ha ) * ( 1.0 - Ha ) * Hb * ( 1. - Hn ) / ( 1. - H ) / ( 1. - H );
G4complex R = (F1 + F2) * OneInterfaceXTRdEdx(energy, gamma, varAngle);
result = 2.0 * std::real(R);
return result;
}
@@ -82,6 +82,7 @@
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "Randomize.hh"
#include "G4PhysicsModelCatalog.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Scintillation::G4Scintillation(const G4String& processName,
@@ -93,6 +94,7 @@ G4Scintillation::G4Scintillation(const G4String& processName,
, fEmSaturation(nullptr)
, fNumPhotons(0)
{
secID = G4PhysicsModelCatalog::GetModelID("model_Scintillation");
SetProcessSubType(fScintillation);
#ifdef G4DEBUG_SCINTILLATION
@@ -147,9 +149,9 @@ void G4Scintillation::ProcessDescription(std::ostream& out) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4Scintillation::IsApplicable(const G4ParticleDefinition& aParticleType)
{
if (aParticleType.GetParticleName() == "opticalphoton")
if(aParticleType.GetParticleName() == "opticalphoton")
return false;
if (aParticleType.IsShortLived())
if(aParticleType.IsShortLived())
return false;
return true;
}
@@ -218,7 +220,8 @@ void G4Scintillation::BuildPhysicsTable(const G4ParticleDefinition&)
if(MPT)
{
G4MaterialPropertyVector* MPV = MPT->GetProperty(kSCINTILLATIONCOMPONENT1);
G4MaterialPropertyVector* MPV =
MPT->GetProperty(kSCINTILLATIONCOMPONENT1);
if(MPV)
{
// Retrieve the first intensity point in vector
@@ -387,7 +390,6 @@ G4VParticleChange* G4Scintillation::PostStepDoIt(const G4Track& aTrack,
G4double yield3 = 0.;
G4double sum_yields = 0.;
if(fScintillationByParticleType)
{
MeanNumberOfPhotons = GetScintillationYieldByParticleType(
@@ -406,8 +408,7 @@ G4VParticleChange* G4Scintillation::PostStepDoIt(const G4Track& aTrack,
: 0.;
// The default linear scintillation process
// Units: [# scintillation photons / MeV]
MeanNumberOfPhotons =
MPT->GetConstProperty(kSCINTILLATIONYIELD);
MeanNumberOfPhotons = MPT->GetConstProperty(kSCINTILLATIONYIELD);
// Birk's correction via fEmSaturation and specifying scintillation by
// by particle type are physically mutually exclusive
if(fEmSaturation)
@@ -418,7 +419,6 @@ G4VParticleChange* G4Scintillation::PostStepDoIt(const G4Track& aTrack,
}
sum_yields = yield1 + yield2 + yield3;
if(MeanNumberOfPhotons > 10.)
{
G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
@@ -577,6 +577,7 @@ G4VParticleChange* G4Scintillation::PostStepDoIt(const G4Track& aTrack,
secTrack->SetTouchableHandle(
aStep.GetPreStepPoint()->GetTouchableHandle());
secTrack->SetParentID(aTrack.GetTrackID());
secTrack->SetCreatorModelID(secID);
if(fScintillationTrackInfo)
secTrack->SetUserInformation(
new G4ScintillationTrackInformation(scintType));
@@ -593,20 +594,6 @@ G4VParticleChange* G4Scintillation::PostStepDoIt(const G4Track& aTrack,
return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetScintillationByParticleType(const G4bool scintType)
{
if(fEmSaturation && scintType)
{
G4Exception("G4Scintillation::SetScintillationByParticleType", "Scint02",
JustWarning,
"Redefinition: Birks Saturation is replaced by "
"ScintillationByParticleType!");
RemoveSaturation();
}
fScintillationByParticleType = scintType;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4Scintillation::GetMeanFreePath(const G4Track&, G4double,
G4ForceCondition* condition)
@@ -866,3 +853,55 @@ void G4Scintillation::DumpPhysicsTable() const
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetTrackSecondariesFirst(const G4bool state)
{
fTrackSecondariesFirst = state;
G4OpticalParameters::Instance()->SetScintTrackSecondariesFirst(
fTrackSecondariesFirst);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetFiniteRiseTime(const G4bool state)
{
fFiniteRiseTime = state;
G4OpticalParameters::Instance()->SetScintFiniteRiseTime(fFiniteRiseTime);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetScintillationByParticleType(const G4bool scintType)
{
if(fEmSaturation && scintType)
{
G4Exception("G4Scintillation::SetScintillationByParticleType", "Scint02",
JustWarning,
"Redefinition: Birks Saturation is replaced by "
"ScintillationByParticleType!");
RemoveSaturation();
}
fScintillationByParticleType = scintType;
G4OpticalParameters::Instance()->SetScintByParticleType(
fScintillationByParticleType);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetScintillationTrackInfo(const G4bool trackType)
{
fScintillationTrackInfo = trackType;
G4OpticalParameters::Instance()->SetScintTrackInfo(fScintillationTrackInfo);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetStackPhotons(const G4bool stackingFlag)
{
fStackingFlag = stackingFlag;
G4OpticalParameters::Instance()->SetScintStackPhotons(fStackingFlag);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Scintillation::SetVerboseLevel(G4int verbose)
{
verboseLevel = verbose;
G4OpticalParameters::Instance()->SetScintVerboseLevel(verboseLevel);
}
@@ -47,6 +47,7 @@
#include "G4SystemOfUnits.hh"
#include "G4TransportationManager.hh"
#include "G4UnitsTable.hh"
#include "G4PhysicsModelCatalog.hh"
///////////////////////////////////////////////////////////////////////
// Constructor
@@ -60,6 +61,7 @@ G4SynchrotronRadiation::G4SynchrotronRadiation(const G4String& processName,
fFieldPropagator = transportMgr->GetPropagatorInField();
secID = G4PhysicsModelCatalog::GetModelID("model_SynRad");
SetProcessSubType(fSynchrotronRadiation);
verboseLevel = 1;
FirstTime = true;
@@ -267,7 +269,6 @@ G4VParticleChange* G4SynchrotronRadiation::PostStepDoIt(
gammaPolarization.z());
aParticleChange.SetNumberOfSecondaries(1);
aParticleChange.AddSecondary(aGamma);
// Update the incident particle
G4double newKinEnergy = kineticEnergy - energyOfSR;
@@ -280,6 +281,14 @@ G4VParticleChange* G4SynchrotronRadiation::PostStepDoIt(
{
aParticleChange.ProposeEnergy(0.);
}
// Create the G4Track
G4Track* aSecondaryTrack = new G4Track(aGamma, trackData.GetGlobalTime(), trackData.GetPosition());
aSecondaryTrack->SetTouchableHandle(stepData.GetPostStepPoint()->GetTouchableHandle());
aSecondaryTrack->SetParentID(trackData.GetTrackID());
aSecondaryTrack->SetCreatorModelID(secID);
aParticleChange.AddSecondary(aSecondaryTrack);
}
}
return G4VDiscreteProcess::PostStepDoIt(trackData, stepData);
@@ -43,6 +43,7 @@
#include "G4PhysicalConstants.hh"
#include "G4PropagatorInField.hh"
#include "G4SystemOfUnits.hh"
#include "G4PhysicsModelCatalog.hh"
const G4double G4SynchrotronRadiationInMat::fIntegralProbabilityOfSR[200] = {
1.000000e+00, 9.428859e-01, 9.094095e-01, 8.813971e-01, 8.565154e-01,
@@ -104,6 +105,7 @@ G4SynchrotronRadiationInMat::G4SynchrotronRadiationInMat(
G4TransportationManager::GetTransportationManager();
fFieldPropagator = transportMgr->GetPropagatorInField();
secID = G4PhysicsModelCatalog::GetModelID("model_SynchrotronRadiation");
SetProcessSubType(fSynchrotronRadiation);
CutInRange = GammaCutInKineticEnergyNow = ElectronCutInKineticEnergyNow =
PositronCutInKineticEnergyNow = ParticleCutInKineticEnergyNow = fKsi =
@@ -315,7 +317,6 @@ G4VParticleChange* G4SynchrotronRadiationInMat::PostStepDoIt(
gammaPolarization.z());
aParticleChange.SetNumberOfSecondaries(1);
aParticleChange.AddSecondary(aGamma);
// Update the incident particle
G4double newKinEnergy = kineticEnergy - energyOfSR;
@@ -340,6 +341,13 @@ G4VParticleChange* G4SynchrotronRadiationInMat::PostStepDoIt(
aParticleChange.ProposeTrackStatus(fStopButAlive);
}
}
// Create the G4Track
G4Track* aSecondaryTrack = new G4Track(aGamma, trackData.GetGlobalTime(), trackData.GetPosition());
aSecondaryTrack->SetTouchableHandle(stepData.GetPostStepPoint()->GetTouchableHandle());
aSecondaryTrack->SetParentID(trackData.GetTrackID());
aSecondaryTrack->SetCreatorModelID(secID);
aParticleChange.AddSecondary(aSecondaryTrack);
}
else
{
@@ -52,6 +52,7 @@
#include "G4VDiscreteProcess.hh"
#include "G4VParticleChange.hh"
#include "G4VSolid.hh"
#include "G4PhysicsModelCatalog.hh"
////////////////////////////////////////////////////////////////////////////
// Constructor, destructor
@@ -70,13 +71,30 @@ G4VXTRenergyLoss::G4VXTRenergyLoss(G4LogicalVolume* anEnvelope,
, fGammaTkinCut(0.0)
{
verboseLevel = 1;
secID = G4PhysicsModelCatalog::GetModelID("model_XTRenergyLoss");
SetProcessSubType(fTransitionRadiation);
fPtrGamma = nullptr;
fMinEnergyTR = fMaxEnergyTR = fMaxThetaTR = fGamma = fEnergy = 0.0;
fVarAngle = fLambda = fTotalDist = fPlateThick = fGasThick = 0.0;
fAlphaPlate = fAlphaGas = 0.0;
fAlphaPlate = 100.;
fAlphaGas = 40.;
fTheMinEnergyTR = CLHEP::keV * 1.; // 1.; //
fTheMaxEnergyTR = CLHEP::keV * 100.; // 40.; //
fTheMinAngle = 1.e-8; //
fTheMaxAngle = 4.e-4;
fTotBin = 50; // number of bins in log scale
fBinTR = 100; // number of bins in TR vectors
// min/max angle2 in log-vectors
fMinThetaTR = 3.0e-9;
fMaxThetaTR = 1.0e-4;
// Proton energy vector initialization
fProtonEnergyVector =
new G4PhysicsLogVector(fMinProtonTkin, fMaxProtonTkin, fTotBin);
@@ -97,6 +115,8 @@ G4VXTRenergyLoss::G4VXTRenergyLoss(G4LogicalVolume* anEnvelope,
}
// default is XTR dEdx, not flux after radiator
fExitFlux = false;
// default angle distribution according numerical integration
fFastAngle = false; // no angle according sum of delta-functions by default
fAngleRadDistr = true;
fCompton = false;
@@ -338,7 +358,11 @@ void G4VXTRenergyLoss::BuildEnergyTable()
// Legendre96 or Legendre10
energySum += radiatorCof * fCofTR *
integral.Legendre10(this, &G4VXTRenergyLoss::SpectralXTRdEdx,
// integral.Legendre10(this, &G4VXTRenergyLoss::SpectralXTRdEdx,
integral.Legendre96(this, &G4VXTRenergyLoss::SpectralXTRdEdx,
energyVector->GetLowEdgeEnergy(iTR),
energyVector->GetLowEdgeEnergy(iTR + 1));
@@ -366,14 +390,16 @@ void G4VXTRenergyLoss::BuildEnergyTable()
//////////////////////////////////////////////////////////////////////////
// Bank of angle distributions for given energies (slow!)
void G4VXTRenergyLoss::BuildAngleForEnergyBank()
{
if(this->GetProcessName() == "TranspRegXTRadiator" ||
this->GetProcessName() == "TranspRegXTRmodel" ||
this->GetProcessName() == "RegularXTRadiator" ||
this->GetProcessName() == "RegularXTRmodel")
if( ( this->GetProcessName() == "TranspRegXTRadiator" ||
this->GetProcessName() == "TranspRegXTRmodel" ||
this->GetProcessName() == "RegularXTRadiator" ||
this->GetProcessName() == "RegularXTRmodel" ) && fFastAngle ) // ffastAngle=true!
{
BuildAngleTable();
BuildAngleTable(); // by sum of delta-functions
return;
}
G4int i, iTkin, iTR;
@@ -407,8 +433,6 @@ void G4VXTRenergyLoss::BuildAngleForEnergyBank()
fGamma =
1.0 + (fProtonEnergyVector->GetLowEdgeEnergy(iTkin) / proton_mass_c2);
fMaxThetaTR = 25. * 2500.0 / (fGamma * fGamma); // theta^2
if(fMaxThetaTR > fTheMaxAngle)
fMaxThetaTR = fTheMaxAngle;
else if(fMaxThetaTR < fTheMinAngle)
@@ -420,8 +444,11 @@ void G4VXTRenergyLoss::BuildAngleForEnergyBank()
{
angleSum = 0.0;
fEnergy = energyVector->GetLowEdgeEnergy(iTR);
G4PhysicsLinearVector* angleVector =
new G4PhysicsLinearVector(0.0, fMaxThetaTR, fBinTR);
// log-vector to increase number of thin bins for small angles
G4PhysicsLogVector* angleVector = new G4PhysicsLogVector(fMinThetaTR, fMaxThetaTR, fBinTR);
angleVector->PutValue(fBinTR - 1, angleSum);
@@ -486,7 +513,7 @@ void G4VXTRenergyLoss::BuildAngleTable()
fGamma =
1.0 + (fProtonEnergyVector->GetLowEdgeEnergy(iTkin) / proton_mass_c2);
fMaxThetaTR = 25. * 2500.0 / (fGamma * fGamma); // theta^2
// fMaxThetaTR = 25. * 2500.0 / (fGamma * fGamma); // theta^2
if(fMaxThetaTR > fTheMaxAngle)
fMaxThetaTR = fTheMaxAngle;
@@ -560,7 +587,8 @@ G4PhysicsFreeVector* G4VXTRenergyLoss::GetAngleVector(G4double energy, G4int n)
if(k == kMin && kMin == G4int(cofMin))
{
angleSum += 0.5 * tmp;
// angleSum += 0.5 * tmp;
angleSum += tmp; // ATLAS TB
}
else if(iTheta == n - 1)
;
@@ -580,8 +608,9 @@ G4PhysicsFreeVector* G4VXTRenergyLoss::GetAngleVector(G4double energy, G4int n)
}
if(theta > 0.)
{
angleSum += 0.5 * tmp;
theta = 0.;
// angleSum += 0.5 * tmp;
angleSum += 0.; // ATLAS TB
theta = 0.;
}
if(verboseLevel > 2)
{
@@ -632,7 +661,8 @@ void G4VXTRenergyLoss::BuildGlobalAngleTable()
fGamma =
1.0 + (fProtonEnergyVector->GetLowEdgeEnergy(iTkin) / proton_mass_c2);
fMaxThetaTR = 25.0 / (fGamma * fGamma); // theta^2
// fMaxThetaTR = 25.0 / (fGamma * fGamma); // theta^2
// fMaxThetaTR = 1.e-4; // theta^2
if(fMaxThetaTR > fTheMaxAngle)
fMaxThetaTR = fTheMaxAngle;
@@ -642,7 +672,9 @@ void G4VXTRenergyLoss::BuildGlobalAngleTable()
fMaxThetaTR = fTheMinAngle;
}
G4PhysicsLinearVector* angleVector =
// G4PhysicsLogVector* angleVector =
new G4PhysicsLinearVector(0.0, fMaxThetaTR, fBinTR);
// new G4PhysicsLogVector(1.e-8, fMaxThetaTR, fBinTR);
angleSum = 0.0;
@@ -1425,6 +1457,7 @@ G4double G4VXTRenergyLoss::GetXTRenergy(G4int iPlace, G4double, G4int iTransfer)
/////////////////////////////////////////////////////////////////////////
// Get XTR photon angle at given energy and Tkin
G4double G4VXTRenergyLoss::GetRandomAngle(G4double energyXTR, G4int iTkin)
{
G4int iTR, iAngle;
@@ -1444,8 +1477,10 @@ G4double G4VXTRenergyLoss::GetRandomAngle(G4double energyXTR, G4int iTkin)
--iTR;
position = (*(*fAngleForEnergyTable)(iTR))(0) * G4UniformRand();
// position = (*(*fAngleForEnergyTable)(iTR))(1) * G4UniformRand(); // ATLAS TB
for(iAngle = 0;; ++iAngle)
// for(iAngle = 1;; ++iAngle) // ATLAS TB
{
if(position >= (*(*fAngleForEnergyTable)(iTR))(iAngle))
break;
@@ -1457,12 +1492,14 @@ G4double G4VXTRenergyLoss::GetRandomAngle(G4double energyXTR, G4int iTkin)
////////////////////////////////////////////////////////////////////////
// Returns approximate position of X-ray photon angle at given energy during
// random sampling over integral energy distribution
G4double G4VXTRenergyLoss::GetAngleXTR(G4int iPlace, G4double position,
G4int iTransfer)
{
G4double x1, x2, y1, y2, result;
if(iTransfer == 0)
if( iTransfer == 0 )
// if( iTransfer == 1 ) // ATLAS TB
{
result = (*fAngleForEnergyTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
}
@@ -1474,15 +1511,15 @@ G4double G4VXTRenergyLoss::GetAngleXTR(G4int iPlace, G4double position,
x1 = (*fAngleForEnergyTable)(iPlace)->GetLowEdgeEnergy(iTransfer - 1);
x2 = (*fAngleForEnergyTable)(iPlace)->GetLowEdgeEnergy(iTransfer);
if(x1 == x2)
result = x2;
if(x1 == x2) result = x2;
else
{
if(y1 == y2)
result = x1 + (x2 - x1) * G4UniformRand();
if( y1 == y2 ) result = x1 + (x2 - x1) * G4UniformRand();
else
{
result = x1 + (position - y1) * (x2 - x1) / (y2 - y1);
// result = x1 + 0.1*(position - y1) * (x2 - x1) / (y2 - y1); // ATLAS TB
// result = x1 + 0.05*(position - y1) * (x2 - x1) / (y2 - y1); // ATLAS TB
}
}
}