Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPProduct.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// P. Arce, June-2014 Conversion neutron_hp to particle_hp
28//
29#ifndef G4ParticleHPProduct_h
30#define G4ParticleHPProduct_h 1
31
33#include "globals.hh"
34#include "G4ParticleHPVector.hh"
35#include "Randomize.hh"
36#include "G4ios.hh"
37#include <fstream>
38#include "globals.hh"
41
47#include "G4Cache.hh"
49
51
53{
54 struct toBeCached
55 {
56 G4ReactionProduct* theProjectileRP;
57 G4ReactionProduct* theTarget;
58 G4int theCurrentMultiplicity;
59 toBeCached()
60 : theProjectileRP(0), theTarget(0), theCurrentMultiplicity(-1) {}
61 };
62
63public:
64
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 }
93
95 {
96 if(theDist != 0) delete theDist;
97 }
98
99 inline void Init(std::istream & aDataFile, G4ParticleDefinition* projectile)
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 }
170
172 G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles);
173
175 {
176 return theYield.GetY(anEnergy);
177 }
178
179 void SetProjectileRP(G4ReactionProduct * aIncidentPart)
180 {
181 fCache.Get().theProjectileRP = aIncidentPart;
182 }
183
185 {
186 fCache.Get().theTarget = aTarget;
187 }
188
190 {
191 return fCache.Get().theTarget;
192 }
193
195 {
196 return fCache.Get().theProjectileRP;
197 }
198
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 }
213
215 {
216 return theActualStateQValue;
217 }
218
219 //TK120515 For migration of frameFlag (MF6 LCT) = 3 in
220 //G4ParticleHPEnAngCorrelation
221 G4double GetMassCode() {return theMassCode;}
222 G4double GetMass() {return theMass;}
223
224private:
225
226 // data members
227
228 G4double theMassCode;
229 G4double theMass;
230 G4int theIsomerFlag;
231 G4double theGroundStateQValue;
232 G4double theActualStateQValue;
233 G4int theDistLaw; // redundant
234 G4ParticleHPVector theYield;
236
237 // cashed values
238 //
239 G4Cache<toBeCached> fCache;
240
241 G4HPMultiMethod theMultiplicityMethod;
242};
243
244#endif
G4HPMultiMethod
@ G4HPMultiPoisson
@ G4HPMultiBetweenInts
std::vector< G4ReactionProduct * > G4ReactionProductVector
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
value_type & Get() const
Definition: G4Cache.hh:315
void Put(const value_type &val) const
Definition: G4Cache.hh:321
void Init(std::istream &aDataFile, G4ParticleDefinition *projectile)
G4ReactionProduct * GetProjectileRP()
G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles)
G4double MeanEnergyOfThisInteraction()
G4ReactionProduct * GetTarget()
G4double GetMeanYield(G4double anEnergy)
void SetTarget(G4ReactionProduct *aTarget)
void SetProjectileRP(G4ReactionProduct *aIncidentPart)
G4int GetMultiplicity(G4double anEnergy)
G4double GetY(G4double x)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
virtual G4double MeanEnergyOfThisInteraction()=0
virtual void Init(std::istream &aDataFile)=0