60 aDataFile >> theEnergy >> nEnergies >> nDiscreteEnergies >> nAngularParameters;
63 for(
G4int i=0; i<nEnergies; i++)
69 theAngular[i].
Init(aDataFile, nAngularParameters, 1.);
106 if(Z!=2)
throw G4HadronicException(__FILE__, __LINE__,
"G4NeutronHPContAngularPar: Unknown ion case 1");
118 if( angularRep == 1 )
124 if ( nDiscreteEnergies != 0 )
133 remaining_energy =
std::max ( theAngular[0].GetLabel() , theAngular[nEnergies-1].GetLabel() );
139 if ( nDiscreteEnergies == nEnergies )
141 remaining_energy =
std::max ( remaining_energy , theAngular[nDiscreteEnergies-1].GetLabel() );
148 for (
G4int j = nDiscreteEnergies ; j < nEnergies ; j++ )
150 cont_min = theAngular[j].
GetLabel();
151 if ( theAngular[j].GetValue(0) != 0.0 )
break;
153 remaining_energy =
std::max ( remaining_energy ,
std::min ( theAngular[nDiscreteEnergies-1].GetLabel() , cont_min ) );
161 for (
G4int j = 0 ; j < nDiscreteEnergies ; j++ )
164 if ( theAngular[j].GetLabel() <= remaining_energy ) delta = theAngular[i].
GetValue(0);
165 running[j+1] = running[j] + delta;
167 G4double tot_prob_DIS = running[ nDiscreteEnergies ];
169 for (
G4int j = nDiscreteEnergies ; j < nEnergies ; j++ )
174 if ( theAngular[j].GetLabel() <= remaining_energy ) delta = theAngular[j].
GetValue(0);
181 if ( theAngular[j].GetLabel() != 0 )
183 if ( j == nDiscreteEnergies ) {
192 if ( theAngular[j].GetLabel() == 0.0 ) {
194 if ( j != nEnergies-1 ) {
198 if ( theAngular[j].GetValue(0) != 0.0 ) {
199 throw G4HadronicException(__FILE__, __LINE__,
"G4NeutronHPContAngularPar: Unexpected non zero value of theAngular[nEnergies-1].GetValue(0)");
204 running[j+1] = running[j] + ( ( e_high - e_low ) * delta );
206 G4double tot_prob_CON = running[ nEnergies ] - running[ nDiscreteEnergies ];
220 random *= (tot_prob_DIS + tot_prob_CON);
222 if ( random <= ( tot_prob_DIS / ( tot_prob_DIS + tot_prob_CON ) ) || nDiscreteEnergies == nEnergies )
225 for (
G4int j = 0 ; j < nDiscreteEnergies ; j++ )
228 if ( random < running[ j+1 ] )
234 fsEnergy = theAngular[ it ].
GetLabel();
237 theStore.
Init(0,fsEnergy,nAngularParameters);
238 for (
G4int j=0;j<nAngularParameters;j++)
240 theStore.
SetCoeff(0,j,theAngular[it].GetValue(j));
249 for (
G4int j = nDiscreteEnergies ; j < nEnergies ; j++ )
252 if ( random < running[ j ] )
263 if ( it != nDiscreteEnergies )
271 theStore.
Init(0,y1,nAngularParameters);
272 theStore.
Init(1,y2,nAngularParameters);
274 for (
G4int j=0;j<nAngularParameters;j++)
277 if ( it == nDiscreteEnergies ) itt = it+1;
284 theStore.
SetCoeff(0,j,theAngular[itt-1].GetValue(j));
285 theStore.
SetCoeff(1,j,theAngular[itt].GetValue(j));
294 remaining_energy -= fsEnergy;
308 remaining_energy = theAngular[ nEnergies-1 ].
GetLabel();
316 for(i=1; i<nEnergies; i++)
331 running[i]=running[i-1];
332 if ( remaining_energy >= theAngular[i].GetLabel() )
344 if ( nEnergies == 1 || running[nEnergies-1] == 0 )
345 currentMeanEnergy = 0.0;
348 currentMeanEnergy = weighted/running[nEnergies-1];
352 if ( nEnergies == 1 ) it = 0;
355 if ( running[nEnergies-1] != 0 )
357 for ( i = 1 ; i < nEnergies ; i++ )
360 if ( random < running [ i ] / running [ nEnergies-1 ] )
break;
365 if ( running [ nEnergies-1 ] == 0 ) it = 0;
368 if (it<nDiscreteEnergies||it==0)
372 fsEnergy = theAngular[it].
GetLabel();
374 theStore.
Init(0,fsEnergy,nAngularParameters);
375 for(i=0;i<nAngularParameters;i++)
377 theStore.
SetCoeff(0,i,theAngular[it].GetValue(i));
389 running[it-1]/running[nEnergies-1],
390 running[it]/running[nEnergies-1],
394 theStore.
Init(0,e1,nAngularParameters);
395 theStore.
Init(1,e2,nAngularParameters);
396 for(i=0;i<nAngularParameters;i++)
398 theStore.
SetCoeff(0,i,theAngular[it-1].GetValue(i));
399 theStore.
SetCoeff(1,i,theAngular[it].GetValue(i));
408 G4double x1 = running[it-1]/running[nEnergies-1];
409 G4double x2 = running[it]/running[nEnergies-1];
415 theStore.
Init(0,y1,nAngularParameters);
416 theStore.
Init(1,y2,nAngularParameters);
418 for(i=0;i<nAngularParameters;i++)
420 theStore.
SetCoeff(0,i,theAngular[it-1].GetValue(i));
421 theStore.
SetCoeff(1,i,theAngular[it].GetValue(i));
429 remaining_energy -= fsEnergy;
433 else if(angularRep==2)
440 for(j=1; j<nEnergies; j++)
442 if(j!=0) running[j]=running[j-1];
453 if ( nEnergies == 1 )
454 currentMeanEnergy = 0.0;
456 currentMeanEnergy = weighted/running[nEnergies-1];
462 for(j=1; j<nEnergies; j++)
465 if(randkal<running[j]/running[nEnergies-1])
break;
471 x = randkal*running[nEnergies-1];
484 fsEnergy,
y1,
y2, cLow,cHigh);
493 G4int targetA =
G4int(theTargetCode-1000*targetZ);
498 G4int residualA = targetA+1-A;
499 G4int residualZ = targetZ-
Z;
504 incidentEnergy, incidentMass,
505 productEnergy, productMass,
506 residualMass, residualA, residualZ,
507 targetMass, targetA, targetZ);
508 cosTh = theKallbach.
Sample(anEnergy);
510 else if(angularRep>10&&angularRep<16)
516 for(i=1; i<nEnergies; i++)
518 if(i!=0) running[i]=running[i-1];
528 if ( nEnergies == 1 )
529 currentMeanEnergy = 0.0;
531 currentMeanEnergy = weighted/running[nEnergies-1];
534 if ( nEnergies == 1 ) it = 0;
536 for(i=1; i<nEnergies; i++)
539 if(random<running[i]/running[nEnergies-1])
break;
541 if(it<nDiscreteEnergies||it==0)
545 fsEnergy = theAngular[0].
GetLabel();
548 for(
G4int j=1; j<nAngularParameters; j+=2)
550 theStore.
SetX(aCounter, theAngular[0].GetValue(j));
551 theStore.
SetY(aCounter, theAngular[0].GetValue(j+1));
555 aMan.
Init(angularRep-10, nAngularParameters-1);
557 cosTh = theStore.
Sample();
561 fsEnergy = theAngular[it].
GetLabel();
564 aMan.
Init(angularRep-10, nAngularParameters-1);
568 for(
G4int j=1; j<nAngularParameters; j+=2)
570 theStore.
SetX(aCounter, theAngular[it].GetValue(j));
573 running[it-1]/running[nEnergies-1],
574 running[it]/running[nEnergies-1],
579 cosTh = theStore.
Sample();
584 G4double x1 = running[it-1]/running[nEnergies-1];
585 G4double x2 = running[it]/running[nEnergies-1];
593 aMan.
Init(angularRep-10, nAngularParameters-1);
607 for(i=0,j=1; i<nAngularParameters; i++,j+=2)
609 theBuff1.
SetX(i, theAngular[it-1].GetValue(j));
610 theBuff1.
SetY(i, theAngular[it-1].GetValue(j+1));
611 theBuff2.
SetX(i, theAngular[it].GetValue(j));
612 theBuff2.
SetY(i, theAngular[it].GetValue(j+1));
623 x = theBuff1.
GetX(i);
624 y1 = theBuff1.
GetY(i);
625 y2 = theBuff2.
GetY(i);
627 fsEnergy, theAngular[it-1].
GetLabel(),
632 cosTh = theStore.
Sample();
638 throw G4HadronicException(__FILE__, __LINE__,
"G4NeutronHPContAngularPar::Sample: Unknown angular representation");
645 G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
G4double GetY(G4double x)
G4int GetVectorLength() const
void SetInterpolationManager(const G4InterpolationManager &aManager)
G4double SampleMax(G4double energy)
G4double GetTotalMomentum() const
void SetLabel(G4double aLabel)
void Init(G4int aScheme, G4int aRange)
void SetKineticEnergy(const G4double en)
void Init(G4int i, G4double e, G4int n)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetCoeff(G4int i, G4int l, G4double coeff)
G4double G4NeutronHPJENDLHEData::G4double result
G4double GetX(G4int i) const
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
void SetY(G4int i, G4double x)
G4double GetWeightedBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, G4int angularRep, G4int interpol)
G4InterpolationScheme GetScheme(G4int index) const
G4double GetBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
static G4Triton * Triton()
static G4Proton * Proton()
void SetX(G4int i, G4double e)
static G4Neutron * Neutron()
static G4Deuteron * Deuteron()
static G4IonTable * GetIonTable()
G4double Sample(G4double anEnergy)
void Init(std::istream &aDataFile, G4int nPar, G4double unit=1.)
static G4Positron * Positron()
G4double GetPDGMass() const
static G4double GetBindingEnergy(const G4int A, const G4int Z)
void Init(std::istream &aDataFile)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void SetManager(G4InterpolationManager &aManager)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void SetDefinition(G4ParticleDefinition *aParticleDefinition)
G4double GetValue(G4int i)
G4InterpolationScheme GetInverseScheme(G4int index)
static G4Electron * Electron()