66 :
G4VEmModel(nam),fParticleChange(0),fParticle(0),
67 isInitialised(false),energyGrid(0),
68 XSTableElectron(0),XSTablePositron(0),fPenelopeFSHelper(0),
69 fPenelopeAngular(0),fLocalTable(false)
118 G4cout <<
"Calling G4PenelopeBremsstrahlungModel::Initialise()" <<
G4endl;
147 std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>;
166 G4cout <<
"Penelope Bremsstrahlung model v2008 is initialized " << G4endl
184 G4cout <<
"Calling G4PenelopeBremsstrahlungModel::InitialiseLocal()" <<
G4endl;
242 G4cout <<
"Calling CrossSectionPerVolume() of G4PenelopeBremsstrahlungModel" <<
G4endl;
258 G4cout <<
"Material " << material->
GetName() <<
" has " << atPerMol <<
259 "atoms per molecule" <<
G4endl;
263 moleculeDensity = atomDensity/atPerMol;
265 G4double crossPerVolume = crossPerMolecule*moleculeDensity;
270 G4cout <<
"Mean free path for gamma emission > " << cutEnergy/
keV <<
" keV at " <<
271 energy/
keV <<
" keV = " << (1./crossPerVolume)/
mm <<
" mm" << G4endl;
274 return crossPerVolume;
289 G4cout <<
"*** G4PenelopeBremsstrahlungModel -- WARNING ***" <<
G4endl;
290 G4cout <<
"Penelope Bremsstrahlung model v2008 does not calculate cross section _per atom_ " <<
G4endl;
291 G4cout <<
"so the result is always zero. For physics values, please invoke " <<
G4endl;
292 G4cout <<
"GetCrossSectionPerVolume() or GetMeanFreePath() via the G4EmCalculator" <<
G4endl;
304 G4cout <<
"Calling ComputeDEDX() of G4PenelopeBremsstrahlungModel" <<
G4endl;
318 moleculeDensity = atomDensity/atPerMol;
320 G4double sPowerPerVolume = sPowerPerMolecule*moleculeDensity;
325 G4cout <<
"Stopping power < " << cutEnergy/
keV <<
" keV at " <<
326 kineticEnergy/
keV <<
" keV = " <<
327 sPowerPerVolume/(
keV/
mm) <<
" keV/mm" << G4endl;
329 return sPowerPerVolume;
341 G4cout <<
"Calling SampleSecondaries() of G4PenelopeBremsstrahlungModel" <<
G4endl;
358 if (kineticEnergy < cutG)
362 G4cout <<
"Going to sample gamma energy for: " <<material->
GetName() <<
" " <<
363 "energy = " << kineticEnergy/
keV <<
", cut = " << cutG/
keV <<
G4endl;
370 G4cout <<
"Sampled gamma energy: " << gammaEnergy/
keV <<
" keV" <<
G4endl;
380 G4double residualPrimaryEnergy = kineticEnergy-gammaEnergy;
381 if (residualPrimaryEnergy < 0)
384 gammaEnergy += residualPrimaryEnergy;
385 residualPrimaryEnergy = 0.0;
389 G4ThreeVector particleDirection1 = initialMomentum - gammaEnergy*gammaDirection1;
390 particleDirection1 = particleDirection1.
unit();
393 if (residualPrimaryEnergy > 0.)
407 fvect->push_back(theGamma);
411 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
412 G4cout <<
"Energy balance from G4PenelopeBremsstrahlung" <<
G4endl;
413 G4cout <<
"Incoming primary energy: " << kineticEnergy/
keV <<
" keV" <<
G4endl;
414 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
415 G4cout <<
"Outgoing primary energy: " << residualPrimaryEnergy/
keV <<
" keV" <<
G4endl;
416 G4cout <<
"Bremsstrahlung photon " << gammaEnergy/
keV <<
" keV" <<
G4endl;
417 G4cout <<
"Total final state: " << (residualPrimaryEnergy+gammaEnergy)/
keV
419 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
424 G4double energyDiff = std::fabs(residualPrimaryEnergy+gammaEnergy-kineticEnergy);
425 if (energyDiff > 0.05*
keV)
426 G4cout <<
"Warning from G4PenelopeBremsstrahlung: problem with energy conservation: "
428 (residualPrimaryEnergy+gammaEnergy)/
keV <<
429 " keV (final) vs. " <<
430 kineticEnergy/
keV <<
" keV (initial)" << G4endl;
441 G4Exception(
"G4PenelopeBremsstrahlungModel::ClearTables()",
466 G4cout <<
"G4PenelopeBremsstrahlungModel: cleared tables" <<
G4endl;
485 G4Exception(
"G4PenelopeBremsstrahlungModel::BuildXSTable()",
489 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
502 G4cout <<
"G4PenelopeBremsstrahlungModel: going to build cross section table " <<
G4endl;
503 G4cout <<
"for e+/e- in " << mat->
GetName() <<
" for Ecut(gamma)= " <<
511 ed <<
"Energy Grid looks not initialized" <<
G4endl;
513 G4Exception(
"G4PenelopeBremsstrahlungModel::BuildXSTable()",
542 for (
size_t ix=0;ix<nBinsX;ix++)
545 G4double val = (*table)[ix]->Value(logene);
546 tempData[ix] =
G4Exp(val);
550 if (restrictedCut <= 1)
558 if (restrictedCut <=1)
570 XS2 = XS2A*fact*energy*
energy;
571 XH2 = XH2A*fact*energy*
energy;
604 G4Exception(
"G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
617 G4String excep =
"The Cross Section Table for e- was not initialized correctly!";
618 G4Exception(
"G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
630 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
641 ed <<
"Unable to find e- table for " << mat->
GetName() <<
" at Ecut(gamma)= "
643 ed <<
"This can happen only in Unit Tests or via G4EmCalculator" <<
G4endl;
644 G4Exception(
"G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
648 G4AutoLock lock(&PenelopeBremsstrahlungModelMutex);
663 G4String excep =
"The Cross Section Table for e+ was not initialized correctly!";
664 G4Exception(
"G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
676 std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
687 ed <<
"Unable to find e+ table for " << mat->
GetName() <<
" at Ecut(gamma)= "
689 ed <<
"This can happen only in Unit Tests or via G4EmCalculator" <<
G4endl;
690 G4Exception(
"G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
694 G4AutoLock lock(&PenelopeBremsstrahlungModelMutex);
720 (3.1516
e-2-t*(7.7446
e-3-t*(1.0595
e-3-t*
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
T max(const T t1, const T t2)
brief Return the largest of the two arguments
const G4ParticleDefinition * fParticle
void PrepareTables(const G4Material *material, G4bool isMaster)
Reserved for Master Model.
virtual void SetupForMaterial(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double out_energy, G4int Z, const G4Material *mat=0)
Samples the direction of the outgoing photon (in global coordinates).
std::ostringstream G4ExceptionDescription
G4double fIntrinsicLowEnergyLimit
G4double GetLowEdgeEnergy(size_t binNumber) const
void SetHighEnergyLimit(G4double)
static constexpr double keV
static constexpr double mm
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *theParticle, G4double kineticEnergy, G4double cutEnergy, G4double maxEnergy=DBL_MAX)
const G4ThreeVector & GetMomentumDirection() const
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4double GetEffectiveZSquared(const G4Material *mat) const
void BuildScaledXSTable(const G4Material *material, G4double cut, G4bool isMaster)
const G4String & GetParticleName() const
void SetParticle(const G4ParticleDefinition *)
G4PenelopeBremsstrahlungModel(const G4ParticleDefinition *p=0, const G4String &processName="PenBrem")
G4double LowEnergyLimit() const
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *)
const G4String & GetName() const
G4ParticleChangeForLoss * GetParticleChangeForLoss()
G4PenelopeBremsstrahlungFS * fPenelopeFSHelper
static G4PenelopeOscillatorManager * GetOscillatorManager()
void SetDeexcitationFlag(G4bool val)
#define G4MUTEX_INITIALIZER
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void AddCrossSectionPoint(size_t binNumber, G4double energy, G4double XH0, G4double XH1, G4double XH2, G4double XS0, G4double XS1, G4double XS2)
virtual G4double MinEnergyCut(const G4ParticleDefinition *, const G4MaterialCutsCouple *)
G4PenelopeBremsstrahlungAngular * fPenelopeAngular
static constexpr double electron_mass_c2
G4double GetMomentumIntegral(G4double *y, G4double up, G4int momOrder) const
G4PenelopeOscillatorManager * oscManager
static G4Positron * Positron()
static constexpr double eV
G4double GetPositronXSCorrection(const G4Material *, G4double energy)
void ClearTables(G4bool isMaster=true)
Reserved for the master model: they build and handle tables.
static G4Electron * Electron()
size_t GetTableSize() const
G4double SampleGammaEnergy(G4double energy, const G4Material *, const G4double cut) const
G4ThreeVector GetMomentum() const
static G4ProductionCutsTable * GetProductionCutsTable()
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *theParticle, G4double kinEnergy, G4double Z, G4double A=0, G4double cut=0, G4double emax=DBL_MAX)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::map< std::pair< const G4Material *, G4double >, G4PenelopeCrossSection * > * XSTablePositron
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void BuildXSTable(const G4Material *material, G4double cut)
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
virtual ~G4PenelopeBremsstrahlungModel()
G4PhysicsLogVector * energyGrid
const G4PhysicsTable * GetScaledXSTable(const G4Material *, const G4double cut) const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4double fIntrinsicHighEnergyLimit
const G4Material * GetMaterial() const
std::map< std::pair< const G4Material *, G4double >, G4PenelopeCrossSection * > * XSTableElectron
G4ParticleChangeForLoss * fParticleChange
G4double GetTotNbOfAtomsPerVolume() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double GetHardCrossSection(G4double energy) const
Returns hard cross section at the given energy.
G4double GetSoftStoppingPower(G4double energy) const
Returns the total stopping power due to soft collisions.
G4double HighEnergyLimit() const
static constexpr double GeV
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy)
size_t GetVectorLength() const
G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, G4double cut)