43 algorithm(argAlgorithm), unitEnergies(argUnitEnergies), unitData(argUnitData)
68 message+=fullFileName;
69 message+=
"\" not found";
70 G4Exception(
"G4MicroElecCrossSectionDataSet::LoadData",
"em0003",
75 std::vector<G4DataVector *> columns;
76 std::vector<G4DataVector *> log_columns;
78 std::stringstream *stream(
new std::stringstream);
99 while (!stream->eof())
103 while (i>=columns.size())
109 columns[i]->push_back(value);
123 if (value <=0.) value = 1
e-300;
124 log_columns[i]->push_back(std::log10(value));
130 stream=
new std::stringstream;
148 if (comment) {
break; }
149 if (space && (!first)) { (*stream) <<
' '; }
157 catch(
const std::ios::failure &
e)
165 std::vector<G4DataVector *>::size_type maxI(columns.size());
170 message+=fullFileName;
171 message+=
"\" should have at least two columns";
172 G4Exception(
"G4MicroElecCrossSectionDataSet::LoadData",
"em0005",
177 std::vector<G4DataVector*>::size_type i(1);
180 G4DataVector::size_type maxJ(columns[i]->size());
182 if (maxJ!=columns[0]->size())
185 message+=fullFileName;
186 message+=
"\" has lines with a different number of columns";
187 G4Exception(
"G4MicroElecCrossSectionDataSet::LoadData",
"em0005",
192 G4DataVector::size_type j(0);
202 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
203 argLogEnergies->push_back(log_columns[0]->
operator[] (j) + std::log10(
GetUnitEnergies()));
204 argLogData->push_back(log_columns[i]->
operator[] (j) + std::log10(
GetUnitData()));
218 delete log_columns[i];
235 message+=fullFileName;
236 message+=
"\" not found";
237 G4Exception(
"G4MicroElecCrossSectionDataSet::LoadData",
"em0003",
242 std::vector<G4DataVector *> columns;
244 std::stringstream *stream(
new std::stringstream);
265 while (!stream->eof())
269 while (i>=columns.size())
274 columns[i]->push_back(value);
280 stream=
new std::stringstream;
298 if (comment) {
break; }
299 if (space && (!first)) { (*stream) <<
' '; }
307 catch(
const std::ios::failure &
e)
315 std::vector<G4DataVector *>::size_type maxI(columns.size());
320 message+=fullFileName;
321 message+=
"\" should have at least two columns";
322 G4Exception(
"G4MicroElecCrossSectionDataSet::LoadData",
"em0005",
327 std::vector<G4DataVector*>::size_type i(1);
330 G4DataVector::size_type maxJ(columns[i]->size());
332 if (maxJ!=columns[0]->size())
335 message+=fullFileName;
336 message+=
"\" has lines with a different number of columns.";
337 G4Exception(
"G4MicroElecCrossSectionDataSet::LoadData",
"em0005",
342 G4DataVector::size_type j(0);
350 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
376 G4Exception(
"G4MicroElecCrossSectionDataSet::SaveData",
"em0005",
383 std::ofstream out(fullFileName);
388 message+=fullFileName;
390 G4Exception(
"G4MicroElecCrossSectionDataSet::SaveData",
"em0005",
397 G4DataVector::const_iterator * iData(
new G4DataVector::const_iterator[n]);
407 while (iEnergies!=iEnergiesEnd)
441 char* path = getenv(
"G4LEDATA");
444 G4Exception(
"G4MicroElecCrossSectionDataSet::FullFileName",
"em0006",
450 std::ostringstream fullFileName;
452 fullFileName << path <<
"/" << argFileName <<
".dat";
454 return G4String(fullFileName.str().c_str());
463 std::vector<G4VEMDataSet *>::const_iterator i(
components.begin());
464 std::vector<G4VEMDataSet *>::const_iterator end(
components.end());
468 value+=(*i)->FindValue(argEnergy);
480 G4cout <<
"The data set has " << n <<
" components" <<
G4endl;
496 G4int argComponentId)
507 message <<
"Component " << argComponentId <<
" not found";
509 G4Exception(
"G4MicroElecCrossSectionDataSet::SetEnergiesData",
"em0005",
519 G4int argComponentId)
530 message <<
"Component " << argComponentId <<
" not found";
532 G4Exception(
"G4MicroElecCrossSectionDataSet::SetLogEnergiesData",
"em0005",
virtual G4bool SaveData(const G4String &argFileName) const
virtual void AddComponent(G4VEMDataSet *dataSet)
void message(RunManager *runmanager)
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *values, G4int componentId)
G4double GetUnitEnergies() const
virtual G4bool LoadData(const G4String &argFileName)
virtual const G4DataVector & GetData(G4int componentId) const =0
virtual G4bool LoadNonLogData(const G4String &argFileName)
virtual void PrintData(void) const
virtual G4double FindValue(G4double e, G4int componentId=0) const
const XML_Char int const XML_Char * value
virtual const G4DataVector & GetEnergies(G4int componentId) const
virtual size_t NumberOfComponents(void) const
G4double GetUnitData() const
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *values, G4DataVector *log_x, G4DataVector *log_values, G4int componentId)
void CleanUpComponents(void)
G4MicroElecCrossSectionDataSet()
virtual const G4VEMDataSet * GetComponent(G4int componentId) const
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *data, G4DataVector *Log_x, G4DataVector *Log_data, G4int component=0)=0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4VDataSetAlgorithm * algorithm
G4String FullFileName(const G4String &argFileName) const
virtual void PrintData(void) const =0
G4GLOB_DLL std::ostream G4cout
virtual ~G4MicroElecCrossSectionDataSet()
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *data, G4int component=0)=0
const G4VDataSetAlgorithm * GetAlgorithm() const
std::vector< G4VEMDataSet * > components