72{
76
77 if(massCode==0)
78 {
80 }
81 else if(A==0)
82 {
85 }
86 else if(A==1)
87 {
90 }
91 else if(A==2)
92 {
94 }
95 else if(A==3)
96 {
99 }
100 else if(A==4)
101 {
104 }
105 else
106 {
107 throw G4HadronicException(__FILE__, __LINE__,
"G4NeutronHPLabAngularEnergy: Unknown ion case 2");
108 }
109
110
113
114 for(i=0; i<nEnergies; i++)
115 {
116 it = i;
117 if ( anEnergy < theEnergies[i] ) break;
118 }
119
120
121 if ( it == 0 )
122 {
123if(it==0)
G4cout <<
"080808 Something unexpected is happen in G4NeutronHPLabAngularEnergy " <<
G4endl;
124
126 running[0]=0;
127 for(i=0;i<nCosTh[it]; i++)
128 {
129 if(i!=0) running[i] = running[i-1];
131 }
134 for(i=0;i<nCosTh[it]; i++)
135 {
136 ith = i;
137 if(random<running[i]) break;
138 }
139
140
141 if ( ith == 0 )
142 {
143 cosTh = theData[it][ith].
GetLabel();
144 secEnergy = theData[it][ith].
Sample();
145 currentMeanEnergy = theData[it][ith].
GetMeanX();
146 }
147 else
148 {
149
150
151
157 cosTh = theInt.
Interpolate(theSecondManager[it].GetInverseScheme(ith),
158 x, x1, x2, y1, y2);
163 x1=y1;
164 x2=y2;
167 {
168 mu = theData[it][ith-1].
GetX(i);
169 y1 = theData[it][ith-1].
GetY(i);
170 y2 = theData[it][ith].
GetY(mu);
171
172 y = theInt.
Interpolate(theSecondManager[it].GetScheme(ith),
173 cosTh, x1,x2,y1,y2);
175 }
177 {
178 mu = theData[it][ith].
GetX(i);
179 y1 = theData[it][ith-1].
GetY(mu);
180 y2 = theData[it][ith].
GetY(i);
181 y = theInt.
Interpolate(theSecondManager[it].GetScheme(ith),
182 cosTh, x1,x2,y1,y2);
184 }
186 theStore.
Merge(&theBuff1, &theBuff2);
187 secEnergy = theStore.
Sample();
188 currentMeanEnergy = theStore.
GetMeanX();
189 }
190 delete [] running;
191 }
192 else
193 {
194 G4double x, x1, x2, y1, y2, y, tmp, E;
195
198 for(i=0;i<nCosTh[it-1]; i++)
199 {
200 if(i!=0) run1.
SetY(i, run1.
GetY(i-1));
201 run1.
SetX(i, theData[it-1][i].GetLabel());
202 run1.
SetY(i, run1.
GetY(i)+theData[it-1][i].GetIntegral());
203 }
206 for(i=0;i<nCosTh[it]; i++)
207 {
208 if(i!=0) run2.
SetY(i, run2.
GetY(i-1));
209 run2.
SetX(i, theData[it][i].GetLabel());
210 run2.
SetY(i, run2.
GetY(i)+theData[it][i].GetIntegral());
211 }
212
213 x = anEnergy;
214 x1 = theEnergies[it-1];
215 x2 = theEnergies[it];
219 {
225 }
229 {
233 y = theInt.
Lin(x, x1,x2,y1,y2);
235 }
237 theThVec.
Merge(&thBuff1 ,&thBuff2);
242 {
243 ith = i;
244 if(random<theThVec.
GetY(i)-theThVec.
GetY(0))
break;
245 }
246 {
247
249 xx = random;
250 xx1 = theThVec.
GetY(ith-1)-theThVec.
GetY(0);
251 xx2 = theThVec.
GetY(ith)-theThVec.
GetY(0);
252 yy1 = theThVec.
GetX(ith-1);
253 yy2 = theThVec.
GetX(ith);
254 cosTh = theInt.
Interpolate(theSecondManager[it].GetScheme(ith),
255 xx, xx1,xx2,yy1,yy2);
256 }
258
259
260 for(i=0; i<nCosTh[it-1]; i++)
261 {
262 i1 = i;
263 if(cosTh<theData[it-1][i].GetLabel()) break;
264 }
265
266 x = cosTh;
267 x1 = theData[it-1][i1-1].
GetLabel();
272 {
273 E = theData[it-1][i1-1].
GetX(i);
274 y1 = theData[it-1][i1-1].
GetY(i);
275 y2 = theData[it-1][i1].
GetY(E);
276 y = theInt.
Lin(x, x1,x2,y1,y2);
278 }
282 {
283 E = theData[it-1][i1].
GetX(i);
284 y1 = theData[it-1][i1-1].
GetY(E);
285 y2 = theData[it-1][i1].
GetY(i);
286 y = theInt.
Lin(x, x1,x2,y1,y2);
288 }
290 theStore1.
Merge(&theBuff1a, &theBuff2a);
291
292
293
294 for(i=0; i<nCosTh[it]; i++)
295 {
296 i2 = i;
297 if(cosTh<theData[it][i2].GetLabel()) break;
298 }
304 {
305 E = theData[it][i2-1].
GetX(i);
306 y1 = theData[it][i2-1].
GetY(i);
307 y2 = theData[it][i2].
GetY(E);
308 y = theInt.
Lin(x, x1,x2,y1,y2);
310 }
313
314
316 {
317
318
319
320 E = theData[it][i2].
GetX(i);
321 y1 = theData[it][i2-1].
GetY(E);
322 y2 = theData[it][i2].
GetY(i);
323 y = theInt.
Lin(x, x1,x2,y1,y2);
325 }
327 theStore2.
Merge(&theBuff1b, &theBuff2b);
328
329
330 x = anEnergy;
331 x1 = theEnergies[it-1];
332 x2 = theEnergies[it];
336 {
337 E = theStore1.
GetX(i);
338 y1 = theStore1.
GetY(i);
339 y2 = theStore2.
GetY(E);
342 }
346 {
347 E = theStore2.
GetX(i);
348 y1 = theStore1.
GetY(E);
349 y2 = theStore2.
GetY(i);
352 }
354 theOne.
Merge(&theOne1, &theOne2);
355
356 secEnergy = theOne.
Sample();
357 currentMeanEnergy = theOne.
GetMeanX();
358 }
359
360
361
363
368 G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
370
371 return result;
372}
G4DLLIMPORT std::ostream G4cout
static G4Deuteron * Deuteron()
static G4Electron * Electron()
G4InterpolationScheme GetScheme(G4int index) const
G4double Lin(G4double x, G4double x1, G4double x2, G4double y1, G4double y2)
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
void Merge(G4NeutronHPVector *active, G4NeutronHPVector *passive)
void SetX(G4int i, G4double e)
G4int GetVectorLength() const
G4double GetX(G4int i) const
const G4InterpolationManager & GetInterpolationManager() const
G4double GetY(G4double x)
void SetData(G4int i, G4double x, G4double y)
void SetInterpolationManager(const G4InterpolationManager &aManager)
void SetY(G4int i, G4double x)
static G4Neutron * Neutron()
static G4Positron * Positron()
static G4Proton * Proton()
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4double GetTotalMomentum() const
void SetKineticEnergy(const G4double en)
void SetDefinition(G4ParticleDefinition *aParticleDefinition)
static G4Triton * Triton()