Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPField Class Reference

#include <G4ParticleHPField.hh>

Public Member Functions

 G4ParticleHPField ()
 
 ~G4ParticleHPField ()
 
void InitY (G4int i, G4int n)
 
void SetData (G4int i, G4double x, G4int j, G4double y)
 
void SetEnergy (G4int i, G4double e)
 
void SetX (G4int i, G4double e)
 
void SetY (G4int i, G4int j, G4double x)
 
G4double GetEnergy (G4int i)
 
G4double GetX (G4int i)
 
G4double GetY (G4int i, G4int j)
 
G4ParticleHPFieldPointGetPoint (G4int i)
 
G4double GetY (G4double e, G4int j)
 
G4int GetFieldLength ()
 
void Dump ()
 

Detailed Description

Definition at line 35 of file G4ParticleHPField.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPField()

G4ParticleHPField::G4ParticleHPField ( )

Definition at line 37 of file G4ParticleHPField.cc.

38{
39 theData = new G4ParticleHPFieldPoint[100];
40 nPoints = 100;
41 nEntries = 0;
42 theData->SetData(0, 0, 0);
43}
void SetData(G4double e, G4int i, G4double x)

◆ ~G4ParticleHPField()

G4ParticleHPField::~G4ParticleHPField ( )

Definition at line 45 of file G4ParticleHPField.cc.

46{
47 delete[] theData;
48}

Member Function Documentation

◆ Dump()

void G4ParticleHPField::Dump ( )

Definition at line 91 of file G4ParticleHPField.cc.

92{
93 G4cout << nEntries << G4endl;
94 for (G4int i = 0; i < nEntries; ++i) {
95 G4cout << theData[i].GetX() << " ";
96 for (G4int j = 0; j < theData[i].GetDepth(); ++j) {
97 G4cout << theData[i].GetY(j) << " ";
98 }
99 G4cout << G4endl;
100 }
101}
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4double GetY(G4int i) const

◆ GetEnergy()

G4double G4ParticleHPField::GetEnergy ( G4int i)
inline

Definition at line 67 of file G4ParticleHPField.hh.

67{ return theData[i].GetX(); }

◆ GetFieldLength()

G4int G4ParticleHPField::GetFieldLength ( )
inline

Definition at line 74 of file G4ParticleHPField.hh.

74{ return nEntries; }

◆ GetPoint()

G4ParticleHPFieldPoint & G4ParticleHPField::GetPoint ( G4int i)
inline

Definition at line 70 of file G4ParticleHPField.hh.

70{ return theData[i]; }

◆ GetX()

G4double G4ParticleHPField::GetX ( G4int i)
inline

Definition at line 68 of file G4ParticleHPField.hh.

68{ return theData[i].GetX(); }

Referenced by GetY().

◆ GetY() [1/2]

G4double G4ParticleHPField::GetY ( G4double e,
G4int j )

Definition at line 50 of file G4ParticleHPField.cc.

51{
52 G4int low = 0;
53 G4int high = 0;
54 G4int i;
55 for (i = 1; i < nEntries / 10; i++) {
56 if (theData[10 * i].GetX() > e) break;
57 }
58 if (i == (nEntries / 10)) {
59 i = 10 * i;
60 while (i < nEntries) // Loop checking, 11.05.2015, T. Koi
61 {
62 if (theData[i++].GetX() > e) break;
63 }
64 if (i == nEntries) {
65 low = nEntries - 1;
66 high = nEntries - 2;
67 }
68 else {
69 low = i - 1;
70 high = i;
71 }
72 }
73 else {
74 for (G4int jj = 0; jj < 10; jj++) {
75 if (theData[i].GetX() < e) break;
76 i--;
77 }
78 low = i;
79 high = i + 1;
80 }
81 G4double x1, x2, y1, y2, x, y;
82 x = e;
83 x1 = theData[low].GetX();
84 x2 = theData[high].GetX();
85 y1 = theData[low].GetY(j);
86 y2 = theData[high].GetY(j);
87 y = x * (y2 - y1) / (x2 - x1);
88 return y += y2 - x2 * (y2 - y1) / (x2 - x1);
89}
double G4double
Definition G4Types.hh:83
G4double GetX(G4int i)

◆ GetY() [2/2]

G4double G4ParticleHPField::GetY ( G4int i,
G4int j )
inline

Definition at line 69 of file G4ParticleHPField.hh.

69{ return theData[i].GetY(j); }

◆ InitY()

void G4ParticleHPField::InitY ( G4int i,
G4int n )
inline

Definition at line 42 of file G4ParticleHPField.hh.

43 {
44 Check(i);
45 theData[i].InitY(n);
46 }

◆ SetData()

void G4ParticleHPField::SetData ( G4int i,
G4double x,
G4int j,
G4double y )
inline

Definition at line 47 of file G4ParticleHPField.hh.

48 {
49 Check(i);
50 theData[i].SetData(x, j, y);
51 }

◆ SetEnergy()

void G4ParticleHPField::SetEnergy ( G4int i,
G4double e )
inline

Definition at line 52 of file G4ParticleHPField.hh.

53 {
54 Check(i);
55 theData[i].SetX(e);
56 }

◆ SetX()

void G4ParticleHPField::SetX ( G4int i,
G4double e )
inline

Definition at line 57 of file G4ParticleHPField.hh.

58 {
59 Check(i);
60 theData[i].SetX(e);
61 }

◆ SetY()

void G4ParticleHPField::SetY ( G4int i,
G4int j,
G4double x )
inline

Definition at line 62 of file G4ParticleHPField.hh.

63 {
64 Check(i);
65 theData[i].SetY(j, x);
66 }
void SetY(G4int i, G4double x)

The documentation for this class was generated from the following files: