61 #ifdef VERBOSE_ENERSPLIT
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;
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;
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;
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;
181 kinEnergyPre = kinEnergyPreOrig;
182 for( ii = 0; ii < rnsl.size(); 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;
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
243 #ifdef VERBOSE_ENERSPLIT
245 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes "<< ii <<
" RN: iter" << iiter <<
" corrected energy lost " <<
theEnergies[ii]
247 <<
" energy before interaction " << kinEnergyPreOrig-elostTot+
theEnergies[ii]
248 <<
" energy after interaction " << kinEnergyPreOrig-elostTot
264 std::vector<G4VPhysicalVolume*>::iterator cite;
265 for( cite = pvs->begin(); cite != pvs->end(); cite++ ) {
280 "No G4PhantomParameterisation found !");
318 "Invalid stepNo, smaller than 0 or bigger or equal to number of voxels traversed",
323 advance( ite, stepNo );
324 voxelID = (*ite).first;
333 advance( ite, stepNo );
334 stepLength = (*ite).second;
const std::vector< std::pair< G4int, G4double > > & GetStepLengths()
G4int SplitEnergyInVolumes(const G4Step *aStep)
G4PhantomParameterisation * thePhantomParam
G4StepPoint * GetPreStepPoint() const
void GetStepLength(G4int stepNo, G4double &stepLength)
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
G4EnergyLossForExtrapolator * theElossExt
G4double GetPDGCharge() const
void GetFirstVoxelID(G4int &voxelID)
static constexpr double second
G4Material * GetMaterial(size_t nx, size_t ny, size_t nz) const
G4ParticleDefinition * GetDefinition() const
const G4String & GetName() const
G4Material * GetMaterial() const
virtual G4int GetRegularStructureId() const =0
G4VPVParameterisation * GetParameterisation() const
G4double GetStepLength() const
G4Track * GetTrack() const
G4double GetTotalEnergyDeposit() const
G4double GetKineticEnergy() const
void GetVoxelID(G4int stepNo, G4int &voxelID)
static G4String ConvertToString(G4bool boolVal)
void GetLastVoxelID(G4int &voxelID)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4PhysicalVolumeStore * GetInstance()
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
G4bool IsPhantomVolume(G4VPhysicalVolume *pv)
G4GLOB_DLL std::ostream G4cout
void GetPhantomParam(G4bool mustExist)
virtual ~G4EnergySplitter()
std::vector< G4double > theEnergies
static G4RegularNavigationHelper * Instance()