105 : interpolation(algorithm), eMin(minE), eMax(maxE), nBins(bins),
106 unit1(unitE), unit2(unitData), zMin(minZ), zMax(maxZ)
116 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::iterator
pos;
131 for (
size_t i=0; i<
n; i++)
133 delete (*crossSections)[i];
159 nBins = numberOfBins;
168 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator
pos;
177 G4int z = (*pos).first;
179 G4cout <<
"---- Data set for Z = "
183 G4cout <<
"--------------------------------------------------" <<
G4endl;
190 for (
size_t i=0; i<nZ; i++)
196 char* path = getenv(
"G4LEDATA");
204 std::ostringstream ost;
205 ost << path <<
'/' << fileName << Z <<
".dat";
206 std::ifstream file(ost.str().c_str());
207 std::filebuf* lsdp = file.rdbuf();
209 if (! (lsdp->is_open()) )
211 G4String excep =
"data file: " + ost.str() +
" not found";
236 if (a != -1 && a != -2)
240 orig_reg_energies->push_back(a*
unit1);
241 log_reg_energies->push_back(std::log10(a)+std::log10(unit1));
243 else if (k%nColumns == 1)
245 orig_reg_data->push_back(a*
unit2);
246 log_reg_data->push_back(std::log10(a)+std::log10(unit2));
267 for (
size_t i=0; i<nZ; i++)
273 char* path = getenv(
"G4LEDATA");
276 G4Exception(
"G4VCrossSectionHandler::LoadNonLogData",
281 std::ostringstream ost;
282 ost << path <<
'/' << fileName << Z <<
".dat";
283 std::ifstream file(ost.str().c_str());
284 std::filebuf* lsdp = file.rdbuf();
286 if (! (lsdp->is_open()) )
288 G4String excep =
"data file: " + ost.str() +
" not found";
289 G4Exception(
"G4VCrossSectionHandler::LoadNonLogData",
309 if (a != -1 && a != -2)
313 orig_reg_energies->push_back(a*
unit1);
315 else if (k%nColumns == 1)
317 orig_reg_data->push_back(a*
unit2);
337 for (
size_t i=0; i<nZ; i++)
356 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::iterator
pos;
369 G4int i = (*pos).first;
383 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator
pos;
396 G4cout <<
"WARNING: G4VCrossSectionHandler::FindValue did not find Z = "
403 G4int shellIndex)
const
407 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator
pos;
419 if(shellIndex < nComponents)
424 G4cout <<
"WARNING: G4VCrossSectionHandler::FindValue did not find"
425 <<
" shellIndex= " << shellIndex
435 G4cout <<
"WARNING: G4VCrossSectionHandler::FindValue did not find Z = "
451 for (
G4int i=0 ; i<nElements ; i++)
453 G4int Z = (
G4int) (*elementVector)[i]->GetZ();
455 G4double nAtomsVol = nAtomsPerVolume[i];
456 value += nAtomsVol * elementValue;
473 energyVector.push_back(std::pow(10., std::log10(
eMin)+i*dBin));
481 std::vector<G4VEMDataSet*>::iterator mat;
500 G4Exception(
"G4VCrossSectionHandler::BuildMeanFreePathForMaterials",
520 for (
size_t mLocal=0; mLocal<numOfCouples; mLocal++)
529 energies->push_back(energy);
530 log_energies->push_back(std::log10(energy));
532 G4double materialCrossSection = 0.0;
534 for(
G4int j=0; j<nElm; j++) {
538 if (materialCrossSection > 0.)
540 data->push_back(1./materialCrossSection);
541 log_data->push_back(std::log10(1./materialCrossSection));
546 log_data->push_back(std::log10(
DBL_MAX));
581 size_t materialIndex = couple->
GetIndex();
583 G4VEMDataSet* materialSet = (*crossSections)[materialIndex];
584 G4double materialCrossSection0 = 0.0;
587 for (
G4int i=0; i < nElements; i++ )
590 materialCrossSection0 += cr;
591 cross.push_back(materialCrossSection0);
596 for (
G4int k=0 ; k < nElements ; k++ )
598 if (random <= cross[k])
return (
G4int) (*elementVector)[k]->GetZ();
618 G4Element* element = (*elementVector)[0];
625 size_t materialIndex = couple->
GetIndex();
627 G4VEMDataSet* materialSet = (*crossSections)[materialIndex];
628 G4double materialCrossSection0 = 0.0;
631 for (
G4int i=0; i<nElements; i++)
634 materialCrossSection0 += cr;
635 cross.push_back(materialCrossSection0);
640 for (
G4int k=0 ; k < nElements ; k++ )
642 if (random <= cross[k])
return (*elementVector)[k];
645 G4cout <<
"G4VCrossSectionHandler::SelectRandomElement - no element found" <<
G4endl;
665 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator
pos;
672 dataSet = (*pos).second;
675 G4Exception(
"G4VCrossSectionHandler::SelectRandomShell",
680 size_t nShells = dataSet->NumberOfComponents();
681 for (
size_t i=0; i<nShells; i++)
684 if (shellDataSet != 0)
688 if (random <= partialSum)
return i;
698 if (materialTable == 0)
699 G4Exception(
"G4VCrossSectionHandler::ActiveElements",
704 for (
G4int mLocal2=0; mLocal2<nMaterials; mLocal2++)
706 const G4Material* material= (*materialTable)[mLocal2];
710 for (
G4int iEl=0; iEl<nElements; iEl++)
712 G4Element* element = (*elementVector)[iEl];
732 std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator
pos;
741 G4cout <<
"WARNING: G4VCrossSectionHandler::NumberOfComponents did not "
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
std::vector< G4Element * > G4ElementVector
virtual std::vector< G4VEMDataSet * > * BuildCrossSectionsForMaterials(const G4DataVector &energyVector, const G4DataVector *energyCuts=0)=0
std::vector< ExP01TrackerHit * > a
G4int SelectRandomShell(G4int Z, G4double e) const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
const G4ElementVector * GetElementVector() const
virtual G4VDataSetAlgorithm * Clone() const =0
G4double ValueForMaterial(const G4Material *material, G4double e) const
G4int NumberOfComponents(G4int Z) const
virtual const G4VEMDataSet * GetComponent(G4int componentId) const =0
G4double FindValue(G4int Z, G4double e) const
const G4double * GetVecNbOfAtomsPerVolume() const
G4GLOB_DLL std::ostream G4cout
size_t GetTableSize() const
virtual size_t NumberOfComponents(void) const =0
virtual void AddComponent(G4VEMDataSet *dataSet)=0
std::vector< G4VEMDataSet * > * crossSections
G4VEMDataSet * BuildMeanFreePathForMaterials(const G4DataVector *energyCuts=0)
static size_t GetNumberOfMaterials()
void LoadShellData(const G4String &dataFile)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void PrintData(void) const =0
std::map< G4int, G4VEMDataSet *, std::less< G4int > > dataMap
G4VDataSetAlgorithm * interpolation
static G4ProductionCutsTable * GetProductionCutsTable()
void Initialise(G4VDataSetAlgorithm *interpolation=0, G4double minE=250 *CLHEP::eV, G4double maxE=100 *CLHEP::GeV, G4int numberOfBins=200, G4double unitE=CLHEP::MeV, G4double unitData=CLHEP::barn, G4int minZ=1, G4int maxZ=99)
void LoadNonLogData(const G4String &dataFile)
G4double energy(const ThreeVector &p, const G4double m)
void LoadData(const G4String &dataFile)
virtual G4bool LoadData(const G4String &fileName)=0
const G4Element * SelectRandomElement(const G4MaterialCutsCouple *material, G4double e) const
size_t GetNumberOfElements() const
virtual G4VDataSetAlgorithm * CreateInterpolation()
G4bool contains(const G4double &) const
virtual ~G4VCrossSectionHandler()
G4int SelectRandomAtom(const G4MaterialCutsCouple *couple, G4double e) const
static const G4double pos
const G4Material * GetMaterial() const