Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4ParticleHPField Class Reference

#include <G4ParticleHPField.hh>

Public Member Functions

void Dump ()
 
 G4ParticleHPField ()
 
G4double GetEnergy (G4int i)
 
G4int GetFieldLength ()
 
G4ParticleHPFieldPointGetPoint (G4int i)
 
G4double GetX (G4int i)
 
G4double GetY (G4double e, G4int j)
 
G4double GetY (G4int i, G4int j)
 
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)
 
 ~G4ParticleHPField ()
 

Private Member Functions

void Check (G4int i)
 

Private Attributes

G4int nEntries
 
G4int nPoints
 
G4ParticleHPFieldPointtheData
 

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 {
40 nPoints=100;
41 nEntries=0;
42 theData->SetData(0,0,0);
43 }
void SetData(G4double e, G4int i, G4double x)
G4ParticleHPFieldPoint * theData

References nEntries, nPoints, G4ParticleHPFieldPoint::SetData(), and theData.

◆ ~G4ParticleHPField()

G4ParticleHPField::~G4ParticleHPField ( )

Definition at line 45 of file G4ParticleHPField.cc.

45{ delete [] theData;}

References theData.

Member Function Documentation

◆ Check()

void G4ParticleHPField::Check ( G4int  i)
private

Definition at line 104 of file G4ParticleHPField.cc.

105 {
106 if(i>nEntries) throw G4HadronicException(__FILE__, __LINE__, "Skipped some index numbers in G4ParticleHPField");
107 if(i==nPoints)
108 {
109 nPoints += 50;
111// G4cout << "copying 1"<<G4endl;
112 for (G4int j=0; j<nEntries; j++)
113 {
114 buff[j] = theData[j];
115 }
116// G4cout << "copying 2"<<G4endl;
117 delete [] theData;
118 theData = buff;
119 }
120 if(i==nEntries) nEntries=i+1;
121 }
int G4int
Definition: G4Types.hh:85

References nEntries, nPoints, and theData.

Referenced by InitY(), SetData(), SetEnergy(), SetX(), and SetY().

◆ Dump()

void G4ParticleHPField::Dump ( )

Definition at line 90 of file G4ParticleHPField.cc.

91 {
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 }
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4double GetY(G4int i) const

References G4cout, G4endl, G4ParticleHPFieldPoint::GetDepth(), G4ParticleHPFieldPoint::GetX(), G4ParticleHPFieldPoint::GetY(), nEntries, and theData.

◆ GetEnergy()

G4double G4ParticleHPField::GetEnergy ( G4int  i)
inline

Definition at line 68 of file G4ParticleHPField.hh.

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

References G4ParticleHPFieldPoint::GetX(), and theData.

◆ GetFieldLength()

G4int G4ParticleHPField::GetFieldLength ( )
inline

Definition at line 75 of file G4ParticleHPField.hh.

75{return nEntries;}

References nEntries.

◆ GetPoint()

G4ParticleHPFieldPoint & G4ParticleHPField::GetPoint ( G4int  i)
inline

Definition at line 71 of file G4ParticleHPField.hh.

71{ return theData[i]; }

References theData.

◆ GetX()

G4double G4ParticleHPField::GetX ( G4int  i)
inline

Definition at line 69 of file G4ParticleHPField.hh.

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

References G4ParticleHPFieldPoint::GetX(), and theData.

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)

References G4ParticleHPFieldPoint::GetX(), GetX(), G4ParticleHPFieldPoint::GetY(), nEntries, and theData.

◆ 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); }

References G4ParticleHPFieldPoint::GetY(), and theData.

◆ InitY()

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

◆ 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 }

References Check(), G4ParticleHPFieldPoint::SetData(), and theData.

◆ 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 }

References Check(), G4ParticleHPFieldPoint::SetX(), and theData.

◆ 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 }

References Check(), G4ParticleHPFieldPoint::SetX(), and theData.

◆ 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)

References Check(), G4ParticleHPFieldPoint::SetY(), and theData.

Field Documentation

◆ nEntries

G4int G4ParticleHPField::nEntries
private

Definition at line 84 of file G4ParticleHPField.hh.

Referenced by Check(), Dump(), G4ParticleHPField(), GetFieldLength(), and GetY().

◆ nPoints

G4int G4ParticleHPField::nPoints
private

Definition at line 85 of file G4ParticleHPField.hh.

Referenced by Check(), and G4ParticleHPField().

◆ theData

G4ParticleHPFieldPoint* G4ParticleHPField::theData
private

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