55 : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy)
61 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos;
62 for (pos = idMap.begin(); pos != idMap.end(); ++pos)
64 std::vector<G4double>* dataSet = (*pos).second;
68 std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos2;
69 for (pos2 = bindingMap.begin(); pos2 != bindingMap.end(); ++pos2)
77 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos3;
78 for (pos3 = occupancyPdfMap.begin(); pos3 != occupancyPdfMap.end(); ++pos3)
80 std::vector<G4double>* dataSet = (*pos3).second;
92 if (Z>= zMin && Z <= zMax)
102 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
103 if (Z < zMin || Z > zMax)
104 G4Exception(
"G4RDShellData::ShellIdVector()",
"OutOfRange",
107 std::vector<G4double>* dataSet = (*pos).second;
112 const std::vector<G4double>& G4RDShellData::ShellVector(
G4int Z)
const
114 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
115 if (Z < zMin || Z > zMax)
116 G4Exception(
"G4RDShellData::ShellVector()",
"OutOfRange",
118 pos = occupancyPdfMap.find(Z);
119 std::vector<G4double>* dataSet = (*pos).second;
128 if (Z >= zMin && Z <= zMax)
130 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
132 if (pos!= idMap.end())
134 std::vector<G4double> dataSet = *((*pos).second);
135 G4int nData = dataSet.size();
136 if (shellIndex >= 0 && shellIndex < nData)
138 n = (
G4int) dataSet[shellIndex];
150 if (Z >= zMin && Z <= zMax)
152 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
154 if (pos!= idMap.end())
156 std::vector<G4double> dataSet = *((*pos).second);
157 G4int nData = dataSet.size();
158 if (shellIndex >= 0 && shellIndex < nData)
160 prob = dataSet[shellIndex];
173 if (Z >= zMin && Z <= zMax)
175 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
176 pos = bindingMap.find(Z);
177 if (pos!= bindingMap.end())
180 G4int nData = dataSet.size();
181 if (shellIndex >= 0 && shellIndex < nData)
183 value = dataSet[shellIndex];
192 for (
G4int Z = zMin; Z <= zMax; Z++)
194 G4cout <<
"---- Shell data for Z = "
198 G4int nSh = nShells[Z-1];
199 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posId;
200 posId = idMap.find(Z);
201 std::vector<G4double>* ids = (*posId).second;
202 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posE;
203 posE = bindingMap.find(Z);
205 for (
G4int i=0; i<nSh; i++)
219 G4cout <<
id <<
" - Binding energy = "
223 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posOcc;
224 posOcc = occupancyPdfMap.find(Z);
225 std::vector<G4double> probs = *((*posOcc).second);
227 G4cout <<
"- Probability = " << prob;
231 G4cout <<
"-------------------------------------------------"
241 std::ostringstream ost;
243 ost << fileName <<
".dat";
247 char* path = getenv(
"G4LEDATA");
250 G4String excep(
"G4LEDATA environment variable not set!");
251 G4Exception(
"G4RDShellData::LoadData()",
"InvalidSetup",
257 std::ifstream
file(dirFile);
258 std::filebuf* lsdp = file.rdbuf();
260 if (! (lsdp->is_open()) )
265 G4Exception(
"G4RDShellData::LoadData()",
"DataNotFound",
275 std::vector<G4double>* ids =
new std::vector<G4double>;
286 bindingMap[
Z] = energies;
288 nShells.push_back(n);
290 ids =
new std::vector<G4double>;
315 else if (k%nColumns == 0)
319 energies->push_back(e);
333 for (
G4int Z=zMin; Z <= zMax; Z++)
337 std::vector<G4double>* prob =
new std::vector<G4double>;
340 prob->push_back(occupancy[0] * scale);
341 for (
size_t i=1; i<occupancy.size(); i++)
343 prob->push_back(occupancy[i]*scale + (*prob)[i-1]);
345 occupancyPdfMap[
Z] = prob;
363 if (Z < zMin || Z > zMax)
364 G4Exception(
"G4RDShellData::SelectRandomShell()",
"OutOfRange",
367 G4int shellIndex = 0;
368 std::vector<G4double> prob = ShellVector(Z);
377 G4int upperBound = nShells;
379 while (shellIndex <= upperBound)
381 G4int midShell = (shellIndex + upperBound) / 2;
382 if ( random < prob[midShell] )
383 upperBound = midShell - 1;
385 shellIndex = midShell + 1;
387 if (shellIndex >= nShells) shellIndex = nShells - 1;
G4double BindingEnergy(G4int Z, G4int shellIndex) const
size_t NumberOfShells(G4int Z) const
void LoadData(const G4String &fileName)
G4GLOB_DLL std::ostream G4cout
G4RDShellData(G4int minZ=1, G4int maxZ=100, G4bool isOccupancy=false)
G4int ShellId(G4int Z, G4int shellIndex) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const std::vector< G4double > & ShellIdVector(G4int Z) const
G4double ShellOccupancyProbability(G4int Z, G4int shellIndex) const
const XML_Char int const XML_Char * value
G4int SelectRandomShell(G4int Z) const