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