#include <G4ParticleHPArbitaryTab.hh>
Definition at line 45 of file G4ParticleHPArbitaryTab.hh.
◆ G4ParticleHPArbitaryTab()
G4ParticleHPArbitaryTab::G4ParticleHPArbitaryTab |
( |
| ) |
|
|
inline |
◆ ~G4ParticleHPArbitaryTab()
G4ParticleHPArbitaryTab::~G4ParticleHPArbitaryTab |
( |
| ) |
|
|
inline |
◆ GetFractionalProbability()
◆ Init()
void G4ParticleHPArbitaryTab::Init |
( |
std::istream & |
theData | ) |
|
|
inlinevirtual |
Implements G4VParticleHPEDis.
Definition at line 58 of file G4ParticleHPArbitaryTab.hh.
59 {
61 theFractionalProb.
Init(theData, CLHEP::eV);
62 theData >> nDistFunc;
64 theManager.
Init(theData);
66 for(i=0; i<nDistFunc; i++)
67 {
68 theData >> currentEnergy;
69 theDistFunc[i].
SetLabel(currentEnergy*CLHEP::eV);
70 theDistFunc[i].
Init(theData, CLHEP::eV);
72
73
74
75
76
77 }
78
79
80
81
82 for(i=0; i<nDistFunc; i++){
84 theLowThreshold[i]=theDistFunc[i].
GetEnergy(0);
85 theHighThreshold[i]=theDistFunc[i].
GetEnergy(np-1);
86 for(
G4int j=0;j<np-1;j++){
87 if(theDistFunc[i].GetXsec(j+1)>1.e-20){
88 theLowThreshold[i]=theDistFunc[i].
GetEnergy(j);
89 break;
90 }
91 }
92 for(
G4int j=1;j<np;j++){
93 if(theDistFunc[i].GetXsec(j-1)>1.e-20){
94 theHighThreshold[i]=theDistFunc[i].
GetEnergy(j);
95 }
96 }
97 }
98
99 }
void Init(G4int aScheme, G4int aRange)
void IntegrateAndNormalise()
void SetLabel(G4double aLabel)
G4double GetEnergy(G4int i) const
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4int GetVectorLength() const
◆ Sample()
Implements G4VParticleHPEDis.
Definition at line 35 of file G4ParticleHPArbitaryTab.cc.
36 {
38 for(i=0;i<nDistFunc;i++)
39 {
40 if(anEnergy<theDistFunc[i].GetLabel()) break;
41 }
42 G4int low(0), high(0);
43 if(i==nDistFunc)
44 {
45 low = i-2;
46 high = i-1;
47 }
48 else if(i==0)
49 {
50 if(nDistFunc==0)
51 {
52 G4cerr <<
"No distribution functions to sample "
53 <<
"from in G4ParticleHPArbitaryTab::Sample"<<
G4endl;
55 }
56 else
57 {
58 return theDistFunc[0].
Sample();
59 }
60 }
61 else
62 {
63 low = i-1;
64 high = i;
65 }
66
67
68
69
70
71
72
73
74
77 G4double rval=(anEnergy-elow)/(ehigh-elow);
78 G4double eoutlow=theLowThreshold[low]+rval*(theLowThreshold[high]-theLowThreshold[low]);
79 G4double eouthigh=theHighThreshold[low]+rval*(theHighThreshold[high]-theHighThreshold[low]);
82 if(rval<rand){
83 Eout_1=theDistFunc[low].
Sample();
84 Eout_2=eoutlow+(Eout_1-theLowThreshold[low])*(eouthigh-eoutlow)/(theHighThreshold[low]-theLowThreshold[low]);
85 }
86 else{
87 Eout_1=theDistFunc[high].
Sample();
88 Eout_2=eoutlow+(Eout_1-theLowThreshold[high])*(eouthigh-eoutlow)/(theHighThreshold[high]-theLowThreshold[high]);
89 }
90 return Eout_2;
91
92
93 }
G4GLOB_DLL std::ostream G4cerr
The documentation for this class was generated from the following files: