41 algorithm(argAlgorithm), unitEnergies(argUnitEnergies), unitData(argUnitData)
64 message+=fullFileName;
65 message+=
"\" not found";
66 G4Exception(
"G4MuElecCrossSectionDataSet::LoadData",
"em0003",
71 std::vector<G4DataVector *> columns;
72 std::vector<G4DataVector *> log_columns;
74 std::stringstream *stream(
new std::stringstream);
95 while (!stream->eof())
99 while (i>=columns.size())
105 columns[i]->push_back(value);
119 if (value <=0.) value = 1
e-300;
120 log_columns[i]->push_back(std::log10(value));
126 stream=
new std::stringstream;
144 if (comment) {
break; }
145 if (space && (!first)) { (*stream) <<
' '; }
153 catch(
const std::ios::failure &
e)
161 std::vector<G4DataVector *>::size_type maxI(columns.size());
166 message+=fullFileName;
167 message+=
"\" should have at least two columns";
168 G4Exception(
"G4MuElecCrossSectionDataSet::LoadData",
"em0005",
173 std::vector<G4DataVector*>::size_type i(1);
176 G4DataVector::size_type maxJ(columns[i]->size());
178 if (maxJ!=columns[0]->size())
181 message+=fullFileName;
182 message+=
"\" has lines with a different number of columns";
183 G4Exception(
"G4MuElecCrossSectionDataSet::LoadData",
"em0005",
188 G4DataVector::size_type j(0);
198 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
199 argLogEnergies->push_back(log_columns[0]->
operator[] (j) + std::log10(
GetUnitEnergies()));
200 argLogData->push_back(log_columns[i]->
operator[] (j) + std::log10(
GetUnitData()));
214 delete log_columns[i];
231 message+=fullFileName;
232 message+=
"\" not found";
233 G4Exception(
"G4MuElecCrossSectionDataSet::LoadData",
"em0003",
238 std::vector<G4DataVector *> columns;
240 std::stringstream *stream(
new std::stringstream);
261 while (!stream->eof())
265 while (i>=columns.size())
270 columns[i]->push_back(value);
276 stream=
new std::stringstream;
294 if (comment) {
break; }
295 if (space && (!first)) { (*stream) <<
' '; }
303 catch(
const std::ios::failure &
e)
311 std::vector<G4DataVector *>::size_type maxI(columns.size());
316 message+=fullFileName;
317 message+=
"\" should have at least two columns";
318 G4Exception(
"G4MuElecCrossSectionDataSet::LoadData",
"em0005",
323 std::vector<G4DataVector*>::size_type i(1);
326 G4DataVector::size_type maxJ(columns[i]->size());
328 if (maxJ!=columns[0]->size())
331 message+=fullFileName;
332 message+=
"\" has lines with a different number of columns.";
333 G4Exception(
"G4MuElecCrossSectionDataSet::LoadData",
"em0005",
338 G4DataVector::size_type j(0);
346 argData->push_back(columns[i]->
operator[] (j)*
GetUnitData());
372 G4Exception(
"G4MuElecCrossSectionDataSet::SaveData",
"em0005",
379 std::ofstream out(fullFileName);
384 message+=fullFileName;
386 G4Exception(
"G4MuElecCrossSectionDataSet::SaveData",
"em0005",
393 G4DataVector::const_iterator * iData(
new G4DataVector::const_iterator[n]);
403 while (iEnergies!=iEnergiesEnd)
437 char* path = getenv(
"G4LEDATA");
440 G4Exception(
"G4MuElecCrossSectionDataSet::FullFileName",
"em0006",
446 std::ostringstream fullFileName;
448 fullFileName << path <<
"/" << argFileName <<
".dat";
450 return G4String(fullFileName.str().c_str());
459 std::vector<G4VEMDataSet *>::const_iterator i(
components.begin());
460 std::vector<G4VEMDataSet *>::const_iterator end(
components.end());
464 value+=(*i)->FindValue(argEnergy);
476 G4cout <<
"The data set has " << n <<
" components" <<
G4endl;
492 G4int argComponentId)
503 message <<
"Component " << argComponentId <<
" not found";
505 G4Exception(
"G4MuElecCrossSectionDataSet::SetEnergiesData",
"em0005",
515 G4int argComponentId)
526 message <<
"Component " << argComponentId <<
" not found";
528 G4Exception(
"G4MuElecCrossSectionDataSet::SetLogEnergiesData",
"em0005",
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *values, G4DataVector *log_x, G4DataVector *log_values, G4int componentId)
const G4VDataSetAlgorithm * GetAlgorithm() const
virtual G4bool LoadNonLogData(const G4String &argFileName)
void message(RunManager *runmanager)
virtual const G4DataVector & GetData(G4int componentId) const =0
G4double GetUnitData() const
virtual G4bool LoadData(const G4String &argFileName)
virtual G4double FindValue(G4double e, G4int componentId=0) const
virtual const G4DataVector & GetEnergies(G4int componentId) const
void CleanUpComponents(void)
G4VDataSetAlgorithm * algorithm
const XML_Char int const XML_Char * value
virtual const G4VEMDataSet * GetComponent(G4int componentId) const
virtual void AddComponent(G4VEMDataSet *dataSet)
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *data, G4DataVector *Log_x, G4DataVector *Log_data, G4int component=0)=0
G4MuElecCrossSectionDataSet()
std::vector< G4VEMDataSet * > components
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *values, G4int componentId)
G4double GetUnitEnergies() const
virtual void PrintData(void) const
virtual void PrintData(void) const =0
G4GLOB_DLL std::ostream G4cout
G4String FullFileName(const G4String &argFileName) const
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *data, G4int component=0)=0
virtual ~G4MuElecCrossSectionDataSet()
virtual G4bool SaveData(const G4String &argFileName) const
virtual size_t NumberOfComponents(void) const