#include "G4NeutronHPVector.hh"
#include "G4SystemOfUnits.hh"
Go to the source code of this file.
Functions | |
G4NeutronHPVector & | operator+ (G4NeutronHPVector &left, G4NeutronHPVector &right) |
G4NeutronHPVector& operator+ | ( | G4NeutronHPVector & | left, | |
G4NeutronHPVector & | right | |||
) |
Definition at line 37 of file G4NeutronHPVector.cc.
References G4NeutronHPVector::GetVectorLength(), G4NeutronHPVector::GetX(), G4NeutronHPVector::GetY(), G4NeutronHPVector::SetData(), and G4NeutronHPVector::ThinOut().
00038 { 00039 G4NeutronHPVector * result = new G4NeutronHPVector; 00040 G4int j=0; 00041 G4double x; 00042 G4double y; 00043 G4int running = 0; 00044 for(G4int i=0; i<left.GetVectorLength(); i++) 00045 { 00046 while(j<right.GetVectorLength()) 00047 { 00048 if(right.GetX(j)<left.GetX(i)*1.001) 00049 { 00050 x = right.GetX(j); 00051 y = right.GetY(j)+left.GetY(x); 00052 result->SetData(running++, x, y); 00053 j++; 00054 } 00055 //else if(std::abs((right.GetX(j)-left.GetX(i))/(left.GetX(i)+right.GetX(j)))>0.001) 00056 else if( left.GetX(i)+right.GetX(j) == 0 00057 || std::abs((right.GetX(j)-left.GetX(i))/(left.GetX(i)+right.GetX(j))) > 0.001 ) 00058 { 00059 x = left.GetX(i); 00060 y = left.GetY(i)+right.GetY(x); 00061 result->SetData(running++, x, y); 00062 break; 00063 } 00064 else 00065 { 00066 break; 00067 } 00068 } 00069 if(j==right.GetVectorLength()) 00070 { 00071 x = left.GetX(i); 00072 y = left.GetY(i)+right.GetY(x); 00073 result->SetData(running++, x, y); 00074 } 00075 } 00076 result->ThinOut(0.02); 00077 return *result; 00078 }