51 : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy)
57 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos;
58 for (pos = idMap.begin(); pos != idMap.end(); ++pos)
60 std::vector<G4double>* dataSet = (*pos).second;
64 std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos2;
65 for (pos2 = bindingMap.begin(); pos2 != bindingMap.end(); ++pos2)
73 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos3;
74 for (pos3 = occupancyPdfMap.begin(); pos3 != occupancyPdfMap.end(); ++pos3)
76 std::vector<G4double>* dataSet = (*pos3).second;
88 if (Z>= zMin && Z <= zMax)
98 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
99 if (Z < zMin || Z > zMax) {
104 } pos = idMap.find(Z);
105 std::vector<G4double>* dataSet = (*pos).second;
110const std::vector<G4double>& G4ShellData::ShellVector(
G4int Z)
const
112 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
113 if (Z < zMin || Z > zMax)
G4Exception(
"G4ShellData::ShellVector()",
"de0001",
JustWarning,
"Z outside boundaries");
114 pos = occupancyPdfMap.find(Z);
115 std::vector<G4double>* dataSet = (*pos).second;
124 if (Z >= zMin && Z <= zMax)
126 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
128 if (pos!= idMap.end())
130 std::vector<G4double> dataSet = *((*pos).second);
131 G4int nData = dataSet.size();
132 if (shellIndex >= 0 && shellIndex < nData)
134 n = (
G4int) dataSet[shellIndex];
146 if (Z >= zMin && Z <= zMax)
148 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator pos;
150 if (pos!= idMap.end())
152 std::vector<G4double> dataSet = *((*pos).second);
153 G4int nData = dataSet.size();
154 if (shellIndex >= 0 && shellIndex < nData)
156 prob = dataSet[shellIndex];
169 if (Z >= zMin && Z <= zMax)
171 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator pos;
172 pos = bindingMap.find(Z);
173 if (pos!= bindingMap.end())
176 G4int nData = dataSet.size();
177 if (shellIndex >= 0 && shellIndex < nData)
179 value = dataSet[shellIndex];
188 for (
G4int Z = zMin; Z <= zMax; Z++)
190 G4cout <<
"---- Shell data for Z = "
194 G4int nSh = nShells[Z-1];
195 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posId;
196 posId = idMap.find(Z);
197 std::vector<G4double>* ids = (*posId).second;
198 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator posE;
199 posE = bindingMap.find(Z);
201 for (
G4int i=0; i<nSh; i++)
215 G4cout <<
id <<
" - Binding energy = "
219 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator posOcc;
220 posOcc = occupancyPdfMap.find(Z);
221 std::vector<G4double> probs = *((*posOcc).second);
223 G4cout <<
"- Probability = " << prob;
227 G4cout <<
"-------------------------------------------------"
237 std::ostringstream ost;
239 ost << fileName <<
".dat";
243 char* path = std::getenv(
"G4LEDATA");
246 G4String excep(
"G4ShellData::LoadData()");
252 G4String dirFile = pathString + name;
253 std::ifstream file(dirFile);
254 std::filebuf* lsdp = file.rdbuf();
256 if (! (lsdp->is_open()) )
259 G4String excep =
"G4ShellData::LoadData()";
260 G4String msg =
"data file: " + dirFile +
" not found";
271 std::vector<G4double>* ids =
new std::vector<G4double>;
282 bindingMap[Z] = energies;
283 G4int n = ids->size();
284 nShells.push_back(n);
287 ids =
new std::vector<G4double>;
292 if (sLocal == nColumns)
314 else if (k%nColumns == 0)
318 energies->push_back(e);
334 for (
G4int ZLocal=zMin; ZLocal <= zMax; ZLocal++)
338 std::vector<G4double>* prob =
new std::vector<G4double>;
341 prob->push_back(occupancy[0] * scale);
342 for (
size_t i=1; i<occupancy.size(); i++)
344 prob->push_back(occupancy[i]*scale + (*prob)[i-1]);
346 occupancyPdfMap[ZLocal] = prob;
364 if (Z < zMin || Z > zMax) {
369 G4int shellIndex = 0;
370 std::vector<G4double> prob = ShellVector(Z);
379 G4int upperBound = nShellsLocal;
381 while (shellIndex <= upperBound)
383 G4int midShell = (shellIndex + upperBound) / 2;
384 if ( random < prob[midShell] )
385 upperBound = midShell - 1;
387 shellIndex = midShell + 1;
389 if (shellIndex >= nShellsLocal) shellIndex = nShellsLocal - 1;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
G4int ShellId(G4int Z, G4int shellIndex) const
G4double BindingEnergy(G4int Z, G4int shellIndex) const
size_t NumberOfShells(G4int Z) const
G4ShellData(G4int minZ=1, G4int maxZ=100, G4bool isOccupancy=false)
G4double ShellOccupancyProbability(G4int Z, G4int shellIndex) const
void LoadData(const G4String &fileName)
const std::vector< G4double > & ShellIdVector(G4int Z) const
G4int SelectRandomShell(G4int Z) const