59 #ifdef VERBOSE_ENERSPLIT
66 return theEnergies.size();
69 theEnergies.push_back(edep);
70 return theEnergies.size();
73 if( !thePhantomParam ) GetPhantomParam(
TRUE);
75 if( aStep == 0 )
return FALSE;
82 G4double kinEnergyPre = kinEnergyPreOrig;
87 for( ii = 0; ii < rnsl.size(); ii++ ){
90 #ifdef VERBOSE_ENERSPLIT
91 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter1 step length geom " << sl <<
G4endl;
95 #ifdef VERBOSE_ENERSPLIT
97 G4cout <<
"G4EnergySplitter RN: step length geom TOTAL " << slSum
98 <<
" true TOTAL " << stepLength
99 <<
" ratio " << stepLength/slSum
102 <<
" Number of geom steps " << rnsl.size() <<
G4endl;
105 if( theNIterations == 0 ) {
106 for( ii = 0; ii < rnsl.size(); ii++ ){
108 G4double edepStep = edep * sl/slSum;
109 #ifdef VERBOSE_ENERSPLIT
110 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii
111 <<
" edep " << edepStep <<
G4endl;
114 theEnergies.push_back(edepStep);
119 #ifdef VERBOSE_ENERSPLIT
123 for( ii = 0; ii < rnsl.size(); ii++ ){
127 for( ii = 0; ii < rnsl.size(); ii++ ){
128 G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes "<< ii
129 <<
" RN: iter0 corrected energy lost " << edep*rnsl[ii].second/slSum
135 G4double slRatio = stepLength/slSum;
136 #ifdef VERBOSE_ENERSPLIT
137 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio <<
G4endl;
143 std::vector<G4double> stepLengths;
144 for(
int iiter = 1; iiter <= theNIterations; iiter++ ) {
147 for( ii = 0; ii < rnsl.size(); ii++ ){
149 stepLengths.push_back( sl * slRatio );
150 #ifdef VERBOSE_ENERSPLIT
151 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" corrected step length " << sl*slRatio <<
G4endl;
155 for( ii = 0; ii < rnsl.size(); ii++ ){
158 if( kinEnergyPre > 0. ) {
159 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
161 G4double elost = stepLengths[ii] * dEdx;
163 #ifdef VERBOSE_ENERSPLIT
164 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter1 energy lost " << elost
165 <<
" energy at interaction " << kinEnergyPre
166 <<
" = stepLength " << stepLengths[ii]
167 <<
" * dEdx " << dEdx <<
G4endl;
169 kinEnergyPre -= elost;
170 theEnergies.push_back( elost );
179 kinEnergyPre = kinEnergyPreOrig;
180 for( ii = 0; ii < rnsl.size(); ii++ ){
183 kinEnergyPre -= theEnergies[ii];
185 #ifdef VERBOSE_ENERSPLIT
186 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii
187 <<
" RN: iter" << iiter <<
" step length geom " << stepLengths[ii]
188 <<
" geom2true " << rnsl[ii].second / stepLengths[ii] <<
G4endl;
191 slSum += stepLengths[ii];
196 #ifdef VERBOSE_ENERSPLIT
197 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes" << ii <<
" RN: iter" << iiter <<
" step ratio " << slRatio <<
G4endl;
199 for( ii = 0; ii < rnsl.size(); ii++ ){
200 stepLengths[ii] *= slratio;
201 #ifdef VERBOSE_ENERSPLIT
202 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" corrected step length " << stepLengths[ii] <<
G4endl;
209 for( ii = 0; ii < rnsl.size(); ii++ ){
212 if( kinEnergyPre > 0. ) {
213 dEdx = emcalc.
GetDEDX(kinEnergyPre, part, mate);
215 G4double elost = stepLengths[ii] * dEdx;
216 #ifdef VERBOSE_ENERSPLIT
217 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" energy lost " << elost
218 <<
" energy at interaction " << kinEnergyPre
219 <<
" = stepLength " << stepLengths[ii]
220 <<
" * dEdx " << dEdx <<
G4endl;
222 kinEnergyPre -= elost;
223 theEnergies[ii] = elost;
230 G4double enerRatio = (edep/totalELost);
232 #ifdef VERBOSE_ENERSPLIT
233 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes"<< ii <<
" RN: iter" << iiter <<
" energy ratio " << enerRatio <<
G4endl;
236 #ifdef VERBOSE_ENERSPLIT
239 for( ii = 0; ii < theEnergies.size(); ii++ ){
240 theEnergies[ii] *= enerRatio;
241 #ifdef VERBOSE_ENERSPLIT
242 elostTot += theEnergies[ii];
243 if(verbose)
G4cout <<
"G4EnergySplitter::SplitEnergyInVolumes "<< ii <<
" RN: iter" << iiter <<
" corrected energy lost " << theEnergies[ii]
244 <<
" orig elost " << theEnergies[ii]/enerRatio
245 <<
" energy before interaction " << kinEnergyPreOrig-elostTot+theEnergies[ii]
246 <<
" energy after interaction " << kinEnergyPreOrig-elostTot
254 return theEnergies.size();
259 void G4EnergySplitter::GetPhantomParam(
G4bool mustExist)
262 std::vector<G4VPhysicalVolume*>::iterator cite;
263 for( cite = pvs->begin(); cite != pvs->end(); cite++ ) {
265 if( IsPhantomVolume( *cite ) ) {
275 if( !thePhantomParam && mustExist )
278 "No G4PhantomParameterisation found !");
316 "Invalid stepNo, smaller than 0 or bigger or equal to number of voxels traversed",
321 advance( ite, stepNo );
322 voxelID = (*ite).first;
328 void G4EnergySplitter::GetStepLength(
G4int stepNo,
G4double& stepLength )
331 advance( ite, stepNo );
332 stepLength = (*ite).second;
G4ParticleDefinition * GetDefinition() const
G4double GetStepLength() const
const G4String & GetName() const
G4Material * GetMaterial() const
const std::vector< std::pair< G4int, G4double > > & GetStepLengths()
static G4String ConvertToString(G4bool boolVal)
virtual ~G4EnergySplitter()
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
static G4PhysicalVolumeStore * GetInstance()
void GetFirstVoxelID(G4int &voxelID)
G4StepPoint * GetPreStepPoint() const
G4VPVParameterisation * GetParameterisation() const
G4GLOB_DLL std::ostream G4cout
void GetLastVoxelID(G4int &voxelID)
virtual G4int GetRegularStructureId() const =0
G4double GetTotalEnergyDeposit() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4Material * GetMaterial(size_t nx, size_t ny, size_t nz) const
void GetVoxelID(G4int stepNo, G4int &voxelID)
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
G4double GetKineticEnergy() const
static G4RegularNavigationHelper * Instance()
G4Track * GetTrack() const
G4double GetPDGCharge() const
G4int SplitEnergyInVolumes(const G4Step *aStep)