63 "Interpolation == 0");
86 "Interpolation == 0");
92 "different size for energies and data (zero case)");
100 "different size for energies and data");
139 for (
size_t i(0); i<size; i++)
143 if (
pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
164 "different size for energies and data (zero case)");
172 "different size for energies and data");
184 std::ifstream in(fullFileName);
189 std::ostringstream message;
190 message <<
"G4DataSet::LoadData - data file " << fullFileName <<
" not found";
195 message.str().c_str());
202 bool energyColumn(
true);
217 energyColumn=(!energyColumn);
237 std::ofstream out(fullFileName);
242 std::ostringstream message;
243 message <<
"G4DataSet:: SaveData - cannot open " << fullFileName;
248 message.str().c_str());
254 out.setf(std::ofstream::left);
258 G4DataVector::const_iterator i(
energies->begin());
259 G4DataVector::const_iterator endI(
energies->end());
260 G4DataVector::const_iterator j(
data->begin());
266 out.setf(std::ofstream::left);
271 out.setf(std::ofstream::left);
272 out << ((*j)/
unitData) << std::endl;
281 out.setf(std::ofstream::left);
286 out.setf(std::ofstream::left);
287 out << -1.f << std::endl;
291 out.setf(std::ofstream::left);
296 out.setf(std::ofstream::left);
297 out << -2.f << std::endl;
304 size_t lowerBound = 0;
305 size_t upperBound(
energies->size() - 1);
307 while (lowerBound <= upperBound)
309 size_t midBin((lowerBound + upperBound) / 2);
311 if (x < (*
energies)[midBin]) upperBound = midBin - 1;
312 else lowerBound = midBin + 1;
321 size_t lowerBound = 0;;
322 size_t upperBound(values->size() - 1);
324 while (lowerBound <= upperBound)
326 size_t midBin((lowerBound + upperBound) / 2);
328 if (x < (*values)[midBin]) upperBound = midBin - 1;
329 else lowerBound = midBin + 1;
338 char* path = std::getenv(
"G4PIIDATA");
343 "G4PIIDATA environment variable not set");
345 std::ostringstream fullFileName;
346 fullFileName << path <<
'/' <<
name <<
z <<
".dat";
348 return G4String(fullFileName.str().c_str());
363 for (i=1; i<nData; i++)
368 totalSum = totalSum + sum;
369 pdf->push_back(totalSum);
374 if (totalSum > 0.) tot = 1. / totalSum;
375 for (i=1; i<nData; i++)
377 (*pdf)[i] = (*pdf)[i] * tot;
390 "PDF has not been created for this data set");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
virtual void PrintData(void) const
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
G4double IntegrationFunction(G4double x)
virtual G4double RandomSelect(G4int componentId=0) const
size_t FindLowerBound(G4double energy) const
virtual G4bool SaveData(const G4String &fileName) const
G4IInterpolator * algorithm
G4String FullFileName(const G4String &fileName) const
virtual G4double FindValue(G4double x, G4int componentId=0) const
virtual G4bool LoadData(const G4String &fileName)
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const override
G4double energy(const ThreeVector &p, const G4double m)
const char * name(G4int ptype)