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=3; i<=ZPROJMAX; ++i) {
105 fMatData[i] =
new std::vector<G4PhysicsLogVector*>;
114 for(
G4int i=3; i<=ZPROJMAX; ++i) {
115 auto v = fMatData[i];
117 for(
auto & dat : *v) {
122 for(
G4int j=1; j<=ZTARGMAX; ++j) {
123 delete fElmData[i][j];
134 if (Z > ZPROJMAX) {
return 0.0; }
139 if(Z1 > ZTARGMAX) {
return 0.0; }
144 if (idx < 0) {
return 0.0; }
145 v = (*(fMatData[Z]))[idx];
147 if(
nullptr == v) {
return 0.0; }
149 : (*v)[0]*std::sqrt(e/fEmin);
158 if(fDataDirectory.empty()) {
159 std::ostringstream ost;
161 fDataDirectory = ost.str();
167 if(nmat == fMatIndex.size()) {
return; }
172 G4cout <<
"### G4IonICRU73Data::Initialise() for " << nmat
173 <<
" materials" <<
G4endl;
175 fMatIndex.resize(nmat, -1);
176 for(
G4int j=3; j<=ZPROJMAX; ++j) {
177 fMatData[j]->resize(nmat,
nullptr);
187 G4cout << i <<
". material: " << matname
188 <<
" idx=" << idx <<
" matIdx=" << fMatIndex[idx]
191 if(fMatIndex[idx] == -1) {
196 for(
G4int j=0; j<3; ++j) {
197 if(matname == namesICRU90[j]) {
198 ReadMaterialData(mat, densityCoef[j],
true);
209 for(
G4int j=0; j<31; ++j) {
210 if(matname == namesICRU73[j]) {
211 ReadMaterialData(mat, 1.0,
false);
226 for (std::size_t j=0; j<nelm; ++j) {
227 if ((*elmv)[j]->GetZasInt() > ZTARGMAX) {
233 ReadElementData(mat, useICRU90);
236 G4cout <<
"Data via elements for " << matname <<
G4endl;
240 if(isOK) { fMatIndex[idx] = i; }
250void G4IonICRU73Data::ReadMaterialData(
const G4Material* mat,
256 for(
G4int Z=3; Z<=ZPROJMAX; ++Z) {
257 std::ostringstream ost;
258 ost << fDataDirectory <<
"icru";
261 if(useICRU90 && Z <= 18) {
265 for(
G4int i=0; i<NZ; ++i) {
268 }
else if(i == NZ-1) {
271 }
else if(Z > zdat[i] && Z < zdat[i+1]) {
272 if(Z - zdat[i] <= zdat[i + 1] - Z) {
282 if(
nullptr == (*(fMatData[Z1]))[idx]) {
283 ost <<
"/z" << Z1 <<
"_" <<
name <<
".dat";
287 mat->
GetDensity() * CLHEP::MeV * 1000 * CLHEP::cm2 / CLHEP::g;
291 <<
" and projectile Z=" << Z1 <<
G4endl;
294 (*(fMatData[Z1]))[idx] = v;
298 auto v2 = (*(fMatData[Z1]))[idx];
301 (*(fMatData[Z]))[idx] = v1;
302 v1->ScaleVector(1.0, scale);
310void G4IonICRU73Data::ReadElementData(
const G4Material* mat,
G4bool useICRU90)
315 for(
G4int Z=3; Z<=ZPROJMAX; ++Z) {
317 G4cout <<
"ReadElementData for " << mat->
GetName() <<
" Z=" << Z
318 <<
" Nelm=" << nelm <<
G4endl;
322 v = FindOrBuildElementData(Z, (*elmv)[0]->GetZasInt(), useICRU90);
325 for(
G4int i=0; i<=fNbins; ++i) {
327 for(
G4int j=0; j<nelm; ++j) {
329 FindOrBuildElementData(Z, (*elmv)[j]->GetZasInt(), useICRU90);
330 dedx += (*v1)[i]*dens[j];
340 mat->
GetDensity() * CLHEP::MeV * 1000 * CLHEP::cm2 / CLHEP::g;
344 <<
" for projectile Z=" << Z <<
G4endl;
354G4IonICRU73Data::FindOrBuildElementData(
const G4int Z,
const G4int Z1,
358 if(Z <= ZPROJMAX && Z1 <= ZTARGMAX) {
362 G4bool isICRU90 = (useICRU90 && Z <= 18 &&
363 (Z1 == 1 || Z1 == 6 || Z1 == 7 || Z1 == 8));
367 for(
G4int i=0; i<NZ; ++i) {
370 }
else if(i == NZ-1) {
373 }
else if(Z1 > zdat[i] && Z1 < zdat[i+1]) {
374 if(Z1 - zdat[i] <= zdat[i + 1] - Z1) {
385 std::ostringstream ost;
386 ost << fDataDirectory <<
"icru";
387 if(isICRU90) { ost <<
"90"; }
388 else { ost <<
"73"; }
389 ost <<
"/z" << Z <<
"_" << Z2 <<
".dat";
390 v = RetrieveVector(ost,
false);
392 if(Z1 != Z2 &&
nullptr != v) {
404G4IonICRU73Data::RetrieveVector(std::ostringstream& ost,
G4bool warn)
407 std::ifstream filein(ost.str().c_str());
408 if (!filein.is_open()) {
411 ed <<
"Data file <" << ost.str().c_str()
412 <<
"> is not opened";
413 G4Exception(
"G4IonICRU73Data::RetrieveVector(..)",
"em013",
418 G4cout <<
"File " << ost.str()
419 <<
" is opened by G4IonICRU73Data" <<
G4endl;
423 if(!fVector->
Retrieve(filein,
true)) {
425 ed <<
"Data file <" << ost.str().c_str()
426 <<
"> is not retrieved!";
427 G4Exception(
"G4IonICRU73Data::RetrieveVector(..)",
"had015",
433 for(
G4int i=0; i<=fNbins; ++i) {
std::vector< const G4Element * > G4ElementVector
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
const G4String & GetDirLEDATA() const
G4double GetDEDX(const G4Material *, const G4int Z, const G4double e, const G4double loge) const
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
const G4double * GetFractionVector() const
static std::size_t GetNumberOfMaterials()
std::size_t GetIndex() const
static G4MaterialTable * GetMaterialTable()
std::size_t GetNumberOfElements() const
const G4String & GetName() const
void EnableLogBinSearch(const G4int n=1)
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)