60 if (aStep ==
nullptr)
return false;
64#ifdef VERBOSE_ENERSPLIT
74 return (
G4int)theEnergies.size();
77 theEnergies.push_back(edep);
78 return (
G4int)theEnergies.size();
81 if (thePhantomParam ==
nullptr) GetPhantomParam(
true);
84 std::vector<std::pair<G4int, G4double>> rnsl =
89 G4double kinEnergyPre = kinEnergyPreOrig;
94 for (ii = 0; ii < rnsl.size(); ++ii) {
97#ifdef VERBOSE_ENERSPLIT
99 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter1 step length geom "
104#ifdef VERBOSE_ENERSPLIT
106 G4cout <<
"G4EnergySplitter RN: step length geom TOTAL " << slSum <<
" true TOTAL "
107 << stepLength <<
" ratio " << stepLength / slSum <<
" Energy "
114 if (theNIterations == 0) {
115 for (ii = 0; ii < rnsl.size(); ++ii) {
117 G4double edepStep = edep * sl / slSum;
119#ifdef VERBOSE_ENERSPLIT
121 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" edep " << edepStep <<
G4endl;
124 theEnergies.push_back(edepStep);
129#ifdef VERBOSE_ENERSPLIT
133 for (ii = 0; ii < rnsl.size(); ++ii) {
137 for (ii = 0; ii < rnsl.size(); ii++) {
138 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes " << ii
139 <<
" RN: iter0 corrected energy lost " << edep * rnsl[ii].second / slSum <<
G4endl;
144 G4double slRatio = stepLength / slSum;
145#ifdef VERBOSE_ENERSPLIT
147 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio
154 std::vector<G4double> stepLengths;
155 for (
G4int iiter = 1; iiter <= theNIterations; ++iiter) {
159 for (ii = 0; ii < rnsl.size(); ++ii) {
161 stepLengths.push_back(sl * slRatio);
162#ifdef VERBOSE_ENERSPLIT
164 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
165 <<
" corrected step length " << sl * slRatio <<
G4endl;
169 for (ii = 0; ii < rnsl.size(); ++ii) {
172 if (kinEnergyPre > 0.) {
173 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
175 G4double elost = stepLengths[ii] * dEdx;
177#ifdef VERBOSE_ENERSPLIT
179 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter1 energy lost "
180 << elost <<
" energy at interaction " << kinEnergyPre <<
" = stepLength "
181 << stepLengths[ii] <<
" * dEdx " << dEdx <<
G4endl;
183 kinEnergyPre -= elost;
184 theEnergies.push_back(elost);
193 kinEnergyPre = kinEnergyPreOrig;
194 for (ii = 0; ii < rnsl.size(); ++ii) {
196 stepLengths[ii] = theElossExt->
TrueStepLength(kinEnergyPre, rnsl[ii].second, mate, part);
197 kinEnergyPre -= theEnergies[ii];
199#ifdef VERBOSE_ENERSPLIT
201 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
202 <<
" step length geom " << stepLengths[ii] <<
" geom2true "
203 << rnsl[ii].second / stepLengths[ii] <<
G4endl;
206 slSum += stepLengths[ii];
211#ifdef VERBOSE_ENERSPLIT
213 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
214 <<
" step ratio " << slRatio <<
G4endl;
216 for (ii = 0; ii < rnsl.size(); ++ii) {
217 stepLengths[ii] *= slratio;
218#ifdef VERBOSE_ENERSPLIT
220 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
221 <<
" corrected step length " << stepLengths[ii] <<
G4endl;
228 for (ii = 0; ii < rnsl.size(); ++ii) {
231 if (kinEnergyPre > 0.) {
232 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
234 G4double elost = stepLengths[ii] * dEdx;
235#ifdef VERBOSE_ENERSPLIT
237 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
238 <<
" energy lost " << elost <<
" energy at interaction " << kinEnergyPre
239 <<
" = stepLength " << stepLengths[ii] <<
" * dEdx " << dEdx <<
G4endl;
241 kinEnergyPre -= elost;
242 theEnergies[ii] = elost;
248 G4double enerRatio = (edep / totalELost);
250#ifdef VERBOSE_ENERSPLIT
252 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
253 <<
" energy ratio " << enerRatio <<
G4endl;
256#ifdef VERBOSE_ENERSPLIT
259 for (ii = 0; ii < theEnergies.size(); ++ii) {
260 theEnergies[ii] *= enerRatio;
261#ifdef VERBOSE_ENERSPLIT
262 elostTot += theEnergies[ii];
264 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes " << ii <<
" RN: iter" << iiter
265 <<
" corrected energy lost " << theEnergies[ii] <<
" orig elost "
266 << theEnergies[ii] / enerRatio <<
" energy before interaction "
267 << kinEnergyPreOrig - elostTot + theEnergies[ii] <<
" energy after interaction "
268 << kinEnergyPreOrig - elostTot <<
G4endl;
274 return (
G4int)theEnergies.size();
G4double GetPDGCharge() const