Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -4,6 +4,9 @@
//
#include "G4NeutronHPCapture.hh"
#include "G4NeutronHPCaptureFS.hh"
#include "G4NeutronHPDeExGammas.hh"
#include "G4ParticleTable.hh"
#include "G4IonTable.hh"
G4NeutronHPCapture::G4NeutronHPCapture()
{
@@ -43,10 +46,14 @@
xSec = new G4double[n];
G4double sum=0;
G4int i, index;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
xSec[i] = theCapture[index].GetXsec(aTrack.GetKineticEnergy());
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
@@ -58,5 +65,93 @@
if(random<=running/sum) break;
}
delete [] xSec;
return theCapture[index].ApplyYourself(aTrack);
if(aTrack.GetKineticEnergy()<100*keV)
{
G4NeutronHPDeExGammas theGammas;
G4int aA = theMaterial->GetElement(i)->GetN();
G4int aZ = theMaterial->GetElement(i)->GetZ();
char the[100] = {""};
G4std::ostrstream ost(the, 100, G4std::ios::out);
ost
<<getenv("NeutronHPCrossSections")<<"/Inelastic/Gammas/"<<"z"<<aZ<<".a"<<aA;
G4String * aName = new G4String(the);
#ifdef G4USE_STD_NAMESPACE
G4std::ifstream from(*aName, G4std::ios::in);
#else
ifstream from(*aName, ios::in|ios::nocreate);
#endif
G4std::ifstream theGammaData(*aName, G4std::ios::in);
theGammas.Init(theGammaData);
G4double theGammaEnergy = aTrack.GetKineticEnergy();
theGammaEnergy+=G4Neutron::Neutron()->GetPDGMass();
theGammaEnergy+=
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(aZ,aA);
theGammaEnergy-=
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(aZ,aA+1);
if(theGammaEnergy<1.1*theGammas.GetLevelEnergy(theGammas.GetNumberOfLevels()-1))
{
G4ReactionProductVector * thePhotons = 0;
G4ReactionProductVector * theOtherPhotons = NULL;
G4int iLevel;
while(theGammaEnergy>=theGammas.GetLevelEnergy(0))
{
for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
{
if(theGammas.GetLevelEnergy(iLevel)<theGammaEnergy) break;
}
if(iLevel==0||iLevel==theGammas.GetNumberOfLevels()-1)
{
theOtherPhotons = theGammas.GetDecayGammas(iLevel);
}
else
{
G4double random = G4UniformRand();
G4double eLow = theGammas.GetLevelEnergy(iLevel);
G4double eHigh = theGammas.GetLevelEnergy(iLevel+1);
if(random > (eHigh-eLow)/(theGammaEnergy-eLow)) iLevel++;
theOtherPhotons = theGammas.GetDecayGammas(iLevel);
}
if(thePhotons==NULL) thePhotons = new G4ReactionProductVector;
if(theOtherPhotons != NULL)
{
for(G4int ii=0; ii<theOtherPhotons->length(); ii++)
{
thePhotons->insert(theOtherPhotons->at(ii));
}
delete theOtherPhotons;
}
theGammaEnergy -= theGammas.GetLevelEnergy(iLevel);
if(iLevel == -1) break;
}
// clean up the primary neutron
theResult.SetStatusChange(fStopAndKill);
// fill particle change
theResult.Initialize(aTrack);
G4int nSecondaries = thePhotons->length();
theResult.SetNumberOfSecondaries(nSecondaries);
theResult.SetStatusChange(fStopAndKill);
G4DynamicParticle * theSec;
for(G4int gammaCount=0; gammaCount<nSecondaries; gammaCount++)
{
theSec = new G4DynamicParticle;
theSec->SetDefinition(thePhotons->at(gammaCount)->GetDefinition());
theSec->SetMomentum(thePhotons->at(gammaCount)->GetMomentum());
theResult.AddSecondary(theSec);
delete thePhotons->at(gammaCount);
}
delete thePhotons;
// return
if(0!=nSecondaries) return &theResult;
}
return theCapture[index].ApplyYourself(aTrack);
}
else
{
return theCapture[index].ApplyYourself(aTrack);
}
}
@@ -47,8 +47,7 @@
else
{
G4ThreeVector aCMSMomentum = theNeutron.GetMomentum()+theTarget.GetMomentum();
G4LorentzVector p4(aCMSMomentum, theTarget.GetTotalEnergy() + theNeutron.GetTotalEnergy()
+ theBaseZ*G4Electron::ElectronDefinition()->GetPDGMass());
G4LorentzVector p4(aCMSMomentum, theTarget.GetTotalEnergy() + theNeutron.GetTotalEnergy());
G4Fragment nucleus(theBaseA+1, theBaseZ ,p4);
G4PhotonEvaporation photonEvaporation;
G4FragmentVector* products = photonEvaporation.BreakItUp(nucleus);
@@ -4,10 +4,11 @@
//
#include "G4NeutronHPChannel.hh"
#include "G4NeutronHPFinalState.hh"
#include "globals.hh"
G4double G4NeutronHPChannel::GetXsec(G4double energy)
{
return theChannelData->GetXsec(energy);
return G4std::max(0., theChannelData->GetXsec(energy));
}
G4double G4NeutronHPChannel::GetWeightedXsec(G4double energy, G4int isoNumber)
@@ -121,7 +122,7 @@
if(anActive->GetEnergy(a) <= aPassive->GetEnergy(p))
{
G4double xa = anActive->GetEnergy(a);
theMerge->SetData(m, xa, anActive->GetXsec(a)+aPassive->GetXsec(xa));
theMerge->SetData(m, xa, anActive->GetXsec(a)+G4std::max(0., aPassive->GetXsec(xa)) );
m++;
a++;
G4double xp = aPassive->GetEnergy(p);
@@ -27,6 +27,8 @@ G4ReactionProduct * G4NeutronHPContEnergyAngular::Sample(G4double anEnergy, G4do
else
{
// interpolation through alternating sampling. This needs improvement @@@
// This is the cause of the He3 problem !!!!!!!!
// See to it, if you can improve this.
G4double random = G4UniformRand();
G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
G4double offset = theAngular[it].GetEnergy()-anEnergy;
@@ -37,10 +37,14 @@
xSec = new G4double[n];
G4double sum=0;
G4int i, index;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
xSec[i] = theElastic[index].GetXsec(aTrack.GetKineticEnergy());
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
@@ -110,7 +110,7 @@
{
if(theNew == NULL) return;
G4int s = 0, n=0, i=0, m=0;
G4NeutronHPVector * theMerge = new G4NeutronHPVector;
G4NeutronHPVector * theMerge = new G4NeutronHPVector(theStore->GetVectorLength());
G4bool flag;
// G4cout << "Harmonise 1: "<<theStore->GetEnergy(s)<<" "<<theNew->GetEnergy(0)<<G4endl;
while ( theStore->GetEnergy(s)<theNew->GetEnergy(0)&&s<theStore->GetVectorLength() )
@@ -129,7 +129,7 @@
{
theMerge->SetData(m, active->GetEnergy(a), active->GetXsec(a));
G4double x = theMerge->GetEnergy(m);
G4double y = passive->GetXsec(x);
G4double y = G4std::max(0., passive->GetXsec(x));
theMerge->SetData(m, x, theMerge->GetXsec(m)+y);
m++;
a++;
@@ -38,10 +38,14 @@
xSec = new G4double[n];
G4double sum=0;
G4int i, it, index;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
xSec[i] = theFission[index].GetXsec(aTrack.GetKineticEnergy());
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
@@ -7,8 +7,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NeutronHPInelastic.cc,v 1.4 1999/12/15 14:53:17 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4NeutronHPInelastic.cc,v 1.7 2000/11/09 16:14:22 hpw Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4NeutronHPInelastic.hh"
@@ -73,6 +73,7 @@
while(!theInelastic[i].HasDataInAnyFinalState());
}
}
G4NeutronHPInelastic::~G4NeutronHPInelastic()
{
delete [] theInelastic;
@@ -85,10 +86,14 @@
xSec = new G4double[n];
G4double sum=0;
G4int i, it, index;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
for (i=0; i<n; i++)
{
index = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
xSec[i] = theInelastic[index].GetXsec(aTrack.GetKineticEnergy());
xSec[i] *= rWeight;
sum+=xSec[i];
}
G4double random = G4UniformRand();
@@ -256,10 +256,13 @@ void G4NeutronHPInelasticBaseFS::BaseApply(const G4Track & theTrack,
boosted.Lorentz(theNeutron, theTarget);
G4double anEnergy = boosted.GetKineticEnergy();
thePhotons = theFinalStatePhotons->GetPhotons(anEnergy);
for(i=0; i<thePhotons->length(); i++)
if(thePhotons!=NULL)
{
// back to lab
thePhotons->at(i)->Lorentz(*(thePhotons->at(i)), -1.*theTarget);
for(i=0; i<thePhotons->length(); i++)
{
// back to lab
thePhotons->at(i)->Lorentz(*(thePhotons->at(i)), -1.*theTarget);
}
}
}
else if(theEnergyAngData!=NULL)
@@ -71,7 +71,7 @@ void G4NeutronHPInelasticCompFS::Init (G4double A, G4double Z, G4String & dirNam
theData >> dataType;
theData >> sfType >> dummy;
it = 50;
if(sfType>600||(sfType<100&&sfType>50)) it = sfType%50;
if(sfType>=600||(sfType<100&&sfType>=50)) it = sfType%50;
if(dataType==3)
{
theData >> dummy >> dummy;
@@ -130,7 +130,7 @@ G4int G4NeutronHPInelasticCompFS::SelectExitChannel(G4double eKinetic)
if(i!=0) running[i]=running[i-1];
if(theXsection[i] != NULL)
{
running[i] += theXsection[i]->GetXsec(eKinetic);
running[i] += G4std::max(0., theXsection[i]->GetXsec(eKinetic));
}
}
G4double random = G4UniformRand();
@@ -361,11 +361,44 @@ void G4NeutronHPInelasticCompFS::CompositeApply(const G4Track & theTrack, G4Part
}
// fill the result
// Beware - the recoil is not necessarily in the particles...
// Can be calculated from momentum conservation?
// The idea is that the particles ar emitted forst, and the gammas only once the
// recoil is on the residual; assumption is that gammas do not contribute to
// the recoil.
// This needs more design @@@
G4int nSecondaries = 2; // the hadron and the recoil
if(theParticles != NULL) nSecondaries = theParticles->length();
G4bool needsSeparateRecoil = false;
G4int totalBaryonNumber = 0;
G4int totalCharge = 0;
G4ThreeVector totalMomentum(0);
if(theParticles != NULL)
{
nSecondaries = theParticles->length();
G4ParticleDefinition * aDef;
for(i=0; i<theParticles->length(); i++)
{
aDef = theParticles->at(i)->GetDefinition();
totalBaryonNumber+=aDef->GetBaryonNumber();
totalCharge+=G4int(aDef->GetPDGCharge()+eps);
totalMomentum += theParticles->at(i)->GetMomentum();
}
if(totalBaryonNumber!=G4int(theBaseA+eps+incidentParticle->GetDefinition()->GetBaryonNumber()))
{
needsSeparateRecoil = true;
nSecondaries++;
residualA = G4int(theBaseA+eps+incidentParticle->GetDefinition()->GetBaryonNumber()
-totalBaryonNumber);
residualZ = G4int(theBaseZ+eps+incidentParticle->GetDefinition()->GetPDGCharge()
-totalCharge);
}
}
G4int nPhotons = 0;
if(thePhotons!=NULL) nPhotons = thePhotons->length();
nSecondaries += nPhotons;
theResult.SetNumberOfSecondaries(nSecondaries);
G4DynamicParticle * theSec;
@@ -407,6 +440,21 @@ void G4NeutronHPInelasticCompFS::CompositeApply(const G4Track & theTrack, G4Part
delete theParticles->at(i);
}
delete theParticles;
if(needsSeparateRecoil)
{
G4ReactionProduct theResidual;
theResidual.SetDefinition(G4ParticleTable::GetParticleTable()->GetIon(residualZ, residualA, 0));
G4double resiualKineticEnergy = theResidual.GetMass()*theResidual.GetMass();
resiualKineticEnergy += totalMomentum*totalMomentum;
resiualKineticEnergy = sqrt(resiualKineticEnergy) - theResidual.GetMass();
// cout << "Kinetic energy of the residual = "<<resiualKineticEnergy<<endl;
theResidual.SetKineticEnergy(resiualKineticEnergy);
theResidual.SetMomentum(-1.*totalMomentum);
theSec = new G4DynamicParticle;
theSec->SetDefinition(theResidual.GetDefinition());
theSec->SetMomentum(theResidual.GetMomentum());
theResult.AddSecondary(theSec);
}
}
if(thePhotons!=NULL)
{
@@ -68,8 +68,11 @@ G4double G4NeutronHPLegendreStore::SampleMax (G4double anEnergy)
G4double legend = theLeg.Evaluate(l, result); // @@@ done to avoid optimization error on SUN
v2 += (2.*l+1)/2.*theCoeff[high].GetCoeff(l)*legend;
}
v1 = G4std::max(0.,v1); // Workaround in case one of the distributions is fully non-physical.
v2 = G4std::max(0.,v2);
value = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, v1, v2);
random = G4UniformRand();
if(0>=theNorm) break; // Workaround for negative cross-section values. @@@@ 31 May 2000
}
while(random>value/theNorm);
@@ -8,7 +8,7 @@
// and all its terms.
//
// $Id: G4NeutronHPNBodyPhaseSpace.cc,v 1.2 1999/07/02 10:01:14 johna Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4NeutronHPNBodyPhaseSpace.hh"
#include "G4Gamma.hh"
@@ -24,6 +24,7 @@ G4NeutronHPVector * G4NeutronHPPartial::GetY(G4double e1)
if(X[i]>e1) break;
}
if(i==nData) i--;
if(0==i) i=1;
G4double x1,x2,y1,y2,y, off, slope;
G4int i1=0, ib=0;
G4double E1 = X[i-1];
@@ -84,7 +85,7 @@ G4NeutronHPVector * G4NeutronHPPartial::GetY(G4double e1)
if(i==0)
{
theBuff.SetInterpolationManager(data[0].GetInterpolationManager());
for(G4int ii=0;ii<GetNEntries(0);i++)
for(G4int ii=0;ii<GetNEntries(0);ii++)
{
theBuff.SetX(ii, GetX(0,ii));
theBuff.SetY(ii, GetY(0,ii));
@@ -4,16 +4,16 @@
#include "G4NeutronHPVector.hh"
// if the ranges do not match, constant extrapolation is used.
G4NeutronHPVector & operator + (const G4NeutronHPVector & left, const G4NeutronHPVector & right)
G4NeutronHPVector & operator + (G4NeutronHPVector & left, G4NeutronHPVector & right)
{
G4NeutronHPVector * result = new G4NeutronHPVector;
G4int j=0;
G4double x;
G4double yl, yr, y;
G4int running = 0;
for(G4int i=0; i<left.nEntries; i++)
for(G4int i=0; i<left.GetVectorLength(); i++)
{
while(j<right.nEntries)
while(j<right.GetVectorLength())
{
if(right.GetX(j)<left.GetX(i)*1.001)
{
@@ -34,7 +34,7 @@
break;
}
}
if(j==right.nEntries)
if(j==right.GetVectorLength())
{
x = left.GetX(i);
y = left.GetY(i)+right.GetY(x);
@@ -54,8 +54,26 @@
theIntegral=NULL;
totalIntegral=-1;
isFreed = 0;
maxValue = -DBL_MAX;
the15percentBorderCash = -DBL_MAX;
the50percentBorderCash = -DBL_MAX;
}
G4NeutronHPVector::G4NeutronHPVector(G4int n)
{
theData = new G4NeutronHPDataPoint[G4std::max(n, 100)];
nPoints=G4std::max(n, 100);
nEntries=0;
Verbose=0;
theIntegral=NULL;
totalIntegral=-1;
isFreed = 0;
maxValue = -DBL_MAX;
the15percentBorderCash = -DBL_MAX;
the50percentBorderCash = -DBL_MAX;
}
G4NeutronHPVector::~G4NeutronHPVector()
{
// if(Verbose==1)G4cout <<"G4NeutronHPVector::~G4NeutronHPVector"<<G4endl;
@@ -87,84 +105,50 @@
label = right.label;
Verbose = right.Verbose;
return *this;
the15percentBorderCash = right.the15percentBorderCash;
the50percentBorderCash = right.the50percentBorderCash;
theHash = right.theHash;
return *this;
}
G4double G4NeutronHPVector::GetXsec(G4double e) const
G4double G4NeutronHPVector::GetXsec(G4double e)
{
if(nEntries <= 1)
if(!theHash.Prepared()) Hash();
G4int min = theHash.GetMinIndex(e);
G4int i;
for(i=min ; i<nEntries; i++)
{
if(nEntries == 0) return 0;
return theData[0].GetY();
if(theData[i].GetX()>e) break;
}
G4int found = 0;
G4int low = 0;
G4int high = 0;
G4double eps = 0.00001*e; // fast fix of precision problems, needs improvement @@@
// if(Verbose==1) G4cout <<"G4NeutronHPVector::GetXsec";
if(e<=theData[0].GetX()) return theData[0].GetY();
G4int i=0, ii;
for (ii=0; ii<nEntries/10+1; ii++) // von null weg, weil sonst <10 im argen liegt.
G4int low = i-1;
G4int high = i;
if(i==0)
{
i = ii;
if(theData[10*i].GetX()+eps>e) break;
low = 0;
high = 1;
}
// if(Verbose==1) G4cout << low<<" "<<high<<" "<<i<<" "<<nEntries<<" ";
if(i!=(nEntries/10))
else if(i==nEntries)
{
i=10*i;
for (G4int j=0; j<11; j++)
low = nEntries-2;
high = nEntries-1;
}
G4double y;
if(e<theData[nEntries-1].GetX())
{
// Protect against doubled-up x values
if( (theData[high].GetX()-theData[low].GetX())/theData[high].GetX() < 0.000001)
{
if(theData[i].GetX()<e+eps) break;
i--;
}
if(i>nEntries-2) i = nEntries-2;
low = i;
high = i+1;
}
else
{
i=G4std::max(0,10*(i-1));
while (i<nEntries)
{
if(theData[i].GetX()>e) break;
i++;
}
if(i>nEntries-1) i = nEntries-1;
low = i-1;
high = i;
}
// if(Verbose==1) G4cout << "sss"<<low<<" "<<high<<" ";
G4double x1, x2, y1, y2, x, y;
while ( theData[low].GetX()-e > 0.0000001*e )
{
low--;
if(low<0) return theData[0].GetY();
}
while ( theData[high].GetX()-e < -0.0000001*e && high!=nEntries-1)
{
high++;
}
while( theData[high].GetX()-theData[low].GetX()<0.0000001*e)
{
if(high<nEntries-1)
{
high++;
y = theData[low].GetY();
}
else
{
low--;
if(low<0) return theData[0].GetY();
y = theInt.Interpolate(theManager.GetScheme(high), e,
theData[low].GetX(), theData[high].GetX(),
theData[low].GetY(), theData[high].GetY());
}
}
// if(Verbose==1) G4cout << "ddd"<<low<<" "<<high<<" ";
x = e;
x1 = theData[low] .GetX();
x2 = theData[high].GetX();
y1 = theData[low] .GetY();
y2 = theData[high].GetY();
y = theInt.Interpolate(theManager.GetScheme(high), x, x1, x2, y1, y2);
if(e>=theData[nEntries-1].GetX())
else
{
y=theData[nEntries-1].GetY();
}
@@ -186,26 +170,16 @@
void G4NeutronHPVector::Check(G4int i)
{
// G4cout << "1: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<G4endl;
if(i>nEntries) G4Exception("Skipped some index numbers in G4NeutronHPVector");
if(i==nPoints)
{
nPoints += 50;
// G4cout << "2a: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<G4endl;
nPoints *= 1.5;
G4NeutronHPDataPoint * buff = new G4NeutronHPDataPoint[nPoints];
// G4cout << "2b: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<G4endl;
if(nPoints!=50)
{
// G4cout << "copying 1: nEntries="<<nEntries<<" nPoints="<<nPoints<<G4endl;
for (G4int j=0; j<nEntries; j++) buff[j] = theData[j];
// G4cout << "copying 2"<<G4endl;
delete [] theData;
// G4cout << "3: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<G4endl;
}
for (G4int j=0; j<nEntries; j++) buff[j] = theData[j];
delete [] theData;
theData = buff;
}
if(i==nEntries) nEntries=i+1;
// G4cout << "4: i: "<<i<<" nEntries: "<<nEntries<<" nPoints: "<<nPoints<<G4endl;
}
void G4NeutronHPVector::
@@ -261,8 +235,13 @@
}
p++;
}
// Rebuild the Hash;
if(theHash.Prepared())
{
ReHash();
}
}
void G4NeutronHPVector::ThinOut(G4double precision)
{
// anything in there?
@@ -300,4 +279,136 @@
delete [] theData;
theData = aBuff;
nEntries = count+1;
// Rebuild the Hash;
if(theHash.Prepared())
{
ReHash();
}
}
G4bool G4NeutronHPVector::IsBlocked(G4double aX)
{
G4bool result = false;
G4std::vector<G4double>::iterator i;
for(i=theBlocked.begin(); i!=theBlocked.end(); i++)
{
G4double aBlock = *i;
if(abs(aX-aBlock) < 0.1*MeV)
{
result = true;
theBlocked.erase(i);
break;
}
}
return result;
}
G4double G4NeutronHPVector::Sample() // Samples X according to distribution Y
{
G4double result;
if(theBuffered.size() !=0 && G4UniformRand()<0.5)
{
result = theBuffered[0];
theBuffered.erase(theBuffered.begin());
if(result < GetX(GetVectorLength()-1) ) return result;
}
if(GetVectorLength()==1)
{
result = theData[0].GetX();
}
else
{
if(theIntegral==NULL) IntegrateAndNormalise();
do
{
G4int i;
G4double value, test, baseline;
baseline = theData[GetVectorLength()-1].GetX()-theData[0].GetX();
G4double rand;
do
{
value = baseline*G4UniformRand();
value += theData[0].GetX();
test = GetY(value)/maxValue;
rand = G4UniformRand();
}
while(test<rand);
result = value;
}
while(IsBlocked(result));
}
return result;
}
G4double G4NeutronHPVector::Get15percentBorder()
{
if(the15percentBorderCash>-DBL_MAX/2.) return the15percentBorderCash;
G4double result;
if(GetVectorLength()==1)
{
result = theData[0].GetX();
the15percentBorderCash = result;
}
else
{
if(theIntegral==NULL) IntegrateAndNormalise();
G4int i;
result = theData[GetVectorLength()-1].GetX();
for(i=0;i<GetVectorLength();i++)
{
if(theIntegral[i]/theIntegral[GetVectorLength()-1]>0.15)
{
result = theData[G4std::min(i+1, GetVectorLength()-1)].GetX();
the15percentBorderCash = result;
break;
}
}
the15percentBorderCash = result;
}
return result;
}
G4double G4NeutronHPVector::Get50percentBorder()
{
if(the50percentBorderCash>-DBL_MAX/2.) return the50percentBorderCash;
G4double result;
if(GetVectorLength()==1)
{
result = theData[0].GetX();
the50percentBorderCash = result;
}
else
{
if(theIntegral==NULL) IntegrateAndNormalise();
G4int i;
G4double x = 0.5;
result = theData[GetVectorLength()-1].GetX();
G4NeutronHPInterpolator theLin;
for(i=0;i<GetVectorLength();i++)
{
if(theIntegral[i]/theIntegral[GetVectorLength()-1]>x)
{
G4int it;
it = i;
if(it == GetVectorLength()-1)
{
result = theData[GetVectorLength()-1].GetX();
}
else
{
G4double x1, x2, y1, y2;
x1 = theIntegral[i-1]/theIntegral[GetVectorLength()-1];
x2 = theIntegral[i]/theIntegral[GetVectorLength()-1];
y1 = theData[i-1].GetX();
y2 = theData[i].GetX();
result = theLin.Lin(x, x1, x2, y1, y2);
}
the50percentBorderCash = result;
break;
}
}
the50percentBorderCash = result;
}
return result;
}