100 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4ParticleHPContAngularPar::Sample " << anEnergy <<
" " << massCode <<
" " << angularRep <<
G4endl;
131 if(Z!=2)
throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPContAngularPar: Unknown ion case 1");
142 if( angularRep == 1 )
153 if (
fCache.Get()->fresh == true )
158 fCache.Get()->fresh =
false;
175 if (
theAngular[j].GetValue(0) != 0.0 )
break;
189 running[j+1] = running[j] + delta;
207 if ( j == nDiscreteEnergies ) {
218 if ( j != nEnergies-1 ) {
223 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPContAngularPar: Unexpected non zero value of theAngular[nEnergies-1].GetValue(0)");
228 running[j+1] = running[j] + ( ( e_high - e_low ) * delta );
244 random *= (tot_prob_DIS + tot_prob_CON);
246 if ( random <= ( tot_prob_DIS / ( tot_prob_DIS + tot_prob_CON ) ) || nDiscreteEnergies ==
nEnergies )
252 if ( random < running[ j+1 ] )
264 theStore.SetCoeff(0,j,
theAngular[it].GetValue(j));
267 cosTh = theStore.SampleMax(fsEnergy);
276 if ( random < running[ j ] )
287 if ( it != nDiscreteEnergies )
295 theStore.Init(0,y1,nAngularParameters);
296 theStore.Init(1,y2,nAngularParameters);
301 if ( it == nDiscreteEnergies ) itt = it+1;
308 theStore.SetCoeff(0,j,
theAngular[itt-1].GetValue(j));
309 theStore.SetCoeff(1,j,
theAngular[itt].GetValue(j));
312 cosTh = theStore.SampleMax(fsEnergy);
330 if (
fCache.Get()->fresh == true )
333 fCache.Get()->fresh =
false;
355 running[i]=running[i-1];
368 if ( nEnergies == 1 || running[nEnergies-1] == 0 )
369 fCache.Get()->currentMeanEnergy = 0.0;
372 fCache.Get()->currentMeanEnergy = weighted/running[nEnergies-1];
376 if ( nEnergies == 1 ) it = 0;
379 if ( running[nEnergies-1] != 0 )
384 if ( random < running [ i ] / running [ nEnergies-1 ] )
break;
389 if ( running [ nEnergies-1 ] == 0 ) it = 0;
392 if (it<nDiscreteEnergies||it==0)
398 theStore.Init(0,fsEnergy,nAngularParameters);
401 theStore.SetCoeff(0,i,
theAngular[it].GetValue(i));
404 cosTh = theStore.SampleMax(fsEnergy);
413 running[it-1]/running[nEnergies-1],
414 running[it]/running[nEnergies-1],
418 theStore.Init(0,e1,nAngularParameters);
419 theStore.Init(1,e2,nAngularParameters);
422 theStore.SetCoeff(0,i,
theAngular[it-1].GetValue(i));
423 theStore.SetCoeff(1,i,
theAngular[it].GetValue(i));
427 cosTh = theStore.SampleMax(fsEnergy);
432 G4double x1 = running[it-1]/running[nEnergies-1];
433 G4double x2 = running[it]/running[nEnergies-1];
439 theStore.Init(0,y1,nAngularParameters);
440 theStore.Init(1,y2,nAngularParameters);
444 theStore.SetCoeff(0,i,
theAngular[it-1].GetValue(i));
445 theStore.SetCoeff(1,i,
theAngular[it].GetValue(i));
448 cosTh = theStore.SampleMax(fsEnergy);
457 else if(angularRep==2)
464 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4ParticleHPContAngularPar::Sample nEnergies " << nEnergies <<
G4endl;
467 if(j!=0) running[j]=running[j-1];
474 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4ParticleHPContAngularPar::Sample " << j <<
" running " << running[j]
480 if ( nEnergies == 1 )
481 fCache.Get()->currentMeanEnergy = 0.0;
483 fCache.Get()->currentMeanEnergy = weighted/running[nEnergies-1];
492 if(randkal<running[j]/running[nEnergies-1])
break;
498 x = randkal*running[nEnergies-1];
507 if( getenv(
"G4PHPTEST") )
G4cout << itt <<
" G4particleHPContAngularPar fsEnergy " << fsEnergy <<
" " <<
theManager.
GetInverseScheme(itt-1) <<
" x " << x <<
" " << x1 <<
" " << x2 <<
" y " << y1 <<
" " << y2 <<
G4endl;
512 fsEnergy,
y1,
y2, cLow,cHigh);
513 if( getenv(
"G4PHPTEST") )
G4cout << itt <<
" G4particleHPContAngularPar compoundFraction " << compoundFraction <<
" E " << fsEnergy <<
" " <<
theManager.
GetScheme(itt) <<
" ener " << fsEnergy <<
" y " << y1 <<
" " << y2 <<
" cLH " << cLow <<
" " << cHigh <<
G4endl;
527 G4int residualA = targetA+1-
A;
528 G4int residualZ = targetZ-
Z;
533 incidentEnergy, incidentMass,
534 productEnergy, productMass,
535 residualMass, residualA, residualZ,
536 targetMass, targetA, targetZ);
537 cosTh = theKallbach.Sample(anEnergy);
538 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4ParticleHPKallbachMannSyst::Sample resulttest " << cosTh <<
G4endl;
540 else if(angularRep>10&&angularRep<16)
548 if(i!=0) running[i]=running[i-1];
558 if ( nEnergies == 1 )
559 fCache.Get()->currentMeanEnergy = 0.0;
561 fCache.Get()->currentMeanEnergy = weighted/running[nEnergies-1];
564 if ( nEnergies == 1 ) it = 0;
569 if(random<running[i]/running[nEnergies-1])
break;
571 if(it<nDiscreteEnergies||it==0)
585 aMan.
Init(angularRep-10, nAngularParameters-1);
587 cosTh = theStore.
Sample();
594 aMan.
Init(angularRep-10, nAngularParameters-1);
603 running[it-1]/running[nEnergies-1],
604 running[it]/running[nEnergies-1],
609 cosTh = theStore.
Sample();
614 G4double x1 = running[it-1]/running[nEnergies-1];
615 G4double x2 = running[it]/running[nEnergies-1];
623 aMan.
Init(angularRep-10, nAngularParameters-1);
653 x = theBuff1.
GetX(i);
654 y1 = theBuff1.
GetY(i);
655 y2 = theBuff2.
GetY(i);
662 cosTh = theStore.
Sample();
668 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPContAngularPar::Sample: Unknown angular representation");
675 G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
void Init(G4int aScheme, G4int aRange)
void SetKineticEnergy(const G4double en)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4Cache< toBeCached *> fCache
G4ParticleDefinition * theProjectile
G4InterpolationManager theManager
void SetInterpolationManager(const G4InterpolationManager &aManager)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
void SetY(G4int i, G4double x)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
static const double twopi
static G4Triton * Triton()
static G4Proton * Proton()
static G4Neutron * Neutron()
G4double GetY(G4double x)
G4int GetVectorLength() const
G4double GetWeightedBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
static G4Deuteron * Deuteron()
static G4IonTable * GetIonTable()
G4double GetTotalMomentum() const
static G4Positron * Positron()
G4ParticleHPInterpolator theInt
static G4double GetBindingEnergy(const G4int A, const G4int Z)
G4InterpolationScheme GetScheme(G4int index) const
G4double GetX(G4int i) const
G4double GetPDGMass() const
G4ParticleHPList * theAngular
G4InterpolationScheme GetInverseScheme(G4int index)
static G4Electron * Electron()
G4double GetValue(G4int i)
G4double GetBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
void SetX(G4int i, G4double e)