Geant4 10.7.0
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 222 of file G4ParticleHPProduct.hh.

222{return theMass;}

◆ GetMassCode()

G4double G4ParticleHPProduct::GetMassCode ( )
inline

Definition at line 221 of file G4ParticleHPProduct.hh.

221{return theMassCode;}

◆ GetMeanYield()

G4double G4ParticleHPProduct::GetMeanYield ( G4double  anEnergy)
inline

Definition at line 174 of file G4ParticleHPProduct.hh.

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

◆ 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
81 if( theMultiplicityMethod == G4HPMultiPoisson ) {
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
value_type & Get() const
Definition: G4Cache.hh:315
static G4HadronicParameters * Instance()

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetProjectileRP()

G4ReactionProduct * G4ParticleHPProduct::GetProjectileRP ( )
inline

Definition at line 194 of file G4ParticleHPProduct.hh.

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

◆ GetQValue()

G4double G4ParticleHPProduct::GetQValue ( )
inline

Definition at line 214 of file G4ParticleHPProduct.hh.

215 {
216 return theActualStateQValue;
217 }

Referenced by G4ParticleHPEnAngCorrelation::Sample().

◆ GetTarget()

G4ReactionProduct * G4ParticleHPProduct::GetTarget ( )
inline

Definition at line 189 of file G4ParticleHPProduct.hh.

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

◆ 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 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
110 theGroundStateQValue*= CLHEP::eV;
111 theActualStateQValue*= CLHEP::eV;
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
118 theDist = new G4ParticleHPIsotropic;
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
128 theDist = new G4ParticleHPDiscreteTwoBody;
129 }
130 else if(theDistLaw == 3)
131 {
132 // Isotropic emission
133 theDist = new G4ParticleHPIsotropic;
134 }
135 else if(theDistLaw == 4)
136 {
137 // Discrete 2-body recoil modification
138 // not used for now. @@@@
139 theDist = new G4ParticleHPDiscreteTwoBody;
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
153 theDist = new G4ParticleHPNBodyPhaseSpace;
154 }
155 else if(theDistLaw == 7)
156 {
157 // Laboratory angular energy paraetrisation
158 theDist = new G4ParticleHPLabAngularEnergy;
159 }
160 else
161 {
162 throw G4HadronicException(__FILE__, __LINE__, "distribution law unknown to G4ParticleHPProduct");
163 }
164 if(theDist!=0)
165 {
166 theDist->SetQValue(theActualStateQValue);
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

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 {
208 result=theDist->MeanEnergyOfThisInteraction();
209 result *= fCache.Get().theCurrentMultiplicity;
210 }
211 return result;
212 }
virtual G4double MeanEnergyOfThisInteraction()=0

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;
123 theDist->ClearHistories();
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)

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 }

◆ SetTarget()

void G4ParticleHPProduct::SetTarget ( G4ReactionProduct aTarget)
inline

Definition at line 184 of file G4ParticleHPProduct.hh.

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

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