60 if (aStep ==
nullptr)
return false;
68#ifdef VERBOSE_ENERSPLIT
78 return (
G4int)theEnergies.size();
81 theEnergies.push_back(edep);
82 return (
G4int)theEnergies.size();
87 if (!IsPhantomVolume(preStepPhysVol)) {
89 "SplitEnergyInVolumes() called for a step not in a phantom volume");
95 std::vector<std::pair<G4int, G4double>> rnsl =
100 G4double kinEnergyPre = kinEnergyPreOrig;
105 for (ii = 0; ii < rnsl.size(); ++ii) {
108#ifdef VERBOSE_ENERSPLIT
110 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter1 step length geom "
115#ifdef VERBOSE_ENERSPLIT
117 G4cout <<
"G4EnergySplitter RN: step length geom TOTAL " << slSum <<
" true TOTAL "
118 << stepLength <<
" ratio " << stepLength / slSum <<
" Energy "
125 if (theNIterations == 0) {
126 for (ii = 0; ii < rnsl.size(); ++ii) {
128 G4double edepStep = edep * sl / slSum;
130#ifdef VERBOSE_ENERSPLIT
132 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" edep " << edepStep <<
G4endl;
135 theEnergies.push_back(edepStep);
140#ifdef VERBOSE_ENERSPLIT
144 for (ii = 0; ii < rnsl.size(); ++ii) {
148 for (ii = 0; ii < rnsl.size(); ii++) {
149 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes " << ii
150 <<
" RN: iter0 corrected energy lost " << edep * rnsl[ii].second / slSum <<
G4endl;
155 G4double slRatio = stepLength / slSum;
156#ifdef VERBOSE_ENERSPLIT
158 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio
165 std::vector<G4double> stepLengths;
166 for (
G4int iiter = 1; iiter <= theNIterations; ++iiter) {
170 for (ii = 0; ii < rnsl.size(); ++ii) {
172 stepLengths.push_back(sl * slRatio);
173#ifdef VERBOSE_ENERSPLIT
175 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
176 <<
" corrected step length " << sl * slRatio <<
G4endl;
180 for (ii = 0; ii < rnsl.size(); ++ii) {
183 if (kinEnergyPre > 0.) {
184 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
186 G4double elost = stepLengths[ii] * dEdx;
188#ifdef VERBOSE_ENERSPLIT
190 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter1 energy lost "
191 << elost <<
" energy at interaction " << kinEnergyPre <<
" = stepLength "
192 << stepLengths[ii] <<
" * dEdx " << dEdx <<
G4endl;
194 kinEnergyPre -= elost;
195 theEnergies.push_back(elost);
204 kinEnergyPre = kinEnergyPreOrig;
205 for (ii = 0; ii < rnsl.size(); ++ii) {
207 stepLengths[ii] = theElossExt->TrueStepLength(kinEnergyPre, rnsl[ii].second, mate, part);
208 kinEnergyPre -= theEnergies[ii];
210#ifdef VERBOSE_ENERSPLIT
212 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
213 <<
" step length geom " << stepLengths[ii] <<
" geom2true "
214 << rnsl[ii].second / stepLengths[ii] <<
G4endl;
217 slSum += stepLengths[ii];
222#ifdef VERBOSE_ENERSPLIT
224 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
225 <<
" step ratio " << slRatio <<
G4endl;
227 for (ii = 0; ii < rnsl.size(); ++ii) {
228 stepLengths[ii] *= slratio;
229#ifdef VERBOSE_ENERSPLIT
231 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
232 <<
" corrected step length " << stepLengths[ii] <<
G4endl;
239 for (ii = 0; ii < rnsl.size(); ++ii) {
242 if (kinEnergyPre > 0.) {
243 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
245 G4double elost = stepLengths[ii] * dEdx;
246#ifdef VERBOSE_ENERSPLIT
248 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
249 <<
" energy lost " << elost <<
" energy at interaction " << kinEnergyPre
250 <<
" = stepLength " << stepLengths[ii] <<
" * dEdx " << dEdx <<
G4endl;
252 kinEnergyPre -= elost;
253 theEnergies[ii] = elost;
259 G4double enerRatio = (edep / totalELost);
261#ifdef VERBOSE_ENERSPLIT
263 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter
264 <<
" energy ratio " << enerRatio <<
G4endl;
267#ifdef VERBOSE_ENERSPLIT
270 for (ii = 0; ii < theEnergies.size(); ++ii) {
271 theEnergies[ii] *= enerRatio;
272#ifdef VERBOSE_ENERSPLIT
273 elostTot += theEnergies[ii];
275 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes " << ii <<
" RN: iter" << iiter
276 <<
" corrected energy lost " << theEnergies[ii] <<
" orig elost "
277 << theEnergies[ii] / enerRatio <<
" energy before interaction "
278 << kinEnergyPreOrig - elostTot + theEnergies[ii] <<
" energy after interaction "
279 << kinEnergyPreOrig - elostTot <<
G4endl;
285 return (
G4int)theEnergies.size();
G4double GetPDGCharge() const