Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
G4Generator2BS Class Reference

#include <G4Generator2BS.hh>

Inheritance diagram for G4Generator2BS:
G4VEmAngularDistribution

Public Member Functions

 G4Generator2BS (const G4Generator2BS &)=delete
 
 G4Generator2BS (const G4String &name="")
 
const G4String & GetName () const
 
G4Generator2BS & operator= (const G4Generator2BS &right)=delete
 
void PrintGeneratorInformation () const override
 
G4ThreeVector & SampleDirection (const G4DynamicParticle *dp, G4double out_energy, G4int Z, const G4Material *mat=nullptr) override
 
virtual G4ThreeVector & SampleDirectionForShell (const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, G4int shellID, const G4Material *)
 
virtual void SamplePairDirections (const G4DynamicParticle *dp, G4double elecKinEnergy, G4double posiKinEnergy, G4ThreeVector &dirElectron, G4ThreeVector &dirPositron, G4int Z=0, const G4Material *mat=nullptr)
 
virtual ~G4Generator2BS ()
 

Protected Member Functions

G4double RejectionFunction (G4double value) const
 

Protected Attributes

G4ThreeVector fLocalDirection
 
G4bool fPolarisation
 

Private Attributes

G4double delta
 
G4String fName
 
G4double fz
 
G4Pow * g4pow
 
G4int nwarn
 
G4double ratio
 
G4double ratio1
 
G4double ratio2
 

Detailed Description

Definition at line 64 of file G4Generator2BS.hh.

Constructor & Destructor Documentation

◆ G4Generator2BS() [1/2]

G4Generator2BS::G4Generator2BS ( const G4String &  name = "")
explicit

Definition at line 63 of file G4Generator2BS.cc.

64 : G4VEmAngularDistribution("AngularGen2BS"),fz(1.),ratio(1.),
65 ratio1(1.),ratio2(1.),delta(0.)
66{
68 nwarn = 0;
69}
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4VEmAngularDistribution(const G4String &name)

References g4pow, G4Pow::GetInstance(), and nwarn.

◆ ~G4Generator2BS()

G4Generator2BS::~G4Generator2BS ( )
virtual

Definition at line 71 of file G4Generator2BS.cc.

72{}

◆ G4Generator2BS() [2/2]

G4Generator2BS::G4Generator2BS ( const G4Generator2BS &  )
delete

Member Function Documentation

◆ GetName()

const G4String & G4VEmAngularDistribution::GetName ( ) const
inlineinherited

Definition at line 111 of file G4VEmAngularDistribution.hh.

112{
113 return fName;
114}

References G4VEmAngularDistribution::fName.

◆ operator=()

G4Generator2BS & G4Generator2BS::operator= ( const G4Generator2BS &  right)
delete

◆ PrintGeneratorInformation()

void G4Generator2BS::PrintGeneratorInformation ( ) const
overridevirtual

Reimplemented from G4VEmAngularDistribution.

Definition at line 134 of file G4Generator2BS.cc.

135{
136 G4cout << "\n" << G4endl;
137 G4cout << "Bremsstrahlung Angular Generator is 2BS Generator "
138 << "from 2BS Koch & Motz distribution (Rev Mod Phys 31(4), 920 (1959))" << G4endl;
139 G4cout << "Sampling algorithm adapted from PIRS-0203" << G4endl;
140 G4cout << "\n" << G4endl;
141}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References G4cout, and G4endl.

◆ RejectionFunction()

G4double G4Generator2BS::RejectionFunction ( G4double  value) const
inlineprotected

Definition at line 99 of file G4Generator2BS.hh.

100{
101 G4double y2 = (1 + y)*(1 + y);
102 G4double x = 4*y*ratio/y2;
103 return 4*x - ratio1 - (ratio2 - x)*G4Log(delta + fz/y2);
104}
G4double G4Log(G4double x)
Definition: G4Log.hh:226
double G4double
Definition: G4Types.hh:83

References delta, fz, G4Log(), ratio, ratio1, and ratio2.

Referenced by SampleDirection().

◆ SampleDirection()

G4ThreeVector & G4Generator2BS::SampleDirection ( const G4DynamicParticle *  dp,
G4double  out_energy,
G4int  Z,
const G4Material *  mat = nullptr 
)
overridevirtual

Implements G4VEmAngularDistribution.

Definition at line 74 of file G4Generator2BS.cc.

