78 maxCacheEntries(maxCacheSize) {
81 G4cerr <<
"G4IonDEDXHandler::G4IonDEDXHandler() "
82 <<
" Pointer to G4VIonDEDXTable object is null-pointer."
87 G4cerr <<
"G4IonDEDXHandler::G4IonDEDXHandler() "
88 <<
" Pointer to G4VIonDEDXScalingAlgorithm object is null-pointer."
93 G4cerr <<
"G4IonDEDXHandler::G4IonDEDXHandler() "
94 <<
" Cache size <=0. Resetting to 5."
127 G4bool isApplicable =
true;
130 isApplicable =
false;
134 G4int atomicNumberIon = particle -> GetAtomicNumber();
135 G4int atomicNumberBase =
136 algorithm -> AtomicNumberBaseIon(atomicNumberIon, material);
138 G4IonKey key = std::make_pair(atomicNumberBase, material);
158 if(kineticEnergy <= 0.0) dedx = 0.0;
164 factor *=
algorithm -> ScalingFactorDEDX(particle,
175 dedx = factor * value.
dedxVector -> GetValue(scaledKineticEnergy, b);
177 if(dedx < 0.0) dedx = 0.0;
182 G4cout <<
"G4IonDEDXHandler::GetDEDX() E = "
183 << kineticEnergy /
MeV <<
" MeV * "
186 <<
" MeV, dE/dx = " << dedx /
MeV *
cm <<
" MeV/cm"
187 <<
", material = " << material ->
GetName()
200 G4int atomicNumberIon = particle -> GetAtomicNumber();
211 G4int atomicNumberIon,
214 G4bool isApplicable =
true;
217 isApplicable =
false;
221 G4int atomicNumberBase =
222 algorithm -> AtomicNumberBaseIon(atomicNumberIon, material);
226 G4IonKey key = std::make_pair(atomicNumberBase, material);
233 const G4String& chemFormula = material -> GetChemicalFormula();
236 isApplicable =
table -> BuildPhysicsVector(atomicNumberBase, chemFormula);
240 table -> GetPhysicsVector(atomicNumberBase, chemFormula);
244 isApplicable =
table -> BuildPhysicsVector(atomicNumberBase, materialName);
247 table -> GetPhysicsVector(atomicNumberBase, materialName);
252 const G4ElementVector* elementVector = material -> GetElementVector() ;
254 std::vector<G4PhysicsVector*> dEdxTable;
256 size_t nmbElements = material -> GetNumberOfElements();
258 for(
size_t i = 0; i < nmbElements; i++) {
260 G4int atomicNumberMat =
G4int((*elementVector)[i] -> GetZ());
262 isApplicable =
table -> BuildPhysicsVector(atomicNumberBase, atomicNumberMat);
267 table -> GetPhysicsVector(atomicNumberBase, atomicNumberMat);
268 dEdxTable.push_back(dEdx);
279 if(dEdxTable.size() > 0) {
281 size_t nmbdEdxBins = dEdxTable[0] -> GetVectorLength();
282 G4double lowerEdge = dEdxTable[0] -> GetLowEdgeEnergy(0);
283 G4double upperEdge = dEdxTable[0] -> GetLowEdgeEnergy(nmbdEdxBins-1);
290 const G4double* massFractionVector = material -> GetFractionVector();
293 for(
size_t j = 0; j < nmbdEdxBins; j++) {
295 G4double edge = dEdxTable[0] -> GetLowEdgeEnergy(j);
298 for(
size_t i = 0; i < nmbElements; i++) {
300 value += (dEdxTable[i] -> GetValue(edge ,b)) *
301 massFractionVector[i];
304 dEdxBragg -> PutValues(j, edge, value);
309 G4cout <<
"G4IonDEDXHandler::BuildPhysicsVector() for ion with Z="
310 << atomicNumberBase <<
" in "
335 G4int atomicNumberIon = particle -> GetAtomicNumber();
336 G4int atomicNumberBase =
337 algorithm -> AtomicNumberBaseIon(atomicNumberIon, material);
339 G4IonKey key = std::make_pair(atomicNumberBase, material);
348 algorithm -> ScalingFactorEnergy(particle, material) / nmbNucleons;
350 size_t nmbdEdxBins = value.
dedxVector -> GetVectorLength();
354 value.
dedxVector -> GetLowEdgeEnergy(nmbdEdxBins-1);
355 value.
density = material -> GetDensity();
366 G4cout <<
"G4IonDEDXHandler::UpdateCacheValue() for "
367 << particle -> GetParticleName() <<
" in "
381 G4CacheKey key = std::make_pair(particle, material);
384 CacheEntryList::iterator* pointerIter =
393 CacheEntryList::iterator* pointerIter1 =
394 new CacheEntryList::iterator();
403 CacheEntryList::iterator* listPointerIter =
404 (CacheEntryList::iterator*) pointerIter2;
408 delete listPointerIter;
413 entry = *(*pointerIter);
430 for(;iter != iter_end; iter++) {
431 void* pointerIter = iter ->
second;
432 CacheEntryList::iterator* listPointerIter =
433 (CacheEntryList::iterator*) pointerIter;
435 delete listPointerIter;
452 G4double atomicMassNumber = particle -> GetAtomicMass();
453 G4double materialDensity = material -> GetDensity();
455 G4cout <<
"# dE/dx table for " << particle -> GetParticleName()
456 <<
" in material " << material ->
GetName()
457 <<
" of density " << materialDensity /
g *
cm3
460 <<
"# Projectile mass number A1 = " << atomicMassNumber
462 <<
"# Energy range (per nucleon) of tabulation: "
468 <<
"# ------------------------------------------------------"
472 << std::setw(14) <<
"E/A1"
473 << std::setw(14) <<
"dE/dx"
474 << std::setw(14) <<
"1/rho*dE/dx"
478 << std::setw(14) <<
"(MeV)"
479 << std::setw(14) <<
"(MeV/cm)"
480 << std::setw(14) <<
"(MeV*cm2/mg)"
482 <<
"# ------------------------------------------------------"
487 G4double energyLowerBoundary = lowerBoundary * atomicMassNumber;
488 G4double energyUpperBoundary = upperBoundary * atomicMassNumber;
492 energyLowerBoundary = std::log(energyLowerBoundary);
493 energyUpperBoundary = std::log(energyUpperBoundary);
496 G4double deltaEnergy = (energyUpperBoundary - energyLowerBoundary) /
500 for(
int i = 0; i < nmbBins + 1; i++) {
503 if(logScaleEnergy) energy =
G4Exp(energy);
508 << std::setw(14) << energy / atomicMassNumber /
MeV
509 << std::setw(14) << loss /
MeV *
cm
510 << std::setw(14) << loss / materialDensity / (
MeV*
cm2/(0.001*
g))