61 #ifdef VERBOSE_ENERSPLIT
68 return theEnergies.size();
71 theEnergies.push_back(edep);
72 return theEnergies.size();
75 if( !thePhantomParam ) GetPhantomParam(
TRUE);
77 if( aStep == 0 )
return FALSE;
84 G4double kinEnergyPre = kinEnergyPreOrig;
89 for( ii = 0; ii < rnsl.size(); ii++ ){
92 #ifdef VERBOSE_ENERSPLIT
93 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter1 step length geom " << sl <<
G4endl;
97 #ifdef VERBOSE_ENERSPLIT
99 G4cout <<
"G4EnergySplitter RN: step length geom TOTAL " << slSum
100 <<
" true TOTAL " << stepLength
101 <<
" ratio " << stepLength/slSum
104 <<
" Number of geom steps " << rnsl.size() <<
G4endl;
107 if( theNIterations == 0 ) {
108 for( ii = 0; ii < rnsl.size(); ii++ ){
110 G4double edepStep = edep * sl/slSum;
111 #ifdef VERBOSE_ENERSPLIT
112 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii
113 <<
" edep " << edepStep <<
G4endl;
116 theEnergies.push_back(edepStep);
121 #ifdef VERBOSE_ENERSPLIT
125 for( ii = 0; ii < rnsl.size(); ii++ ){
129 for( ii = 0; ii < rnsl.size(); ii++ ){
130 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes "<< ii
131 <<
" RN: iter0 corrected energy lost " << edep*rnsl[ii].second/slSum
137 G4double slRatio = stepLength/slSum;
138 #ifdef VERBOSE_ENERSPLIT
139 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio <<
G4endl;
145 std::vector<G4double> stepLengths;
146 for(
int iiter = 1; iiter <= theNIterations; iiter++ ) {
149 for( ii = 0; ii < rnsl.size(); ii++ ){
151 stepLengths.push_back( sl * slRatio );
152 #ifdef VERBOSE_ENERSPLIT
153 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" corrected step length " << sl*slRatio <<
G4endl;
157 for( ii = 0; ii < rnsl.size(); ii++ ){
160 if( kinEnergyPre > 0. ) {
161 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
163 G4double elost = stepLengths[ii] * dEdx;
165 #ifdef VERBOSE_ENERSPLIT
166 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter1 energy lost " << elost
167 <<
" energy at interaction " << kinEnergyPre
168 <<
" = stepLength " << stepLengths[ii]
169 <<
" * dEdx " << dEdx <<
G4endl;
171 kinEnergyPre -= elost;
172 theEnergies.push_back( elost );
181 kinEnergyPre = kinEnergyPreOrig;
182 for( ii = 0; ii < rnsl.size(); ii++ ){
185 kinEnergyPre -= theEnergies[ii];
187 #ifdef VERBOSE_ENERSPLIT
188 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii
189 <<
" RN: iter" << iiter <<
" step length geom " << stepLengths[ii]
190 <<
" geom2true " << rnsl[ii].second / stepLengths[ii] <<
G4endl;
193 slSum += stepLengths[ii];
198 #ifdef VERBOSE_ENERSPLIT
199 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter <<
" step ratio " << slRatio <<
G4endl;
201 for( ii = 0; ii < rnsl.size(); ii++ ){
202 stepLengths[ii] *= slratio;
203 #ifdef VERBOSE_ENERSPLIT
204 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" corrected step length " << stepLengths[ii] <<
G4endl;
211 for( ii = 0; ii < rnsl.size(); ii++ ){
214 if( kinEnergyPre > 0. ) {
215 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
217 G4double elost = stepLengths[ii] * dEdx;
218 #ifdef VERBOSE_ENERSPLIT
219 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" energy lost " << elost
220 <<
" energy at interaction " << kinEnergyPre
221 <<
" = stepLength " << stepLengths[ii]
222 <<
" * dEdx " << dEdx <<
G4endl;
224 kinEnergyPre -= elost;
225 theEnergies[ii] = elost;
232 G4double enerRatio = (edep/totalELost);
234 #ifdef VERBOSE_ENERSPLIT
235 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" energy ratio " << enerRatio <<
G4endl;
238 #ifdef VERBOSE_ENERSPLIT
241 for( ii = 0; ii < theEnergies.size(); ii++ ){
242 theEnergies[ii] *= enerRatio;
243 #ifdef VERBOSE_ENERSPLIT
244 elostTot += theEnergies[ii];
245 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes "<< ii <<
" RN: iter" << iiter <<
" corrected energy lost " << theEnergies[ii]
246 <<
" orig elost " << theEnergies[ii]/enerRatio
247 <<
" energy before interaction " << kinEnergyPreOrig-elostTot+theEnergies[ii]
248 <<
" energy after interaction " << kinEnergyPreOrig-elostTot
256 return theEnergies.size();
G4ParticleDefinition * GetDefinition() const
G4double GetStepLength() const
const G4String & GetName() const
G4Material * GetMaterial() const
const std::vector< std::pair< G4int, G4double > > & GetStepLengths()
static constexpr double second
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
G4double GetTotalEnergyDeposit() const
G4Material * GetMaterial(size_t nx, size_t ny, size_t nz) const
G4double GetKineticEnergy() const
static G4RegularNavigationHelper * Instance()
G4Track * GetTrack() const
G4double GetPDGCharge() const