Geant4  10.02.p03
G4ParticleHPEnergyDistribution Class Reference

#include <G4ParticleHPEnergyDistribution.hh>

Collaboration diagram for G4ParticleHPEnergyDistribution:

Public Member Functions

 G4ParticleHPEnergyDistribution ()
 
 ~G4ParticleHPEnergyDistribution ()
 
void Init (std::istream &theData)
 
G4double Sample (G4double anEnergy, G4int &it)
 

Private Attributes

G4int theNumberOfPartials
 
G4int theRepresentationType
 
G4VParticleHPEDis ** theEnergyDistribution
 

Detailed Description

Definition at line 47 of file G4ParticleHPEnergyDistribution.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPEnergyDistribution()

G4ParticleHPEnergyDistribution::G4ParticleHPEnergyDistribution ( )
inline

◆ ~G4ParticleHPEnergyDistribution()

G4ParticleHPEnergyDistribution::~G4ParticleHPEnergyDistribution ( )
inline

Definition at line 56 of file G4ParticleHPEnergyDistribution.hh.

57  {
58  if(theEnergyDistribution != 0)
59  {
60  for(G4int i=0; i<theNumberOfPartials; i++)
61  {
62  delete theEnergyDistribution[i];
63  }
64  delete [] theEnergyDistribution;
65  }
66  }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

◆ Init()

void G4ParticleHPEnergyDistribution::Init ( std::istream &  theData)
inline

Definition at line 68 of file G4ParticleHPEnergyDistribution.hh.

69  {
70  G4double dummy;
71  theData >> dummy >> theNumberOfPartials;
73  for(G4int i=0; i<theNumberOfPartials; i++)
74  {
75  theData >> theRepresentationType;
76  switch(theRepresentationType)
77  {
78  case 1:
80  break;
81  case 5:
83  break;
84  case 7:
85  theEnergyDistribution[i] = new G4ParticleHPFissionSpectrum;
86  break;
87  case 9:
89  break;
90  case 11:
92  break;
93  case 12:
95  break;
96  }
97  theEnergyDistribution[i]->Init(theData);
98  }
99  }
int G4int
Definition: G4Types.hh:78
virtual void Init(std::istream &theData)=0
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sample()

G4double G4ParticleHPEnergyDistribution::Sample ( G4double  anEnergy,
G4int it 
)
inline

Definition at line 101 of file G4ParticleHPEnergyDistribution.hh.

102  {
103  G4double result = 0;
104  it = 0;
105  if (theNumberOfPartials != 0)
106  {
107  G4double sum=0;
108  G4double * running = new G4double[theNumberOfPartials];
109  running[0] = 0;
110  G4int i;
111  for (i=0; i<theNumberOfPartials; i++)
112  {
113  if (i!=0) running[i]=running[i-1];
114  running[i]+=theEnergyDistribution[i]->GetFractionalProbability(anEnergy);
115  }
116  sum = running[theNumberOfPartials-1];
117  G4double random = G4UniformRand();
118  for(i=0; i<theNumberOfPartials; i++)
119  {
120  it = i;
121  if(running[i]/sum>random) break;
122  }
123  delete [] running;
124  if(it==theNumberOfPartials) it--;
125  result = theEnergyDistribution[it]->Sample(anEnergy);
126  }
127  return result;
128  }
int G4int
Definition: G4Types.hh:78
virtual G4double GetFractionalProbability(G4double anEnergy)=0
virtual G4double Sample(G4double anEnergy)=0
#define G4UniformRand()
Definition: Randomize.hh:97
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ theEnergyDistribution

G4VParticleHPEDis** G4ParticleHPEnergyDistribution::theEnergyDistribution
private

Definition at line 134 of file G4ParticleHPEnergyDistribution.hh.

◆ theNumberOfPartials

G4int G4ParticleHPEnergyDistribution::theNumberOfPartials
private

Definition at line 132 of file G4ParticleHPEnergyDistribution.hh.

◆ theRepresentationType

G4int G4ParticleHPEnergyDistribution::theRepresentationType
private

Definition at line 133 of file G4ParticleHPEnergyDistribution.hh.


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