64 "Interpolation == 0");
87 "Interpolation == 0");
93 "different size for energies and data (zero case)");
101 "different size for energies and data");
140 for (
size_t i(0); i<size; i++)
144 if (
pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
165 "different size for energies and data (zero case)");
173 "different size for energies and data");
185 std::ifstream
in(fullFileName);
191 message <<
"G4DataSet::LoadData - data file " << fullFileName <<
" not found";
196 message.str().c_str());
203 bool energyColumn(
true);
218 energyColumn=(!energyColumn);
238 std::ofstream out(fullFileName);
244 message <<
"G4DataSet:: SaveData - cannot open " << fullFileName;
249 message.str().c_str());
259 G4DataVector::const_iterator i(
energies->begin());
260 G4DataVector::const_iterator endI(
energies->end());
261 G4DataVector::const_iterator j(
data->begin());
273 out << ((*j)/
unitData) << std::endl;
288 out << -1.f << std::endl;
298 out << -2.f << std::endl;
305 size_t lowerBound = 0;
306 size_t upperBound(
energies->size() - 1);
308 while (lowerBound <= upperBound)
310 size_t midBin((lowerBound + upperBound) / 2);
312 if (x < (*
energies)[midBin]) upperBound = midBin - 1;
313 else lowerBound = midBin + 1;
322 size_t lowerBound = 0;;
323 size_t upperBound(values->size() - 1);
325 while (lowerBound <= upperBound)
327 size_t midBin((lowerBound + upperBound) / 2);
329 if (x < (*values)[midBin]) upperBound = midBin - 1;
330 else lowerBound = midBin + 1;
339 char* path = getenv(
"G4PIIDATA");
344 "G4PIIDATA environment variable not set");
346 std::ostringstream fullFileName;
347 fullFileName << path <<
'/' << name <<
z <<
".dat";
349 return G4String(fullFileName.str().c_str());
364 for (i=1; i<nData; i++)
369 totalSum = totalSum +
sum;
370 pdf->push_back(totalSum);
375 if (totalSum > 0.) tot = 1. / totalSum;
376 for (i=1; i<nData; i++)
378 (*pdf)[i] = (*pdf)[i] * tot;
391 "PDF has not been created for this data set");
std::vector< ExP01TrackerHit * > a
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
virtual G4double RandomSelect(G4int componentId=0) const
G4double Legendre96(T &typeT, F f, G4double a, G4double b)
void message(RunManager *runmanager)
G4double IntegrationFunction(G4double x)
const XML_Char const XML_Char * data
virtual void PrintData(void) const
const XML_Char int const XML_Char * value
G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
virtual G4bool SaveData(const G4String &fileName) const
G4GLOB_DLL std::ostream G4cout
virtual G4bool LoadData(const G4String &fileName)
G4String FullFileName(const G4String &fileName) const
size_t FindLowerBound(G4double energy) const
virtual G4double FindValue(G4double x, G4int componentId=0) const
G4IInterpolator * algorithm