Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleHPVector.cc File Reference
#include "G4ParticleHPVector.hh"
#include "G4SystemOfUnits.hh"
#include "G4Threading.hh"
Include dependency graph for G4ParticleHPVector.cc:

Go to the source code of this file.

Functions

G4ParticleHPVectoroperator+ (G4ParticleHPVector &left, G4ParticleHPVector &right)
 

Function Documentation

G4ParticleHPVector& operator+ ( G4ParticleHPVector left,
G4ParticleHPVector right 
)

Definition at line 40 of file G4ParticleHPVector.cc.

41  {
43  G4int j=0;
44  G4double x;
45  G4double y;
46  G4int running = 0;
47  for(G4int i=0; i<left.GetVectorLength(); i++)
48  {
49  while(j<right.GetVectorLength()) // Loop checking, 11.05.2015, T. Koi
50  {
51  if(right.GetX(j)<left.GetX(i)*1.001)
52  {
53  x = right.GetX(j);
54  y = right.GetY(j)+left.GetY(x);
55  result->SetData(running++, x, y);
56  j++;
57  }
58  //else if(std::abs((right.GetX(j)-left.GetX(i))/(left.GetX(i)+right.GetX(j)))>0.001)
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 )
61  {
62  x = left.GetX(i);
63  y = left.GetY(i)+right.GetY(x);
64  result->SetData(running++, x, y);
65  break;
66  }
67  else
68  {
69  break;
70  }
71  }
72  if(j==right.GetVectorLength())
73  {
74  x = left.GetX(i);
75  y = left.GetY(i)+right.GetY(x);
76  result->SetData(running++, x, y);
77  }
78  }
79  result->ThinOut(0.02);
80  return *result;
81  }
G4double G4ParticleHPJENDLHEData::G4double result
G4int GetVectorLength() const
void SetData(G4int i, G4double x, G4double y)
int G4int
Definition: G4Types.hh:78
G4double GetX(G4int i) const
G4double GetY(G4double x)
double G4double
Definition: G4Types.hh:76
void ThinOut(G4double precision)

Here is the call graph for this function: