#include <G4PenelopeSamplingData.hh>
Definition at line 49 of file G4PenelopeSamplingData.hh.
◆ G4PenelopeSamplingData()
G4PenelopeSamplingData::G4PenelopeSamplingData |
( |
G4int |
npoints = 150 | ) |
|
Definition at line 37 of file G4PenelopeSamplingData.cc.
37 :
38 np(nPoints)
39{
40
45 ITTL = new std::vector<size_t>;
46 ITTU = new std::vector<size_t>;
47}
◆ ~G4PenelopeSamplingData()
G4PenelopeSamplingData::~G4PenelopeSamplingData |
( |
| ) |
|
Definition at line 50 of file G4PenelopeSamplingData.cc.
51{
52 if (x) delete x;
53 if (pac) delete pac;
54 if (a) delete a;
55 if (b) delete b;
56 if (ITTL) delete ITTL;
57 if (ITTU) delete ITTU;
58}
◆ AddPoint()
Definition at line 97 of file G4PenelopeSamplingData.cc.
99{
100 x->push_back(x0);
101 pac->push_back(pac0);
102 a->push_back(a0);
103 b->push_back(b0);
104 ITTL->push_back(ITTL0);
105 ITTU->push_back(ITTU0);
106
107
109
110 if (nOfPoints > ((size_t)np))
111 {
112 G4cout <<
"G4PenelopeSamplingData::AddPoint() " <<
G4endl;
113 G4cout <<
"WARNING: Up to now there are " << nOfPoints <<
" points in the table" <<
G4endl;
114 G4cout <<
"while the anticipated (declared) number is " << np <<
G4endl;
115 }
116 return;
117}
G4DLLIMPORT std::ostream G4cout
size_t GetNumberOfStoredPoints()
◆ Clear()
void G4PenelopeSamplingData::Clear |
( |
| ) |
|
Definition at line 79 of file G4PenelopeSamplingData.cc.
80{
81 if (x) delete x;
82 if (pac) delete pac;
83 if (a) delete a;
84 if (b) delete b;
85 if (ITTL) delete ITTL;
86 if (ITTU) delete ITTU;
87
92 ITTL = new std::vector<size_t>;
93 ITTU = new std::vector<size_t>;
94}
◆ DumpTable()
void G4PenelopeSamplingData::DumpTable |
( |
| ) |
|
Definition at line 120 of file G4PenelopeSamplingData.cc.
121{
122
123 G4cout <<
"*************************************************************************" <<
G4endl;
125 G4cout <<
"*************************************************************************" <<
G4endl;
127 {
128 G4cout << i <<
" " << (*x)[i] <<
" " << (*pac)[i] <<
" " << (*a)[i] <<
" " <<
129 (*b)[i] <<
" " << (*ITTL)[i] <<
" " << (*ITTU)[i] <<
G4endl;
130 }
131 G4cout <<
"*************************************************************************" <<
G4endl;
132}
◆ GetA()
G4double G4PenelopeSamplingData::GetA |
( |
size_t |
index | ) |
|
Definition at line 153 of file G4PenelopeSamplingData.cc.
154{
155 if (index < a->size())
156 return (*a)[index];
157 else
158 return 0;
159}
◆ GetB()
G4double G4PenelopeSamplingData::GetB |
( |
size_t |
index | ) |
|
Definition at line 162 of file G4PenelopeSamplingData.cc.
163{
164 if (index < b->size())
165 return (*b)[index];
166 else
167 return 0;
168}
◆ GetNumberOfStoredPoints()
size_t G4PenelopeSamplingData::GetNumberOfStoredPoints |
( |
| ) |
|
Definition at line 61 of file G4PenelopeSamplingData.cc.
62{
63 size_t points = x->size();
64
65
66 if (pac->size() != points || a->size() != points ||
67 b->size() != points || ITTL->size() != points ||
68 ITTU->size() != points)
69 {
71 ed <<
"Data vectors look to have different dimensions !" <<
G4endl;
72 G4Exception(
"G4PenelopeSamplingData::GetNumberOfStoredPoints()",
"em2040",
74 }
75 return points;
76}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription
Referenced by AddPoint(), DumpTable(), G4PenelopeRayleighModel::SampleSecondaries(), and SampleValue().
◆ GetPAC()
G4double G4PenelopeSamplingData::GetPAC |
( |
size_t |
index | ) |
|
Definition at line 144 of file G4PenelopeSamplingData.cc.
145{
146 if (index < pac->size())
147 return (*pac)[index];
148 else
149 return 0;
150}
◆ GetX()
G4double G4PenelopeSamplingData::GetX |
( |
size_t |
index | ) |
|
◆ SampleValue()
Definition at line 171 of file G4PenelopeSamplingData.cc.
172{
173
174
176
177 size_t itn = (size_t) (maxRand*(points-1));
178 size_t i = (*ITTL)[itn];
179 size_t j = (*ITTU)[itn];
180
181 while ((j-i) > 1)
182 {
183 size_t k = (i+j)/2;
184 if (maxRand > (*pac)[k])
185 i = k;
186 else
187 j = k;
188 }
189
190
192
194 if (rr > 1e-16)
195 {
197 result = (*x)[i]+
198 ((1.0+(*a)[i]+(*b)[i])*d*rr/
199 (d*d+((*a)[i]*d+(*b)[i]*rr)*rr))*((*x)[i+1]-(*x)[i]);
200 }
201 else
202 result = (*x)[i];
203
204 return result;
205}
Referenced by G4PenelopeRayleighModel::SampleSecondaries().
The documentation for this class was generated from the following files: