Geant4 11.1.1
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 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 }
163
165 G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles);
166
168 {
169 return theYield.GetY(anEnergy);
170 }
171
172 void SetProjectileRP(G4ReactionProduct * aIncidentPart)
173 {
174 fCache.Get().theProjectileRP = aIncidentPart;
175 }
176
178 {
179 fCache.Get().theTarget = aTarget;
180 }
181
183 {
184 return fCache.Get().theTarget;
185 }
186
188 {
189 return fCache.Get().theProjectileRP;
190 }
191
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 }
206
208 {
209 return theActualStateQValue;
210 }
211
212 //TK120515 For migration of frameFlag (MF6 LCT) = 3 in
213 //G4ParticleHPEnAngCorrelation
214 G4double GetMassCode() {return theMassCode;}
215 G4double GetMass() {return theMass;}
216
217private:
218
219 // data members
220
221 G4double theMassCode;
222 G4double theMass;
223 G4int theIsomerFlag;
224 G4double theGroundStateQValue;
225 G4double theActualStateQValue;
226 G4int theDistLaw; // redundant
227 G4ParticleHPVector theYield;
229
230 // cashed values
231 //
232 G4Cache<toBeCached> fCache;
233
234 G4HPMultiMethod theMultiplicityMethod;
235};
236
237#endif
G4HPMultiMethod
@ G4HPMultiPoisson
@ G4HPMultiBetweenInts
std::vector< G4ReactionProduct * > G4ReactionProductVector
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
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