#include <G4DataSet.hh>
|
| G4DataSet (G4int argZ, G4IInterpolator *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
| G4DataSet (G4int argZ, G4DataVector *xData, G4DataVector *data, G4IInterpolator *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
virtual | ~G4DataSet () |
|
virtual G4double | FindValue (G4double x, G4int componentId=0) const |
|
virtual void | PrintData (void) const |
|
virtual const G4IDataSet * | GetComponent (G4int) const |
|
virtual void | AddComponent (G4IDataSet *) |
|
virtual size_t | NumberOfComponents (void) const |
|
virtual const G4DataVector & | GetEnergies (G4int) const |
|
virtual const G4DataVector & | GetData (G4int) const |
|
virtual void | SetEnergiesData (G4DataVector *xData, G4DataVector *data, G4int componentId) |
|
virtual G4bool | LoadData (const G4String &fileName) |
|
virtual G4bool | SaveData (const G4String &fileName) const |
|
virtual G4double | RandomSelect (G4int componentId=0) const |
|
| G4IDataSet () |
|
virtual | ~G4IDataSet () |
|
Definition at line 54 of file G4DataSet.hh.
Definition at line 47 of file G4DataSet.cc.
61 if (algorithm == 0)
G4Exception(
"G4DataSet::G4DataSet",
64 "Interpolation == 0");
65 if (randomSet) BuildPdf();
const XML_Char const XML_Char * data
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition at line 68 of file G4DataSet.cc.
84 if (algorithm == 0)
G4Exception(
"G4DataSet::G4DataSet",
87 "Interpolation == 0");
89 if ((energies == 0) ^ (data == 0))
93 "different size for energies and data (zero case)");
95 if (energies == 0)
return;
97 if (energies->size() != data->size())
101 "different size for energies and data");
103 if (randomSet) BuildPdf();
const XML_Char const XML_Char * data
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4DataSet::~G4DataSet |
( |
| ) |
|
|
virtual |
Definition at line 106 of file G4DataSet.cc.
109 if (energies)
delete energies;
const XML_Char const XML_Char * data
Implements G4IDataSet.
Definition at line 114 of file G4DataSet.cc.
120 if (energies->empty())
return 0;
121 if (
energy <= (*energies)[0])
return (*
data)[0];
123 size_t i = energies->size()-1;
124 if (
energy >= (*energies)[i])
return (*
data)[i];
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
const XML_Char const XML_Char * data
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double energy(const ThreeVector &p, const G4double m)
Implements G4IDataSet.
Definition at line 176 of file G4DataSet.cc.
184 G4String fullFileName(FullFileName(fileName));
185 std::ifstream in(fullFileName);
190 std::ostringstream message;
191 message <<
"G4DataSet::LoadData - data file " << fullFileName <<
" not found";
196 message.str().c_str());
203 bool energyColumn(
true);
214 argEnergies->push_back(a*unitEnergies);
217 argData->push_back(a*unitData);
218 energyColumn=(!energyColumn);
224 if (randomSet) BuildPdf();
std::vector< ExP01TrackerHit * > a
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
virtual size_t G4DataSet::NumberOfComponents |
( |
void |
| ) |
const |
|
inlinevirtual |
void G4DataSet::PrintData |
( |
void |
| ) |
const |
|
virtual |
Implements G4IDataSet.
Definition at line 131 of file G4DataSet.cc.
139 size_t size = energies->size();
140 for (
size_t i(0); i<size; i++)
142 G4cout <<
"Point: " << ((*energies)[i]/unitEnergies)
143 <<
" - Data value: " << ((*
data)[i]/unitData);
144 if (pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
const XML_Char const XML_Char * data
G4GLOB_DLL std::ostream G4cout
Implements G4IDataSet.
Definition at line 383 of file G4DataSet.cc.
391 "PDF has not been created for this data set");
397 size_t bin = FindLowerBound(x,pdf);
404 if (bin == 0) value = linearAlgo.
Calculate(x, bin, *pdf, *energies);
405 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
const XML_Char int const XML_Char * value
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Implements G4IDataSet.
Definition at line 229 of file G4DataSet.cc.
238 std::ofstream out(fullFileName);
243 std::ostringstream message;
244 message <<
"G4DataSet:: SaveData - cannot open " << fullFileName;
249 message.str().c_str());
257 if (energies!=0 &&
data!=0)
259 G4DataVector::const_iterator i(energies->begin());
260 G4DataVector::const_iterator endI(energies->end());
261 G4DataVector::const_iterator j(
data->begin());
268 out << ((*i)/unitEnergies) <<
' ';
273 out << ((*j)/unitData) << std::endl;
288 out << -1.f << std::endl;
298 out << -2.f << std::endl;
const XML_Char const XML_Char * data
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Implements G4IDataSet.
Definition at line 151 of file G4DataSet.cc.
155 if (energies)
delete energies;
158 if (data)
delete data;
161 if ((energies == 0) ^ (data==0))
165 "different size for energies and data (zero case)");
167 if (energies == 0)
return;
169 if (energies->size() != data->size())
173 "different size for energies and data");
const XML_Char const XML_Char * 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:
- source/geant4.10.03.p03/source/processes/electromagnetic/pii/include/G4DataSet.hh
- source/geant4.10.03.p03/source/processes/electromagnetic/pii/src/G4DataSet.cc