#include <G4EMDataSet.hh>
|
| G4EMDataSet (G4int argZ, G4VDataSetAlgorithm *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
| G4EMDataSet (G4int argZ, G4DataVector *xData, G4DataVector *data, G4VDataSetAlgorithm *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
| G4EMDataSet (G4int argZ, G4DataVector *xData, G4DataVector *data, G4DataVector *xLogData, G4DataVector *Logdata, G4VDataSetAlgorithm *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
virtual | ~G4EMDataSet () |
|
virtual G4double | FindValue (G4double x, G4int componentId=0) const |
|
virtual void | PrintData (void) const |
|
virtual const G4VEMDataSet * | GetComponent (G4int) const |
|
virtual void | AddComponent (G4VEMDataSet *) |
|
virtual size_t | NumberOfComponents (void) const |
|
virtual const G4DataVector & | GetEnergies (G4int) const |
|
virtual const G4DataVector & | GetData (G4int) const |
|
virtual const G4DataVector & | GetLogEnergies (G4int) const |
|
virtual const G4DataVector & | GetLogData (G4int) const |
|
virtual void | SetEnergiesData (G4DataVector *xData, G4DataVector *data, G4int componentId) |
|
virtual void | SetLogEnergiesData (G4DataVector *xData, G4DataVector *data, G4DataVector *xLogData, G4DataVector *Logdata, G4int componentId) |
|
virtual G4bool | LoadData (const G4String &fileName) |
|
virtual G4bool | LoadNonLogData (const G4String &fileName) |
|
virtual G4bool | SaveData (const G4String &fileName) const |
|
virtual G4double | RandomSelect (G4int componentId=0) const |
|
| G4VEMDataSet () |
|
virtual | ~G4VEMDataSet () |
|
Definition at line 58 of file G4EMDataSet.hh.
Definition at line 84 of file G4EMDataSet.cc.
References FatalException, G4EMDataSet(), and G4Exception().
102 if (algorithm == 0) {
105 }
else if ((energies == 0) ^ (data == 0)) {
107 "em1012",
FatalException,
"different size for energies and data (zero case)");
108 }
else if (energies->size() != data->size()) {
111 }
else if (randomSet) {
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition at line 116 of file G4EMDataSet.cc.
References FatalException, G4EMDataSet(), and G4Exception().
128 log_energies(dataLogX),
136 if (algorithm == 0) {
139 }
else if ((energies == 0) ^ (data == 0)) {
141 "em1012",
FatalException,
"different size for energies and data (zero case)");
142 }
else if (energies->size() != data->size()) {
145 }
else if ((log_energies == 0) ^ (log_data == 0)) {
147 "em1012",
FatalException,
"different size for log energies and log data (zero case)");
148 }
else if (log_energies->size() != log_data->size()) {
150 "em1012",
FatalException,
"different size for log energies and log data");
151 }
else if (randomSet) {
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4EMDataSet::~G4EMDataSet |
( |
| ) |
|
|
virtual |
Implements G4VEMDataSet.
Definition at line 168 of file G4EMDataSet.cc.
References G4VDataSetAlgorithm::Calculate(), FatalException, and G4Exception().
174 }
else if (energies->empty()) {
176 }
else if (
energy <= (*energies)[0]) {
179 size_t i = energies->size()-1;
180 if (
energy >= (*energies)[i]) {
return (*
data)[i]; }
184 if (log_energies != 0)
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
double precision function energy(A, Z)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const XML_Char const XML_Char * data
Implements G4VEMDataSet.
Definition at line 292 of file G4EMDataSet.cc.
References test::a, test::b, FatalException, and G4Exception().
300 G4String fullFileName(FullFileName(fileName));
301 std::ifstream in(fullFileName);
306 message += fullFileName;
307 message +=
"\" not found";
330 if (a != -1 && a != -2)
332 if (a==0.) { a=1e-300; }
333 if (b==0.) { b=1e-300; }
336 energies->push_back(a);
337 log_energies->push_back(std::log10(a));
339 log_data->push_back(std::log10(b));
344 if (randomSet) { BuildPdf(); }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const XML_Char const XML_Char * data
Implements G4VEMDataSet.
Definition at line 350 of file G4EMDataSet.cc.
References test::a, FatalException, G4Exception(), and SetEnergiesData().
358 G4String fullFileName(FullFileName(fileName));
359 std::ifstream in(fullFileName);
363 message += fullFileName;
364 message +=
"\" not found";
380 if (a != -1 && a != -2)
384 argEnergies->push_back(a*unitEnergies);
386 else if (k%nColumns == 1)
388 argData->push_back(a*unitData);
397 if (randomSet) BuildPdf();
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual size_t G4EMDataSet::NumberOfComponents |
( |
void |
| ) |
const |
|
inlinevirtual |
void G4EMDataSet::PrintData |
( |
void |
| ) |
const |
|
virtual |
Implements G4VEMDataSet.
Definition at line 193 of file G4EMDataSet.cc.
References G4cout, and G4endl.
201 size_t size = energies->size();
202 for (
size_t i(0); i<size; i++)
204 G4cout <<
"Point: " << ((*energies)[i]/unitEnergies)
205 <<
" - Data value: " << ((*
data)[i]/unitData);
206 if (pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
G4GLOB_DLL std::ostream G4cout
const XML_Char const XML_Char * data
G4double G4EMDataSet::RandomSelect |
( |
G4int |
componentId = 0 | ) |
const |
|
virtual |
Implements G4VEMDataSet.
Definition at line 555 of file G4EMDataSet.cc.
References plottest35::bin, G4VDataSetAlgorithm::Calculate(), G4LinInterpolation::Calculate(), FatalException, G4Exception(), and G4UniformRand.
563 "em1012",
FatalException,
"PDF has not been created for this data set");
570 size_t bin = FindLowerBound(x,pdf);
577 if (bin == 0) value = linearAlgo.
Calculate(x, bin, *pdf, *energies);
578 else value = algorithm->
Calculate(x, bin, *pdf, *energies);
G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const XML_Char int const XML_Char * value
Implements G4VEMDataSet.
Definition at line 404 of file G4EMDataSet.cc.
References FatalException, G4Exception(), and left.
413 std::ofstream out(fullFileName);
418 message+=fullFileName;
428 if (energies!=0 &&
data!=0)
430 G4DataVector::const_iterator i(energies->begin());
431 G4DataVector::const_iterator endI(energies->end());
432 G4DataVector::const_iterator j(
data->begin());
439 out << ((*i)/unitEnergies) <<
' ';
444 out << ((*j)/unitData) << std::endl;
459 out << -1.f << std::endl;
469 out << -2.f << std::endl;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const XML_Char const XML_Char * data
Implements G4VEMDataSet.
Definition at line 213 of file G4EMDataSet.cc.
References FatalException, and G4Exception().
Referenced by LoadNonLogData().
217 if (energies) {
delete energies; }
220 if (data) {
delete data; }
223 if ((energies == 0) ^ (data==0)) {
225 "em1012",
FatalException,
"different size for energies and data (zero case)");
227 }
else if (energies == 0) {
return; }
230 if (energies->size() != data->size()) {
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Implements G4VEMDataSet.
Definition at line 236 of file G4EMDataSet.cc.
References FatalException, and G4Exception().
243 if (energies) {
delete energies; }
245 if (data) {
delete data; }
248 if (log_energies) {
delete log_energies; }
249 log_energies = data_logX;
250 if (log_data) {
delete log_data; }
251 log_data = data_logY;
255 if(data || log_energies || log_data ) {
265 }
else if (energies->size() != data->size()) {
273 if ( !log_energies ) {
283 }
else if ((log_energies->size() != log_data->size()) || (log_energies->size() != data->size())) {
285 "em1012",
FatalException,
"different size for log energies and data");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
The documentation for this class was generated from the following files: