Geant4-11
Data Structures | Public Member Functions | Private Attributes
G4ParticleHPProduct Class Reference

#include <G4ParticleHPProduct.hh>

Data Structures

struct  toBeCached
 

Public Member Functions

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

Private Attributes

G4Cache< toBeCachedfCache
 
G4double theActualStateQValue
 
G4VParticleHPEnergyAngulartheDist
 
G4int theDistLaw
 
G4double theGroundStateQValue
 
G4int theIsomerFlag
 
G4double theMass
 
G4double theMassCode
 
G4HPMultiMethod theMultiplicityMethod
 
G4ParticleHPVector theYield
 

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" ) {
76 } else if( G4String(method) == "BetweenInts" ) {
78 } else {
79 throw G4HadronicException(__FILE__, __LINE__, ("multiplicity method unknown to G4ParticleHPProduct" + G4String(method)).c_str());
80 }
81 }
82 else
83 {
85 }
86 theMassCode = 0.0;
87 theMass = 0.0;
88 theIsomerFlag = 0;
91 theDistLaw = -1;
92 }
@ G4HPMultiPoisson
@ G4HPMultiBetweenInts
G4HPMultiMethod theMultiplicityMethod
G4Cache< toBeCached > fCache
G4VParticleHPEnergyAngular * theDist

References fCache, G4HPMultiBetweenInts, G4HPMultiPoisson, theActualStateQValue, theDist, theDistLaw, theGroundStateQValue, theIsomerFlag, theMass, theMassCode, and theMultiplicityMethod.

◆ ~G4ParticleHPProduct()

G4ParticleHPProduct::~G4ParticleHPProduct ( )
inline

Definition at line 94 of file G4ParticleHPProduct.hh.

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

References theDist.

Member Function Documentation

◆ GetMass()

G4double G4ParticleHPProduct::GetMass ( )
inline

Definition at line 222 of file G4ParticleHPProduct.hh.

222{return theMass;}

References theMass.

◆ GetMassCode()

G4double G4ParticleHPProduct::GetMassCode ( )
inline

Definition at line 221 of file G4ParticleHPProduct.hh.

221{return theMassCode;}

References theMassCode.

◆ GetMeanYield()

G4double G4ParticleHPProduct::GetMeanYield ( G4double  anEnergy)
inline

Definition at line 174 of file G4ParticleHPProduct.hh.

175 {
176 return theYield.GetY(anEnergy);
177 }
G4ParticleHPVector theYield
G4double GetY(G4double x)

References G4ParticleHPVector::GetY(), and theYield.

◆ GetMultiplicity()

G4int G4ParticleHPProduct::GetMultiplicity ( G4double  anEnergy)

Definition at line 45 of file G4ParticleHPProduct.cc.

