Geant4 10.7.0
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.

45{ delete [] theData;}

Member Function Documentation

◆ Dump()

void G4ParticleHPField::Dump ( )

Definition at line 90 of file G4ParticleHPField.cc.

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

◆ GetEnergy()

G4double G4ParticleHPField::GetEnergy ( G4int  i)
inline

Definition at line 68 of file G4ParticleHPField.hh.

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

◆ GetFieldLength()

G4int G4ParticleHPField::GetFieldLength ( )
inline

Definition at line 75 of file G4ParticleHPField.hh.

75{return nEntries;}

◆ GetPoint()

G4ParticleHPFieldPoint & G4ParticleHPField::GetPoint ( G4int  i)
inline

Definition at line 71 of file G4ParticleHPField.hh.

71{ return theData[i]; }

◆ GetX()

G4double G4ParticleHPField::GetX ( G4int  i)
inline

Definition at line 69 of file G4ParticleHPField.hh.

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

Referenced by GetY().

◆ GetY() [1/2]

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

Definition at line 47 of file G4ParticleHPField.cc.

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

◆ GetY() [2/2]

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

Definition at line 70 of file G4ParticleHPField.hh.

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

◆ InitY()

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

Definition at line 43 of file G4ParticleHPField.hh.

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

◆ SetData()

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

Definition at line 48 of file G4ParticleHPField.hh.

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

◆ SetEnergy()

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

Definition at line 53 of file G4ParticleHPField.hh.

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

◆ SetX()

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

Definition at line 58 of file G4ParticleHPField.hh.

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

◆ SetY()

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

Definition at line 63 of file G4ParticleHPField.hh.

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

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