66 Initialise(0,
"",
"",
"",1.*
keV,0.1*
GeV,200,
MeV,
barn,6,92);
82 : interpolation(algorithm), eMin(minE), eMax(maxE), nBins(bins),
83 unit1(unitE), unit2(unitData), zMin(minZ), zMax(maxZ)
87 crossModel.push_back(modelK);
88 crossModel.push_back(modelL);
89 crossModel.push_back(modelM);
100 delete interpolation;
102 std::map<G4int,G4IDataSet*,std::less<G4int> >::iterator pos;
104 for (pos = dataMap.begin(); pos != dataMap.end(); ++pos)
114 if (crossSections != 0)
116 size_t n = crossSections->size();
117 for (
size_t i=0; i<
n; i++)
119 delete (*crossSections)[i];
121 delete crossSections;
137 delete interpolation;
138 interpolation = algorithm;
142 interpolation = CreateInterpolation();
147 nBins = numberOfBins;
153 crossModel.push_back(modelK);
154 crossModel.push_back(modelL);
155 crossModel.push_back(modelM);
161 std::map<G4int,G4IDataSet*,std::less<G4int> >::const_iterator pos;
163 for (pos = dataMap.begin(); pos != dataMap.end(); pos++)
172 G4cout <<
"---- Data set for Z = "
176 G4cout <<
"--------------------------------------------------" <<
G4endl;
182 size_t nZ = activeZ.size();
183 for (
size_t i=0; i<nZ; i++)
199 dataMap[
Z] = dataSet;
213 std::map<G4int,G4IDataSet*,std::less<G4int> >::iterator pos;
215 if(! dataMap.empty())
217 for (pos = dataMap.begin(); pos != dataMap.end(); ++pos)
226 G4int i = (*pos).first;
240 std::map<G4int,G4IDataSet*,std::less<G4int> >::const_iterator pos;
241 pos = dataMap.find(Z);
242 if (pos!= dataMap.end())
253 G4cout <<
"WARNING: G4PixeCrossSectionHandler::FindValue(Z,e) did not find Z = "
260 G4int shellIndex)
const
264 std::map<G4int,G4IDataSet*,std::less<G4int> >::const_iterator pos;
265 pos = dataMap.find(Z);
266 if (pos!= dataMap.end())
276 if(shellIndex < nComponents)
281 G4cout <<
"WARNING: G4PixeCrossSectionHandler::FindValue(Z,e,shell) did not find"
282 <<
" shellIndex= " << shellIndex
292 G4cout <<
"WARNING: G4PixeCrossSectionHandler::FindValue did not find Z = "
308 for (
G4int i=0 ; i<nElements ; i++)
312 G4double nAtomsVol = nAtomsPerVolume[i];
313 value += nAtomsVol * elementValue;
406 void G4PixeCrossSectionHandler::BuildForMaterials()
412 G4double dBin = std::log10(eMax/eMin) / nBins;
414 for (
G4int i=0; i<nBins+1; i++)
416 energyVector.push_back(std::pow(10., std::log10(eMin)+i*dBin));
419 if (crossSections != 0)
421 std::vector<G4IDataSet*>::iterator
mat;
422 if (! crossSections->empty())
424 for (mat = crossSections->begin(); mat!= crossSections->end(); ++
mat)
430 crossSections->clear();
431 delete crossSections;
436 crossSections = BuildCrossSectionsForMaterials(energyVector);
438 if (crossSections == 0)
439 G4Exception(
"G4PixeCrossSectionHandler::BuildForMaterials",
442 ", crossSections = 0");
466 size_t materialIndex = material->
GetIndex();
468 G4IDataSet* materialSet = (*crossSections)[materialIndex];
469 G4double materialCrossSection0 = 0.0;
472 for (
G4int i=0; i < nElements; i++ )
475 materialCrossSection0 += cr;
476 cross.push_back(materialCrossSection0);
481 for (
G4int k=0 ; k < nElements ; k++ )
483 if (random <= cross[k])
return (
G4int) (*elementVector)[k]->GetZ();
553 std::map<G4int,G4IDataSet*,std::less<G4int> >::const_iterator pos;
554 pos = dataMap.find(Z);
559 if (pos != dataMap.end()) dataSet = (*pos).second;
562 for (
size_t i=0; i<nShells; i++)
565 if (shellDataSet != 0)
569 if (random <= partialSum)
return i;
576 void G4PixeCrossSectionHandler::ActiveElements()
579 if (materialTable == 0)
580 G4Exception(
"G4PixeCrossSectionHandler::ActiveElements",
583 "no MaterialTable found");
587 for (
G4int mat=0; mat<nMaterials; mat++)
593 for (
G4int iEl=0; iEl<nElements; iEl++)
595 G4Element* element = (*elementVector)[iEl];
597 if (!(activeZ.
contains(Z)) && Z >= zMin && Z <= zMax)
599 activeZ.push_back(Z);
611 G4int G4PixeCrossSectionHandler::NumberOfComponents(
G4int Z)
const
615 std::map<G4int,G4IDataSet*,std::less<G4int> >::const_iterator pos;
616 pos = dataMap.find(Z);
617 if (pos!= dataMap.end())
624 G4cout <<
"WARNING: G4PixeCrossSectionHandler::NumberOfComponents did not "
632 std::vector<G4IDataSet*>*
633 G4PixeCrossSectionHandler::BuildCrossSectionsForMaterials(
const G4DataVector& energyVector)
638 std::vector<G4IDataSet*>* matCrossSections =
new std::vector<G4IDataSet*>;
643 size_t nOfBins = energyVector.size();
647 if (materialTable == 0)
648 G4Exception(
"G4PixeCrossSectionHandler::BuildCrossSectionsForMaterials",
651 "no MaterialTable found");
655 for (
G4int mat=0; mat<nMaterials; mat++)
666 for (
G4int i=0; i<nElements; i++) {
668 G4int Z = (
G4int) (*elementVector)[i]->GetZ();
678 energies->push_back(e);
680 if (Z >= zMin && Z <= zMax) cross = density*
FindValue(Z,e);
681 data->push_back(cross);
689 matCrossSections->push_back(setForMat);
691 return matCrossSections;
712 G4double gamma = energy / particleMass;
713 G4double beta2 = 1. - 1. / (gamma * gamma);
719 if ( tMax > deltaCut )
721 var = deltaCut / tMax;
722 cross = (1. - var * (1. - beta2 * std::log(var))) / deltaCut;
729 cross += 0.5 * (tMax - deltaCut) / (energy*energy);
732 else if (spin > 0.9 )
734 cross += -std::log(var) / (3.*deltaCut) + (tMax-deltaCut) *
735 ((5.+1./
var)*0.25 /(energy*energy) - beta2 / (tMax*deltaCut))/3.;