Geant4 11.1.1
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, 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 52 of file G4ParticleHPProduct.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPProduct()

G4ParticleHPProduct::G4ParticleHPProduct ( )
inline

Definition at line 65 of file G4ParticleHPProduct.hh.

66 {
67 theDist = 0;
68 toBeCached val;
69 fCache.Put( val );
70
71 char * method = std::getenv( "G4PHP_MULTIPLICITY_METHOD" );
72 if( method )
73 {
74 if( G4String(method) == "Poisson" ) {
75 theMultiplicityMethod = G4HPMultiPoisson;
76 } else if( G4String(method) == "BetweenInts" ) {
77 theMultiplicityMethod = G4HPMultiBetweenInts;
78 } else {
79 throw G4HadronicException(__FILE__, __LINE__, ("multiplicity method unknown to G4ParticleHPProduct" + G4String(method)).c_str());
80 }
81 }
82 else
83 {
84 theMultiplicityMethod = G4HPMultiPoisson;
85 }
86 theMassCode = 0.0;
87 theMass = 0.0;
88 theIsomerFlag = 0;
89 theGroundStateQValue = 0.0;
90 theActualStateQValue = 0.0;
91 theDistLaw = -1;
92 }
@ G4HPMultiPoisson
@ G4HPMultiBetweenInts
void Put(const value_type &val) const
Definition: G4Cache.hh:321

◆ ~G4ParticleHPProduct()

G4ParticleHPProduct::~G4ParticleHPProduct ( )
inline

Definition at line 94 of file G4ParticleHPProduct.hh.

95 {
96 if(theDist != 0) delete theDist;
97 }

Member Function Documentation

◆ GetMass()

G4double G4ParticleHPProduct::GetMass ( )
inline

Definition at line 215 of file G4ParticleHPProduct.hh.

215{return theMass;}

◆ GetMassCode()

G4double G4ParticleHPProduct::GetMassCode ( )
inline

Definition at line 214 of file G4ParticleHPProduct.hh.

214{return theMassCode;}

◆ GetMeanYield()

G4double G4ParticleHPProduct::GetMeanYield ( G4double  anEnergy)
inline

Definition at line 167 of file G4ParticleHPProduct.hh.

168 {
169 return theYield.GetY(anEnergy);
170 }
G4double GetY(G4double x)

◆ GetMultiplicity()

G4int G4ParticleHPProduct::GetMultiplicity ( G4double  anEnergy)

Definition at line 45 of file G4ParticleHPProduct.cc.

