76 : interpolation(algorithm), eMin(minE), eMax(maxE), nBins(bins),
77 unit1(unitE), unit2(unitData), zMin(minZ), zMax(maxZ)
87 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::iterator
pos;
102 for (
size_t i=0; i<
n; i++)
104 delete (*crossSections)[i];
138 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator
pos;
149 G4cout <<
"---- Data set for Z = "
153 G4cout <<
"--------------------------------------------------" <<
G4endl;
160 for (
size_t i=0; i<nZ; i++)
166 char* path = getenv(
"G4LEDATA");
169 G4String excep =
"G4LEDATA environment variable not set!";
170 G4Exception(
"G4RDVCrossSectionHandler::LoadData()",
174 std::ostringstream ost;
175 ost << path <<
'/' << fileName << Z <<
".dat";
176 std::ifstream
file(ost.str().c_str());
177 std::filebuf* lsdp =
file.rdbuf();
179 if (! (lsdp->is_open()) )
181 G4String excep =
"Data file: " + ost.str() +
" not found!";
182 G4Exception(
"G4RDVCrossSectionHandler::LoadData()",
198 if (a == -1 || a == -2)
206 energies->push_back(e);
209 else if (k%nColumns == 0)
212 data->push_back(value);
228 for (
size_t i=0; i<nZ; i++)
240 char* path = getenv(
"G4LEDATA");
243 G4String excep =
"G4LEDATA environment variable not set!";
244 G4Exception(
"G4RDVCrossSectionHandler::LoadShellData()",
248 std::ostringstream ost;
250 ost << path <<
'/' << fileName << Z <<
".dat";
252 std::ifstream
file(ost.str().c_str());
253 std::filebuf* lsdp =
file.rdbuf();
255 if (! (lsdp->is_open()) )
257 G4String excep =
"Data file: " + ost.str() +
" not found!";
258 G4Exception(
"G4RDVCrossSectionHandler::LoadShellData()",
274 if (a == -1 || a == -2)
282 energies->push_back(e);
285 else if (k%nColumns == 0)
288 data->push_back(value);
309 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::iterator
pos;
322 G4int i = (*pos).first;
336 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator
pos;
349 G4cout <<
"WARNING: G4RDVCrossSectionHandler::FindValue did not find Z = "
356 G4int shellIndex)
const
360 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator
pos;
372 if(shellIndex < nComponents)
377 G4cout <<
"WARNING: G4RDVCrossSectionHandler::FindValue did not find"
378 <<
" shellIndex= " << shellIndex
388 G4cout <<
"WARNING: G4RDVCrossSectionHandler::FindValue did not find Z = "
404 for (
G4int i=0 ; i<nElements ; i++)
408 G4double nAtomsVol = nAtomsPerVolume[i];
409 value += nAtomsVol * elementValue;
426 energyVector.push_back(std::pow(10., std::log10(
eMin)+i*dBin));
434 std::vector<G4RDVEMDataSet*>::iterator
mat;
452 G4Exception(
"G4RDVCrossSectionHandler::BuildMeanFreePathForMaterials()",
466 for (
size_t m=0;
m<numOfCouples;
m++)
473 energies->push_back(energy);
475 G4double materialCrossSection = 0.0;
477 for(
G4int j=0; j<nElm; j++) {
481 if (materialCrossSection > 0.)
483 data->push_back(1./materialCrossSection);
517 size_t materialIndex = couple->
GetIndex();
520 G4double materialCrossSection0 = 0.0;
523 for (
G4int i=0; i < nElements; i++ )
526 materialCrossSection0 += cr;
527 cross.push_back(materialCrossSection0);
532 for (
G4int k=0 ; k < nElements ; k++ )
534 if (random <= cross[k])
return (
G4int) (*elementVector)[k]->GetZ();
554 G4Element* element = (*elementVector)[0];
561 size_t materialIndex = couple->
GetIndex();
564 G4double materialCrossSection0 = 0.0;
567 for (
G4int i=0; i<nElements; i++)
570 materialCrossSection0 += cr;
571 cross.push_back(materialCrossSection0);
576 for (
G4int k=0 ; k < nElements ; k++ )
578 if (random <= cross[k])
return (*elementVector)[k];
581 G4cout <<
"G4RDVCrossSectionHandler::SelectRandomElement - no element found" <<
G4endl;
601 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator
pos;
607 if (pos !=
dataMap.end()) dataSet = (*pos).second;
610 for (
size_t i=0; i<nShells; i++)
613 if (shellDataSet != 0)
617 if (random <= partialSum)
return i;
627 if (materialTable == 0)
628 G4Exception(
"G4RDVCrossSectionHandler::ActiveElements",
639 for (
G4int iEl=0; iEl<nElements; iEl++)
641 G4Element* element = (*elementVector)[iEl];
661 std::map<G4int,G4RDVEMDataSet*,std::less<G4int> >::const_iterator
pos;
670 G4cout <<
"WARNING: G4RDVCrossSectionHandler::NumberOfComponents did not "
G4RDVEMDataSet * BuildMeanFreePathForMaterials(const G4DataVector *energyCuts=0)
std::vector< ExP01TrackerHit * > a
static const G4double pos
static size_t GetNumberOfMaterials()
G4int SelectRandomAtom(const G4MaterialCutsCouple *couple, G4double e) const
static G4MaterialTable * GetMaterialTable()
virtual void AddComponent(G4RDVEMDataSet *dataSet)=0
G4bool contains(const G4double &) const
const G4ElementVector * GetElementVector() const
G4RDVCrossSectionHandler()
virtual std::vector< G4RDVEMDataSet * > * BuildCrossSectionsForMaterials(const G4DataVector &energyVector, const G4DataVector *energyCuts=0)=0
const G4double * GetVecNbOfAtomsPerVolume() const
virtual void PrintData(void) const =0
std::map< G4int, G4RDVEMDataSet *, std::less< G4int > > dataMap
const XML_Char const XML_Char * data
void LoadData(const G4String &dataFile)
virtual G4RDVDataSetAlgorithm * Clone() const =0
static constexpr double m
virtual size_t NumberOfComponents(void) const =0
const XML_Char int const XML_Char * value
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual G4bool LoadData(const G4String &fileName)=0
G4int SelectRandomShell(G4int Z, G4double e) const
const G4Element * SelectRandomElement(const G4MaterialCutsCouple *material, G4double e) const
size_t GetTableSize() const
G4RDVDataSetAlgorithm * interpolation
std::vector< G4Material * > G4MaterialTable
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double ValueForMaterial(const G4Material *material, G4double e) const
std::vector< G4Element * > G4ElementVector
virtual G4RDVDataSetAlgorithm * CreateInterpolation()
void Initialise(G4RDVDataSetAlgorithm *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 LoadShellData(const G4String &dataFile)
G4GLOB_DLL std::ostream G4cout
const G4Material * GetMaterial() const
std::vector< G4RDVEMDataSet * > * crossSections
virtual const G4RDVEMDataSet * GetComponent(G4int componentId) const =0
G4int NumberOfComponents(G4int Z) const
G4double FindValue(G4int Z, G4double e) const
size_t GetNumberOfElements() const
virtual ~G4RDVCrossSectionHandler()