Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
G4NeutronHPElementData::G4NeutronHPElementData()
|
||||
{
|
||||
precision = 0.02;
|
||||
theFissionData = new G4NeutronHPVector;
|
||||
theCaptureData = new G4NeutronHPVector;
|
||||
theElasticData = new G4NeutronHPVector;
|
||||
@@ -57,6 +58,10 @@
|
||||
UpdateData(A, Z, count++, frac);
|
||||
}
|
||||
}
|
||||
theElasticData->ThinOut(precision);
|
||||
theInelasticData->ThinOut(precision);
|
||||
theCaptureData->ThinOut(precision);
|
||||
theFissionData->ThinOut(precision);
|
||||
}
|
||||
|
||||
void G4NeutronHPElementData::UpdateData(G4int A, G4int Z, G4int index, G4double abundance)
|
||||
|
||||
@@ -26,7 +26,11 @@
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
#ifndef WIN32
|
||||
ifstream theData(filename, ios::in);
|
||||
#else
|
||||
ifstream theData(filename, ios::in|ios::nocreate);
|
||||
#endif
|
||||
// here it comes
|
||||
G4int infoType, dataType;
|
||||
hasFSData = false;
|
||||
|
||||
@@ -28,7 +28,11 @@
|
||||
hasXsec = false;
|
||||
return; // no data for exactly this isotope.
|
||||
}
|
||||
#ifndef WIN32
|
||||
ifstream theData(filename, ios::in);
|
||||
#else
|
||||
ifstream theData(filename, ios::in|ios::nocreate);
|
||||
#endif
|
||||
G4int dummy;
|
||||
G4double dumm;
|
||||
if(!(theData))
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NeutronHPInelastic.cc,v 1.3 1999/07/02 12:27:15 hpw Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
#include "G4NeutronHPInelastic.hh"
|
||||
|
||||
|
||||
@@ -16,7 +16,11 @@ void G4NeutronHPInelasticBaseFS::InitGammas(G4double AR, G4double ZR)
|
||||
ostrstream ost(the, 100, ios::out);
|
||||
ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
|
||||
G4String * aName = new G4String(the);
|
||||
#ifndef WIN32
|
||||
ifstream from(*aName, ios::in);
|
||||
#else
|
||||
ifstream from(*aName, ios::in|ios::nocreate);
|
||||
#endif
|
||||
if(!from) return; // no data found for this isotope
|
||||
ifstream theGammaData(*aName, ios::in);
|
||||
|
||||
@@ -48,7 +52,11 @@ void G4NeutronHPInelasticBaseFS::Init (G4double A, G4double Z, G4String & dirNam
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
#ifndef WIN32
|
||||
ifstream theData(filename, ios::in);
|
||||
#else
|
||||
ifstream theData(filename, ios::in|ios::nocreate);
|
||||
#endif
|
||||
if(!(theData))
|
||||
{
|
||||
hasAnyData = false;
|
||||
|
||||
@@ -16,7 +16,11 @@ void G4NeutronHPInelasticCompFS::InitGammas(G4double AR, G4double ZR)
|
||||
ostrstream ost(the, 100, ios::out);
|
||||
ost <<gammaPath<<"z"<<ZR<<".a"<<AR;
|
||||
G4String * aName = new G4String(the);
|
||||
#ifndef WIN32
|
||||
ifstream from(*aName, ios::in);
|
||||
#else
|
||||
ifstream from(*aName, ios::in|ios::nocreate);
|
||||
#endif
|
||||
if(!from) return; // no data found for this isotope
|
||||
ifstream theGammaData(*aName, ios::in);
|
||||
|
||||
@@ -44,7 +48,11 @@ void G4NeutronHPInelasticCompFS::Init (G4double A, G4double Z, G4String & dirNam
|
||||
hasXsec = false;
|
||||
return;
|
||||
}
|
||||
#ifndef WIN32
|
||||
ifstream theData(filename, ios::in);
|
||||
#else
|
||||
ifstream theData(filename, ios::in|ios::nocreate);
|
||||
#endif
|
||||
if(!theData)
|
||||
{
|
||||
hasAnyData = false;
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result);
|
||||
filename = aFile.GetName();
|
||||
// if(filename=="") return false;
|
||||
#ifndef WIN32
|
||||
ifstream theChannel(filename);
|
||||
#else
|
||||
ifstream theChannel(filename,ios::in|ios::nocreate);
|
||||
#endif
|
||||
|
||||
if(!theChannel) return false;
|
||||
// accommodating deficiencie of some compilers
|
||||
if(theChannel.eof()) return false;
|
||||
|
||||
@@ -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-00-01 $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
#include "G4NeutronHPNBodyPhaseSpace.hh"
|
||||
#include "G4Gamma.hh"
|
||||
|
||||
@@ -50,9 +50,14 @@
|
||||
result.SetName(*theName);
|
||||
result.SetA(myA);
|
||||
result.SetZ(myZ);
|
||||
#ifndef WIN32
|
||||
check.open(*theName);
|
||||
#else
|
||||
check.open(*theName,ios::in|ios::nocreate);
|
||||
#endif
|
||||
if(!(check))
|
||||
{
|
||||
check.close();
|
||||
aFlag = false;
|
||||
if(first)
|
||||
{
|
||||
@@ -68,9 +73,14 @@
|
||||
G4double natA = myZ/G4SandiaTable::GetZtoA(myZ);
|
||||
result.SetA(natA);
|
||||
result.SetZ(myZ);
|
||||
#ifndef WIN32
|
||||
check.open(*theName);
|
||||
#else
|
||||
check.open(*theName,ios::in|ios::nocreate);
|
||||
#endif
|
||||
if (!check)
|
||||
{
|
||||
check.close();
|
||||
aFlag = false;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2,6 +2,48 @@
|
||||
// J.P. Wellisch, Nov-1996
|
||||
// A prototype of the low energy neutron transport model.
|
||||
#include "G4NeutronHPVector.hh"
|
||||
|
||||
// if the ranges do not match, constant extrapolation is used.
|
||||
G4NeutronHPVector & operator + (const G4NeutronHPVector & left, const 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++)
|
||||
{
|
||||
while(j<right.nEntries)
|
||||
{
|
||||
if(right.GetX(j)<left.GetX(i)*1.001)
|
||||
{
|
||||
x = right.GetX(j);
|
||||
y = right.GetY(j)+left.GetY(x);
|
||||
result->SetData(running++, x, y);
|
||||
j++;
|
||||
}
|
||||
else if(abs((right.GetX(j)-left.GetX(i))/(left.GetX(i)+right.GetX(j)))>0.001)
|
||||
{
|
||||
x = left.GetX(i);
|
||||
y = left.GetY(i)+right.GetY(x);
|
||||
result->SetData(running++, x, y);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(j==right.nEntries)
|
||||
{
|
||||
x = left.GetX(i);
|
||||
y = left.GetY(i)+right.GetY(x);
|
||||
result->SetData(running++, x, y);
|
||||
}
|
||||
}
|
||||
result->ThinOut(0.02);
|
||||
return *result;
|
||||
}
|
||||
|
||||
G4NeutronHPVector::G4NeutronHPVector()
|
||||
{
|
||||
@@ -11,6 +53,7 @@
|
||||
Verbose=0;
|
||||
theIntegral=NULL;
|
||||
totalIntegral=-1;
|
||||
isFreed = 0;
|
||||
}
|
||||
|
||||
G4NeutronHPVector::~G4NeutronHPVector()
|
||||
@@ -23,9 +66,31 @@
|
||||
// if(Verbose==1)G4cout <<"Vector: delete theData"<<endl;
|
||||
if(theIntegral!=NULL) delete [] theIntegral;
|
||||
// if(Verbose==1)G4cout <<"Vector: delete theIntegral"<<endl;
|
||||
isFreed = 1;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPVector::GetXsec(G4double e)
|
||||
G4NeutronHPVector & G4NeutronHPVector::
|
||||
operator = (const G4NeutronHPVector & right)
|
||||
{
|
||||
if(&right == this) return *this;
|
||||
|
||||
G4int i;
|
||||
|
||||
totalIntegral = right.totalIntegral;
|
||||
if(right.theIntegral!=NULL) theIntegral = new G4double[right.nEntries];
|
||||
for(i=0; i<right.nEntries; i++)
|
||||
{
|
||||
SetPoint(i, right.GetPoint(i)); // copy theData
|
||||
if(right.theIntegral!=NULL) theIntegral[i] = right.theIntegral[i];
|
||||
}
|
||||
theManager = right.theManager;
|
||||
label = right.label;
|
||||
|
||||
Verbose = right.Verbose;
|
||||
return *this;
|
||||
}
|
||||
|
||||
G4double G4NeutronHPVector::GetXsec(G4double e) const
|
||||
{
|
||||
if(nEntries <= 1)
|
||||
{
|
||||
@@ -35,14 +100,14 @@
|
||||
G4int found = 0;
|
||||
G4int low = 0;
|
||||
G4int high = 0;
|
||||
G4double eps = 0.00001*e; // fast fix of precision problems, needs improvement
|
||||
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.
|
||||
{
|
||||
i = ii;
|
||||
if(10*i==nEntries || theData[10*i].GetX()+eps>e) break;
|
||||
if(theData[10*i].GetX()+eps>e) break;
|
||||
}
|
||||
// if(Verbose==1) G4cout << low<<" "<<high<<" "<<i<<" "<<nEntries<<" ";
|
||||
if(i!=(nEntries/10))
|
||||
@@ -99,6 +164,10 @@
|
||||
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())
|
||||
{
|
||||
y=theData[nEntries-1].GetY();
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
@@ -109,7 +178,8 @@
|
||||
{
|
||||
G4cout << theData[i].GetX()<<" ";
|
||||
G4cout << theData[i].GetY()<<" ";
|
||||
if (i!=1&&i==5*(i/5)) G4cout << endl;
|
||||
// if (i!=1&&i==5*(i/5)) G4cout << endl;
|
||||
G4cout << endl;
|
||||
}
|
||||
G4cout << endl;
|
||||
}
|
||||
@@ -195,15 +265,22 @@
|
||||
|
||||
void G4NeutronHPVector::ThinOut(G4double precision)
|
||||
{
|
||||
// anything in there?
|
||||
if(GetVectorLength()==0) return;
|
||||
// make the new vector
|
||||
G4NeutronHPDataPoint * aBuff = new G4NeutronHPDataPoint[nPoints];
|
||||
G4double x, x1, x2, y, y1, y2;
|
||||
G4int count = 1, current = 1, start = 1;
|
||||
G4int count = 0, current = 2, start = 1;
|
||||
|
||||
// First element always goes and is never tested.
|
||||
aBuff[0] = theData[0];
|
||||
|
||||
// Find the rest
|
||||
while(current < GetVectorLength())
|
||||
{
|
||||
x1=aBuff[count].GetX();
|
||||
x2=theData[current].GetX();
|
||||
y1=aBuff[count].GetY();
|
||||
x2=theData[current].GetX();
|
||||
y2=theData[current].GetY();
|
||||
for(G4int j=start; j<current; j++)
|
||||
{
|
||||
@@ -211,16 +288,16 @@
|
||||
y = theInt.Lin(x, x1, x2, y1, y2);
|
||||
if (abs(y-theData[j].GetY())>precision*y)
|
||||
{
|
||||
start = current;
|
||||
aBuff[count] = theData[current-1];
|
||||
count++;
|
||||
aBuff[++count] = theData[current-1]; // for this one, everything was fine
|
||||
start = current; // the next candidate
|
||||
break;
|
||||
}
|
||||
}
|
||||
current++ ;
|
||||
}
|
||||
aBuff[count] = theData[GetVectorLength()-1];
|
||||
// The last one also always goes, and is never tested.
|
||||
aBuff[++count] = theData[GetVectorLength()-1];
|
||||
delete [] theData;
|
||||
theData = aBuff;
|
||||
nEntries = count;
|
||||
nEntries = count+1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user