31#ifndef G4NeutronHPVector_h
32#define G4NeutronHPVector_h 1
73 for(i=0; i<nEntries; i++)
75 theData[i].
SetY(theData[i].
GetY()*factor);
79 theIntegral[i] *= factor;
94 if(y>maxValue) maxValue=y;
110 if(x>maxValue) maxValue=x;
116 if(x>maxValue) maxValue=x;
125 return theData[i].
GetX();
133 for(i=0 ; i<nEntries; i++)
154 for(i=min ; i<nEntries; i++)
156 if(theData[i].
GetX()>e)
break;
171 if(e<theData[nEntries-1].
GetX())
174 if( (theData[high].
GetX()-theData[low].
GetX())/theData[high].
GetX() < 0.000001)
176 y = theData[low].
GetY();
181 theData[low].
GetX(), theData[high].
GetX(),
182 theData[low].
GetY(), theData[high].
GetY());
187 y=theData[nEntries-1].
GetY();
199 return theData[i].
GetY();
206 return theData[i].
GetY();
212 theManager.
Init(aDataFile);
218 for (
G4int i=0;i<total;i++)
226 theHash.
SetData(nEntries-1, x, y);
235 if(theData!=0)
delete [] theData;
239 theManager.
Init(aDataFile);
240 Init(aDataFile, total, ux, uy);
262 delete[] theIntegral;
270 G4int s_tmp = 0, n=0, m_tmp=0;
272 G4int a = s_tmp, p = n, t;
287 if ( !( xa == 0 ) && std::abs(std::abs(xp-xa)/xa)<0.001 ) p++;
324 result = theData[0].
GetX();
346 y1 = theData[i-1].
GetX();
347 x1 = theIntegral[i-1];
348 y2 = theData[i].
GetX();
350 if(std::abs((y2-y1)/y2)<0.0000001)
352 y1 = theData[i-2].
GetX();
353 x1 = theIntegral[i-2];
355 result = theLin.
Lin(rand, x1, x2, y1, y2);
370 if(theIntegral!=0)
return;
371 theIntegral =
new G4double[nEntries];
383 x1 = theData[i].
GetX();
384 x0 = theData[i-1].
GetX();
385 if (std::abs(x1-x0) > std::abs(x1*0.0000001) )
399 if(!_finite(integ)){integ=0;}
400#elif defined __IBMCPP__
401 if(isinf(integ)||isnan(integ)){integ=0;}
403 if(std::isinf(integ)||std::isnan(integ)){integ=0;}
408 theIntegral[i] = sum;
413 theIntegral[i]/=total;
428 if(std::abs((theData[i].
GetX()-theData[i-1].
GetX())/theData[i].
GetX())>0.0000001)
437 sum+= 0.5*(y2+y1)*(x2-x1);
442 G4double b = (y2-y1)/(std::log(x2)-std::log(x1));
443 sum+= (a-b)*(x2-x1) + b*(x2*std::log(x2)-x1*std::log(x1));
448 G4double b = (std::log(y2)-std::log(y1))/(x2-x1);
449 sum += (std::exp(a)/b)*(std::exp(b*x2)-std::exp(b*x1));
458 G4double b = (std::log(y2)-std::log(y1))/(std::log(x2)-std::log(x1));
459 sum += (std::exp(a)/(b+1))*(std::pow(x2,b+1)-std::pow(x1,b+1));
463 throw G4HadronicException(__FILE__, __LINE__,
"Unknown interpolation scheme in G4NeutronHPVector::Integrate");
474 return totalIntegral;
479 theManager = aManager;
507 for(
G4int i=1; i<nEntries; i++)
510 theData[i-1].
GetX(), theData[i].
GetX(),
511 theData[i-1].
GetY(), theData[i].
GetY());
513 theData[i-1].
GetX(), theData[i].
GetX(),
514 theData[i-1].
GetY(), theData[i].
GetY());
516 result = weighted / running;
570 std::vector<G4double> theBlocked;
571 std::vector<G4double> theBuffered;
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 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 Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double GetBinIntegral(const G4InterpolationScheme &aScheme, const G4double x1, const G4double x2, const G4double y1, const G4double y2)
std::vector< G4double > GetBlocked()
void Init(std::ifstream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
void SetLabel(G4double aLabel)
void Merge(G4NeutronHPVector *active, G4NeutronHPVector *passive)
G4double Get15percentBorder()
G4InterpolationScheme GetScheme(G4int anIndex)
void SetX(G4int i, G4double e)
std::vector< G4double > GetBuffered()
G4NeutronHPVector & operator=(const G4NeutronHPVector &right)
G4int GetVectorLength() const
void InitInterpolation(std::ifstream &aDataFile)
G4double GetX(G4int i) const
void SetEnergy(G4int i, G4double e)
void IntegrateAndNormalise()
G4double Get50percentBorder()
void SetVerbose(G4int ff)
G4double GetEnergy(G4int i) const
const G4InterpolationManager & GetInterpolationManager() const
void Init(std::ifstream &aDataFile, G4double ux=1., G4double uy=1.)
void SetInterpolationManager(G4InterpolationManager &aMan)
G4double GetXsec(G4int i)
void SetScheme(G4int aPoint, const G4InterpolationScheme &aScheme)
G4double GetY(G4double x)
void SetPoint(G4int i, const G4NeutronHPDataPoint &it)
void SetData(G4int i, G4double x, G4double y)
void SetInterpolationManager(const G4InterpolationManager &aManager)
G4double GetY(G4int i) const
void SetXsec(G4int i, G4double x)
void Times(G4double factor)
const G4NeutronHPDataPoint & GetPoint(G4int i) const
friend G4NeutronHPVector & operator+(G4NeutronHPVector &left, G4NeutronHPVector &right)
void ThinOut(G4double precision)
G4double GetXsec(G4double e, G4int min)
void SetY(G4int i, G4double x)