Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
G4NeutronHPVector.cc File Reference
#include "G4NeutronHPVector.hh"
#include "G4SystemOfUnits.hh"

Go to the source code of this file.

Functions

G4NeutronHPVectoroperator+ (G4NeutronHPVector &left, G4NeutronHPVector &right)
 

Function Documentation

G4NeutronHPVector& operator+ ( G4NeutronHPVector left,
G4NeutronHPVector right 
)

Definition at line 37 of file G4NeutronHPVector.cc.

References G4NeutronHPVector::GetVectorLength(), G4NeutronHPVector::GetX(), G4NeutronHPVector::GetY(), G4NeutronHPVector::SetData(), G4NeutronHPVector::ThinOut(), and test::x.

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