46 G4cout <<
"### G4ExtendedPhysicsVector with undefined G4PhysicsVector " <<
G4endl;
52 nPartialXS = nxsec - 1;
53 dataPartialXS =
new std::vector<std::vector<G4float>* >;
54 dataPartialXS->resize((std::size_t)nPartialXS,
nullptr);
63 for (
auto const & p : *dataPartialXS) {
delete p; }
73 totalData->SetDataLength(dlength);
74 numberOfNodes = totalData->GetVectorLength();
75 if (1 < numberOfNodes)
77 idxmax = numberOfNodes - 2;
83 G4cout <<
"### G4ExtendedPhysicsVector::SetDataLength numberOfNodes="
84 << numberOfNodes <<
" data structure left empty." <<
G4endl;
91 for (
G4int i = 0; i < nPartialXS; ++i)
93 (*dataPartialXS)[i] =
new std::vector<G4float>(numberOfNodes, 0.f);
101 G4bool interpolation = totalData->CheckIndex(e, idx);
106 G4double e1 = totalData->Energy(idx);
107 G4double e2 = totalData->Energy(idx + 1);
108 G4double y2 = (*totalData)[idx + 1];
109 if (e1 > 0.0 && e2 > e1 && y1 > 0.0 && y2 > 0.0)
120 if (idx >= numberOfNodes)
122 if (0 < verboseLevel)
124 G4cout <<
"### G4ExtendedPhysicsVector::PutPartialXSData(..) idx=" << idx
125 <<
" is out of range " << numberOfNodes
134 for (
G4int i = 0; i < nPartialXS; ++i)
137 (*((*dataPartialXS)[i]))[idx] = sum;
143 for (
G4int i = 0; i < nPartialXS; ++i)
145 (*((*dataPartialXS)[i]))[idx] *= sum;
153 std::size_t& idx)
const
155 if (nPartialXS <= 1) {
return 0; }
156 G4bool interpolation = totalData->CheckIndex(e, idx);
158 G4double e1 = totalData->Energy(idx);
162 e2 = totalData->Energy(idx + 1) - e1;
163 if (e2 <= 0.0) { interpolation =
false; }
165 for (
G4int i=0; i < nPartialXS; ++i)
171 xs += (e - e1) * xs2 / e2;
173 if (xs >= rand) {
return i; }
182 std::size_t& idx)
const
184 if (nPartialXS <= 1) {
return 0; }
185 G4bool interpolation = totalData->CheckIndex(e, idx);
187 G4double e1 = totalData->Energy(idx);
188 if (e1 <= 0.0) { interpolation =
false; }
192 e2 = totalData->Energy(idx + 1);
193 if (e2 <= e1) { interpolation =
false; }
196 for (
G4int i = 0; i < nPartialXS; ++i)
199 if (interpolation && xs > 0.0)
207 if (xs >= rand) {
return i; }
215 G4cout <<
"====== Data length " << numberOfNodes <<
" =====" <<
G4endl;
217 for (std::size_t i = 0; i < numberOfNodes; ++i)
219 G4cout << i <<
". " << totalData->Energy(i) / unitE;
220 for (
G4int j = 0; j < nPartialXS; ++j)
222 G4cout <<
" " << (*((*dataPartialXS)[i]))[j];
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
void SetDataLength(G4int dlength)
G4int SampleReactionChannelLogLog(const G4double energy, const G4double rand, std::size_t &lastidx) const
void PutPartialXSData(const std::size_t idx, const G4double *y)
void DumpValues(G4double unitE=1.0, G4double unitV=1.0) const
G4int SampleReactionChannel(const G4double energy, const G4double rand, std::size_t &lastidx) const
G4double LogLogValue(const G4double energy, std::size_t &lastidx) const
G4ExtendedPhysicsVector(G4PhysicsVector *, G4int nxsec=0)
virtual ~G4ExtendedPhysicsVector()