105   : interpolation(algorithm), eMin(minE), eMax(maxE), nBins(bins),
 
  106     unit1(unitE), unit2(unitData), zMin(minZ), zMax(maxZ)
 
  114   delete interpolation;
 
  116   std::map<G4int,G4VEMDataSet*,std::less<G4int> >::iterator pos;
 
  118   for (pos = dataMap.begin(); pos != dataMap.end(); ++pos)
 
  128   if (crossSections != 0)
 
  130       size_t n = crossSections->size();
 
  131       for (
size_t i=0; i<
n; i++)
 
  133       delete (*crossSections)[i];
 
  135       delete crossSections;
 
  148       delete interpolation;
 
  149       interpolation = algorithm;
 
  153       delete interpolation;
 
  159   nBins = numberOfBins;
 
  168   std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator pos;
 
  170   for (pos = dataMap.begin(); pos != dataMap.end(); pos++)
 
  179       G4cout << 
"---- Data set for Z = " 
  183       G4cout << 
"--------------------------------------------------" << 
G4endl;
 
  189   size_t nZ = activeZ.size();
 
  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));
 
  258       dataMap[
Z] = dataSet;
 
  266   size_t nZ = activeZ.size();
 
  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);
 
  329       dataMap[
Z] = dataSet;
 
  336   size_t nZ = activeZ.size();
 
  337   for (
size_t i=0; i<nZ; i++)
 
  346       dataMap[
Z] = dataSet;
 
  356   std::map<G4int,G4VEMDataSet*,std::less<G4int> >::iterator pos;
 
  358   if(! dataMap.empty())
 
  360         for (pos = dataMap.begin(); pos != dataMap.end(); ++pos)
 
  369       G4int i = (*pos).first;
 
  383   std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator pos;
 
  384   pos = dataMap.find(Z);
 
  385   if (pos!= dataMap.end())
 
  396       G4cout << 
"WARNING: G4VCrossSectionHandler::FindValue did not find Z = " 
  403                                            G4int shellIndex)
 const 
  407   std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator pos;
 
  408   pos = dataMap.find(Z);
 
  409   if (pos!= dataMap.end())
 
  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++)
 
  455       G4double nAtomsVol = nAtomsPerVolume[i];
 
  456       value += nAtomsVol * elementValue;
 
  469   G4double dBin = std::log10(eMax/eMin) / nBins;
 
  471   for (
G4int i=0; i<nBins+1; i++)
 
  473       energyVector.push_back(std::pow(10., std::log10(eMin)+i*dBin));
 
  479   if (crossSections != 0)
 
  481       std::vector<G4VEMDataSet*>::iterator 
mat;
 
  482       if (! crossSections->empty())
 
  484       for (mat = crossSections->begin(); mat!= crossSections->end(); ++
mat)
 
  490       crossSections->clear();
 
  491       delete crossSections;
 
  498   if (crossSections == 0)
 
  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;
 
  666   pos = dataMap.find(Z);
 
  671   if (pos != dataMap.end()) 
 
  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++)
 
  710       for (
G4int iEl=0; iEl<nElements; iEl++)
 
  712       G4Element* element = (*elementVector)[iEl];
 
  714       if (!(activeZ.
contains(Z)) && Z >= zMin && Z <= zMax)
 
  716           activeZ.push_back(Z);
 
  732   std::map<G4int,G4VEMDataSet*,std::less<G4int> >::const_iterator pos;
 
  733   pos = dataMap.find(Z);
 
  734   if (pos!= dataMap.end())
 
  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
 
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
 
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
 
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)
 
void LoadData(const G4String &dataFile)
 
virtual G4bool LoadData(const G4String &fileName)=0
 
const G4Element * SelectRandomElement(const G4MaterialCutsCouple *material, G4double e) const 
 
const XML_Char int const XML_Char * value
 
size_t GetNumberOfElements() const 
 
virtual G4VDataSetAlgorithm * CreateInterpolation()
 
G4bool contains(const G4double &) const 
 
virtual ~G4VCrossSectionHandler()
 
G4int SelectRandomAtom(const G4MaterialCutsCouple *couple, G4double e) const 
 
const XML_Char const XML_Char * data
 
const G4Material * GetMaterial() const