68 algorithm(argAlgorithm), unitEnergies(argUnitEnergies), unitData(argUnitData)
93 message+=fullFileName;
94 message+=
"\" not found";
95 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0003",
100 std::vector<G4DataVector *> columns;
101 std::vector<G4DataVector *> log_columns;
103 std::stringstream *stream(
new std::stringstream);
124 while (!stream->eof())
128 while (i>=columns.size())
134 columns[i]->push_back(value);
148 if (value <=0.) value = 1
e-300;
149 log_columns[i]->push_back(std::log10(value));
155 stream=
new std::stringstream;
173 if (comment) {
break; }
174 if (space && (!first)) { (*stream) <<
' '; }
182 catch(
const std::ios::failure &
e)
190 std::vector<G4DataVector *>::size_type maxI(columns.size());
195 message+=fullFileName;
196 message+=
"\" should have at least two columns";
197 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
202 std::vector<G4DataVector*>::size_type i(1);
205 G4DataVector::size_type maxJ(columns[i]->size());
207 if (maxJ!=columns[0]->size())
210 message+=fullFileName;
211 message+=
"\" has lines with a different number of columns";
212 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
217 G4DataVector::size_type j(0);
227 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
228 argLogEnergies->push_back(log_columns[0]->
operator[] (j) + std::log10(
GetUnitEnergies()));
229 argLogData->push_back(log_columns[i]->
operator[] (j) + std::log10(
GetUnitData()));
243 delete log_columns[i];
260 message+=fullFileName;
261 message+=
"\" not found";
262 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0003",
267 std::vector<G4DataVector *> columns;
269 std::stringstream *stream(
new std::stringstream);
290 while (!stream->eof())
294 while (i>=columns.size())
299 columns[i]->push_back(value);
305 stream=
new std::stringstream;
323 if (comment) {
break; }
324 if (space && (!first)) { (*stream) <<
' '; }
332 catch(
const std::ios::failure &
e)
340 std::vector<G4DataVector *>::size_type maxI(columns.size());
345 message+=fullFileName;
346 message+=
"\" should have at least two columns";
347 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
352 std::vector<G4DataVector*>::size_type i(1);
355 G4DataVector::size_type maxJ(columns[i]->size());
357 if (maxJ!=columns[0]->size())
360 message+=fullFileName;
361 message+=
"\" has lines with a different number of columns.";
362 G4Exception(
"G4DNACrossSectionDataSet::LoadData",
"em0005",
367 G4DataVector::size_type j(0);
375 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
401 G4Exception(
"G4DNACrossSectionDataSet::SaveData",
"em0005",
408 std::ofstream out(fullFileName);
413 message+=fullFileName;
415 G4Exception(
"G4DNACrossSectionDataSet::SaveData",
"em0005",
422 G4DataVector::const_iterator * iData(
new G4DataVector::const_iterator[n]);
432 while (iEnergies!=iEnergiesEnd)
466 char* path = std::getenv(
"G4LEDATA");
469 G4Exception(
"G4DNACrossSectionDataSet::FullFileName",
"em0006",
475 std::ostringstream fullFileName;
477 fullFileName << path <<
"/" << argFileName <<
".dat";
479 return G4String(fullFileName.str().c_str());
488 std::vector<G4VEMDataSet *>::const_iterator i(
components.begin());
489 std::vector<G4VEMDataSet *>::const_iterator end(
components.end());
493 value+=(*i)->FindValue(argEnergy);
505 G4cout <<
"The data set has " << n <<
" components" <<
G4endl;
521 G4int argComponentId)
532 message <<
"Component " << argComponentId <<
" not found";
534 G4Exception(
"G4DNACrossSectionDataSet::SetEnergiesData",
"em0005",
544 G4int argComponentId)
555 message <<
"Component " << argComponentId <<
" not found";
557 G4Exception(
"G4DNACrossSectionDataSet::SetLogEnergiesData",
"em0005",