69 algorithm(argAlgorithm), unitEnergies(argUnitEnergies), unitData(argUnitData)
94 message+=fullFileName;
95 message+=
"\" not found";
96 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0003",
101 std::vector<G4DataVector *> columns;
102 std::vector<G4DataVector *> log_columns;
104 std::stringstream *stream(
new std::stringstream);
125 while (!stream->eof())
129 while (i>=columns.size())
135 columns[i]->push_back(value);
149 if (value <=0.) value = 1
e-300;
150 log_columns[i]->push_back(std::log10(value));
156 stream=
new std::stringstream;
174 if (comment) {
break; }
175 if (space && (!first)) { (*stream) <<
' '; }
183 catch(
const std::ios::failure &
e)
191 std::vector<G4DataVector *>::size_type maxI(columns.size());
196 message+=fullFileName;
197 message+=
"\" should have at least two columns";
198 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
203 std::vector<G4DataVector*>::size_type i(1);
206 G4DataVector::size_type maxJ(columns[i]->size());
208 if (maxJ!=columns[0]->size())
211 message+=fullFileName;
212 message+=
"\" has lines with a different number of columns";
213 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
218 G4DataVector::size_type j(0);
228 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
229 argLogEnergies->push_back(log_columns[0]->
operator[] (j) + std::log10(
GetUnitEnergies()));
230 argLogData->push_back(log_columns[i]->
operator[] (j) + std::log10(
GetUnitData()));
244 delete log_columns[i];
261 message+=fullFileName;
262 message+=
"\" not found";
263 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0003",
268 std::vector<G4DataVector *> columns;
270 std::stringstream *stream(
new std::stringstream);
291 while (!stream->eof())
295 while (i>=columns.size())
300 columns[i]->push_back(value);
306 stream=
new std::stringstream;
324 if (comment) {
break; }
325 if (space && (!first)) { (*stream) <<
' '; }
333 catch(
const std::ios::failure &
e)
341 std::vector<G4DataVector *>::size_type maxI(columns.size());
346 message+=fullFileName;
347 message+=
"\" should have at least two columns";
348 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
353 std::vector<G4DataVector*>::size_type i(1);
356 G4DataVector::size_type maxJ(columns[i]->size());
358 if (maxJ!=columns[0]->size())
361 message+=fullFileName;
362 message+=
"\" has lines with a different number of columns.";
363 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
368 G4DataVector::size_type j(0);
376 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
402 G4Exception(
"G4DNACrossSectionDataSet::SaveData",
"em0005",
409 std::ofstream out(fullFileName);
414 message+=fullFileName;
416 G4Exception(
"G4DNACrossSectionDataSet::SaveData",
"em0005",
423 G4DataVector::const_iterator * iData(
new G4DataVector::const_iterator[n]);
433 while (iEnergies!=iEnergiesEnd)
467 char* path = getenv(
"G4LEDATA");
470 G4Exception(
"G4DNACrossSectionDataSet::FullFileName",
"em0006",
476 std::ostringstream fullFileName;
478 fullFileName << path <<
"/" << argFileName <<
".dat";
480 return G4String(fullFileName.str().c_str());
489 std::vector<G4VEMDataSet *>::const_iterator i(
components.begin());
490 std::vector<G4VEMDataSet *>::const_iterator end(
components.end());
494 value+=(*i)->FindValue(argEnergy);
506 G4cout <<
"The data set has " << n <<
" components" <<
G4endl;
522 G4int argComponentId)
533 message <<
"Component " << argComponentId <<
" not found";
535 G4Exception(
"G4DNACrossSectionDataSet::SetEnergiesData",
"em0005",
545 G4int argComponentId)
556 message <<
"Component " << argComponentId <<
" not found";
558 G4Exception(
"G4DNACrossSectionDataSet::SetLogEnergiesData",
"em0005",
virtual const G4DataVector & GetEnergies(G4int componentId) const
virtual G4bool LoadData(const G4String &argFileName)
virtual size_t NumberOfComponents(void) const
void CleanUpComponents(void)
G4DNACrossSectionDataSet()
void message(RunManager *runmanager)
G4double GetUnitData() const
virtual const G4DataVector & GetData(G4int componentId) const =0
const G4VDataSetAlgorithm * GetAlgorithm() const
std::vector< G4VEMDataSet * > components
const XML_Char int const XML_Char * value
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *values, G4DataVector *log_x, G4DataVector *log_values, G4int componentId)
G4String FullFileName(const G4String &argFileName) const
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *data, G4DataVector *Log_x, G4DataVector *Log_data, G4int component=0)=0
G4VDataSetAlgorithm * algorithm
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual G4bool LoadNonLogData(const G4String &argFileName)
virtual void AddComponent(G4VEMDataSet *dataSet)
virtual ~G4DNACrossSectionDataSet()
virtual void PrintData(void) const =0
virtual G4double FindValue(G4double e, G4int componentId=0) const
G4GLOB_DLL std::ostream G4cout
virtual const G4VEMDataSet * GetComponent(G4int componentId) const
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *data, G4int component=0)=0
virtual G4bool SaveData(const G4String &argFileName) const
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *values, G4int componentId)
G4double GetUnitEnergies() const
virtual void PrintData(void) const