46{
47 if ( theDist == 0 ) {
48 fCache.Get().theCurrentMultiplicity = 0;
49 return 0;
50 }
51
52 G4double mean = theYield.GetY(anEnergy);
53 if ( mean <= 0. ) {
54 fCache.Get().theCurrentMultiplicity = 0;
55 return 0;
56 }
57
58 G4int multi;
59 multi = G4int(mean+0.0001);
60#ifdef PHP_AS_HP
61 if ( theMassCode == 0 ) // DELETE THIS: IT MUST BE DONE FOR ALL PARTICLES
62#endif
63 {
64 if ( G4int ( mean ) == mean )
65 {
66 multi = (G4int) mean;
67 }
68 else
69 {
70#ifdef PHP_AS_HP
71 multi = G4Poisson ( mean );
72#else
73 if( theMultiplicityMethod == G4HPMultiPoisson )
74 {
75 multi = (G4int)G4Poisson ( mean );
76 }
77 else
78 {
80 G4int imulti = G4int(mean);
81 multi = imulti + G4int(radnf < mean-imulti);
82 }
83#endif
84 }
85#ifdef G4PHPDEBUG
86 #ifdef G4VERBOSE
87 if( std::getenv("G4ParticleHPDebug") && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
88 G4cout << "G4ParticleHPProduct::GetMultiplicity " << theMassCode
89 << " " << theMass << " multi " << multi << " mean " << mean
90 << G4endl;
91 #endif
92#endif
93 }
94
95 fCache.Get().theCurrentMultiplicity = static_cast<G4int>(mean);
96
97 return multi;
98}
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:57
G4GLOB_DLL std::ostream G4cout
static double shoot()
Definition: RandFlat.cc:61
value_type & Get() const
Definition: G4Cache.hh:315
static G4HadronicParameters * Instance()

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetProjectileRP()

G4ReactionProduct * G4ParticleHPProduct::GetProjectileRP ( )
inline

Definition at line 187 of file G4ParticleHPProduct.hh.

188 {
189 return fCache.Get().theProjectileRP;
190 }

◆ GetQValue()

G4double G4ParticleHPProduct::GetQValue ( )
inline

Definition at line 207 of file G4ParticleHPProduct.hh.

208 {
209 return theActualStateQValue;
210 }

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetTarget()

G4ReactionProduct * G4ParticleHPProduct::GetTarget ( )
inline

Definition at line 182 of file G4ParticleHPProduct.hh.

183 {
184 return fCache.Get().theTarget;
185 }

◆ Init()

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

Definition at line 99 of file G4ParticleHPProduct.hh.

100 {
101 aDataFile >> theMassCode>>theMass>>theIsomerFlag>>theDistLaw
102 >> theGroundStateQValue>>theActualStateQValue;
103 theGroundStateQValue*= CLHEP::eV;
104 theActualStateQValue*= CLHEP::eV;
105 theYield.Init(aDataFile, CLHEP::eV);
106 theYield.Hash();
107 if(theDistLaw==0)
108 {
109 // distribution not known, use E-independent, isotropic
110 // angular distribution
111 theDist = new G4ParticleHPIsotropic;
112 }
113 else if(theDistLaw == 1)
114 {
115 // Continuum energy-angular distribution
116 theDist = new G4ParticleHPContEnergyAngular(projectile);
117 }
118 else if(theDistLaw == 2)
119 {
120 // Discrete 2-body scattering
121 theDist = new G4ParticleHPDiscreteTwoBody;
122 }
123 else if(theDistLaw == 3)
124 {
125 // Isotropic emission
126 theDist = new G4ParticleHPIsotropic;
127 }
128 else if(theDistLaw == 4)
129 {
130 // Discrete 2-body recoil modification
131 // not used for now. @@@@
132 theDist = new G4ParticleHPDiscreteTwoBody;
133 // the above is only temporary;
134 // recoils need to be addressed
135 // properly
136 delete theDist;
137 theDist = 0;
138 }
139 // else if(theDistLaw == 5)
140 // {
141 // charged particles only, to be used in a later stage. @@@@
142 // }
143 else if(theDistLaw == 6)
144 {
145 // N-Body phase space
146 theDist = new G4ParticleHPNBodyPhaseSpace;
147 }
148 else if(theDistLaw == 7)
149 {
150 // Laboratory angular energy paraetrisation
151 theDist = new G4ParticleHPLabAngularEnergy;
152 }
153 else
154 {
155 throw G4HadronicException(__FILE__, __LINE__, "distribution law unknown to G4ParticleHPProduct");
156 }
157 if(theDist!=0)
158 {
159 theDist->SetQValue(theActualStateQValue);
160 theDist->Init(aDataFile);
161 }
162 }
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 192 of file G4ParticleHPProduct.hh.

193 {
194 G4double result;
195 if(theDist == 0)
196 {
197 result = 0;
198 }
199 else
200 {
201 result=theDist->MeanEnergyOfThisInteraction();
202 result *= fCache.Get().theCurrentMultiplicity;
203 }
204 return result;
205 }
virtual G4double MeanEnergyOfThisInteraction()=0

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ Sample()

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

Definition at line 101 of file G4ParticleHPProduct.cc.

102{
103 if(theDist == 0) { return nullptr; }
105
106 theDist->SetTarget(fCache.Get().theTarget);
107 theDist->SetProjectileRP(fCache.Get().theProjectileRP);
108 G4int i;
109 G4ReactionProduct * tmp;
110 theDist->ClearHistories();
111
112 for(i=0; i<multi; ++i)
113 {
114#ifdef G4PHPDEBUG
115
116#endif
117 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
118 if(tmp != 0) { result->push_back(tmp); }
119#ifndef G4PHPDEBUG //GDEB
120 #ifdef G4VERBOSE
121 if( std::getenv("G4ParticleHPDebug")
122 && tmp != 0 && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
123 G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample "
124 << tmp->GetDefinition()->GetParticleName() << " E= "
125 << tmp->GetKineticEnergy() << G4endl;
126 #endif
127#endif
128 }
129 if(multi == 0)
130 {
131 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
132 delete tmp;
133 }
134
135 return result;
136}
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 172 of file G4ParticleHPProduct.hh.

173 {
174 fCache.Get().theProjectileRP = aIncidentPart;
175 }

◆ SetTarget()

void G4ParticleHPProduct::SetTarget ( G4ReactionProduct aTarget)
inline

Definition at line 177 of file G4ParticleHPProduct.hh.

178 {
179 fCache.Get().theTarget = aTarget;
180 }

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