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

#include <G4ParticleHPList.hh>

Public Member Functions

void Dump ()
 
 G4ParticleHPList ()
 
G4double GetLabel ()
 
G4int GetListLength ()
 
G4double GetValue (G4int i)
 
void Init (std::istream &aDataFile, G4double unit=1.)
 
void Init (std::istream &aDataFile, G4int nPar, G4double unit=1.)
 
void SetLabel (G4double aLabel)
 
void SetValue (G4int i, G4double y)
 
 ~G4ParticleHPList ()
 

Private Member Functions

void Check (G4int i)
 

Private Attributes

G4int nEntries
 
G4int nPoints
 
G4doubletheData
 
G4double theLabel
 

Detailed Description

Definition at line 36 of file G4ParticleHPList.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPList()

G4ParticleHPList::G4ParticleHPList ( )
inline

Definition at line 40 of file G4ParticleHPList.hh.

41 {
42 theData = new G4double[2];
43 nPoints=2;
44 nEntries=0;
45 theLabel=0.0;
46 }
double G4double
Definition: G4Types.hh:83

References nEntries, nPoints, theData, and theLabel.

◆ ~G4ParticleHPList()

G4ParticleHPList::~G4ParticleHPList ( )
inline

Definition at line 48 of file G4ParticleHPList.hh.

49 {
50 delete [] theData;
51 }

References theData.

Member Function Documentation

◆ Check()

void G4ParticleHPList::Check ( G4int  i)
private

Definition at line 36 of file G4ParticleHPList.cc.

37 {
38 if(i<0)
39 {
40 throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPList::Check(G4int) called with negative index");
41 }
42 if(i>nEntries) throw G4HadronicException(__FILE__, __LINE__, "Skipped some index numbers in G4ParticleHPList");
43 if(i==nPoints)
44 {
45 nPoints = static_cast<G4int>(1.5*nPoints);
46 G4double * buff = new G4double[nPoints];
47 for (G4int j=0; j<nEntries; j++) buff[j] = theData[j];
48 delete [] theData;
49 theData = buff;
50 }
51 if(i==nEntries) nEntries++;
52 }
int G4int
Definition: G4Types.hh:85

References nEntries, nPoints, and theData.

Referenced by SetValue().

◆ Dump()

void G4ParticleHPList::Dump ( )

Definition at line 92 of file G4ParticleHPList.cc.

93{
94 //store orginal precision
95 std::ios::fmtflags oldform = G4cout.flags();
96 G4cout << std::setprecision(7) << std::setw(9) << theLabel << " " << theData[0] << " " << theData[1] << G4endl;
97 //restore orginal precision
98 G4cout.flags( oldform );
99}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

References G4cout, G4endl, theData, and theLabel.

◆ GetLabel()

G4double G4ParticleHPList::GetLabel ( )
inline

◆ GetListLength()

G4int G4ParticleHPList::GetListLength ( )
inline

Definition at line 60 of file G4ParticleHPList.hh.

60{return nEntries;}

References nEntries.

Referenced by GetValue().

◆ GetValue()

G4double G4ParticleHPList::GetValue ( G4int  i)

Definition at line 77 of file G4ParticleHPList.cc.

78 {
79// G4cout << "TestList "<<i<<" "<<nEntries<<G4endl;
80 if(nEntries<0)
81 {
82// G4cout <<nPoints<<" "<<nEntries<<" "<<theData<<G4endl;
83// for(G4int ii=0; ii<2; ii++) G4cout << theData[ii]<<" ";
84// G4cout << G4endl;
85 }
86 if (i<0) i=0;
87 if(i>=GetListLength()) i=GetListLength()-1;
88 return theData[i];
89 }

References GetListLength(), nEntries, and theData.

Referenced by G4ParticleHPContAngularPar::BuildByInterpolation(), G4ParticleHPContAngularPar::G4ParticleHPContAngularPar(), G4ParticleHPParticleYield::GetDecayConstant(), and G4ParticleHPContAngularPar::Sample().

◆ Init() [1/2]

void G4ParticleHPList::Init ( std::istream &  aDataFile,
G4double  unit = 1. 
)

Definition at line 65 of file G4ParticleHPList.cc.

66 {
67 G4int total, i;
68 aDataFile >> total;
69 G4double y;
70 for (i=0;i<total;i++)
71 {
72 aDataFile >>y;
73 SetValue(i,y*unit);
74 }
75 }
void SetValue(G4int i, G4double y)
G4double total(Particle const *const p1, Particle const *const p2)

References SetValue(), and G4INCL::CrossSections::total().

◆ Init() [2/2]

void G4ParticleHPList::Init ( std::istream &  aDataFile,
G4int  nPar,
G4double  unit = 1. 
)

Definition at line 54 of file G4ParticleHPList.cc.

55 {
56 G4int i;
57 G4double y;
58 for (i=0; i<nPar; i++)
59 {
60 aDataFile >> y;
61 SetValue(i,y*unit);
62 }
63 }

References SetValue().

Referenced by G4ParticleHPContAngularPar::Init(), and G4ParticleHPParticleYield::InitDelayed().

◆ SetLabel()

void G4ParticleHPList::SetLabel ( G4double  aLabel)
inline

◆ SetValue()

void G4ParticleHPList::SetValue ( G4int  i,
G4double  y 
)
inline

Field Documentation

◆ nEntries

G4int G4ParticleHPList::nEntries
private

Definition at line 79 of file G4ParticleHPList.hh.

Referenced by Check(), G4ParticleHPList(), GetListLength(), and GetValue().

◆ nPoints

G4int G4ParticleHPList::nPoints
private

Definition at line 80 of file G4ParticleHPList.hh.

Referenced by Check(), and G4ParticleHPList().

◆ theData

G4double* G4ParticleHPList::theData
private

Definition at line 78 of file G4ParticleHPList.hh.

Referenced by Check(), Dump(), G4ParticleHPList(), GetValue(), SetValue(), and ~G4ParticleHPList().

◆ theLabel

G4double G4ParticleHPList::theLabel
private

Definition at line 76 of file G4ParticleHPList.hh.

Referenced by Dump(), G4ParticleHPList(), GetLabel(), and SetLabel().


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