Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPProduct Class Reference

#include <G4ParticleHPProduct.hh>

Public Member Functions

 G4ParticleHPProduct ()
 
 ~G4ParticleHPProduct ()
 
void Init (std::istream &aDataFile, const G4ParticleDefinition *projectile)
 
G4int GetMultiplicity (G4double anEnergy)
 
G4ReactionProductVectorSample (G4double anEnergy, G4int nParticles)
 
G4double GetMeanYield (G4double anEnergy)
 
void SetProjectileRP (G4ReactionProduct *aIncidentPart)
 
void SetTarget (G4ReactionProduct *aTarget)
 
G4ReactionProductGetTarget ()
 
G4ReactionProductGetProjectileRP ()
 
G4double MeanEnergyOfThisInteraction ()
 
G4double GetQValue ()
 
G4double GetMassCode ()
 
G4double GetMass ()
 

Detailed Description

Definition at line 50 of file G4ParticleHPProduct.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPProduct()

G4ParticleHPProduct::G4ParticleHPProduct ( )

Definition at line 54 of file G4ParticleHPProduct.cc.

55{
56 toBeCached val;
57 fCache.Put(val);
58
59 if (G4ParticleHPManager::GetInstance()->GetPHCUsePoisson()) {
60 theMultiplicityMethod = G4HPMultiPoisson;
61 } else {
62 theMultiplicityMethod = G4HPMultiBetweenInts;
63 }
64}
@ G4HPMultiPoisson
@ G4HPMultiBetweenInts
void Put(const value_type &val) const
Definition G4Cache.hh:321
static G4ParticleHPManager * GetInstance()

◆ ~G4ParticleHPProduct()

G4ParticleHPProduct::~G4ParticleHPProduct ( )

Definition at line 66 of file G4ParticleHPProduct.cc.

67{
68 delete theDist;
69}

Member Function Documentation

◆ GetMass()

G4double G4ParticleHPProduct::GetMass ( )
inline

Definition at line 97 of file G4ParticleHPProduct.hh.

97{ return theMass; }

◆ GetMassCode()

G4double G4ParticleHPProduct::GetMassCode ( )
inline

Definition at line 96 of file G4ParticleHPProduct.hh.

96{ return theMassCode; }

◆ GetMeanYield()

G4double G4ParticleHPProduct::GetMeanYield ( G4double anEnergy)
inline

Definition at line 69 of file G4ParticleHPProduct.hh.

69{ return theYield.GetY(anEnergy); }
G4double GetY(G4double x)

◆ GetMultiplicity()

G4int G4ParticleHPProduct::GetMultiplicity ( G4double anEnergy)

Definition at line 124 of file G4ParticleHPProduct.cc.

125{
126 if (theDist == nullptr) {
127 fCache.Get().theCurrentMultiplicity = 0;
128 return 0;
129 }
130
131 G4double mean = theYield.GetY(anEnergy);
132 if (mean <= 0.) {
133 fCache.Get().theCurrentMultiplicity = 0;
134 return 0;
135 }
136 G4int multi = (theMultiplicityMethod == G4HPMultiPoisson) ?
137 (G4int)G4Poisson(mean) : G4lrint(mean);
138
139#ifdef G4VERBOSE
140 if (G4ParticleHPManager::GetInstance()->GetDEBUG())
141 G4cout << "G4ParticleHPProduct::GetMultiplicity code=" << theMassCode << " M=" << theMass
142 << " multi=" << multi << " mean=" << mean << G4endl;
143#endif
144 fCache.Get().theCurrentMultiplicity = multi;
145
146 return multi;
147}
G4long G4Poisson(G4double mean)
Definition G4Poisson.hh:50
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
value_type & Get() const
Definition G4Cache.hh:315
int G4lrint(double ad)
Definition templates.hh:134

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetProjectileRP()

G4ReactionProduct * G4ParticleHPProduct::GetProjectileRP ( )
inline

Definition at line 80 of file G4ParticleHPProduct.hh.

80{ return fCache.Get().theProjectileRP; }

◆ GetQValue()

G4double G4ParticleHPProduct::GetQValue ( )
inline

Definition at line 92 of file G4ParticleHPProduct.hh.

92{ return theActualStateQValue; }

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetTarget()

G4ReactionProduct * G4ParticleHPProduct::GetTarget ( )
inline

Definition at line 78 of file G4ParticleHPProduct.hh.

78{ return fCache.Get().theTarget; }

◆ Init()

void G4ParticleHPProduct::Init ( std::istream & aDataFile,
const G4ParticleDefinition * projectile )

Definition at line 71 of file G4ParticleHPProduct.cc.

