74{
78
79 if(massCode==0)
80 {
82 }
83 else if(A==0)
84 {
87 }
88 else if(A==1)
89 {
92 }
93 else if(A==2)
94 {
96 }
97 else if(A==3)
98 {
101 }
102 else if(A==4)
103 {
106 }
107 else
108 {
109 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPLabAngularEnergy: Unknown ion case 2");
110 }
111
112
115
116 for(i=0; i<nEnergies; i++)
117 {
118 it = i;
119 if ( anEnergy < theEnergies[i] ) break;
120 }
121
122
123 if ( it == 0 )
124 {
125 G4cout <<
"080808 Something unexpected is happen in G4ParticleHPLabAngularEnergy " <<
G4endl;
126
128 running[0]=0;
129 for(i=0;i<nCosTh[it]; i++)
130 {
131 if(i!=0) running[i] = running[i-1];
133 }
136 for(i=0;i<nCosTh[it]; i++)
137 {
138 ith = i;
139 if(random<running[i]) break;
140 }
141
142
143 if ( ith == 0 )
144 {
145 cosTh = theData[it][ith].
GetLabel();
146 secEnergy = theData[it][ith].
Sample();
147 currentMeanEnergy = theData[it][ith].
GetMeanX();
148 }
149 else
150 {
151
152
153
159 cosTh = theInt.
Interpolate(theSecondManager[it].GetInverseScheme(ith),
160 x, x1, x2, y1, y2);
165 x1=y1;
166 x2=y2;
169 {
170 mu = theData[it][ith-1].
GetX(i);
171 y1 = theData[it][ith-1].
GetY(i);
172 y2 = theData[it][ith].
GetY(mu);
173
174 y = theInt.
Interpolate(theSecondManager[it].GetScheme(ith),
175 cosTh, x1,x2,y1,y2);
177 }
179 {
180 mu = theData[it][ith].
GetX(i);
181 y1 = theData[it][ith-1].
GetY(mu);
182 y2 = theData[it][ith].
GetY(i);
183 y = theInt.
Interpolate(theSecondManager[it].GetScheme(ith),
184 cosTh, x1,x2,y1,y2);
186 }
188 theStore.
Merge(&theBuff1, &theBuff2);
189 secEnergy = theStore.
Sample();
190 currentMeanEnergy = theStore.
GetMeanX();
191 }
192 delete [] running;
193 }
194 else
195 {
196 G4double x, x1, x2, y1, y2, y, tmp, E;
197
200 for(i=0;i<nCosTh[it-1]; i++)
201 {
202 if(i!=0) run1.
SetY(i, run1.
GetY(i-1));
203 run1.
SetX(i, theData[it-1][i].GetLabel());
204 run1.
SetY(i, run1.
GetY(i)+theData[it-1][i].GetIntegral());
205 }
208 for(i=0;i<nCosTh[it]; i++)
209 {
210 if(i!=0) run2.
SetY(i, run2.
GetY(i-1));
211 run2.
SetX(i, theData[it][i].GetLabel());
212 run2.
SetY(i, run2.
GetY(i)+theData[it][i].GetIntegral());
213 }
214
215 x = anEnergy;
216 x1 = theEnergies[it-1];
217 x2 = theEnergies[it];
221 {
227 }
231 {
235 y = theInt.
Lin(x, x1,x2,y1,y2);
237 }
239 theThVec.
Merge(&thBuff1 ,&thBuff2);
244 {
245 ith = i;
246 if(random<theThVec.
GetY(i)-theThVec.
GetY(0))
break;
247 }
248 {
249
251 xx = random;
252 xx1 = theThVec.
GetY(ith-1)-theThVec.
GetY(0);
253 xx2 = theThVec.
GetY(ith)-theThVec.
GetY(0);
254 yy1 = theThVec.
GetX(ith-1);
255 yy2 = theThVec.
GetX(ith);
256 cosTh = theInt.
Interpolate(theSecondManager[it].GetScheme(ith),
257 xx, xx1,xx2,yy1,yy2);
258 }
260
261
262 for(i=0; i<nCosTh[it-1]; i++)
263 {
264 i1 = i;
265 if(cosTh<theData[it-1][i].GetLabel()) break;
266 }
267
268 x = cosTh;
269 x1 = theData[it-1][i1-1].
GetLabel();
274 {
275 E = theData[it-1][i1-1].
GetX(i);
276 y1 = theData[it-1][i1-1].
GetY(i);
277 y2 = theData[it-1][i1].
GetY(E);
278 y = theInt.
Lin(x, x1,x2,y1,y2);
280 }
284 {
285 E = theData[it-1][i1].
GetX(i);
286 y1 = theData[it-1][i1-1].
GetY(E);
287 y2 = theData[it-1][i1].
GetY(i);
288 y = theInt.
Lin(x, x1,x2,y1,y2);
290 }
292 theStore1.
Merge(&theBuff1a, &theBuff2a);
293
294
295
296 for(i=0; i<nCosTh[it]; i++)
297 {
298 i2 = i;
299 if(cosTh<theData[it][i2].GetLabel()) break;
300 }
306 {
307 E = theData[it][i2-1].
GetX(i);
308 y1 = theData[it][i2-1].
GetY(i);
309 y2 = theData[it][i2].
GetY(E);
310 y = theInt.
Lin(x, x1,x2,y1,y2);
312 }
315
316
318 {
319
320
321
322 E = theData[it][i2].
GetX(i);
323 y1 = theData[it][i2-1].
GetY(E);
324 y2 = theData[it][i2].
GetY(i);
325 y = theInt.
Lin(x, x1,x2,y1,y2);
327 }
329 theStore2.
Merge(&theBuff1b, &theBuff2b);
330
331
332 x = anEnergy;
333 x1 = theEnergies[it-1];
334 x2 = theEnergies[it];
338 {
339 E = theStore1.
GetX(i);
340 y1 = theStore1.
GetY(i);
341 y2 = theStore2.
GetY(E);
344 }
348 {
349 E = theStore2.
GetX(i);
350 y1 = theStore1.
GetY(E);
351 y2 = theStore2.
GetY(i);
354 }
356 theOne.
Merge(&theOne1, &theOne2);
357
358 secEnergy = theOne.
Sample();
359 currentMeanEnergy = theOne.
GetMeanX();
360 }
361
362
363
365
370 G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
372
373 return result;
374}
double A(double temperature)
G4GLOB_DLL std::ostream G4cout
static G4Deuteron * Deuteron()
static G4Electron * Electron()
G4InterpolationScheme GetScheme(G4int index) const
static G4Neutron * Neutron()
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double Lin(G4double x, G4double x1, G4double x2, G4double y1, G4double y2)
void SetY(G4int i, G4double x)
void SetX(G4int i, G4double e)
void SetData(G4int i, G4double x, G4double y)
const G4InterpolationManager & GetInterpolationManager() const
void SetInterpolationManager(const G4InterpolationManager &aManager)
G4double GetY(G4double x)
G4double GetX(G4int i) const
void Merge(G4ParticleHPVector *active, G4ParticleHPVector *passive)
G4int GetVectorLength() const
static G4Positron * Positron()
static G4Proton * Proton()
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetTotalMomentum() const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetKineticEnergy(const G4double en)
static G4Triton * Triton()