46{
47 //if(theDist == 0) { return 0; }
48 //151120 TK Modified for solving reproducibility problem
49 if ( theDist == 0 ) {
50 fCache.Get().theCurrentMultiplicity = 0;
51 return 0;
52 }
53
54 G4double mean = theYield.GetY(anEnergy);
55 //g G4cout << "G4ParticleHPProduct MEAN NUMBER OF PARTICLES " << mean << " for " << theMass << G4endl;
56 //if( mean <= 0. ) return 0;
57 //151120 TK Modified for solving reproducibility problem
58 //This is also a real fix
59 if ( mean <= 0. ) {
60 fCache.Get().theCurrentMultiplicity = 0;
61 return 0;
62 }
63
64 G4int multi;
65 multi = G4int(mean+0.0001);
66 //if(theMassCode==0) multi = G4Poisson(mean); // @@@@gammas. please X-check this
67 //080718
68#ifdef PHP_AS_HP
69 if ( theMassCode == 0 ) // DELETE THIS: IT MUST BE DONE FOR ALL PARTICLES
70#endif
71 {
72 if ( G4int ( mean ) == mean )
73 {
74 multi = (G4int) mean;
75 }
76 else
77 {
78#ifdef PHP_AS_HP
79 multi = G4Poisson ( mean );
80#else
82 multi = G4Poisson ( mean );
83 #ifdef G4VERBOSE
84 if( std::getenv("G4PHPTEST") && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
85 G4cout << " MULTIPLICITY MULTIPLIED " << multi << " " << theMassCode << G4endl;
86 #endif
87 } else { // if( theMultiplicityMethod == G4HPMultiBetweenInts ) {
89 G4int imulti = G4int(mean);
90 multi = imulti + G4int(radnf < mean-imulti);
91 // G4cout << theMass << " multi " << multi << " mean " << mean
92 // << " radnf " << radnf << " mean-imulti " << mean-imulti << G4endl;
93 }
94#endif
95 // multi = int(mean);
96 // if( CLHEP::RandFlat::shoot() > mean-multi ) multi++;
97 }
98#ifdef G4PHPDEBUG
99 #ifdef G4VERBOSE
100 if( std::getenv("G4ParticleHPDebug") && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
101 G4cout << "G4ParticleHPProduct::GetMultiplicity " << theMassCode << " " << theMass << " multi " << multi << " mean " << mean << G4endl;
102 #endif
103#endif
104 }
105
106 fCache.Get().theCurrentMultiplicity = static_cast<G4int>(mean);
107
108 return multi;
109}
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
static G4HadronicParameters * Instance()

References fCache, G4cout, G4endl, G4HPMultiPoisson, G4Poisson(), G4ParticleHPVector::GetY(), G4HadronicParameters::Instance(), CLHEP::RandFlat::shoot(), theDist, theMass, theMassCode, theMultiplicityMethod, and theYield.

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetProjectileRP()

G4ReactionProduct * G4ParticleHPProduct::GetProjectileRP ( )
inline

Definition at line 194 of file G4ParticleHPProduct.hh.

195 {
196 return fCache.Get().theProjectileRP;
197 }

References fCache.

◆ GetQValue()

G4double G4ParticleHPProduct::GetQValue ( )
inline

Definition at line 214 of file G4ParticleHPProduct.hh.

215 {
217 }

References theActualStateQValue.

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetTarget()

G4ReactionProduct * G4ParticleHPProduct::GetTarget ( void  )
inline

Definition at line 189 of file G4ParticleHPProduct.hh.

190 {
191 return fCache.Get().theTarget;
192 }

References fCache.

◆ Init()

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

Definition at line 99 of file G4ParticleHPProduct.hh.

100 {
103 if( std::getenv("G4PHPTEST") )
104 G4cout << " G4ParticleHPProduct :: Init MassCode "
105 << theMassCode << " " << theMass << " theActualStateQValue "
106 << theActualStateQValue << G4endl;// GDEB
107 if( std::getenv("G4PHPTEST") )
108 G4cout << " G4ParticleHPProduct :: Init theActualStateQValue "
109 << theActualStateQValue << G4endl;// GDEB
112 theYield.Init(aDataFile, CLHEP::eV);
113 theYield.Hash();
114 if(theDistLaw==0)
115 {
116 // distribution not known, use E-independent, isotropic
117 // angular distribution
119 }
120 else if(theDistLaw == 1)
121 {
122 // Continuum energy-angular distribution
123 theDist = new G4ParticleHPContEnergyAngular(projectile);
124 }
125 else if(theDistLaw == 2)
126 {
127 // Discrete 2-body scattering
129 }
130 else if(theDistLaw == 3)
131 {
132 // Isotropic emission
134 }
135 else if(theDistLaw == 4)
136 {
137 // Discrete 2-body recoil modification
138 // not used for now. @@@@
140 // the above is only temporary;
141 // recoils need to be addressed
142 // properly
143 delete theDist;
144 theDist = 0;
145 }
146 // else if(theDistLaw == 5)
147 // {
148 // charged particles only, to be used in a later stage. @@@@
149 // }
150 else if(theDistLaw == 6)
151 {
152 // N-Body phase space
154 }
155 else if(theDistLaw == 7)
156 {
157 // Laboratory angular energy paraetrisation
159 }
160 else
161 {
162 throw G4HadronicException(__FILE__, __LINE__, "distribution law unknown to G4ParticleHPProduct");
163 }
164 if(theDist!=0)
165 {
167 theDist->Init(aDataFile);
168 }
169 }
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
virtual void Init(std::istream &aDataFile)=0
static constexpr double eV

References CLHEP::eV, G4cout, G4endl, G4ParticleHPVector::Hash(), G4VParticleHPEnergyAngular::Init(), G4ParticleHPVector::Init(), G4VParticleHPEnergyAngular::SetQValue(), theActualStateQValue, theDist, theDistLaw, theGroundStateQValue, theIsomerFlag, theMass, theMassCode, and theYield.

Referenced by G4ParticleHPEnAngCorrelation::Init().

◆ MeanEnergyOfThisInteraction()

G4double G4ParticleHPProduct::MeanEnergyOfThisInteraction ( )
inline

Definition at line 199 of file G4ParticleHPProduct.hh.

200 {
201 G4double result;
202 if(theDist == 0)
203 {
204 result = 0;
205 }
206 else
207 {
209 result *= fCache.Get().theCurrentMultiplicity;
210 }
211 return result;
212 }
virtual G4double MeanEnergyOfThisInteraction()=0

References fCache, G4VParticleHPEnergyAngular::MeanEnergyOfThisInteraction(), and theDist.

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ Sample()

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

Definition at line 112 of file G4ParticleHPProduct.cc.

113{
114 if(theDist == 0) { return 0; }
116
117 theDist->SetTarget(fCache.Get().theTarget);
118 theDist->SetProjectileRP(fCache.Get().theProjectileRP);
119 G4int i;
120// G4double eMax = GetTarget()->GetMass()+GetNeutron()->GetMass()
121// - theActualStateQValue;
122 G4ReactionProduct * tmp;
124
125 for(i=0;i<multi;i++)
126 {
127#ifdef G4PHPDEBUG
128 if( std::getenv("G4PHPTEST") )
129 #ifdef G4VERBOSE
130 if( std::getenv("G4ParticleHPDebug") && tmp != 0 && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
131 G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << anEnergy << " Mass " << theMassCode << " " << theMass << G4endl;
132 #endif
133#endif
134 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
135 if(tmp != 0) { result->push_back(tmp); }
136#ifndef G4PHPDEBUG //GDEB
137 #ifdef G4VERBOSE
138 if( std::getenv("G4ParticleHPDebug") && tmp != 0 && G4HadronicParameters::Instance()->GetVerboseLevel() > 0 )
139 G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << tmp->GetDefinition()->GetParticleName() << " E= " << tmp->GetKineticEnergy() << G4endl;
140 #endif
141#endif
142 }
143 if(multi == 0)
144 {
145 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
146 delete tmp;
147 }
148 /*
149 //080901 TK Comment out, too many secondaries are produced in deuteron reactions
150 if(theTarget->GetMass()<2*GeV) // @@@ take care of residuals in all cases
151 {
152 tmp = theDist->Sample(anEnergy, theMassCode, theMass);
153 tmp->SetDefinition(G4Proton::Proton());
154 if(tmp != 0) { result->push_back(tmp); }
155 }
156 */
157
158 return result;
159}
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)

References G4VParticleHPEnergyAngular::ClearHistories(), fCache, G4cout, G4endl, G4ReactionProduct::GetDefinition(), G4ReactionProduct::GetKineticEnergy(), G4ParticleDefinition::GetParticleName(), G4HadronicParameters::Instance(), G4VParticleHPEnergyAngular::Sample(), G4VParticleHPEnergyAngular::SetProjectileRP(), G4VParticleHPEnergyAngular::SetTarget(), theDist, theMass, and theMassCode.

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

◆ SetProjectileRP()

void G4ParticleHPProduct::SetProjectileRP ( G4ReactionProduct aIncidentPart)
inline

Definition at line 179 of file G4ParticleHPProduct.hh.

180 {
181 fCache.Get().theProjectileRP = aIncidentPart;
182 }

References fCache.

◆ SetTarget()

void G4ParticleHPProduct::SetTarget ( G4ReactionProduct aTarget)
inline

Definition at line 184 of file G4ParticleHPProduct.hh.

185 {
186 fCache.Get().theTarget = aTarget;
187 }

References fCache.

Field Documentation

◆ fCache

G4Cache<toBeCached> G4ParticleHPProduct::fCache
private

◆ theActualStateQValue

G4double G4ParticleHPProduct::theActualStateQValue
private

Definition at line 232 of file G4ParticleHPProduct.hh.

Referenced by G4ParticleHPProduct(), GetQValue(), and Init().

◆ theDist

G4VParticleHPEnergyAngular* G4ParticleHPProduct::theDist
private

◆ theDistLaw

G4int G4ParticleHPProduct::theDistLaw
private

Definition at line 233 of file G4ParticleHPProduct.hh.

Referenced by G4ParticleHPProduct(), and Init().

◆ theGroundStateQValue

G4double G4ParticleHPProduct::theGroundStateQValue
private

Definition at line 231 of file G4ParticleHPProduct.hh.

Referenced by G4ParticleHPProduct(), and Init().

◆ theIsomerFlag

G4int G4ParticleHPProduct::theIsomerFlag
private

Definition at line 230 of file G4ParticleHPProduct.hh.

Referenced by G4ParticleHPProduct(), and Init().

◆ theMass

G4double G4ParticleHPProduct::theMass
private

Definition at line 229 of file G4ParticleHPProduct.hh.

Referenced by G4ParticleHPProduct(), GetMass(), GetMultiplicity(), Init(), and Sample().

◆ theMassCode

G4double G4ParticleHPProduct::theMassCode
private

◆ theMultiplicityMethod

G4HPMultiMethod G4ParticleHPProduct::theMultiplicityMethod
private

Definition at line 241 of file G4ParticleHPProduct.hh.

Referenced by G4ParticleHPProduct(), and GetMultiplicity().

◆ theYield

G4ParticleHPVector G4ParticleHPProduct::theYield
private

Definition at line 234 of file G4ParticleHPProduct.hh.

Referenced by GetMeanYield(), GetMultiplicity(), and Init().


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