Import Geant4 5.1.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BremsstrahlungParameters.cc,v 1.14 2002/11/18 18:08:25 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
// $Id: G4BremsstrahlungParameters.cc,v 1.16 2003/02/28 08:42:18 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
//
|
||||
// Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
|
||||
// V.Ivanchenko (Vladimir.Ivantchenko@cern.ch)
|
||||
@@ -34,6 +34,8 @@
|
||||
// 25.09.01 V.Ivanchenko Add parameter C and change interface to B
|
||||
// 29.11.01 V.Ivanchenko Update parametrisation
|
||||
// 18.11.02 V.Ivanchenko Fix problem of load
|
||||
// 21.02.03 V.Ivanchenko Number of parameters is defined in the constructor
|
||||
// 28.02.03 V.Ivanchenko Filename is defined in the constructor
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@@ -46,18 +48,19 @@
|
||||
#include "g4std/strstream"
|
||||
|
||||
|
||||
G4BremsstrahlungParameters:: G4BremsstrahlungParameters(G4int minZ, G4int maxZ)
|
||||
: zMin(minZ),
|
||||
G4BremsstrahlungParameters:: G4BremsstrahlungParameters(const G4String& name,
|
||||
size_t num, G4int minZ, G4int maxZ)
|
||||
: zMin(minZ),
|
||||
zMax(maxZ),
|
||||
length(16)
|
||||
length(num)
|
||||
{
|
||||
LoadData();
|
||||
LoadData(name);
|
||||
}
|
||||
|
||||
|
||||
G4BremsstrahlungParameters::~G4BremsstrahlungParameters()
|
||||
{
|
||||
// Reset the map of data sets: remove the data sets from the map
|
||||
{
|
||||
// Reset the map of data sets: remove the data sets from the map
|
||||
G4std::map<G4int,G4VEMDataSet*,G4std::less<G4int> >::iterator pos;
|
||||
|
||||
for (pos = param.begin(); pos != param.end(); ++pos)
|
||||
@@ -71,12 +74,12 @@ G4BremsstrahlungParameters::~G4BremsstrahlungParameters()
|
||||
}
|
||||
|
||||
|
||||
G4double G4BremsstrahlungParameters::Parameter(G4int parameterIndex,
|
||||
G4int Z,
|
||||
G4double G4BremsstrahlungParameters::Parameter(G4int parameterIndex,
|
||||
G4int Z,
|
||||
G4double energy) const
|
||||
{
|
||||
G4double value = 0.;
|
||||
G4int id = Z*20 + parameterIndex;
|
||||
G4int id = Z*length + parameterIndex;
|
||||
G4std::map<G4int,G4VEMDataSet*,G4std::less<G4int> >::const_iterator pos;
|
||||
|
||||
pos = param.find(id);
|
||||
@@ -86,7 +89,7 @@ G4double G4BremsstrahlungParameters::Parameter(G4int parameterIndex,
|
||||
const G4DataVector ener = dataSet->GetEnergies(0);
|
||||
G4double ee = G4std::max(ener.front(),G4std::min(ener.back(),energy));
|
||||
value = dataSet->FindValue(ee);
|
||||
|
||||
|
||||
} else {
|
||||
G4cout << "WARNING: G4BremsstrahlungParameters::FindValue "
|
||||
<< "did not find ID = "
|
||||
@@ -96,7 +99,7 @@ G4double G4BremsstrahlungParameters::Parameter(G4int parameterIndex,
|
||||
return value;
|
||||
}
|
||||
|
||||
void G4BremsstrahlungParameters::LoadData()
|
||||
void G4BremsstrahlungParameters::LoadData(const G4String& name)
|
||||
{
|
||||
// Build the complete string identifying the file with the data set
|
||||
|
||||
@@ -112,13 +115,13 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
for (G4int mm=0; mm<100; mm++) {
|
||||
paramC.push_back(x);
|
||||
}
|
||||
|
||||
|
||||
for (G4int m=0; m<nMaterials; m++) {
|
||||
|
||||
const G4Material* material= (*materialTable)[m];
|
||||
const G4Material* material= (*materialTable)[m];
|
||||
const G4ElementVector* elementVector = material->GetElementVector();
|
||||
const G4int nElements = material->GetNumberOfElements();
|
||||
|
||||
|
||||
for (G4int iEl=0; iEl<nElements; iEl++) {
|
||||
G4Element* element = (*elementVector)[iEl];
|
||||
G4double Z = element->GetZ();
|
||||
@@ -127,31 +130,30 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
paramC[iz] = 0.217635e-33*(material->GetTotNbOfElectPerVolume());
|
||||
if (!(activeZ.contains(Z))) {
|
||||
activeZ.push_back(Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read parameters
|
||||
|
||||
|
||||
char* path = getenv("G4LEDATA");
|
||||
if (path == 0)
|
||||
{
|
||||
{
|
||||
G4String excep("G4BremsstrahlungParameters - G4LEDATA environment variable not set");
|
||||
G4Exception(excep);
|
||||
}
|
||||
|
||||
G4String pathString_a(path);
|
||||
G4String stringConversion1("/brem/br-sp.dat");
|
||||
G4String name_a = pathString_a + stringConversion1;
|
||||
G4String name_a = pathString_a + name;
|
||||
G4std::ifstream file_a(name_a);
|
||||
G4std::filebuf* lsdp_a = file_a.rdbuf();
|
||||
|
||||
if (! (lsdp_a->is_open()) )
|
||||
|
||||
if (! (lsdp_a->is_open()) )
|
||||
{
|
||||
G4String stringConversion2("G4BremsstrahlungParameters: cannot open file ");
|
||||
G4String excep = stringConversion2 + name_a;
|
||||
G4Exception(excep);
|
||||
}
|
||||
}
|
||||
|
||||
// The file is organized into two columns:
|
||||
// 1st column is the energy
|
||||
@@ -163,15 +165,15 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
G4DataVector* data;
|
||||
G4double ener = 0.0;
|
||||
G4double sum = 0.0;
|
||||
energies = new G4DataVector();
|
||||
data = new G4DataVector();
|
||||
energies = new G4DataVector();
|
||||
data = new G4DataVector();
|
||||
G4int z = 0;
|
||||
|
||||
G4std::vector<G4DataVector*> a;
|
||||
for (size_t j=0; j<length; j++) {
|
||||
G4DataVector* aa = new G4DataVector();
|
||||
a.push_back(aa);
|
||||
}
|
||||
}
|
||||
G4DataVector e;
|
||||
e.clear();
|
||||
|
||||
@@ -179,21 +181,21 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
file_a >> ener >> sum;
|
||||
|
||||
// End of file
|
||||
if (ener == -2) {
|
||||
if (ener == (G4double)(-2)) {
|
||||
break;
|
||||
|
||||
// End of next element
|
||||
} else if (ener == -1) {
|
||||
} else if (ener == (G4double)(-1)) {
|
||||
|
||||
z++;
|
||||
G4double Z = (G4double)z;
|
||||
|
||||
|
||||
// fill map if Z is used
|
||||
if (activeZ.contains(Z)) {
|
||||
|
||||
for (size_t k=0; k<length; k++) {
|
||||
|
||||
G4int id = z*20 + k;
|
||||
G4int id = z*length + k;
|
||||
G4VDataSetAlgorithm* inter = new G4LogLogInterpolation();
|
||||
G4DataVector* eVector = new G4DataVector;
|
||||
size_t eSize = e.size();
|
||||
@@ -207,14 +209,14 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
for (size_t j=0; j<length; j++) {
|
||||
G4DataVector* aa = new G4DataVector();
|
||||
a.push_back(aa);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (size_t j=0; j<length; j++) {
|
||||
a[j]->clear();
|
||||
}
|
||||
}
|
||||
e.clear();
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
if(ener > 1000.) ener = 1000.;
|
||||
@@ -225,11 +227,11 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
G4double qRead;
|
||||
file_a >> qRead;
|
||||
a[j]->push_back(qRead);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} while (ener != -2);
|
||||
|
||||
} while (ener != (G4double)(-2));
|
||||
|
||||
file_a.close();
|
||||
|
||||
}
|
||||
@@ -238,7 +240,7 @@ void G4BremsstrahlungParameters::LoadData()
|
||||
G4double G4BremsstrahlungParameters::ParameterC(G4int id) const
|
||||
{
|
||||
G4int n = paramC.size();
|
||||
if (id < 0 || id >= n)
|
||||
if (id < 0 || id >= n)
|
||||
{
|
||||
G4String stringConversion1("G4BremsstrahlungParameters::ParameterC - wrong id = ");
|
||||
G4String stringConversion2(id);
|
||||
@@ -252,7 +254,7 @@ G4double G4BremsstrahlungParameters::ParameterC(G4int id) const
|
||||
|
||||
void G4BremsstrahlungParameters::PrintData() const
|
||||
{
|
||||
|
||||
|
||||
G4cout << G4endl;
|
||||
G4cout << "===== G4BremsstrahlungParameters =====" << G4endl;
|
||||
G4cout << G4endl;
|
||||
@@ -263,15 +265,15 @@ void G4BremsstrahlungParameters::PrintData() const
|
||||
G4std::map<G4int,G4VEMDataSet*,G4std::less<G4int> >::const_iterator pos;
|
||||
|
||||
for (size_t j=0; j<nZ; j++) {
|
||||
G4int Z = (G4int)activeZ[j];
|
||||
G4int Z = (G4int)activeZ[j];
|
||||
|
||||
for (size_t i=0; i<length; i++) {
|
||||
|
||||
pos = param.find(Z*20 + i);
|
||||
pos = param.find(Z*length + i);
|
||||
if (pos!= param.end()) {
|
||||
|
||||
G4cout << "===== Z= " << Z
|
||||
<< " parameter[" << i << "] ====="
|
||||
G4cout << "===== Z= " << Z
|
||||
<< " parameter[" << i << "] ====="
|
||||
<< G4endl;
|
||||
G4VEMDataSet* dataSet = (*pos).second;
|
||||
dataSet->PrintData();
|
||||
|
||||
Reference in New Issue
Block a user