51 if (right.
GetX(j) < left.
GetX(i) * 1.001) {
54 result->SetData(running++, x, y);
58 else if (left.
GetX(i) + right.
GetX(j) == 0
59 || std::abs((right.
GetX(j) - left.
GetX(i)) / (left.
GetX(i) + right.
GetX(j))) > 0.001)
63 result->SetData(running++, x, y);
73 result->SetData(running++, x, y);
86 theIntegral =
nullptr;
90 the15percentBorderCash = -
DBL_MAX;
91 the50percentBorderCash = -
DBL_MAX;
97 nPoints = std::max(n, 20);
101 theIntegral =
nullptr;
105 the15percentBorderCash = -
DBL_MAX;
106 the50percentBorderCash = -
DBL_MAX;
115 delete[] theIntegral;
123 if (&right ==
this)
return *
this;
127 totalIntegral = right.totalIntegral;
128 if (right.theIntegral !=
nullptr) theIntegral =
new G4double[right.nEntries];
129 for (i = 0; i < right.nEntries; i++) {
131 if (right.theIntegral !=
nullptr) theIntegral[i] = right.theIntegral[i];
133 theManager = right.theManager;
136 Verbose = right.Verbose;
137 the15percentBorderCash = right.the15percentBorderCash;
138 the50percentBorderCash = right.the50percentBorderCash;
139 theHash = right.theHash;
145 if (nEntries == 0)
return 0;
157 for (i = min; i < nEntries; i++) {
159 if (theData[i].
GetX() >= e)
break;
167 else if (i == nEntries) {
172 if (e < theData[nEntries - 1].
GetX()) {
175 if (theData[high].
GetX() != 0
178 && (std::abs((theData[high].
GetX() - theData[low].
GetX()) / theData[high].
GetX())
181 y = theData[low].
GetY();
185 theData[high].
GetX(), theData[low].
GetY(), theData[high].
GetY());
189 y = theData[nEntries - 1].
GetY();
197 for (
G4int i = 0; i < nEntries; i++) {
206void G4ParticleHPVector::Check(
G4int i)
210 "Skipped some index numbers in G4ParticleHPVector");
212 nPoints =
static_cast<G4int>(1.2 * nPoints);
214 for (
G4int j = 0; j < nEntries; j++)
215 buff[j] = theData[j];
219 if (i == nEntries) nEntries = i + 1;
229 G4int s_tmp = 0, n = 0, m_tmp = 0;
231 G4int a = s_tmp, p = n, t;
244 if (xa != 0 && std::abs(std::abs(xp - xa) / xa) < 0.0000001 && a < active->
GetVectorLength())
270 anX = passive->
GetXsec(p) - deltaX;
296 G4int count = 0, current = 2, start = 1;
299 aBuff[0] = theData[0];
304 x1 = aBuff[count].GetX();
305 y1 = aBuff[count].GetY();
306 x2 = theData[current].
GetX();
307 y2 = theData[current].
GetY();
311 for (
G4int j = start; j < current; j++) {
313 if (std::abs(y - theData[j].
GetY()) > precision * y) {
314 aBuff[++count] = theData[current - 1];
321 for (
G4int j = start; j < current; j++) {
322 x = theData[j].
GetX();
326 y = theInt.
Lin(x, x1, x2, y1, y2);
327 if (std::abs(y - theData[j].
GetY()) > precision * y) {
328 aBuff[++count] = theData[current - 1];
340 nEntries = count + 1;
351 std::vector<G4double>::iterator i;
352 for (i = theBlocked.begin(); i != theBlocked.end(); i++) {
354 if (std::abs(aX - aBlock) < 0.1 * MeV) {
372 result = theBuffered[0];
373 theBuffered.erase(theBuffered.begin());
377 result = theData[0].
GetX();
380 if (theIntegral ==
nullptr) {
384 G4int icounter_max = 1024;
387 if (icounter > icounter_max) {
388 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of "
389 << __FILE__ <<
"." <<
G4endl;
411 G4int jcounter_max = 1024;
414 if (jcounter > jcounter_max) {
415 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of "
416 << __FILE__ <<
"." <<
G4endl;
422 if (rand < theIntegral[i]) {
427 if (ibin < 0)
G4cout <<
"TKDB 080807 " << rand <<
G4endl;
432 x1 = theData[ibin].
GetX();
436 x1 = theData[ibin - 1].
GetX();
438 x2 = theData[ibin].
GetX();
439 value = rand * (x2 - x1) + x1;
448 G4double mval = (y2 - y1) / (x2 - x1);
450 test = (mval * value + bval) / std::max(
GetY(ibin - 1),
GetY(ibin));
455 }
while (IsBlocked(result));
462 if (the15percentBorderCash > -
DBL_MAX / 2.)
return the15percentBorderCash;
465 result = theData[0].
GetX();
466 the15percentBorderCash = result;
469 if (theIntegral ==
nullptr) {
477 the15percentBorderCash = result;
481 the15percentBorderCash = result;
488 if (the50percentBorderCash > -
DBL_MAX / 2.)
return the50percentBorderCash;
491 result = theData[0].
GetX();
492 the50percentBorderCash = result;
495 if (theIntegral ==
nullptr) {
512 y1 = theData[i - 1].
GetX();
513 y2 = theData[i].
GetX();
514 result = theLin.
Lin(x, x1, x2, y1, y2);
516 the50percentBorderCash = result;
520 the50percentBorderCash = result;
528 if (emin > emax || nEntries == 0)
return xsmax;
529 if (emin >= theData[nEntries - 1].
GetX()) {
530 xsmax = theData[nEntries - 1].
GetY();
533 if (emax <= theData[0].
GetX()) {
534 xsmax = theData[0].
GetY();
540 for (; i < nEntries; ++i) {
541 if (theData[i].
GetX() >= emin)
break;
546 for (; i < nEntries; ++i) {
547 if (theData[i].
GetX() >= emax)
break;
552 for (i = low; i < high; ++i) {
553 if (xsmax < theData[i].
GetY()) xsmax = theData[i].
GetY();
557 if (xsmax < highborder) xsmax = highborder;
561 "G4ParticleHPVector::GetMaxY : called "
562 "G4Nucleus::GetBiasedThermalNucleus for DBRC, xsmax==0.");
G4ParticleHPVector & operator+(G4ParticleHPVector &left, G4ParticleHPVector &right)
G4GLOB_DLL std::ostream G4cout
void AppendScheme(G4int aPoint, const G4InterpolationScheme &aScheme)
G4InterpolationScheme GetScheme(G4int index) const
G4int GetMinIndex(G4double e) const
G4double Interpolate(G4InterpolationScheme aScheme, G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
G4double Lin(G4double x, G4double x1, G4double x2, G4double y1, G4double y2)
G4InterpolationScheme GetScheme(G4int anIndex)
void SetY(G4int i, G4double x)
G4ParticleHPVector & operator=(const G4ParticleHPVector &right)
const G4ParticleHPDataPoint & GetPoint(G4int i) const
void SetData(G4int i, G4double x, G4double y)
G4double Get50percentBorder()
void IntegrateAndNormalise()
G4double GetXsec(G4int i)
G4double GetMaxY(G4double emin, G4double emax)
G4double Get15percentBorder()
void ThinOut(G4double precision)
G4double GetY(G4double x)
G4double GetEnergy(G4int i) const
G4double GetX(G4int i) const
void Merge(G4ParticleHPVector *active, G4ParticleHPVector *passive)
G4int GetVectorLength() const
void SetPoint(G4int i, const G4ParticleHPDataPoint &it)