28 #ifndef G4NeutronHPEnergyDistribution_h
29 #define G4NeutronHPEnergyDistribution_h 1
51 theEnergyDistribution = 0;
52 theNumberOfPartials = 0;
53 theRepresentationType = 0;
57 if(theEnergyDistribution != 0)
59 for(
G4int i=0; i<theNumberOfPartials; i++)
61 delete theEnergyDistribution[i];
63 delete [] theEnergyDistribution;
67 inline void Init(std::istream & theData)
70 theData >> dummy >> theNumberOfPartials;
72 for(
G4int i=0; i<theNumberOfPartials; i++)
74 theData >> theRepresentationType;
75 switch(theRepresentationType)
96 theEnergyDistribution[i]->
Init(theData);
104 if (theNumberOfPartials != 0)
110 for (i=0; i<theNumberOfPartials; i++)
112 if (i!=0) running[i]=running[i-1];
115 sum = running[theNumberOfPartials-1];
117 for(i=0; i<theNumberOfPartials; i++)
120 if(running[i]/sum>random)
break;
123 if(it==theNumberOfPartials) it--;
124 result = theEnergyDistribution[it]->
Sample(anEnergy);
131 G4int theNumberOfPartials;
132 G4int theRepresentationType;
G4NeutronHPEnergyDistribution()
G4double G4NeutronHPJENDLHEData::G4double result
G4double Sample(G4double anEnergy, G4int &it)
virtual void Init(std::istream &theData)=0
virtual G4double GetFractionalProbability(G4double anEnergy)=0
virtual G4double Sample(G4double anEnergy)=0
void Init(std::istream &theData)
~G4NeutronHPEnergyDistribution()