Geant4  10.02.p03
G4ParticleHPField Class Reference

#include <G4ParticleHPField.hh>

Collaboration diagram for G4ParticleHPField:

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

Private Member Functions

void Check (G4int i)
 

Private Attributes

G4ParticleHPFieldPointtheData
 
G4int nEntries
 
G4int nPoints
 

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)
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ ~G4ParticleHPField()

G4ParticleHPField::~G4ParticleHPField ( )

Definition at line 45 of file G4ParticleHPField.cc.

45 { delete [] theData;}
G4ParticleHPFieldPoint * 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:78
G4ParticleHPFieldPoint * theData
Here is the caller graph for this function:

◆ 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  }
G4double GetY(G4int i) const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEnergy()

G4double G4ParticleHPField::GetEnergy ( G4int  i)
inline

Definition at line 68 of file G4ParticleHPField.hh.

68 { return theData[i].GetX(); }
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ GetFieldLength()

G4int G4ParticleHPField::GetFieldLength ( )
inline

Definition at line 75 of file G4ParticleHPField.hh.

75 {return nEntries;}
Here is the call graph for this function:

◆ GetPoint()

G4ParticleHPFieldPoint& G4ParticleHPField::GetPoint ( G4int  i)
inline

Definition at line 71 of file G4ParticleHPField.hh.

71 { return theData[i]; }
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ GetX()

G4double G4ParticleHPField::GetX ( G4int  i)
inline

Definition at line 69 of file G4ParticleHPField.hh.

69 { return theData[i].GetX(); }
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetY() [1/2]

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

Definition at line 70 of file G4ParticleHPField.hh.

70 { return theData[i].GetY(j); }
G4double GetY(G4int i) const
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetY() [2/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_t y2[nxs]
G4double GetY(G4int i) const
Double_t y1[nxs]
Double_t x2[nxs]
G4double GetX(G4int i)
int G4int
Definition: G4Types.hh:78
Double_t y
Double_t x1[nxs]
G4ParticleHPFieldPoint * theData
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ 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  }
Char_t n[5]
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ 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  }
Double_t y
void SetData(G4double e, G4int i, G4double x)
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ 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  }
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ 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  }
G4ParticleHPFieldPoint * theData
Here is the call graph for this function:

◆ 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  }
G4ParticleHPFieldPoint * theData
void SetY(G4int i, G4double x)
Here is the call graph for this function:

Member Data Documentation

◆ nEntries

G4int G4ParticleHPField::nEntries
private

Definition at line 84 of file G4ParticleHPField.hh.

◆ nPoints

G4int G4ParticleHPField::nPoints
private

Definition at line 85 of file G4ParticleHPField.hh.

◆ theData

G4ParticleHPFieldPoint* G4ParticleHPField::theData
private

Definition at line 83 of file G4ParticleHPField.hh.


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