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

#include <G4NeutronHPEnergyDistribution.hh>

Public Member Functions

 G4NeutronHPEnergyDistribution ()
 
 ~G4NeutronHPEnergyDistribution ()
 
void Init (std::ifstream &theData)
 
G4double Sample (G4double anEnergy, G4int &it)
 

Detailed Description

Definition at line 47 of file G4NeutronHPEnergyDistribution.hh.

Constructor & Destructor Documentation

◆ G4NeutronHPEnergyDistribution()

G4NeutronHPEnergyDistribution::G4NeutronHPEnergyDistribution ( )
inline

Definition at line 50 of file G4NeutronHPEnergyDistribution.hh.

51 {
52 theEnergyDistribution = 0;
53 theNumberOfPartials = 0;
54 theRepresentationType = 0;
55 }

◆ ~G4NeutronHPEnergyDistribution()

G4NeutronHPEnergyDistribution::~G4NeutronHPEnergyDistribution ( )
inline

Definition at line 56 of file G4NeutronHPEnergyDistribution.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:66

Member Function Documentation

◆ Init()

void G4NeutronHPEnergyDistribution::Init ( std::ifstream &  theData)
inline

Definition at line 68 of file G4NeutronHPEnergyDistribution.hh.

69 {
70 G4double dummy;
71 theData >> dummy >> theNumberOfPartials;
72 theEnergyDistribution = new G4VNeutronHPEDis * [theNumberOfPartials];
73 for(G4int i=0; i<theNumberOfPartials; i++)
74 {
75 theData >> theRepresentationType;
76 switch(theRepresentationType)
77 {
78 case 1:
79 theEnergyDistribution[i] = new G4NeutronHPArbitaryTab;
80 break;
81 case 5:
82 theEnergyDistribution[i] = new G4NeutronHPEvapSpectrum;
83 break;
84 case 7:
85 theEnergyDistribution[i] = new G4NeutronHPFissionSpectrum;
86 break;
87 case 9:
88 theEnergyDistribution[i] = new G4NeutronHPSimpleEvapSpectrum;
89 break;
90 case 11:
91 theEnergyDistribution[i] = new G4NeutronHPWattSpectrum;
92 break;
93 case 12:
94 theEnergyDistribution[i] = new G4NeutronHPMadlandNixSpectrum;
95 break;
96 }
97 theEnergyDistribution[i]->Init(theData);
98 }
99 }
double G4double
Definition: G4Types.hh:64
virtual void Init(std::ifstream &theData)=0

Referenced by G4FissionLibrary::Init(), G4NeutronHPFSFissionFS::Init(), G4NeutronHPInelasticCompFS::Init(), G4NeutronHPFissionBaseFS::Init(), and G4NeutronHPInelasticBaseFS::Init().

◆ Sample()

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

Definition at line 101 of file G4NeutronHPEnergyDistribution.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 }
#define G4UniformRand()
Definition: Randomize.hh:53
virtual G4double Sample(G4double anEnergy)=0
virtual G4double GetFractionalProbability(G4double anEnergy)=0

Referenced by G4NeutronHPFissionBaseFS::ApplyYourself(), G4NeutronHPFSFissionFS::ApplyYourself(), G4NeutronHPInelasticBaseFS::BaseApply(), and G4NeutronHPInelasticCompFS::CompositeApply().


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