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

#include <G4ParticleHPNBodyPhaseSpace.hh>

Inheritance diagram for G4ParticleHPNBodyPhaseSpace:
G4VParticleHPEnergyAngular

Public Member Functions

virtual void ClearHistories ()
 
 G4ParticleHPNBodyPhaseSpace ()
 
G4ReactionProductGetCMS ()
 
G4ReactionProductGetProjectileRP ()
 
G4ReactionProductGetTarget ()
 
void Init (G4double aMass, G4int aCount)
 
void Init (std::istream &aDataFile)
 
G4ReactionProductSample (G4double anEnergy, G4double massCode, G4double mass)
 
void SetProjectileRP (G4ReactionProduct *aIncidentParticleRP)
 
void SetQValue (G4double aValue)
 
void SetTarget (G4ReactionProduct *aTarget)
 
 ~G4ParticleHPNBodyPhaseSpace ()
 

Protected Member Functions

G4double GetQValue ()
 

Private Member Functions

G4double C (G4double anEnergy, G4double mass)
 
G4double GetEmax (G4double anEnergy, G4double mass)
 
G4double MeanEnergyOfThisInteraction ()
 
G4double Prob (G4double anEnergy, G4double eMax, G4int n)
 

Private Attributes

G4Cache< toBeCachedfCache
 
G4double theQValue
 
G4int theTotalCount
 
G4double theTotalMass
 

Detailed Description

Definition at line 42 of file G4ParticleHPNBodyPhaseSpace.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPNBodyPhaseSpace()

G4ParticleHPNBodyPhaseSpace::G4ParticleHPNBodyPhaseSpace ( )
inline

◆ ~G4ParticleHPNBodyPhaseSpace()

G4ParticleHPNBodyPhaseSpace::~G4ParticleHPNBodyPhaseSpace ( )
inline

Definition at line 50 of file G4ParticleHPNBodyPhaseSpace.hh.

50{}

Member Function Documentation

◆ C()

G4double G4ParticleHPNBodyPhaseSpace::C ( G4double  anEnergy,
G4double  mass 
)
inlineprivate

Definition at line 77 of file G4ParticleHPNBodyPhaseSpace.hh.

78 {
79 G4double result(0);
80 if(theTotalCount==3) result = 4./CLHEP::pi/G4Pow::GetInstance()->powN(GetEmax(anEnergy, mass),2);
81 if(theTotalCount==4) result = 105./32./G4Pow::GetInstance()->powA(GetEmax(anEnergy, mass), 3.5);
82 //if(theTotalCount==5) result = 256./14./CLHEP::pi/G4Pow::GetInstance()->powA(GetEmax(anEnergy, mass), 5.);
83 if(theTotalCount==5) result = 256./14./CLHEP::pi/G4Pow::GetInstance()->powN(GetEmax(anEnergy, mass), 5);
84 return result;
85 }
double G4double
Definition: G4Types.hh:83
G4double GetEmax(G4double anEnergy, G4double mass)
static G4Pow * GetInstance()
Definition: G4Pow.cc:41
G4double powN(G4double x, G4int n) const
Definition: G4Pow.cc:166
G4double powA(G4double A, G4double y) const
Definition: G4Pow.hh:230
static constexpr double pi
Definition: SystemOfUnits.h:55

References GetEmax(), G4Pow::GetInstance(), CLHEP::pi, G4Pow::powA(), G4Pow::powN(), and theTotalCount.

◆ ClearHistories()

virtual void G4VParticleHPEnergyAngular::ClearHistories ( )
inlinevirtualinherited

Reimplemented in G4ParticleHPContEnergyAngular.

Definition at line 106 of file G4VParticleHPEnergyAngular.hh.

107 {
108 }

Referenced by G4ParticleHPProduct::Sample().

◆ GetCMS()

G4ReactionProduct * G4VParticleHPEnergyAngular::GetCMS ( )
inlineinherited

Definition at line 94 of file G4VParticleHPEnergyAngular.hh.

95 {
96 *fCache.Get().theCMS = *fCache.Get().theProjectileRP
97 + *fCache.Get().theTarget;
98 return fCache.Get().theCMS;
99 }

References G4VParticleHPEnergyAngular::fCache.

◆ GetEmax()

G4double G4ParticleHPNBodyPhaseSpace::GetEmax ( G4double  anEnergy,
G4double  mass 
)
inlineprivate

Definition at line 87 of file G4ParticleHPNBodyPhaseSpace.hh.

