51 : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy)
58 for (
auto& pos : idMap)
60 std::vector<G4double>* dataSet = pos.second;
63 for (
auto& pos2 : bindingMap)
71 for (
auto& pos3 : occupancyPdfMap)
73 std::vector<G4double>* dataSet = pos3.second;
86 if (
Z>= zMin &&
Z <= zMax)
97 if (Z < zMin || Z > zMax) {
100 auto pos = idMap.find(
Z);
101 std::vector<G4double>* dataSet = (*pos).second;
107const std::vector<G4double>& G4ShellData::ShellVector(
G4int Z)
const
109 if (Z < zMin || Z > zMax)
111 auto pos = occupancyPdfMap.find(
Z);
112 std::vector<G4double>* dataSet = (*pos).second;
122 if (
Z >= zMin &&
Z <= zMax)
124 auto pos = idMap.find(
Z);
125 if (pos!= idMap.end())
127 std::vector<G4double> dataSet = *((*pos).second);
129 if (shellIndex >= 0 && shellIndex < nData)
131 n = (
G4int) dataSet[shellIndex];
143 if (
Z >= zMin &&
Z <= zMax)
145 auto pos = idMap.find(
Z);
146 if (pos!= idMap.end())
148 std::vector<G4double> dataSet = *((*pos).second);
150 if (shellIndex >= 0 && shellIndex < nData)
152 prob = dataSet[shellIndex];
165 if (
Z >= zMin &&
Z <= zMax)
167 auto pos = bindingMap.find(
Z);
168 if (pos!= bindingMap.end())
172 if (shellIndex >= 0 && shellIndex < nData)
174 value = dataSet[shellIndex];
185 for (
G4int Z = zMin;
Z <= zMax;
Z++)
187 G4cout <<
"---- Shell data for Z = "
192 auto posId = idMap.find(
Z);
193 std::vector<G4double>* ids = (*posId).second;
194 auto posE = bindingMap.find(
Z);
196 for (
G4int i=0; i<nSh; ++i)
210 G4cout <<
id <<
" - Binding energy = "
214 auto posOcc = occupancyPdfMap.find(
Z);
215 std::vector<G4double> probs = *((*posOcc).second);
217 G4cout <<
"- Probability = " << prob;
221 G4cout <<
"-------------------------------------------------"
231 std::ostringstream ost;
232 ost << fileName <<
".dat";
238 G4String excep(
"G4ShellData::LoadData()");
244 G4String dirFile = pathString + name;
245 std::ifstream file(dirFile);
246 std::filebuf* lsdp = file.rdbuf();
248 if (! (lsdp->is_open()) )
251 G4String excep =
"G4ShellData::LoadData()";
252 G4String msg =
"data file: " + dirFile +
" not found";
263 std::vector<G4double>* ids =
new std::vector<G4double>;
274 bindingMap[
Z] = energies;
276 nShells.push_back(n);
279 ids =
new std::vector<G4double>;
284 if (sLocal == nColumns)
306 else if (k%nColumns == 0)
310 energies->push_back(e);
325 for (
G4int ZLocal=zMin; ZLocal <= zMax; ++ZLocal)
329 std::vector<G4double>* prob =
new std::vector<G4double>;
332 prob->push_back(occupancy[0] * scale);
333 for (std::size_t i=1; i<occupancy.size(); ++i)
335 prob->push_back(occupancy[i]*scale + (*prob)[i-1]);
337 occupancyPdfMap[ZLocal] = prob;
346 if (Z < zMin || Z > zMax)
349 G4int shellIndex = 0;
350 std::vector<G4double> prob = ShellVector(
Z);
355 G4int upperBound = nShellsLocal;
357 while (shellIndex <= upperBound)
359 G4int midShell = (shellIndex + upperBound) / 2;
360 if ( random < prob[midShell] )
361 upperBound = midShell - 1;
363 shellIndex = midShell + 1;
365 if (shellIndex >= nShellsLocal) shellIndex = nShellsLocal - 1;
const char * G4FindDataDir(const char *)
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
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
std::size_t NumberOfShells(G4int Z) const
G4int SelectRandomShell(G4int Z) const