29 #ifndef G4ParticleHPEnergyDistribution_h
30 #define G4ParticleHPEnergyDistribution_h 1
52 theEnergyDistribution = 0;
53 theNumberOfPartials = 0;
54 theRepresentationType = 0;
58 if(theEnergyDistribution != 0)
60 for(
G4int i=0; i<theNumberOfPartials; i++)
62 delete theEnergyDistribution[i];
64 delete [] theEnergyDistribution;
68 inline void Init(std::istream & theData)
71 theData >> dummy >> theNumberOfPartials;
73 for(
G4int i=0; i<theNumberOfPartials; i++)
75 theData >> theRepresentationType;
76 switch(theRepresentationType)
97 theEnergyDistribution[i]->
Init(theData);
105 if (theNumberOfPartials != 0)
111 for (i=0; i<theNumberOfPartials; i++)
113 if (i!=0) running[i]=running[i-1];
116 sum = running[theNumberOfPartials-1];
118 for(i=0; i<theNumberOfPartials; i++)
121 if(running[i]/sum>random)
break;
124 if(it==theNumberOfPartials) it--;
125 result = theEnergyDistribution[it]->
Sample(anEnergy);
132 G4int theNumberOfPartials;
133 G4int theRepresentationType;
G4double G4ParticleHPJENDLHEData::G4double result
G4ParticleHPEnergyDistribution()
void Init(std::istream &theData)
G4double Sample(G4double anEnergy, G4int &it)
virtual G4double GetFractionalProbability(G4double anEnergy)=0
~G4ParticleHPEnergyDistribution()
virtual G4double Sample(G4double anEnergy)=0
virtual void Init(std::istream &theData)=0