214 G4bool isApplicable =
true;
216 if(table == 0 || algorithm == 0) {
217 isApplicable =
false;
221 G4int atomicNumberBase =
222 algorithm -> AtomicNumberBaseIon(atomicNumberIon, material);
226 G4IonKey key = std::make_pair(atomicNumberBase, material);
228 DEDXTable::iterator iter = stoppingPowerTable.find(key);
229 if(iter != stoppingPowerTable.end())
return isApplicable;
233 const G4String& chemFormula = material -> GetChemicalFormula();
236 isApplicable = table -> BuildPhysicsVector(atomicNumberBase, chemFormula);
239 stoppingPowerTable[key] =
240 table -> GetPhysicsVector(atomicNumberBase, chemFormula);
244 isApplicable = table -> BuildPhysicsVector(atomicNumberBase, materialName);
246 stoppingPowerTable[key] =
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);
306 dEdxBragg -> SetSpline(useSplines);
309 G4cout <<
"G4IonDEDXHandler::BuildPhysicsVector() for ion with Z="
310 << atomicNumberBase <<
" in "
317 stoppingPowerTable[key] = dEdxBragg;
318 stoppingPowerTableBragg[key] = dEdxBragg;
std::vector< G4Element * > G4ElementVector
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value