55 result->
SetData(running++, x, y);
59 else if( left.
GetX(i)+right.
GetX(j) == 0
60 || std::abs((right.
GetX(j)-left.
GetX(i))/(left.
GetX(i)+right.
GetX(j))) > 0.001 )
64 result->
SetData(running++, x, y);
76 result->
SetData(running++, x, y);
93 the15percentBorderCash = -
DBL_MAX;
94 the50percentBorderCash = -
DBL_MAX;
100 nPoints=std::max(n, 20);
108 the15percentBorderCash = -
DBL_MAX;
109 the50percentBorderCash = -
DBL_MAX;
118 delete [] theIntegral;
127 if(&right ==
this)
return *
this;
131 totalIntegral = right.totalIntegral;
132 if(right.theIntegral!=0) theIntegral =
new G4double[right.nEntries];
133 for(i=0; i<right.nEntries; i++)
136 if(right.theIntegral!=0) theIntegral[i] = right.theIntegral[i];
138 theManager = right.theManager;
141 Verbose = right.Verbose;
142 the15percentBorderCash = right.the15percentBorderCash;
143 the50percentBorderCash = right.the50percentBorderCash;
144 theHash = right.theHash;
151 if(nEntries == 0)
return 0;
162 for(i=min ; i<nEntries; i++)
165 if(theData[i].
GetX() >= e)
break;
180 if(e<theData[nEntries-1].
GetX())
184 if ( theData[high].
GetX() !=0
187 &&( std::abs( (theData[high].
GetX()-theData[low].
GetX())/theData[high].
GetX() ) < 0.000001 ) )
189 y = theData[low].
GetY();
194 theData[low].
GetX(), theData[high].
GetX(),
195 theData[low].
GetY(), theData[high].
GetY());
200 y=theData[nEntries-1].
GetY();
208 for(
G4int i=0; i<nEntries; i++)
218 void G4ParticleHPVector::Check(
G4int i)
220 if(i>nEntries)
throw G4HadronicException(__FILE__, __LINE__,
"Skipped some index numbers in G4ParticleHPVector");
223 nPoints =
static_cast<G4int>(1.2*nPoints);
225 for (
G4int j=0; j<nEntries; j++) buff[j] = theData[j];
229 if(i==nEntries) nEntries=i+1;
240 G4int s_tmp = 0, n=0, m_tmp=0;
242 G4int a = s_tmp, p = n, t;
257 && std::abs(std::abs(xp-xa)/xa) < 0.0000001
262 active = passive; a=p;
267 active = passive; a=p;
276 anX = passive->
GetXsec(p)-deltaX;
303 G4int count = 0, current = 2, start = 1;
306 aBuff[0] = theData[0];
311 x1=aBuff[count].
GetX();
312 y1=aBuff[count].
GetY();
313 x2=theData[current].
GetX();
314 y2=theData[current].
GetY();
318 for (
G4int j=start; j<current; j++ ) {
320 if ( std::abs( y-theData[j].
GetY() ) > precision*y ) {
321 aBuff[++count] = theData[current-1];
327 for(
G4int j=start; j<current; j++)
329 x = theData[j].
GetX();
330 if(x1-x2 == 0) y = (y2+y1)/2.;
331 else y = theInt.
Lin(x, x1, x2, y1, y2);
332 if (std::abs(y-theData[j].
GetY())>precision*y)
334 aBuff[++count] = theData[current-1];
358 std::vector<G4double>::iterator i;
359 for(i=theBlocked.begin(); i!=theBlocked.end(); i++)
362 if(std::abs(aX-aBlock) < 0.1*MeV)
383 result = theBuffered[0];
384 theBuffered.erase(theBuffered.begin());
389 result = theData[0].
GetX();
395 G4int icounter_max=1024;
399 if ( icounter > icounter_max ) {
400 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
422 G4int jcounter_max=1024;
426 if ( jcounter > jcounter_max ) {
427 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
434 if ( rand < theIntegral[i] )
440 if ( ibin < 0 )
G4cout <<
"TKDB 080807 " << rand <<
G4endl;
446 x1 = theData[ ibin ].
GetX();
452 x1 = theData[ ibin-1 ].
GetX();
455 x2 = theData[ ibin ].
GetX();
456 value = rand * ( x2 - x1 ) + x1;
467 test =(mval*value+bval)/std::max (
GetY( ibin-1 ) ,
GetY ( ibin ) );
474 while(IsBlocked(result));
481 if(the15percentBorderCash>-
DBL_MAX/2.)
return the15percentBorderCash;
485 result = theData[0].
GetX();
486 the15percentBorderCash = result;
498 the15percentBorderCash = result;
502 the15percentBorderCash = result;
509 if(the50percentBorderCash>-
DBL_MAX/2.)
return the50percentBorderCash;
513 result = theData[0].
GetX();
514 the50percentBorderCash = result;
537 y1 = theData[i-1].
GetX();
538 y2 = theData[i].
GetX();
539 result = theLin.
Lin(x, x1, x2, y1, y2);
541 the50percentBorderCash = result;
545 the50percentBorderCash = result;
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 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)