Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPVector.cc File Reference
#include "G4ParticleHPVector.hh"
#include "G4SystemOfUnits.hh"
#include "G4Threading.hh"

Go to the source code of this file.

Functions

G4ParticleHPVectoroperator+ (G4ParticleHPVector &left, G4ParticleHPVector &right)
 

Function Documentation

◆ operator+()

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 }
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
void SetData(G4int i, G4double x, G4double y)
void ThinOut(G4double precision)
G4double GetY(G4double x)
G4double GetX(G4int i) const
G4int GetVectorLength() const