88 {
89 G4double result;
90 G4double tMass = GetTarget()->GetMass();
91 G4double pMass = GetProjectileRP()->GetMass();
92 G4double availableEnergy = GetQValue() + anEnergy*tMass/(pMass+tMass);
93 result = availableEnergy*(theTotalMass-mass)/theTotalMass;
94 return result;
95 }
G4double GetMass() const

References G4ReactionProduct::GetMass(), G4VParticleHPEnergyAngular::GetProjectileRP(), G4VParticleHPEnergyAngular::GetQValue(), G4VParticleHPEnergyAngular::GetTarget(), and theTotalMass.

Referenced by C(), and Sample().

◆ GetProjectileRP()

G4ReactionProduct * G4VParticleHPEnergyAngular::GetProjectileRP ( )
inlineinherited

Definition at line 89 of file G4VParticleHPEnergyAngular.hh.

90 {
91 return fCache.Get().theProjectileRP;
92 }

References G4VParticleHPEnergyAngular::fCache.

Referenced by GetEmax(), G4ParticleHPContEnergyAngular::Sample(), G4ParticleHPDiscreteTwoBody::Sample(), and Sample().

◆ GetQValue()

G4double G4VParticleHPEnergyAngular::GetQValue ( )
inlineprotectedinherited

◆ GetTarget()

G4ReactionProduct * G4VParticleHPEnergyAngular::GetTarget ( void  )
inlineinherited

◆ Init() [1/2]

void G4ParticleHPNBodyPhaseSpace::Init ( G4double  aMass,
G4int  aCount 
)
inline

Definition at line 54 of file G4ParticleHPNBodyPhaseSpace.hh.

55 {
56 theTotalMass=aMass;
57 theTotalCount=aCount;
58 }

References theTotalCount, and theTotalMass.

Referenced by G4ParticleHPInelasticBaseFS::BaseApply().

◆ Init() [2/2]

void G4ParticleHPNBodyPhaseSpace::Init ( std::istream &  aDataFile)
inlinevirtual

◆ MeanEnergyOfThisInteraction()

G4double G4ParticleHPNBodyPhaseSpace::MeanEnergyOfThisInteraction ( )
inlineprivatevirtual

Implements G4VParticleHPEnergyAngular.

Definition at line 97 of file G4ParticleHPNBodyPhaseSpace.hh.

97{return -1; }

◆ Prob()

G4double G4ParticleHPNBodyPhaseSpace::Prob ( G4double  anEnergy,
G4double  eMax,
G4int  n 
)
inlineprivate

Definition at line 70 of file G4ParticleHPNBodyPhaseSpace.hh.

71 {
72 G4double result;
73 result = std::sqrt(anEnergy)*G4Pow::GetInstance()->powA(eMax-anEnergy, 3.*n/2.-4.);
74 return result;
75 }

References G4Pow::GetInstance(), CLHEP::detail::n, and G4Pow::powA().

Referenced by Sample().

◆ Sample()

G4ReactionProduct * G4ParticleHPNBodyPhaseSpace::Sample ( G4double  anEnergy,
G4double  massCode,
G4double  mass 
)
virtual

Implements G4VParticleHPEnergyAngular.

Definition at line 44 of file G4ParticleHPNBodyPhaseSpace.cc.

