58"G4_ADIPOSE_TISSUE_ICRP"
62"G4_BONE_CORTICAL_ICRP"
68"G4_LITHIUM_TETRABORATE"
71"G4_MUSCLE_STRIATED_ICRU"
75"G4_PLASTIC_SC_VINYLTOLUENE"
88 const G4String namesICRU90[3] = {
"G4_AIR",
"G4_GRAPHITE",
"G4_WATER"};
89 const G4double densityCoef[3] = {0.996, 1.025, 0.998};
91 const G4int zdat[NZ] = { 5, 6, 7, 8, 13, 14, 15, 16, 22, 26,
92 28, 29, 30, 31, 32, 33, 34, 40, 47, 48,
93 49, 51, 52, 72, 73, 74, 79 };
100 fEmin = 0.025*CLHEP::MeV;
101 fEmax = 2.5*CLHEP::MeV;
102 fNbins = fNbinsPerDecade*
G4lrint(std::log10(fEmax/fEmin));
104 for(
G4int i=0; i<81; ++i) {
105 fMatData[i] =
new std::vector<G4PhysicsLogVector*>;
114 for(
G4int i=0; i<81; ++i) {
115 auto v = fMatData[i];
116 for(
G4int j=0; j<fNmat; ++j) {
120 for(
G4int j=0; j<93; ++j) {
delete fElmData[i][j]; }
130 G4int Z2 = std::min(
Z, 80);
133 v = fElmData[Z2][Z1];
137 v = (*(fMatData[Z2]))[idx];
140 if(
nullptr == v) {
return 0.0; }
142 : (*v)[0]*std::sqrt(e/fEmin);
151 if(fDataDirectory.empty()) {
153 if (
nullptr != path) {
154 std::ostringstream ost;
155 ost << path <<
"/ion_stopping_data/";
156 fDataDirectory = ost.str();
158 G4Exception(
"G4IonICRU73Data::Initialise(..)",
"em013",
160 "Environment variable G4LEDATA is not defined");
165 if(nmat == fMatIndex.size()) {
return; }
168 G4cout <<
"### G4IonICRU73Data::Initialise() for " << nmat
169 <<
" materials" <<
G4endl;
171 fMatIndex.resize(nmat, -1);
172 for(
G4int j=0; j<81; ++j) {
173 fMatData[j]->resize(nmat,
nullptr);
184 <<
" idx=" << idx <<
G4endl;
186 if(fMatIndex[idx] == -1) {
191 ReadElementData(mat, useICRU90);
197 if(!isOK && useICRU90) {
198 for(
G4int j=0; j<3; ++j) {
199 if(matname == namesICRU90[j]) {
200 ReadMaterialData(mat, densityCoef[j],
true);
210 for(
G4int j=0; j<31; ++j) {
211 if(matname == namesICRU73[j]) {
212 ReadMaterialData(mat, 1.0,
false);
222 ReadElementData(mat, useICRU90);
233void G4IonICRU73Data::ReadMaterialData(
const G4Material* mat,
239 std::ostringstream ost;
240 ost << fDataDirectory <<
"icru";
243 if(useICRU90 &&
Z <= 18) {
247 for(
G4int i=0; i<NZ; ++i) {
250 }
else if(i == NZ-1) {
253 }
else if(
Z > zdat[i] &&
Z < zdat[i+1]) {
254 if(
Z - zdat[i] <= zdat[i + 1] -
Z) {
264 if(
nullptr == (*(fMatData[Z1]))[fNmat]) {
265 ost <<
"/z" << Z1 <<
"_" <<
name <<
".dat";
269 mat->
GetDensity() * CLHEP::MeV * 1000 * CLHEP::cm2 / CLHEP::g;
273 <<
" and projectile Z=" << Z1 <<
G4endl;
276 (*(fMatData[Z1]))[fNmat] = v;
280 auto v2 = (*(fMatData[Z1]))[fNmat];
283 (*(fMatData[
Z]))[fNmat] = v1;
284 v1->ScaleVector(1.0, scale);
292void G4IonICRU73Data::ReadElementData(
const G4Material* mat,
G4bool useICRU90)
300 v = FindOrBuildElementData(
Z, (*elmv)[0]->GetZasInt(), useICRU90);
303 for(
G4int i=0; i<=fNbins; ++i) {
305 for(
G4int j=0; j<nelm; ++j) {
307 FindOrBuildElementData(
Z, (*elmv)[j]->GetZasInt(), useICRU90);
308 dedx += (*v1)[i]*dens[j];
314 (*(fMatData[
Z]))[fNmat] = v;
318 mat->
GetDensity() * CLHEP::MeV * 1000 * CLHEP::cm2 / CLHEP::g;
322 <<
" for projectile Z=" <<
Z <<
G4endl;
332G4IonICRU73Data::FindOrBuildElementData(
const G4int Z,
const G4int Z1,
336 if(
Z <= 80 && Z1 <= 92) {
340 G4bool isICRU90 = (useICRU90 &&
Z <= 18 &&
341 (Z1 == 1 || Z1 == 6 || Z1 == 7 || Z1 == 8));
345 for(
G4int i=0; i<NZ; ++i) {
348 }
else if(i == NZ-1) {
351 }
else if(Z1 > zdat[i] && Z1 < zdat[i+1]) {
352 if(Z1 - zdat[i] <= zdat[i + 1] - Z1) {
363 std::ostringstream ost;
364 ost << fDataDirectory <<
"icru";
365 if(isICRU90) { ost <<
"90"; }
366 else { ost <<
"73"; }
367 ost <<
"/z" <<
Z <<
"_" << Z2 <<
".dat";
368 v = RetrieveVector(ost,
false);
370 if(Z1 != Z2 &&
nullptr != v) {
382G4IonICRU73Data::RetrieveVector(std::ostringstream& ost,
G4bool warn)
385 std::ifstream filein(ost.str().c_str());
386 if (!filein.is_open()) {
389 ed <<
"Data file <" << ost.str().c_str()
390 <<
"> is not opened";
391 G4Exception(
"G4IonICRU73Data::RetrieveVector(..)",
"em013",
396 G4cout <<
"File " << ost.str()
397 <<
" is opened by G4IonICRU73Data" <<
G4endl;
401 if(!fVector->
Retrieve(filein,
true)) {
403 ed <<
"Data file <" << ost.str().c_str()
404 <<
"> is not retrieved!";
405 G4Exception(
"G4IonICRU73Data::RetrieveVector(..)",
"had015",
410 for(
G4int i=0; i<=fNbins; ++i) {
std::vector< const G4Element * > G4ElementVector
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
static G4EmParameters * Instance()
G4bool UseICRU90Data() const
G4double GetDEDX(const G4Material *, const G4int Z, const G4double e, const G4double loge) const
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
static size_t GetNumberOfMaterials()
const G4double * GetFractionVector() const
size_t GetNumberOfElements() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
void PutValue(const std::size_t index, const G4double value)
void ScaleVector(const G4double factorE, const G4double factorV)
G4double Energy(const std::size_t index) const
G4double LogVectorValue(const G4double energy, const G4double theLogEnergy) const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
G4double Value(const G4double energy, std::size_t &lastidx) const
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
const char * name(G4int ptype)