55 : zMin(minZ), zMax(maxZ), occupancyData(isOccupancy)
61 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator
pos;
64 std::vector<G4double>* dataSet = (*pos).second;
68 std::map<G4int,G4DataVector*,std::less<G4int> >::iterator pos2;
77 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::iterator pos3;
80 std::vector<G4double>* dataSet = (*pos3).second;
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;
114 std::map<G4int,std::vector<G4double>*,std::less<G4int> >::const_iterator
pos;
115 if (Z < zMin || Z >
zMax)
116 G4Exception(
"G4RDShellData::ShellVector()",
"OutOfRange",
119 std::vector<G4double>* dataSet = (*pos).second;
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];
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];
175 std::map<G4int,G4DataVector*,std::less<G4int> >::const_iterator
pos;
180 G4int nData = dataSet.size();
181 if (shellIndex >= 0 && shellIndex < nData)
183 value = dataSet[shellIndex];
194 G4cout <<
"---- Shell data for Z = "
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;
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;
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>;
290 ids =
new std::vector<G4double>;
315 else if (k%nColumns == 0)
319 energies->push_back(e);
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]);
363 if (Z < zMin || Z >
zMax)
364 G4Exception(
"G4RDShellData::SelectRandomShell()",
"OutOfRange",
367 G4int shellIndex = 0;
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;
static constexpr double s
std::map< G4int, std::vector< G4double > *, std::less< G4int > > idMap
std::vector< ExP01TrackerHit * > a
G4double BindingEnergy(G4int Z, G4int shellIndex) const
const char * name(G4int ptype)
size_t NumberOfShells(G4int Z) const
void LoadData(const G4String &fileName)
G4GLOB_DLL std::ostream G4cout
std::vector< G4int > nShells
const std::vector< G4double > & ShellVector(G4int Z) const
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
std::map< G4int, std::vector< G4double > *, std::less< G4int > > occupancyPdfMap
G4double ShellOccupancyProbability(G4int Z, G4int shellIndex) const
static constexpr double MeV
static constexpr double keV
G4int SelectRandomShell(G4int Z) const
static const G4double pos
std::map< G4int, G4DataVector *, std::less< G4int > > bindingMap