45{
47 G4int Z = static_cast<G4int>(massCode/1000);
48 G4int A = static_cast<G4int>(massCode-1000*Z);
49
50 if(massCode==0)
51 {
53 }
54 else if(A==0)
55 {
57 if(Z==1) result->SetDefinition(G4Positron::Positron());
58 }
59 else if(A==1)
60 {
62 if(Z==1) result->SetDefinition(G4Proton::Proton());
63 }
64 else if(A==2)
65 {
67 }
68 else if(A==3)
69 {
71 if(Z==2) result->SetDefinition(G4He3::He3());
72 }
73 else if(A==4)
74 {
76 if(Z!=2) throw G4HadronicException(__FILE__, __LINE__, "Unknown ion case 1");
77 }
78 else
79 {
80 throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPNBodyPhaseSpace: Unknown ion case 2");
81 }
82
83// Get the energy from phase-space distribution
84 // in CMS
85 // P = Cn*std::sqrt(E')*(Emax-E')**(3*n/2-4)
86 G4double maxE = GetEmax(anEnergy, result->GetMass());
87 if(maxE<=0){
88 maxE=1.*CLHEP::eV;
89 }
91 G4double max(0);
92 if(theTotalCount<=3)
93 {
94 max = maxE/2.;
95 }
96 else if(theTotalCount==4)
97 {
98 max = maxE/5.;
99 }
100 else if(theTotalCount==5)
101 {
102 max = maxE/8.;
103 }
104 else
105 {
106 throw G4HadronicException(__FILE__, __LINE__, "NeutronHP Phase-space distribution cannot cope with this number of particles");
107 }
108 G4double testit;
109 G4double rand0 = Prob(max, maxE, theTotalCount);
110 G4double rand;
111
112 G4int icounter=0;
113 G4int icounter_max=1024;
114 do
115 {
116 icounter++;
117 if ( icounter > icounter_max ) {
118 G4cout << "Loop-counter exceeded the threshold value at " << __LINE__ << "th line of " << __FILE__ << "." << G4endl;
119 break;
120 }
121 rand = rand0*G4UniformRand();
122 energy = maxE*G4UniformRand();
123 testit = Prob(energy, maxE, theTotalCount);
124 }
125 while(rand > testit); // Loop checking, 11.05.2015, T. Koi
126 result->SetKineticEnergy(energy);
127
128// now do random direction
129 G4double cosTh = 2.*G4UniformRand()-1.;
131 G4double theta = std::acos(cosTh);
132 G4double sinth = std::sin(theta);
133 G4double mtot = result->GetTotalMomentum();
134 G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
135 result->SetMomentum(tempVector);
137 result->Lorentz(*result, -1.*aCMS);
138 return result;
139}
static constexpr double twopi
Definition: G4SIunits.hh:56
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52
static G4Alpha * Alpha()
Definition: G4Alpha.cc:88
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:93
static G4Electron * Electron()
Definition: G4Electron.cc:93
static G4Gamma * Gamma()
Definition: G4Gamma.cc:85
static G4He3 * He3()
Definition: G4He3.cc:93
G4double Prob(G4double anEnergy, G4double eMax, G4int n)
static G4Positron * Positron()
Definition: G4Positron.cc:93
static G4Proton * Proton()
Definition: G4Proton.cc:92
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetTotalMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
static G4Triton * Triton()
Definition: G4Triton.cc:93
static constexpr double eV
G4double energy(const ThreeVector &p, const G4double m)
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References A, G4Alpha::Alpha(), G4Deuteron::Deuteron(), G4Electron::Electron(), G4INCL::KinematicsUtils::energy(), CLHEP::eV, G4cout, G4endl, G4UniformRand, G4Gamma::Gamma(), GetEmax(), G4ReactionProduct::GetMass(), G4VParticleHPEnergyAngular::GetProjectileRP(), G4VParticleHPEnergyAngular::GetTarget(), G4ReactionProduct::GetTotalMomentum(), G4He3::He3(), G4ReactionProduct::Lorentz(), G4INCL::Math::max(), G4Neutron::Neutron(), G4Positron::Positron(), Prob(), G4Proton::Proton(), G4ReactionProduct::SetDefinition(), G4ReactionProduct::SetKineticEnergy(), G4ReactionProduct::SetMomentum(), theTotalCount, G4Triton::Triton(), twopi, and Z.

Referenced by G4ParticleHPInelasticBaseFS::BaseApply().

◆ SetProjectileRP()

void G4VParticleHPEnergyAngular::SetProjectileRP ( G4ReactionProduct aIncidentParticleRP)
inlineinherited

Definition at line 74 of file G4VParticleHPEnergyAngular.hh.

75 {
76 fCache.Get().theProjectileRP = aIncidentParticleRP;
77 }

References G4VParticleHPEnergyAngular::fCache.

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), and G4ParticleHPProduct::Sample().

◆ SetQValue()

void G4VParticleHPEnergyAngular::SetQValue ( G4double  aValue)
inlineinherited

◆ SetTarget()

void G4VParticleHPEnergyAngular::SetTarget ( G4ReactionProduct aTarget)
inlineinherited

Definition at line 79 of file G4VParticleHPEnergyAngular.hh.

80 {
81 fCache.Get().theTarget = aTarget;
82 }

References G4VParticleHPEnergyAngular::fCache.

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), and G4ParticleHPProduct::Sample().

Field Documentation

◆ fCache

G4Cache<toBeCached> G4VParticleHPEnergyAngular::fCache
privateinherited

◆ theQValue

G4double G4VParticleHPEnergyAngular::theQValue
privateinherited

◆ theTotalCount

G4int G4ParticleHPNBodyPhaseSpace::theTotalCount
private

Definition at line 102 of file G4ParticleHPNBodyPhaseSpace.hh.

Referenced by C(), G4ParticleHPNBodyPhaseSpace(), Init(), and Sample().

◆ theTotalMass

G4double G4ParticleHPNBodyPhaseSpace::theTotalMass
private

Definition at line 101 of file G4ParticleHPNBodyPhaseSpace.hh.

Referenced by G4ParticleHPNBodyPhaseSpace(), GetEmax(), and Init().


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