Geant4  10.02.p03
G4ParticleHPList Class Reference

#include <G4ParticleHPList.hh>

Collaboration diagram for G4ParticleHPList:

Public Member Functions

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

Private Member Functions

void Check (G4int i)
 

Private Attributes

G4double theLabel
 
G4doubletheData
 
G4int nEntries
 
G4int nPoints
 

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:76

◆ ~G4ParticleHPList()

G4ParticleHPList::~G4ParticleHPList ( )
inline

Definition at line 48 of file G4ParticleHPList.hh.

49  {
50  delete [] theData;
51  }

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:78
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ 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 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

◆ GetLabel()

G4double G4ParticleHPList::GetLabel ( )
inline

Definition at line 70 of file G4ParticleHPList.hh.

70 { return theLabel; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetListLength()

G4int G4ParticleHPList::GetListLength ( )
inline

Definition at line 60 of file G4ParticleHPList.hh.

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

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

◆ Init() [1/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  }
int G4int
Definition: G4Types.hh:78
Double_t y
void SetValue(G4int i, G4double y)
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init() [2/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  }
int G4int
Definition: G4Types.hh:78
Double_t y
void SetValue(G4int i, G4double y)
G4double total(Particle const *const p1, Particle const *const p2)
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ SetLabel()

void G4ParticleHPList::SetLabel ( G4double  aLabel)
inline

Definition at line 68 of file G4ParticleHPList.hh.

68 { theLabel = aLabel; }
Here is the caller graph for this function:

◆ SetValue()

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

Definition at line 53 of file G4ParticleHPList.hh.

54  {
55  Check(i);
56  theData[i]=y;
57  }
Double_t y
void Check(G4int i)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ nEntries

G4int G4ParticleHPList::nEntries
private

Definition at line 79 of file G4ParticleHPList.hh.

◆ nPoints

G4int G4ParticleHPList::nPoints
private

Definition at line 80 of file G4ParticleHPList.hh.

◆ theData

G4double* G4ParticleHPList::theData
private

Definition at line 78 of file G4ParticleHPList.hh.

◆ theLabel

G4double G4ParticleHPList::theLabel
private

Definition at line 76 of file G4ParticleHPList.hh.


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