72 if (algorithm ==
nullptr)
73 G4Exception(
"G4ShellEMDataSet::G4ShellEMDataSet()",
"em0007",
81 if (algorithm)
delete algorithm;
90 std::vector<G4VEMDataSet *>::const_iterator i(components.begin());
91 std::vector<G4VEMDataSet *>::const_iterator end(components.end());
95 value += (*i)->FindValue(energy);
108 G4cout <<
"The data set has " << n <<
" components" <<
G4endl;
135 msg +=
static_cast<char>(componentId);
157 msg +=
static_cast<char>(componentId);
159 G4Exception(
"G4ShellEMDataSet::SetLogEnergiesData()",
"em0008",
169 G4String fullFileName = FullFileName(file);
170 std::ifstream in(fullFileName);
175 message += fullFileName;
176 message +=
"\" not found";
187 G4int shellIndex = 0;
205 if ((k%nColumns == 0) && (orig_shell_energies != 0) )
208 orig_shell_data, log_shell_energies,
209 log_shell_data, algorithm->
Clone(),
210 unitEnergies, unitData));
211 orig_shell_energies = 0;
213 log_shell_energies = 0;
219 if (orig_shell_energies == 0)
228 orig_shell_energies->push_back(a*unitEnergies);
229 log_shell_energies->push_back(std::log10(a) + std::log10(unitEnergies));
231 else if (k%nColumns == 1)
233 orig_shell_data->push_back(a*unitData);
234 log_shell_data->push_back(std::log10(a) + std::log10(unitData));
242 delete orig_shell_energies;
243 delete orig_shell_data;
244 delete log_shell_energies;
245 delete log_shell_data;
256 G4String fullFileName = FullFileName(file);
257 std::ifstream in(fullFileName);
261 G4String message(
"G4ShellEMDataSet::LoadData - data file \"");
262 message += fullFileName;
263 message +=
"\" not found";
272 G4int shellIndex = 0;
287 if ((k%nColumns == 0) && (orig_shell_energies != 0) )
290 orig_shell_data, algorithm->
Clone(),
291 unitEnergies, unitData));
292 orig_shell_energies = 0;
298 if (orig_shell_energies == 0)
305 orig_shell_energies->push_back(a*unitEnergies);
307 else if (k%nColumns == 1)
309 orig_shell_data->push_back(a*unitData);
318 delete orig_shell_energies;
319 delete orig_shell_data;
328 G4String fullFileName = FullFileName(file);
329 std::ofstream out(fullFileName);
334 message += fullFileName;
351 G4DataVector::const_iterator i = energies.cbegin();
352 G4DataVector::const_iterator endI = energies.cend();
353 G4DataVector::const_iterator j = data.cbegin();
359 out.setf(std::ofstream::left);
360 out << ((*i)/unitEnergies) <<
' ';
364 out.setf(std::ofstream::left);
365 out << ((*j)/unitData) << std::endl;
373 out.setf(std::ofstream::left);
378 out.setf(std::ofstream::left);
379 out << -1.f << std::endl;
386 out.setf(std::ofstream::left);
391 out.setf(std::ofstream::left);
392 out << -2.f << std::endl;
401 while (!components.empty())
403 if (components.back())
delete components.back();
404 components.pop_back();
420 std::ostringstream fullFileName;
422 fullFileName << path <<
'/' << fileName << z <<
".dat";
424 return G4String(fullFileName.str().c_str());
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
void SetEnergiesData(G4DataVector *energies, G4DataVector *data, G4int componentId) override
void AddComponent(G4VEMDataSet *dataSet) override
G4ShellEMDataSet(G4int Z, G4VDataSetAlgorithm *algo, G4double eUnit=CLHEP::MeV, G4double dataUnit=CLHEP::barn)
size_t NumberOfComponents(void) const override
G4bool LoadData(const G4String &fileName) override
const G4VEMDataSet * GetComponent(G4int componentId) const override
G4bool SaveData(const G4String &fileName) const override
G4bool LoadNonLogData(const G4String &fileName) override
G4double FindValue(G4double energy, G4int componentId=0) const override
void PrintData(void) const override
void SetLogEnergiesData(G4DataVector *energies, G4DataVector *data, G4DataVector *log_energies, G4DataVector *log_data, G4int componentId) override
virtual ~G4ShellEMDataSet()
virtual G4VDataSetAlgorithm * Clone() const =0
virtual void SetEnergiesData(G4DataVector *x, G4DataVector *data, G4int component=0)=0
virtual const G4DataVector & GetData(G4int componentId) const =0
virtual const G4DataVector & GetEnergies(G4int componentId) const =0
virtual void SetLogEnergiesData(G4DataVector *x, G4DataVector *data, G4DataVector *Log_x, G4DataVector *Log_data, G4int component=0)=0
virtual void PrintData(void) const =0