38 :
G4VEmModel(nam),
fName(nam), fpParticleChangeForGamma(0), fSampledMat(
"")
110 G4double crossSectionTimesNbMolPerVol (0);
136 crossSectionTimesNbMolPerVol = nbOfMoleculePerVolumeUnit * model->
CrossSectionPerVolume(material, materialName, p, ekin, emin, emax);
138 crossSectionTimesNbMolPerVol = 0.;
150 std::map<G4Material*, G4double> componentsMap = material->
GetMatComponents();
153 std::map<G4Material*, G4double>::const_iterator
it = componentsMap.begin();
156 unsigned int componentNumber = componentsMap.size();
160 for(
unsigned int i=0; i<componentNumber; ++i)
180 crossSectionTimesNbMolPerVol =
181 nbMoleculeOfComponentInCompositeMat * model->
CrossSectionPerVolume(component, componentName, p, ekin, emin, emax);
183 crossSectionTimesNbMolPerVol = 0.;
187 fMaterialCS[componentName] = crossSectionTimesNbMolPerVol;
191 fCSsumTot += crossSectionTimesNbMolPerVol;
197 crossSectionTimesNbMolPerVol =
fCSsumTot;
203 return crossSectionTimesNbMolPerVol;
249 std::map<const G4String , G4double>::const_iterator
it =
fMaterialCS.begin();
250 std::map<const G4String , G4double>::const_iterator ite =
fMaterialCS.end();
257 G4Exception(
"G4DNAModelManager::SampleSecondaries",
"em0006",
259 "The random component selection has failed: we ran into the end of the map without having a selected component");
264 cumulCS += it->second;
270 if(rand<cumulCS || cumulCS >=
DBL_MAX)
273 materialName = it->first;
287 G4Exception(
"G4DNAModelManager::SampleSecondaries",
"em0006",
289 "The random component selection has failed: while loop ended without a selected component.");
301 if(materialName.find(
"_MODIFIED")!=G4String::npos)
303 materialName = materialName.substr(0,materialName.size()-9);
339 G4MaterialTable::iterator
it;
351 unsigned int compositeSize = componentMap.size();
354 if(componentMap.empty())
366 std::map<G4Material*, G4double>::const_iterator itComp = componentMap.begin();
370 for(
unsigned int k=0;
k<compositeSize; ++
k)
410 for(
size_t i=0, ie=materialTable->size(); i<ie; i++)
413 G4Material* currentMaterial = materialTable->at(i);
422 for(; it != ite; it++)
426 if(materialName == currentMatName)
455 G4int modelNbForMaterial (0);
469 ++modelNbForMaterial;
475 if(modelNbForMaterial>1)
489 std::map<G4double, G4int, std::less<G4double> > sortMap;
495 for(
unsigned int ii=0, em=models.size(); ii<em; ++ii)
497 G4double lowLim = models[ii]->GetLowELimit(matName, pName);
498 G4double highLim = models[ii]->GetHighELimit(matName, pName);
500 if(sortMap.find(lowLim) != sortMap.end() )
505 sortMap[lowLim] = ii;
507 if(sortMap.find(highLim) != sortMap.end() )
509 highLim -= smallDiff;
512 sortMap[highLim] = ii;
519 std::map<G4double, G4int>::iterator
it = sortMap.begin();
522 G4double dummyLim = it->first - smallDiff;
527 for(
unsigned int ii=0, eii=models.size(); ii<eii; ++ii)
529 G4double lim1 = it->first - smallDiff;
530 G4int count1 = it->second;
535 G4double lim2 = it->first + smallDiff;
536 G4int count2 = it->second;
545 if( (count1 != count2) || (
std::abs(dummyLim - lim1) > 1.*
eV ) )
549 std::ostringstream oss;
550 oss<<
"The material "<<matName<<
" and the particle "<<pName;
551 oss<<
" have several models registered for the "<<
fName<<
" interaction and their energy ranges ";
552 oss<<
"do not match. \nEnergy ranges: \n";
554 for(
int iii=0, eiii=models.size(); iii<eiii; ++iii)
556 oss<<models[iii]->GetName()<<
"\n";
557 oss<<
"low: "<<models[iii]->GetLowELimit(matName, pName)/
eV<<
" eV \n";
558 oss<<
"high: "<<models[iii]->GetHighELimit(matName, pName)/
eV<<
" eV \n";
561 G4Exception(
"G4DNAModelManager::InsertModelInTable",
"em0006",
572 else if(modelNbForMaterial==0)
599 for(
int i=0, ie=models.size(); i<ie; ++i)
602 if( ekin >= models[i]->GetLowELimit(material, particle)
603 && ekin < models[i]->GetHighELimit(material, particle) )