Geant4-11
G4ParticleHPContAngularPar.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//
28// 080718 Add ClearHistories method and related class member
29//
30// P. Arce, June-2014 Conversion neutron_hp to particle_hp
31//
32#ifndef G4ParticleHPContAngularPar_h
33#define G4ParticleHPContAngularPar_h 1
34
35#include <fstream>
36#include <set>
37
38#include "G4ios.hh"
39#include "globals.hh"
40#include "G4ParticleHPList.hh"
41#include "G4ReactionProduct.hh"
44#include "G4Cache.hh"
45
47
49{
50
52 {
60 : fresh(true),currentMeanEnergy(-2.0),remaining_energy(0.0),
62 };
63
64 public:
65
67 {
68 theAngular = 0;
69 //currentMeanEnergy = -2;
70 //fresh = true;
71 fCache.Put(0);
74 theEnergy = -1;
75 nEnergies = -1;
78 theProjectile = 0;
79 adjustResult = true;
80 }
81
83 {
84 theEnergy = val.theEnergy;
85 nEnergies = val.nEnergies;
90 theInt = val.theInt;
97 fCache.Put(0);
99 for(G4int ie=0;ie<nEnergies;++ie) {
100 theAngular[ie].SetLabel(val.theAngular[ie].GetLabel());
101 for(G4int ip=0;ip<nAngularParameters;++ip) {
102 theAngular[ie].SetValue(ip,val.theAngular[ie].GetValue(ip));
103 }
104 }
105 }
106
108
110 {
111 if (theAngular !=0 ) delete [] theAngular;
112 if (fCache.Get() != 0) delete fCache.Get();
113 }
114
115 void Init(std::istream & aDataFile, G4ParticleDefinition* projectile);
116
117 G4ReactionProduct* Sample(G4double anEnergy, G4double massCode, G4double mass,
118 G4int angularRep, G4int interpol);
119
121 {
122 if( std::getenv("G4PHPTEST") )
123 G4cout << this << " G4ParticleHPContAngularPar::GetEnergy "
124 << theEnergy << " nE " << nEnergies << G4endl;
125 return theEnergy;
126 }
127
129 {
130 fCache.Get()->thePrimary = aPrimary;
131 }
132
134 {
135 fCache.Get()->theTarget = aTarget;
136 }
137
138 void SetTargetCode(G4double aTargetCode)
139 {
140 fCache.Get()->theTargetCode = aTargetCode;
141 }
142
143 void SetInterpolation(G4int theInterpolation)
144 {
145 theManager.Init(theInterpolation, nEnergies); // one range only
146 }
147
151 // NOTE: this interpolates legendre coefficients
152
154
156 {
157 G4double result;
158 if(fCache.Get()->currentMeanEnergy<-1)
159 {
160 return 0;
161 // throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContAngularPar: Logical error in Product class");
162 }
163 else
164 {
165 result = fCache.Get()->currentMeanEnergy;
166 }
167 fCache.Get()->currentMeanEnergy = -2;
168 return result;
169 }
170
172 {
173 return nEnergies;
174 }
176 {
177 return nDiscreteEnergies;
178 }
179 std::set<G4double> GetEnergiesTransformed() const
180 {
182 }
184 {
185 return theEnergiesTransformed.size();
186 }
188 {
189 return theMinEner;
190 }
192 {
193 return theMaxEner;
194 }
195 std::map<G4double,G4int> GetDiscreteEnergiesOwn() const
196 {
198 }
200 {
201 return theAngular;
202 }
203
205 {
206 if ( fCache.Get() == 0 ) cacheInit();
207 fCache.Get()->fresh = true;
208 }
209
210 void Dump() const;
211
212private:
213
214 // incoming particle
216 // number of exit channel energies
218 // number of discrete exit channels
220 // number of angular paramerers per channel
222 // knows the interpolation between List labels
224 // on per exit-channel energy
226
228
229private:
230
233 {
234 toBeCached* val = new toBeCached;
235 val->currentMeanEnergy = -2;
236 val->remaining_energy = 0;
237 val->fresh=true;
238 fCache.Put( val );
239 };
240
242
244 // if not set it will not force the conservation of energy in angularRep==1,
245 // but will sample the particle energy according to the database
246
249 std::set<G4double> theEnergiesTransformed;
250 std::set<G4double> theDiscreteEnergies;
251 std::map<G4double,G4int> theDiscreteEnergiesOwn;
252};
253
254#endif
G4InterpolationScheme
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void Init(G4int aScheme, G4int aRange)
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, G4int angularRep, G4int interpol)
G4ParticleHPList * GetAngDataList() const
void Init(std::istream &aDataFile, G4ParticleDefinition *projectile)
std::map< G4double, G4int > GetDiscreteEnergiesOwn() const
void SetPrimary(G4ReactionProduct *aPrimary)
void SetTarget(G4ReactionProduct *aTarget)
void SetInterpolation(G4int theInterpolation)
G4ParticleHPContAngularPar(G4ParticleHPContAngularPar &val)
std::set< G4double > GetEnergiesTransformed() const
void SetTargetCode(G4double aTargetCode)
std::map< G4double, G4int > theDiscreteEnergiesOwn
void BuildByInterpolation(G4double anEnergy, G4InterpolationScheme aScheme, G4ParticleHPContAngularPar &store1, G4ParticleHPContAngularPar &store2)
void SetLabel(G4double aLabel)
void SetValue(G4int i, G4double y)
G4double GetValue(G4int i)
#define DBL_MAX
Definition: templates.hh:62