#include <G4RDEMDataSet.hh>
|
| G4RDEMDataSet (G4int argZ, G4RDVDataSetAlgorithm *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
| G4RDEMDataSet (G4int argZ, G4DataVector *xData, G4DataVector *data, G4RDVDataSetAlgorithm *algo, G4double xUnit=CLHEP::MeV, G4double yUnit=CLHEP::barn, G4bool random=false) |
|
virtual | ~G4RDEMDataSet () |
|
virtual G4double | FindValue (G4double x, G4int componentId=0) const |
|
virtual void | PrintData (void) const |
|
virtual const G4RDVEMDataSet * | GetComponent (G4int) const |
|
virtual void | AddComponent (G4RDVEMDataSet *) |
|
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 |
|
| G4RDVEMDataSet () |
|
virtual | ~G4RDVEMDataSet () |
|
Definition at line 56 of file G4RDEMDataSet.hh.
Definition at line 47 of file G4RDEMDataSet.cc.
64 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 67 of file G4RDEMDataSet.cc.
87 if ((energies == 0) ^ (data == 0))
88 G4Exception(
"G4RDEMDataSet::G4RDEMDataSet()",
"InvalidSetup",
89 FatalException,
"Different size for energies and data (zero case)!");
91 if (energies == 0)
return;
93 if (energies->size() != data->size())
94 G4Exception(
"G4RDEMDataSet::G4RDEMDataSet()",
"InvalidSetup",
97 if (randomSet) BuildPdf();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4RDEMDataSet::~G4RDEMDataSet |
( |
| ) |
|
|
virtual |
Definition at line 100 of file G4RDEMDataSet.cc.
103 if (energies)
delete energies;
const XML_Char const XML_Char * data
Implements G4RDVEMDataSet.
Definition at line 108 of file G4RDEMDataSet.cc.
111 G4Exception(
"G4RDEMDataSet::FindValue()",
"InvalidSetup",
113 if (energies->empty())
return 0;
114 if (
energy <= (*energies)[0])
return (*
data)[0];
116 size_t i = energies->size()-1;
117 if (
energy >= (*energies)[i])
return (*
data)[i];
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)
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
Implements G4RDVEMDataSet.
Definition at line 164 of file G4RDEMDataSet.cc.
172 G4String fullFileName(FullFileName(fileName));
173 std::ifstream in(fullFileName);
178 message += fullFileName;
179 message +=
"\" not found";
180 G4Exception(
"G4RDEMDataSet::LoadData()",
"DataNotFound",
188 bool energyColumn(
true);
197 argEnergies->push_back(a*unitEnergies);
199 argData->push_back(a*unitData);
200 energyColumn=(!energyColumn);
206 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 G4RDEMDataSet::NumberOfComponents |
( |
void |
| ) |
const |
|
inlinevirtual |
void G4RDEMDataSet::PrintData |
( |
void |
| ) |
const |
|
virtual |
Implements G4RDVEMDataSet.
Definition at line 123 of file G4RDEMDataSet.cc.
131 size_t size = energies->size();
132 for (
size_t i(0); i<size; i++)
134 G4cout <<
"Point: " << ((*energies)[i]/unitEnergies)
135 <<
" - Data value: " << ((*
data)[i]/unitData);
136 if (pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
const XML_Char const XML_Char * data
G4GLOB_DLL std::ostream G4cout
G4double G4RDEMDataSet::RandomSelect |
( |
G4int |
componentId = 0 | ) |
const |
|
virtual |
Implements G4RDVEMDataSet.
Definition at line 359 of file G4RDEMDataSet.cc.
364 if (!pdf)
G4Exception(
"G4RDEMDataSet::RandomSelect()",
"InvalidSetup",
371 size_t bin = FindLowerBound(x,pdf);
378 if (bin == 0) value = linearAlgo.
Calculate(x, bin, *pdf, *energies);
379 else value = algorithm->
Calculate(x, bin, *pdf, *energies);
const XML_Char int const XML_Char * value
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
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
Implements G4RDVEMDataSet.
Definition at line 211 of file G4RDEMDataSet.cc.
220 std::ofstream out(fullFileName);
225 message+=fullFileName;
227 G4Exception(
"G4RDEMDataSet::SaveData()",
"CannotOpenFile",
235 if (energies!=0 &&
data!=0)
237 G4DataVector::const_iterator i(energies->begin());
238 G4DataVector::const_iterator endI(energies->end());
239 G4DataVector::const_iterator j(
data->begin());
246 out << ((*i)/unitEnergies) <<
' ';
251 out << ((*j)/unitData) << std::endl;
266 out << -1.f << std::endl;
276 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 G4RDVEMDataSet.
Definition at line 143 of file G4RDEMDataSet.cc.
147 if (energies)
delete energies;
150 if (data)
delete data;
153 if ((energies == 0) ^ (data==0))
154 G4Exception(
"G4RDEMDataSet::SetEnergiesData()",
"InvalidSetup",
155 FatalException,
"Different size for energies and data (zero case)!");
157 if (energies == 0)
return;
159 if (energies->size() != data->size())
160 G4Exception(
"G4RDEMDataSet::SetEnergiesData()",
"InvalidSetup",
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/examples/advanced/eRosita/physics/include/G4RDEMDataSet.hh
- source/geant4.10.03.p03/examples/advanced/eRosita/physics/src/G4RDEMDataSet.cc