78{
79 // Adapted from "Improved bremsstrahlung photon angular sampling in the EGS4 code system"
80 // by Alex F. Bielajew, Rahde Mohan anc Chen-Shou Chui, PIRS-0203
81 // Ionizing Radiation Standards
82 // Institute for National Measurement Standards
83 // National Research Council of Canada
84 // Departement of Medical Physics, Memorial Sloan-Kettering Cancer Center, New York
85
87 ratio = final_energy/energy;
88 ratio1 = (1 + ratio)*(1 + ratio);
89 ratio2 = 1 + ratio*ratio;
90
92 G4double beta = std::sqrt((gamma - 1)*(gamma + 1))/gamma;
93
94 // VI speadup
95 fz = 0.00008116224*g4pow->Z13(Z)*g4pow->Z13(Z+1);
96
97 // majoranta
98 G4double ymax = 2*beta*(1 + beta)*gamma*gamma;
99 G4double gMax = RejectionFunction(0.0);
100 gMax = std::max(gMax,RejectionFunction(ymax));
101
102 G4double y, gfun;
103
104 do{
106 y = q*ymax/(1 + ymax*(1 - q));
107 gfun = RejectionFunction(y);
108
109 // violation point
110 if(gfun > gMax && nwarn >= 20) {
111 ++nwarn;
112 G4cout << "### WARNING in G4Generator2BS: Etot(MeV)= " << energy/MeV
113 << " Egamma(MeV)" << (energy - final_energy)/MeV
114 << " gMax= " << gMax << " < " << gfun
115 << " results are not reliable!"
116 << G4endl;
117 if(20 == nwarn) {
118 G4cout << " WARNING in G4Generator2BS is closed" << G4endl;
119 }
120 }
121
122 } while(G4UniformRand()*gMax > gfun || y > ymax);
123
124 G4double cost = 1 - 2*y/ymax;
125 G4double sint = std::sqrt((1 - cost)*(1 + cost));
127
128 fLocalDirection.set(sint*std::cos(phi), sint*std::sin(phi),cost);
130
131 return fLocalDirection;
132}
static constexpr double twopi
Definition: G4SIunits.hh:56
static constexpr double MeV
Definition: G4SIunits.hh:200
const G4int Z[17]
#define G4UniformRand()
Definition: Randomize.hh:52
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
Definition: ThreeVector.cc:33
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalEnergy() const
G4double RejectionFunction(G4double value) const
G4double Z13(G4int Z) const
Definition: G4Pow.hh:123
G4double energy(const ThreeVector &p, const G4double m)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
float electron_mass_c2
Definition: hepunit.py:273

References anonymous_namespace{G4PionRadiativeDecayChannel.cc}::beta, source.hepunit::electron_mass_c2, G4INCL::KinematicsUtils::energy(), G4VEmAngularDistribution::fLocalDirection, fz, G4cout, G4endl, g4pow, G4UniformRand, G4DynamicParticle::GetMomentumDirection(), G4DynamicParticle::GetTotalEnergy(), G4INCL::Math::max(), MeV, nwarn, ratio, ratio1, ratio2, RejectionFunction(), CLHEP::Hep3Vector::rotateUz(), CLHEP::Hep3Vector::set(), twopi, Z, and G4Pow::Z13().

Referenced by G4Generator2BN::SampleDirection().

◆ SampleDirectionForShell()

G4ThreeVector & G4VEmAngularDistribution::SampleDirectionForShell ( const G4DynamicParticle *  dp,
G4double  finalTotalEnergy,
G4int  Z,
G4int  shellID,
const G4Material *  mat 
)
virtualinherited

◆ SamplePairDirections()

void G4VEmAngularDistribution::SamplePairDirections ( const G4DynamicParticle *  dp,
G4double  elecKinEnergy,
G4double  posiKinEnergy,
G4ThreeVector &  dirElectron,
G4ThreeVector &  dirPositron,
G4int  Z = 0,
const G4Material *  mat = nullptr 
)
virtualinherited

Field Documentation

◆ delta

G4double G4Generator2BS::delta
private

Definition at line 93 of file G4Generator2BS.hh.

Referenced by RejectionFunction().

◆ fLocalDirection

G4ThreeVector G4VEmAngularDistribution::fLocalDirection
protectedinherited

◆ fName

G4String G4VEmAngularDistribution::fName
privateinherited

Definition at line 108 of file G4VEmAngularDistribution.hh.

Referenced by G4VEmAngularDistribution::GetName().

◆ fPolarisation

G4bool G4VEmAngularDistribution::fPolarisation
protectedinherited

◆ fz

G4double G4Generator2BS::fz
private

Definition at line 89 of file G4Generator2BS.hh.

Referenced by RejectionFunction(), and SampleDirection().

◆ g4pow

G4Pow* G4Generator2BS::g4pow
private

Definition at line 87 of file G4Generator2BS.hh.

Referenced by G4Generator2BS(), and SampleDirection().

◆ nwarn

G4int G4Generator2BS::nwarn
private

Definition at line 95 of file G4Generator2BS.hh.

Referenced by G4Generator2BS(), and SampleDirection().

◆ ratio

G4double G4Generator2BS::ratio
private

Definition at line 90 of file G4Generator2BS.hh.

Referenced by RejectionFunction(), and SampleDirection().

◆ ratio1

G4double G4Generator2BS::ratio1
private

Definition at line 91 of file G4Generator2BS.hh.

Referenced by RejectionFunction(), and SampleDirection().

◆ ratio2

G4double G4Generator2BS::ratio2
private

Definition at line 92 of file G4Generator2BS.hh.

Referenced by RejectionFunction(), and SampleDirection().


The documentation for this class was generated from the following files: