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

#include <G4NeutronHPField.hh>

Public Member Functions

 G4NeutronHPField ()
 
 ~G4NeutronHPField ()
 
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)
 
G4NeutronHPFieldPointGetPoint (G4int i)
 
G4double GetY (G4double e, G4int j)
 
G4int GetFieldLength ()
 
void Dump ()
 

Detailed Description

Definition at line 35 of file G4NeutronHPField.hh.

Constructor & Destructor Documentation

◆ G4NeutronHPField()

G4NeutronHPField::G4NeutronHPField ( )

Definition at line 35 of file G4NeutronHPField.cc.

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

◆ ~G4NeutronHPField()

G4NeutronHPField::~G4NeutronHPField ( )

Definition at line 43 of file G4NeutronHPField.cc.

43{ delete [] theData;}

Member Function Documentation

◆ Dump()

void G4NeutronHPField::Dump ( )

Definition at line 88 of file G4NeutronHPField.cc.

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

◆ GetEnergy()

G4double G4NeutronHPField::GetEnergy ( G4int  i)
inline

Definition at line 68 of file G4NeutronHPField.hh.

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

◆ GetFieldLength()

G4int G4NeutronHPField::GetFieldLength ( )
inline

Definition at line 75 of file G4NeutronHPField.hh.

75{return nEntries;}

◆ GetPoint()

G4NeutronHPFieldPoint & G4NeutronHPField::GetPoint ( G4int  i)
inline

Definition at line 71 of file G4NeutronHPField.hh.

71{ return theData[i]; }

◆ GetX()

G4double G4NeutronHPField::GetX ( G4int  i)
inline

Definition at line 69 of file G4NeutronHPField.hh.

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

Referenced by GetY().

◆ GetY() [1/2]

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

Definition at line 45 of file G4NeutronHPField.cc.

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

◆ GetY() [2/2]

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

Definition at line 70 of file G4NeutronHPField.hh.

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

◆ InitY()

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

Definition at line 43 of file G4NeutronHPField.hh.

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

◆ SetData()

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

Definition at line 48 of file G4NeutronHPField.hh.

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

◆ SetEnergy()

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

Definition at line 53 of file G4NeutronHPField.hh.

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

◆ SetX()

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

Definition at line 58 of file G4NeutronHPField.hh.

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

◆ SetY()

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

Definition at line 63 of file G4NeutronHPField.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: