34#ifndef G4ParticleHPVector_h
35#define G4ParticleHPVector_h 1
74 for (i = 0; i < nEntries; i++) {
75 theData[i].
SetY(theData[i].
GetY() * factor);
77 if (theIntegral !=
nullptr) {
78 theIntegral[i] *= factor;
93 if (y > maxValue) maxValue = y;
109 if (x > maxValue) maxValue = x;
115 if (x > maxValue) maxValue = x;
124 return theData[i].
GetX();
132 for (i = 0; i < nEntries; i++) {
133 if (0 == (i + 1) % 10) {
151 for (i = min; i < nEntries; i++) {
152 if (theData[i].
GetX() > e)
break;
160 else if (i == nEntries) {
165 if (e < theData[nEntries - 1].
GetX()) {
167 if ((theData[high].
GetX() - theData[low].
GetX()) / theData[high].
GetX() < 0.000001) {
168 y = theData[low].
GetY();
172 theData[high].
GetX(), theData[low].
GetY(), theData[high].
GetY());
176 y = theData[nEntries - 1].
GetY();
188 return theData[i].
GetY();
195 return theData[i].
GetY();
204 for (
G4int i = 0; i < total; i++) {
209 if (0 == nEntries % 10) {
210 theHash.
SetData(nEntries - 1, x, y);
223 theManager.
Init(aDataFile);
224 Init(aDataFile, total, ux, uy);
240 delete[] theIntegral;
241 theIntegral =
nullptr;
248 G4int s_tmp = 0, n = 0, m_tmp = 0;
250 G4int a = s_tmp, p = n, t;
265 if (!(xa == 0) && std::abs(std::abs(xp - xa) / xa) < 0.001) p++;
302 result = theData[0].
GetX();
322 y1 = theData[i - 1].
GetX();
323 x1 = theIntegral[i - 1];
324 y2 = theData[i].
GetX();
326 if (std::abs((y2 - y1) / y2)
329 y1 = theData[i - 2].
GetX();
330 x1 = theIntegral[i - 2];
332 result = theLin.
Lin(rand, x1, x2, y1, y2);
344 if (theIntegral !=
nullptr)
return;
345 theIntegral =
new G4double[nEntries];
355 x1 = theData[i].
GetX();
356 x0 = theData[i - 1].
GetX();
357 if (std::abs(x1 - x0) > std::abs(x1 * 0.0000001)) {
369#if defined WIN32 - VC
370 if (!_finite(integ)) {
373#elif defined __IBMCPP__
374 if (isinf(integ) || isnan(integ)) {
378 if (std::isinf(integ) || std::isnan(integ)) {
385 theIntegral[i] = sum;
389 theIntegral[i] /= total;
402 if (std::abs((theData[i].
GetX() - theData[i - 1].
GetX()) / theData[i].
GetX()) > 0.0000001) {
409 sum += 0.5 * (y2 + y1) * (x2 - x1);
414 sum += (a - b) * (x2 - x1) + b * (x2 *
G4Log(x2) - x1 *
G4Log(x1));
422 sum += y1 * (x2 - x1);
433 __FILE__, __LINE__,
"Unknown interpolation scheme in G4ParticleHPVector::Integrate");
443 return totalIntegral;
448 theManager = aManager;
467 for (
G4int i = 1; i < nEntries; i++) {
470 theData[i].
GetX(), theData[i - 1].
GetY(), theData[i].
GetY());
472 theData[i - 1].
GetX(), theData[i].
GetX(),
473 theData[i - 1].
GetY(), theData[i].
GetY());
475 result = weighted / running;
529 std::vector<G4double> theBlocked;
530 std::vector<G4double> theBuffered;
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
void AppendScheme(G4int aPoint, const G4InterpolationScheme &aScheme)
void Init(G4int aScheme, G4int aRange)
G4InterpolationScheme GetScheme(G4int index) const
void SetData(G4double e, G4double x)
void SetData(G4int index, G4double x, G4double y)
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double GetWeightedBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
G4double Lin(G4double x, G4double x1, G4double x2, G4double y1, G4double y2)
G4double GetBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
G4InterpolationScheme GetScheme(G4int anIndex)
void SetY(G4int i, G4double x)
G4ParticleHPVector & operator=(const G4ParticleHPVector &right)
const G4ParticleHPDataPoint & GetPoint(G4int i) const
void SetX(G4int i, G4double e)
void SetScheme(G4int aPoint, const G4InterpolationScheme &aScheme)
void SetData(G4int i, G4double x, G4double y)
void Times(G4double factor)
friend G4ParticleHPVector & operator+(G4ParticleHPVector &left, G4ParticleHPVector &right)
G4double Get50percentBorder()
void IntegrateAndNormalise()
G4double GetXsec(G4int i)
const G4InterpolationManager & GetInterpolationManager() const
std::vector< G4double > GetBuffered()
G4double GetMaxY(G4double emin, G4double emax)
G4double Get15percentBorder()
G4double GetXsec(G4double e, G4int min)
void ThinOut(G4double precision)
G4double GetY(G4int i) const
void SetXsec(G4int i, G4double x)
void SetLabel(G4double aLabel)
void SetInterpolationManager(const G4InterpolationManager &aManager)
void Init(std::istream &aDataFile, G4double ux=1., G4double uy=1.)
G4double GetY(G4double x)
G4double GetEnergy(G4int i) const
G4double GetX(G4int i) const
void Merge(G4ParticleHPVector *active, G4ParticleHPVector *passive)
void SetEnergy(G4int i, G4double e)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4int GetVectorLength() const
std::vector< G4double > GetBlocked()
void SetPoint(G4int i, const G4ParticleHPDataPoint &it)
void SetVerbose(G4int ff)
void InitInterpolation(std::istream &aDataFile)
void SetInterpolationManager(G4InterpolationManager &aMan)
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const