68 log_energies(nullptr),
94 log_energies(nullptr),
129 log_energies(dataLogX),
190 for (
size_t i(0); i<size; i++)
194 if (
pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
205 if(!dataX || !dataY) {
209 if (dataX->size() != dataY->size()) {
233 if(!dataX || !dataY || !data_logX || !data_logY) {
237 if (dataX->size() != dataY->size() ||
238 dataX->size() != data_logX->size() ||
239 dataX->size() != data_logY->size()) {
272 std::ifstream in(fullFileName);
277 message += fullFileName;
278 message +=
"\" not found";
298 if (a != -1 && a != -2)
300 if (a==0.) { a=1e-300; }
301 if (b==0.) { b=1e-300; }
328 std::ifstream in(fullFileName);
332 message += fullFileName;
333 message +=
"\" not found";
349 if (a != -1 && a != -2)
355 else if (k%nColumns == 1)
382 std::ofstream out(fullFileName);
387 message+=fullFileName;
395 out.setf(std::ofstream::left);
399 G4DataVector::const_iterator i(
energies->begin());
400 G4DataVector::const_iterator endI(
energies->end());
401 G4DataVector::const_iterator j(
data->begin());
407 out.setf(std::ofstream::left);
412 out.setf(std::ofstream::left);
413 out << ((*j)/
unitData) << std::endl;
422 out.setf(std::ofstream::left);
427 out.setf(std::ofstream::left);
428 out << -1.f << std::endl;
432 out.setf(std::ofstream::left);
437 out.setf(std::ofstream::left);
438 out << -2.f << std::endl;
447 size_t lowerBound = 0;
448 size_t upperBound(
energies->size() - 1);
450 while (lowerBound <= upperBound)
452 size_t midBin((lowerBound + upperBound) / 2);
454 if (x < (*
energies)[midBin]) upperBound = midBin - 1;
455 else lowerBound = midBin + 1;
465 size_t lowerBound = 0;;
466 size_t upperBound(values->size() - 1);
468 while (lowerBound <= upperBound)
470 size_t midBin((lowerBound + upperBound) / 2);
472 if (x < (*values)[midBin]) upperBound = midBin - 1;
473 else lowerBound = midBin + 1;
483 char* path = std::getenv(
"G4LEDATA");
489 std::ostringstream fullFileName;
490 fullFileName << path <<
'/' <<
name <<
z <<
".dat";
492 return G4String(fullFileName.str().c_str());
508 for (i=1; i<nData; i++)
513 totalSum = totalSum + sum;
514 pdf->push_back(totalSum);
519 if (totalSum > 0.) tot = 1. / totalSum;
520 for (i=1; i<nData; i++)
522 (*pdf)[i] = (*pdf)[i] * tot;
536 "em1012",
FatalException,
"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
size_t FindLowerBound(G4double energy) const
virtual G4bool LoadNonLogData(const G4String &fileName)
G4String FullFileName(const G4String &fileName) const
G4double IntegrationFunction(G4double x)
virtual void SetLogEnergiesData(G4DataVector *xData, G4DataVector *data, G4DataVector *xLogData, G4DataVector *Logdata, G4int componentId)
virtual G4bool SaveData(const G4String &fileName) const
G4VDataSetAlgorithm * algorithm
virtual G4double RandomSelect(G4int componentId=0) const
G4DataVector * log_energies
virtual G4bool LoadData(const G4String &fileName)
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
virtual G4double FindValue(G4double x, G4int componentId=0) const
virtual void PrintData(void) const
G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const override
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
G4double energy(const ThreeVector &p, const G4double m)
const char * name(G4int ptype)