52 : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy)
58 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos;
59 for (pos = idMap.begin(); pos != idMap.end(); ++pos)
61 std::vector<G4double>* dataSet = (*pos).second;
65 std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos2;
66 for (pos2 = bindingMap.begin(); pos2 != bindingMap.end(); ++pos2)
74 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos3;
75 for (pos3 = occupancyPdfMap.begin(); pos3 != occupancyPdfMap.end(); ++pos3)
77 std::vector<G4double>* dataSet = (*pos3).second;
89 if (Z>= zMin && Z <= zMax)
99 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
100 if (Z < zMin || Z > zMax) {
105 } pos = idMap.find(Z);
106 std::vector<G4double>* dataSet = (*pos).second;
111 const std::vector<G4double>& G4ShellData::ShellVector(
G4int Z)
const
113 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
114 if (Z < zMin || Z > zMax)
G4Exception(
"G4ShellData::ShellVector()",
"de0001",
JustWarning,
"Z outside boundaries");
115 pos = occupancyPdfMap.find(Z);
116 std::vector<G4double>* dataSet = (*pos).second;
125 if (Z >= zMin && Z <= zMax)
127 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
129 if (pos!= idMap.end())
131 std::vector<G4double> dataSet = *((*pos).second);
132 G4int nData = dataSet.size();
133 if (shellIndex >= 0 && shellIndex < nData)
135 n = (
G4int) dataSet[shellIndex];
147 if (Z >= zMin && Z <= zMax)
149 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
151 if (pos!= idMap.end())
153 std::vector<G4double> dataSet = *((*pos).second);
154 G4int nData = dataSet.size();
155 if (shellIndex >= 0 && shellIndex < nData)
157 prob = dataSet[shellIndex];
170 if (Z >= zMin && Z <= zMax)
172 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
173 pos = bindingMap.find(Z);
174 if (pos!= bindingMap.end())
177 G4int nData = dataSet.size();
178 if (shellIndex >= 0 && shellIndex < nData)
180 value = dataSet[shellIndex];
189 for (
G4int Z = zMin; Z <= zMax; Z++)
191 G4cout <<
"---- Shell data for Z = "
195 G4int nSh = nShells[Z-1];
196 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posId;
197 posId = idMap.find(Z);
198 std::vector<G4double>* ids = (*posId).second;
199 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posE;
200 posE = bindingMap.find(Z);
202 for (
G4int i=0; i<nSh; i++)
216 G4cout <<
id <<
" - Binding energy = "
220 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posOcc;
221 posOcc = occupancyPdfMap.find(Z);
222 std::vector<G4double> probs = *((*posOcc).second);
224 G4cout <<
"- Probability = " << prob;
228 G4cout <<
"-------------------------------------------------"
238 std::ostringstream ost;
240 ost << fileName <<
".dat";
244 char* path = getenv(
"G4LEDATA");
247 G4String excep(
"G4ShellData::LoadData()");
254 std::ifstream
file(dirFile);
255 std::filebuf* lsdp = file.rdbuf();
257 if (! (lsdp->is_open()) )
260 G4String excep =
"G4ShellData::LoadData()";
261 G4String msg =
"data file: " + dirFile +
" not found";
272 std::vector<G4double>* ids =
new std::vector<G4double>;
283 bindingMap[
Z] = energies;
285 nShells.push_back(n);
288 ids =
new std::vector<G4double>;
293 if (sLocal == nColumns)
315 else if (k%nColumns == 0)
319 energies->push_back(e);
335 for (
G4int ZLocal=zMin; ZLocal <= zMax; ZLocal++)
339 std::vector<G4double>* prob =
new std::vector<G4double>;
342 prob->push_back(occupancy[0] * scale);
343 for (
size_t i=1; i<occupancy.size(); i++)
345 prob->push_back(occupancy[i]*scale + (*prob)[i-1]);
347 occupancyPdfMap[ZLocal] = prob;
365 if (Z < zMin || Z > zMax) {
370 G4int shellIndex = 0;
371 std::vector<G4double> prob = ShellVector(Z);
380 G4int upperBound = nShellsLocal;
382 while (shellIndex <= upperBound)
384 G4int midShell = (shellIndex + upperBound) / 2;
385 if ( random < prob[midShell] )
386 upperBound = midShell - 1;
388 shellIndex = midShell + 1;
390 if (shellIndex >= nShellsLocal) shellIndex = nShellsLocal - 1;
G4int SelectRandomShell(G4int Z) const
G4ShellData(G4int minZ=1, G4int maxZ=100, G4bool isOccupancy=false)
G4int ShellId(G4int Z, G4int shellIndex) const
void LoadData(const G4String &fileName)
const std::vector< G4double > & ShellIdVector(G4int Z) const
G4GLOB_DLL std::ostream G4cout
G4double BindingEnergy(G4int Z, G4int shellIndex) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double ShellOccupancyProbability(G4int Z, G4int shellIndex) const
size_t NumberOfShells(G4int Z) const
const XML_Char int const XML_Char * value