72{
73 aDataFile >> theMassCode >> theMass >> theIsomerFlag >> theDistLaw >> theGroundStateQValue
74 >> theActualStateQValue;
75 theGroundStateQValue *= CLHEP::eV;
76 theActualStateQValue *= CLHEP::eV;
77 theYield.Init(aDataFile, CLHEP::eV);
78 theYield.Hash();
79 if (theDistLaw == 0) {
80 // distribution not known, use E-independent, isotropic
81 // angular distribution
82 theDist = new G4ParticleHPIsotropic;
83 }
84 else if (theDistLaw == 1) {
85 // Continuum energy-angular distribution
86 theDist = new G4ParticleHPContEnergyAngular(projectile);
87 }
88 else if (theDistLaw == 2) {
89 // Discrete 2-body scattering
90 theDist = new G4ParticleHPDiscreteTwoBody;
91 }
92 else if (theDistLaw == 3) {
93 // Isotropic emission
94 theDist = new G4ParticleHPIsotropic;
95 }
96 else if (theDistLaw == 4) {
97 // Discrete 2-body recoil modification not used for now.
98 // theDist = new G4ParticleHPDiscreteTwoBody;
99 // the above is only temporary;
100 // recoils need to be addressed properly
101 }
102 // else if(theDistLaw == 5)
103 // {
104 // charged particles only, to be used in a later stage. @@@@
105 // }
106 else if (theDistLaw == 6) {
107 // N-Body phase space
108 theDist = new G4ParticleHPNBodyPhaseSpace;
109 }
110 else if (theDistLaw == 7) {
111 // Laboratory angular energy paraetrisation
112 theDist = new G4ParticleHPLabAngularEnergy;
113 }
114 else {
115 throw G4HadronicException(__FILE__, __LINE__,
116 "distribution law unknown to G4ParticleHPProduct");
117 }
118 if (theDist != nullptr) {
119 theDist->SetQValue(theActualStateQValue);
120 theDist->Init(aDataFile);
121 }
122}
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
virtual void Init(std::istream &aDataFile)=0

Referenced by G4ParticleHPEnAngCorrelation::Init().

◆ MeanEnergyOfThisInteraction()

G4double G4ParticleHPProduct::MeanEnergyOfThisInteraction ( )
inline

Definition at line 82 of file G4ParticleHPProduct.hh.

83 {
84 G4double result = 0.0;
85 if (theDist != nullptr) {
86 result = theDist->MeanEnergyOfThisInteraction();
87 result *= fCache.Get().theCurrentMultiplicity;
88 }
89 return result;
90 }
virtual G4double MeanEnergyOfThisInteraction()=0

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ Sample()

G4ReactionProductVector * G4ParticleHPProduct::Sample ( G4double anEnergy,
G4int nParticles )

Definition at line 149 of file G4ParticleHPProduct.cc.

150{
151 if (theDist == nullptr) {
152 return nullptr;
153 }
154 auto result = new G4ReactionProductVector;
155
156 theDist->SetTarget(fCache.Get().theTarget);
157 theDist->SetProjectileRP(fCache.Get().theProjectileRP);
159 theDist->ClearHistories();
160
161 for (G4int i = 0; i < multi; ++i) {
162 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
163 if (tmp != nullptr) {
164 result->push_back(tmp);
165#ifdef G4VERBOSE
166 if (G4ParticleHPManager::GetInstance()->GetDEBUG())
167 G4cout << "multi=" << multi << " i=" << i << " G4ParticleHPProduct::Sample "
168 << tmp->GetDefinition()->GetParticleName() << " E=" << tmp->GetKineticEnergy()
169 << G4endl;
170#endif
171 }
172 }
173 if (multi == 0) {
174 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
175 delete tmp;
176 }
177 return result;
178}
std::vector< G4ReactionProduct * > G4ReactionProductVector
const G4String & GetParticleName() const
G4double GetKineticEnergy() const
const G4ParticleDefinition * GetDefinition() const
void SetProjectileRP(G4ReactionProduct *aIncidentParticleRP)
virtual G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass)=0
void SetTarget(G4ReactionProduct *aTarget)

Referenced by G4ParticleHPEnAngCorrelation::Sample(), and G4ParticleHPEnAngCorrelation::SampleOne().

◆ SetProjectileRP()

void G4ParticleHPProduct::SetProjectileRP ( G4ReactionProduct * aIncidentPart)
inline

Definition at line 71 of file G4ParticleHPProduct.hh.

72 {
73 fCache.Get().theProjectileRP = aIncidentPart;
74 }

◆ SetTarget()

void G4ParticleHPProduct::SetTarget ( G4ReactionProduct * aTarget)
inline

Definition at line 76 of file G4ParticleHPProduct.hh.

76{ fCache.Get().theTarget = aTarget; }

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